1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op Declarations *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: TosaOps.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10namespace mlir::tosa {
11
12/// Elementwise abs operator.
13/// Elementwise absolute value operation.
14///
15/// This operation is not pure. Undefined behaviour may occur if the
16/// calculated result underflows.
17///
18/// Example:
19///
20/// ```mlir
21/// %output = tosa.abs(%input1) : (tensor<21x3xf32>) -> tensor<21x3xf32>
22/// ```
23class AbsOp;
24
25} // namespace mlir::tosa
26namespace mlir::tosa {
27
28/// Elementwise addition operator.
29/// Elementwise addition of input1 and input2. Axis of size 1 will be broadcast,
30/// as necessary. Rank of input tensors must match.
31///
32/// This operation is not pure. Undefined behaviour may occur if the calculated
33/// result overflows.
34///
35/// Example:
36///
37/// ```mlir
38/// // Elementwise addition.
39/// %out = tosa.add %input1, %input2 : tensor<12x6xf32>, tensor<12x6xf32> -> tensor<12x6xf32>
40///
41/// // Elementwise addition with broadcasting.
42/// %out = tosa.add %input1, %input2 : tensor<12x6xsi32>, tensor<1x1xsi32> -> tensor<12x6xsi32>
43/// ```
44class AddOp;
45
46} // namespace mlir::tosa
47namespace mlir::tosa {
48
49/// Elementwise addition of shapes.
50/// Elementwise addition of input1 and input2. Size of shapes must match.
51class AddShapeOp;
52
53} // namespace mlir::tosa
54namespace mlir::tosa {
55
56/// Rescale scalar operator for Tosa tensor operators
57/// Applies rescaling for fixed point values. This behavior is replicated in
58/// multiple quantized operations (mul, convolution, rescale, matmul, pooling).
59///
60/// The commonplace implementation is to use i64 operations to avoid integer
61/// overflow with target specific implementations can use native operations to
62/// avoid wider than necessary types.
63class ApplyScaleOp;
64
65} // namespace mlir::tosa
66namespace mlir::tosa {
67
68/// Perform argmax on the input.
69/// This returns the index with the largest value across the given axis of the
70/// input tensor. If multiple locations have equal values, returns the first
71/// match along the search axis.
72///
73/// This operation is not pure. Undefined behaviour may occur if the max index
74/// is out of bounds for the output data type.
75class ArgMaxOp;
76
77} // namespace mlir::tosa
78namespace mlir::tosa {
79
80/// Perform argmin on the input.
81/// This returns the index with the smallest value across the given axis of the
82/// input tensor. If multiple locations have equal values, returns the first
83/// match along the search axis.
84///
85/// This operation is not pure. Undefined behaviour may occur if the min index
86/// is out of bounds for the output data type.
87class ArgMinOp;
88
89} // namespace mlir::tosa
90namespace mlir::tosa {
91
92/// Elementwise Arithmetic Right Shift.
93/// Elementwise arithmetic right shift of input1 by the amount specified in
94/// input2. Axis of size 1 will be broadcast, as necessary. Rank of input tensors
95/// must match.
96///
97/// This operation is not pure. Undefined behaviour may occur if the specified
98/// shift is out of range.
99class ArithmeticRightShiftOp;
100
101} // namespace mlir::tosa
102namespace mlir::tosa {
103
104/// Verify two shapes are equal.
105/// Verify input1 and input2 are equal. If allow_broadcast is set, shapes which
106/// are broadcast compatible are allowed.
107class AssertEqualShapeOp;
108
109} // namespace mlir::tosa
110namespace mlir::tosa {
111
112/// Performs average pooling on the input with shape operands.
113/// This performs an average pooling over the given input tensor. A sliding
114/// window of size given by <kernel size> is passed over the input tensor, with
115/// the mean value being placed in the output tensor. When calculating the
116/// average, only the number of valid input tensor values, but not padding, are
117/// used to calculate the divisor. Compared to avg_pool2d, the kernel/stride/
118/// pad values are provided as inputs.
119///
120/// This operation is not pure. Undefined behaviour may occur if the accumulated
121/// result overflows.
122class AvgPool2dAdaptiveOp;
123
124} // namespace mlir::tosa
125namespace mlir::tosa {
126
127/// Performs average pooling on the input.
128/// This performs an average pooling over the given input tensor. A sliding
129/// window of size given by <kernel size> is passed over the input tensor, with
130/// the mean value being placed in the output tensor. When calculating the
131/// average, only the number of valid input tensor values, but not padding, are
132/// used to calculate the divisor.
133///
134/// This operation is not pure. Undefined behaviour may occur if the accumulated
135/// result overflows.
136class AvgPool2dOp;
137
138} // namespace mlir::tosa
139namespace mlir::tosa {
140
141/// Bitwise AND operator.
142/// Elementwise bitwise AND of input1 and input2. Axis of size 1
143/// will be broadcast as necessary. Rank of input tensors must match.
144class BitwiseAndOp;
145
146} // namespace mlir::tosa
147namespace mlir::tosa {
148
149/// Bitwise NOT operator.
150/// Elementwise bitwise NOT of input tensor.
151class BitwiseNotOp;
152
153} // namespace mlir::tosa
154namespace mlir::tosa {
155
156/// Bitwise OR operator.
157/// Elementwise bitwise OR of input1 and input2. Axis of size 1 will be
158/// broadcast as necessary. Rank of input tensors must match.
159class BitwiseOrOp;
160
161} // namespace mlir::tosa
162namespace mlir::tosa {
163
164/// Bitwise XOR operator.
165/// Elementwise bitwise XOR of input1 and input2. Axis of size 1 will be
166/// broadcast as necessary. Rank of input tensors must match.
167class BitwiseXorOp;
168
169} // namespace mlir::tosa
170namespace mlir::tosa {
171
172/// Apply scales from a scale tensor to the values in a value tensor
173/// Apply the scales from a scale tensor to the values in a value tensor, casting
174/// the result to the output type. The block dimension must be the last dimension
175/// of the tensor.
176///
177/// Note: This operation is deprecated. It will be removed in the future.
178class CastFromBlockScaledOp;
179
180} // namespace mlir::tosa
181namespace mlir::tosa {
182
183/// Cast operation.
184/// Casts a tensor from one data type to another.
185class CastOp;
186
187} // namespace mlir::tosa
188namespace mlir::tosa {
189
190/// Calculate scale tensor values per block, output to separate scale and data tensors.
191/// Calculate a scale value per block of input values and use that to calculate
192/// scaled data values from an input tensor. The output tensors are cast to the
193/// specified scale and value types. The block dimension will be the last dimension
194/// of the tensor.
195///
196/// Note: This operation is deprecated. It will be removed in the future.
197class CastToBlockScaledOp;
198
199} // namespace mlir::tosa
200namespace mlir::tosa {
201
202/// Elementwise ceil operator.
203/// Elementwise ceiling operation.
204class CeilOp;
205
206} // namespace mlir::tosa
207namespace mlir::tosa {
208
209/// Computes clamp(features, min, max).
210/// Clamp to an arbitrary minimum and maximum value.
211/// Maximum and minimum values are specified as values in the range of the
212/// input type.
213/// No zero point subtraction is done to the values, thus to clamp to the zero
214/// point value, the zero point itself should be supplied as the minimum value.
215class ClampOp;
216
217} // namespace mlir::tosa
218namespace mlir::tosa {
219
220/// Elementwise count leading zero operator.
221/// Elementwise count leading zeros operation.
222class ClzOp;
223
224} // namespace mlir::tosa
225namespace mlir::tosa {
226
227/// Concatenates tensors along one dimension.
228/// Concatenate a list of tensors along a given axis.
229/// No data conversion happens during a concat operation.
230class ConcatOp;
231
232} // namespace mlir::tosa
233namespace mlir::tosa {
234
235/// Concatenates a list of shapes.
236/// Concatenates a list of shapes into a new shape with length equal to the sum
237/// of the lengths of the inputs.
238class ConcatShapeOp;
239
240} // namespace mlir::tosa
241namespace mlir::tosa {
242
243/// Constant operator.
244/// A node containing constant data for use as the input to an operation. May
245/// hold data in any of the supported data formats.
246///
247/// Example:
248///
249/// ```mlir
250/// // Generic form
251/// %out = "tosa.const"() <{values = dense<0> : tensor<2x3xi32>}> : () -> tensor<2x3xi32>
252/// ```
253class ConstOp;
254
255} // namespace mlir::tosa
256namespace mlir::tosa {
257
258/// Constant Shape operator.
259/// A node containing a constant shape.
260///
261/// Example:
262///
263/// ```mlir
264/// // Generic form
265/// %out = "tosa.const_shape"() <{values = dense<0> : tensor<4xindex>}> : () -> !tosa.shape<4>
266/// ```
267class ConstShapeOp;
268
269} // namespace mlir::tosa
270namespace mlir::tosa {
271
272/// Performs two dimensional convolution using block scaled tensors.
273/// Performs a 2D convolution over the given input data and scales, using
274/// the weight data and scales. Implementations may choose to skip calculation
275/// of multiplies in the padding area.
276///
277/// This operation is not pure. Undefined behaviour may occur if the accumulated
278/// result overflows.
279///
280/// // Note: This operation is deprecated. It will be removed in the future.
281class Conv2DBlockScaledOp;
282
283} // namespace mlir::tosa
284namespace mlir::tosa {
285
286/// 2D Convolution operator.
287/// Performs a 2D convolution over the given tensor input, using the weight
288/// tensor. Implementations may choose to skip calculation of multiplies in
289/// the padding area.
290///
291/// This operation is not pure. Undefined behaviour may occur if the accumulated
292/// result overflows.
293class Conv2DOp;
294
295} // namespace mlir::tosa
296namespace mlir::tosa {
297
298/// 3D Convolution operator.
299/// Performs a 3D convolution over the given input tensor. Implementations
300/// may choose to skip calculation of multiplies in the padding area.
301///
302/// This operation is not pure. Undefined behaviour may occur if the accumulated
303/// result overflows.
304class Conv3DOp;
305
306} // namespace mlir::tosa
307namespace mlir::tosa {
308
309/// Elementwise cos operator.
310/// Elementwise cosine operation for values given in radians.
311class CosOp;
312
313} // namespace mlir::tosa
314namespace mlir::tosa {
315
316/// Custom operator wrapper for Tosa
317/// Hardware implementing TOSA may choose to add additional custom operators
318/// that are not expressed in the existing TOSA operations. These operators are
319/// not expected to be portable across TOSA implementations. The input and
320/// output signatures must be expressed in the corresponding TOSA node.
321///
322/// `operator_name` is a string that tells the backend which custom operator is
323/// being called.
324///
325/// `domain_name` is a string identifier which can help avoid name collisions on
326/// the identifier field.
327///
328/// `implementation_attrs` is a string which is a backend and identifier specific
329/// set of attributes to the custom operator.
330///
331/// `input_list` is the set of tensor inputs to the custom operator.
332///
333/// `output_list` is the list of tensors returned by the operator. The number of operators
334/// is backend specific.
335///
336/// Example:
337///
338/// ```mlir
339/// %out = tosa.custom %in operator_name("custom_test")
340/// domain_name("tosa_mlir_test") implementation_attrs("") :
341/// (tensor<10xi32>) -> (tensor<10xi32>)
342/// ```
343class CustomOp;
344
345} // namespace mlir::tosa
346namespace mlir::tosa {
347
348/// Depthwise 2D Convolution operator.
349/// Performs 2D convolutions separately over each channel of the given tensor
350/// input, using the weight tensor. Implementations may choose to skip
351/// calculation of multiplies in the padding area.
352///
353/// This operation is not pure. Undefined behaviour may occur if the accumulated
354/// result overflows.
355class DepthwiseConv2DOp;
356
357} // namespace mlir::tosa
358namespace mlir::tosa {
359
360/// Extract size of dimension from input tensor.
361/// Returns a length 1 shape_t of the size of the input tensor for the given axis.
362class DimOp;
363
364} // namespace mlir::tosa
365namespace mlir::tosa {
366
367/// Elementwise ceiling divide of shapes.
368/// Elementwise divide of input1 by input2. The result of the divide is rounded up.
369class DivCeilShapeOp;
370
371} // namespace mlir::tosa
372namespace mlir::tosa {
373
374/// Elementwise floor divide of shapes.
375/// Elementwise integer divide of input1 by input2. The result of the divide is rounded down.
376class DivFloorShapeOp;
377
378} // namespace mlir::tosa
379namespace mlir::tosa {
380
381/// Returns the truth value of (input1 == input2) element-wise.
382/// Elementwise comparison operation.
383class EqualOp;
384
385} // namespace mlir::tosa
386namespace mlir::tosa {
387
388/// Computes gauss error function of input.
389/// Gauss error function: $ erf(x) = \frac{2}{\sqrt{\pi}} \int_{0}^{x} e^{-t^2} dt $
390/// For quantized integer data types, the TABLE operator should be used instead
391/// with the following definition. The ERF table has 513 entries each of
392/// 16-bit precision and covering the input range -4.0 to +4.0 in steps of 1/64.
393class ErfOp;
394
395} // namespace mlir::tosa
396namespace mlir::tosa {
397
398/// Elementwise base-2 exponential of shapes.
399/// Computation of raising two to the power of each element in input.
400class Exp2ShapeOp;
401
402} // namespace mlir::tosa
403namespace mlir::tosa {
404
405/// Elementwise exp operator.
406/// Elementwise e to the x operation
407class ExpOp;
408
409} // namespace mlir::tosa
410namespace mlir::tosa {
411
412/// Performs FFT2D operation on the input.
413/// Performs a batched complex 2D Fast Fourier Transform over the input. The
414/// complex input values are constructed from the corresponding values in the
415/// input_real and input_imag tensors. The resulting values in the output are
416/// split into the output_real and output_imag tensors. No normalization is
417/// applied on either the forward or inverse versions of the operation.
418///
419/// Example:
420///
421/// ```mlir
422/// %output_real, %output_imag = tosa.fft2d %input_real, %input_imag
423/// inverse(false) : (tensor<1x8x9xf32>, tensor<1x8x9xf32>) ->
424/// (tensor<1x8x9xf32>, tensor<1x8x9xf32>)
425/// ```
426class FFT2dOp;
427
428} // namespace mlir::tosa
429namespace mlir::tosa {
430
431/// Elementwise floor operator.
432/// Elementwise floor operation.
433class FloorOp;
434
435} // namespace mlir::tosa
436namespace mlir::tosa {
437
438/// Gather operation.
439/// Generate a tensor for which each element in the output is a subtensor of the
440/// values tensor based on the indices. N is the number of batches, W the number
441/// of indices in each batch, K the range of each index and C the number data
442/// channels for each index.
443///
444/// This operation is not pure. Undefined behaviour may occur if the specified
445/// indices are out of range.
446class GatherOp;
447
448} // namespace mlir::tosa
449namespace mlir::tosa {
450
451/// Returns the truth value of (input1 >= input2) element-wise.
452/// Elementwise comparison operation.
453class GreaterEqualOp;
454
455} // namespace mlir::tosa
456namespace mlir::tosa {
457
458/// Returns the truth value of (input1 > input2) element-wise.
459/// Elementwise greater than comparison operation.
460class GreaterOp;
461
462} // namespace mlir::tosa
463namespace mlir::tosa {
464
465/// Identity operator.
466/// Returns a tensor with the same shape, type, and contents as the input.
467class IdentityOp;
468
469} // namespace mlir::tosa
470namespace mlir::tosa {
471
472/// Conditional if operator.
473/// Evaluates a Boolean condition and then takes one of two distinct execution
474/// paths. This implements the semantic If-then-else structure.
475class IfOp;
476
477} // namespace mlir::tosa
478namespace mlir::tosa {
479
480/// Integer divide operator.
481/// Elementwise integer divide of input1 by input2. Axis of size 1 will be
482/// broadcast as necessary. Rank of input tensors must match. The result of the
483/// divide is truncated towards zero. Expected use is for operations on
484/// non-scaled integers. Floating point divide should use RECIPROCAL and MUL.
485/// Quantized integer divide should use TABLE (for 1/x) and MUL.
486///
487/// This operation is not pure. Undefined behaviour may occur on division by zero.
488class IntDivOp;
489
490} // namespace mlir::tosa
491namespace mlir::tosa {
492
493/// Elementwise ceil base-2 logarithm of shapes.
494/// Computation of the base two logarithm of each element in input. Result is rounded up.
495class Log2CeilShapeOp;
496
497} // namespace mlir::tosa
498namespace mlir::tosa {
499
500/// Elementwise floor base-2 logarithm of shapes.
501/// Computation of the base two logarithm of each element in input. Result is rounded down.
502class Log2FloorShapeOp;
503
504} // namespace mlir::tosa
505namespace mlir::tosa {
506
507/// Elementwise log operator.
508/// Elementwise natural logarithm operation
509class LogOp;
510
511} // namespace mlir::tosa
512namespace mlir::tosa {
513
514/// Returns the truth value of input1 AND input2 element-wise.
515/// Elementwise logical AND of input1 and input2. Axis of size 1 will be
516/// broadcast, as necessary. Rank of input tensors must match.
517class LogicalAndOp;
518
519} // namespace mlir::tosa
520namespace mlir::tosa {
521
522/// Elementwise Logical Left Shift.
523/// Elementwise logical left-shift of input1 by the amount specified in input2.
524/// Axis of size 1 will be broadcast, as necessary.
525/// Rank of input tensors must match.
526///
527/// This operation is not pure. Undefined behaviour may occur if the specified
528/// shift is out of range.
529class LogicalLeftShiftOp;
530
531} // namespace mlir::tosa
532namespace mlir::tosa {
533
534/// Returns the truth value of NOT input1 element-wise.
535/// Elementwise logical NOT of input.
536class LogicalNotOp;
537
538} // namespace mlir::tosa
539namespace mlir::tosa {
540
541/// Returns the truth value of x OR y element-wise.
542/// Elementwise logical OR of input1 and input2. Axis of size 1 will be
543/// broadcast as necessary. Rank of input tensors must match.
544class LogicalOrOp;
545
546} // namespace mlir::tosa
547namespace mlir::tosa {
548
549/// Elementwise Logical Right Shift.
550/// Elementwise logical right shift of input1 by the amount specified in input2.
551/// Axis of size 1 will be broadcast, as necessary. Rank of input tensors must
552/// match.
553///
554/// This operation is not pure. Undefined behaviour may occur if the specified
555/// shift is out of range.
556class LogicalRightShiftOp;
557
558} // namespace mlir::tosa
559namespace mlir::tosa {
560
561/// Returns the truth value of input1 XOR input2 element-wise.
562/// Elementwise logical XOR of input1 and input2. Axis of size 1 will be
563/// broadcast as necessary. Rank of input tensors must match.
564class LogicalXorOp;
565
566} // namespace mlir::tosa
567namespace mlir::tosa {
568
569/// Matrix multiplication operator.
570/// Performs matrix multiplications over the two innermost dimensions while
571/// treating any leading dimensions as broadcastable batch dimensions. `A` has
572/// shape `[A0, ..., A(n-1), H, C]`. `B` has shape
573/// `[B0, ..., B(m-1), C, W]`. `[A0, ..., A(n-1)]` and
574/// `[B0, ..., B(m-1)]` must be compatible as leading batch dimensions.
575///
576/// Right-align these two dimension lists and treat any missing leading
577/// dimensions as size 1, producing common batch dimensions
578/// `[D0, ..., D(k-1)]` where `k = max(n, m)` and each `Di` is the larger of
579/// the two aligned dimension sizes. `output` has shape
580/// `[D0, ..., D(k-1), H, W]`.
581///
582/// This operation is not pure. Undefined behaviour may occur if the accumulated
583/// result overflows.
584class MatMulOp;
585
586} // namespace mlir::tosa
587namespace mlir::tosa {
588
589/// Matrix multiplication with transposed B operator.
590/// Performs matrix multiplications over the two innermost dimensions while
591/// implicitly transposing the last two dimensions of `B`. Any leading
592/// dimensions are broadcastable batch dimensions. `A` has shape
593/// `[A0, ..., A(n-1), H, C]`. `B` has shape
594/// `[B0, ..., B(m-1), W, C]` before swapping those last two dimensions to
595/// `[B0, ..., B(m-1), C, W]`. `[A0, ..., A(n-1)]` and
596/// `[B0, ..., B(m-1)]` must be compatible as leading batch dimensions.
597///
598/// Right-align these two dimension lists and treat any missing leading
599/// dimensions as size 1, producing common batch dimensions
600/// `[D0, ..., D(k-1)]` where `k = max(n, m)` and each `Di` is the larger of
601/// the two aligned dimension sizes. `output` has shape
602/// `[D0, ..., D(k-1), H, W]`.
603///
604/// This operation is not pure. Undefined behaviour may occur if the accumulated
605/// result overflows.
606class MatMulTOp;
607
608} // namespace mlir::tosa
609namespace mlir::tosa {
610
611/// Performs two dimensional matrix multiplications using block scaled tensors.
612/// Performs two dimensional matrix multiplications using block scaled tensors. The block
613/// dimension is always the the last dimension of the tensor, so the result is effectively
614/// a matrix multiply of A by the transposed B matrix. If the N dimension of input B is of
615/// size 1, the B matrix will be broadcast.
616///
617/// This operation is not pure. Undefined behaviour may occur if the accumulated
618/// result overflows.
619///
620/// Note: This operation is deprecated. It will be removed in the future.
621class MatmulTBlockScaledOp;
622
623} // namespace mlir::tosa
624namespace mlir::tosa {
625
626/// Performs max pooling on the input.
627/// This performs a max pooling over the given input tensor. A sliding window of
628/// size given by <kernel size> is passed over the input tensor, with the
629/// maximum value being placed in the output tensor.
630/// Compared to MAX_POOL2D, MAX_POOL2D_ADAPTIVE has the kernel, stride,
631/// pad arguments as inputs rather than attributes.
632class MaxPool2dAdaptiveOp;
633
634} // namespace mlir::tosa
635namespace mlir::tosa {
636
637/// Performs max pooling on the input.
638/// This performs a max pooling over the given input tensor. A sliding window of
639/// size given by <kernel size> is passed over the input tensor, with the
640/// maximum value being placed in the
641/// output tensor.
642class MaxPool2dOp;
643
644} // namespace mlir::tosa
645namespace mlir::tosa {
646
647/// Elementwise maximum of shapes.
648/// Elementwise maximum of input1 and input2.
649class MaxShapeOp;
650
651} // namespace mlir::tosa
652namespace mlir::tosa {
653
654/// Elementwise Maximum.
655/// Elementwise max of input1 and input2. Axis of size 1 will be broadcast, as
656/// necessary. Rank of input tensors must match.
657class MaximumOp;
658
659} // namespace mlir::tosa
660namespace mlir::tosa {
661
662/// Elementwise minimum of shapes.
663/// Elementwise minimum of input1 and input2.
664class MinShapeOp;
665
666} // namespace mlir::tosa
667namespace mlir::tosa {
668
669/// Elementwise Minimum.
670/// Elementwise minimum of input1 and input2. Axis of size 1
671/// will be broadcast, as necessary. Rank of input tensors must match.
672class MinimumOp;
673
674} // namespace mlir::tosa
675namespace mlir::tosa {
676
677/// Elementwise modulo of shapes.
678/// Elementwise modulo of input1 divided by input2.
679class ModShapeOp;
680
681} // namespace mlir::tosa
682namespace mlir::tosa {
683
684/// Multiplication operator.
685/// Elementwise multiplication (Hadamard product) of input1 and input2.
686/// Axis of size 1 will be broadcast, as necessary. Rank of input tensors must
687/// match.
688///
689/// For int32_t input data, shift must be in the range [0, 63]. For all other
690/// input data types, shift must be 0.
691///
692/// This operation is not pure. Undefined behaviour may occur if the specified
693/// shift is out of range or the result overflows.
694class MulOp;
695
696} // namespace mlir::tosa
697namespace mlir::tosa {
698
699/// Elementwise multiplication of shapes.
700/// Elementwise multiplication of input1 and input2.
701class MulShapeOp;
702
703} // namespace mlir::tosa
704namespace mlir::tosa {
705
706/// Elementwise negate operator.
707/// Elementwise negation operation.
708///
709/// This operation is not pure. Undefined behaviour may occur if the calculated
710/// result underflows or overflows.
711class NegateOp;
712
713} // namespace mlir::tosa
714namespace mlir::tosa {
715
716/// Pads a tensor with value specified.
717/// Pads a tensor along the borders of each dimension with a supplied value.
718/// Returns a new tensor with the padding included. The pad_const value includes
719/// the zero point if the tensor uses a zero point.
720///
721/// The padding amounts must be non-negative. The TOSA specification requires
722/// a negative padding to be diagnosed (`ERROR_IF`).
723///
724/// Example:
725///
726/// ```mlir
727/// %pad_const = "tosa.const"() <{values = dense<3.14> : tensor<1xf32>}> : () -> tensor<1xf32>
728/// %padding = tosa.const_shape values(dense<[1, 2, 3, 4]> : tensor<4xindex>) : () -> !tosa.shape<4>
729/// tosa.pad %arg0, %padding, %pad_const : (tensor<1x2xf32>, !tosa.shape<4>, tensor<1xf32>) -> tensor<4x9xf32>
730/// ```
731class PadOp;
732
733} // namespace mlir::tosa
734namespace mlir::tosa {
735
736/// Computes the power of one value to another.
737/// Elementwise input1 value raised to the power of input2.
738/// Axis of size 1 will be broadcast, as necessary. Rank of input tensors must
739/// match.
740///
741/// This operation is not pure. Undefined behaviour may occur if specified
742/// exponent is negative.
743class PowOp;
744
745} // namespace mlir::tosa
746namespace mlir::tosa {
747
748/// Performs RFFT2D operation on the input.
749/// Performs a batched 2D real-valued Fast Fourier Transform over the input where
750/// the input tensor consists of real values producing complex valued output. The
751/// complex output values will be split into the output_real and output_imag
752/// tensor arguments. RFFT2D takes advantage of Hermitian symmetry to only
753/// calculate the first half of the final output axis. Implementations may choose
754/// to skip calculation of the imaginary values at (0,0), (0,W/2), (H/2,0), and
755/// (H/2, W/2). If the calculation is skipped, the result at that location must be
756/// zero.
757///
758/// Example:
759///
760/// ```mlir
761/// %output_real, %output_imag = tosa.rfft2d %input_real :
762/// (tensor<1x8x16xf32>) ->
763/// (tensor<1x8x9xf32>, tensor<1x8x9xf32>)
764/// ```
765class RFFT2dOp;
766
767} // namespace mlir::tosa
768namespace mlir::tosa {
769
770/// Elementwise reciprocal operator.
771/// Elementwise reciprocal operation. For integer operation, a TABLE should be
772/// used with the appropriate ranges.
773class ReciprocalOp;
774
775} // namespace mlir::tosa
776namespace mlir::tosa {
777
778/// Reduce All operator.
779/// Reduce a tensor along the given axis with a logical AND operation.
780class ReduceAllOp;
781
782} // namespace mlir::tosa
783namespace mlir::tosa {
784
785/// Reduce Any operator.
786/// Reduce a tensor along the given axis with a logical OR operation.
787class ReduceAnyOp;
788
789} // namespace mlir::tosa
790namespace mlir::tosa {
791
792/// Reduce Max operator.
793/// Reduce a tensor along the given axis with a maximum operation.
794class ReduceMaxOp;
795
796} // namespace mlir::tosa
797namespace mlir::tosa {
798
799/// Reduce Min operator.
800/// Reduce a tensor along the given axis with a minimum operation.
801class ReduceMinOp;
802
803} // namespace mlir::tosa
804namespace mlir::tosa {
805
806/// Reduce Product operator.
807/// Reduce a tensor along the given axis by computing the product of the axis.
808///
809/// This operation is not pure. Undefined behaviour may occur if the accumulated
810/// result overflows.
811class ReduceProductOp;
812
813} // namespace mlir::tosa
814namespace mlir::tosa {
815
816/// Reduce Sum operator.
817/// Reduce a tensor along the given axis by computing the sum of the axis.
818///
819/// This operation is not pure. Undefined behaviour may occur if the accumulated
820/// result overflows.
821class ReduceSumOp;
822
823} // namespace mlir::tosa
824namespace mlir::tosa {
825
826/// Tosa rescale operator.
827/// RESCALE is defined using an integer multiply, add, and shift.
828///
829/// Rescale supports two precisions of multiplier: 16-bit and 32-bit. The 32-bit multiplier
830/// version supports two rounding modes to enable simpler lowering of existing frameworks
831/// that use two stage rounding. All arithmetic is designed so that it does not overflow a
832/// 64-bit accumulator and that the result fits in 32 bits. In particular, a 48-bit value
833/// cannot be scaled with the 32-bit multiplier because the accumulator would need to have
834/// 80 bits.
835///
836/// The shift and value range are limited to allow a variety of implementations. The limit
837/// of 62 on shift allows the shift to be decomposed as two right shifts of 31.
838///
839/// This operation is not pure. Undefined behaviour may occur if the calculated
840/// result underflows or overflows.
841///
842/// Supported rescalings:
843/// * This table is showing the supported conversions from the TOSA Specification.
844/// * The MLIR dialect here can be used to represent other conversions.
845///
846/// | Mode | Input | Output | Unsigned input | Unsigned output |
847/// |------------------------|-------|--------|----------------|-----------------|
848/// | signed 16 to 16 | int16 | int16 | false | false |
849/// | signed 16 to 32 | int16 | int32 | false | false |
850/// | signed 16 to 8 | int16 | int8 | false | false |
851/// | signed 32 to 16 | int32 | int16 | false | false |
852/// | signed 32 to 32 | int32 | int32 | false | false |
853/// | signed 32 to 8 | int32 | int8 | false | false |
854/// | signed 8 to 16 | int8 | int16 | false | false |
855/// | signed 8 to 32 | int8 | int32 | false | false |
856/// | signed 8 to 8 | int8 | int8 | false | false |
857/// | signed 48 to 16 | int48 | int16 | false | false |
858/// | signed 48 to 32 | int48 | int32 | false | false |
859/// | signed 48 to 8 | int48 | int8 | false | false |
860/// | unsigned 8 to signed 8 | uint8 | int8 | true | false |
861/// | signed 8 to unsigned 8 | int8 | uint8 | false | true |
862class RescaleOp;
863
864} // namespace mlir::tosa
865namespace mlir::tosa {
866
867/// Reshape with support for block scaled tensors.
868/// Returns a tensor-list with the same type/values as the input, with a new
869/// shape specified by the shape argument. Reshape may operate on block-scaled
870/// tensors (values tensor followed by scale tensor) of rank 1 or higher; or a
871/// single non-block-scaled tensor of any rank. No data conversion happens during
872/// a reshape operation. Reshape must retain the relationship between values
873/// and their scale in a block for block-scaled content.
874///
875/// Note: This operation is deprecated. It will be removed in the future.
876class ReshapeBlockScaledOp;
877
878} // namespace mlir::tosa
879namespace mlir::tosa {
880
881/// Reshape operator.
882/// Returns a tensor with the same type/values as the input, with a new shape
883/// specified by the shape argument. Reshape may operate on tensors of any rank.
884/// No data conversion happens during a reshape operation.
885class ReshapeOp;
886
887} // namespace mlir::tosa
888namespace mlir::tosa {
889
890/// Resize operation, supports various resize/upsample modes.
891/// Resizes a tensor. Resize is only allowed in the H and W dimensions.
892///
893/// The height dimension is scaled by factor (scale_y_n/scale_y_d). The width
894/// dimension is scaled by factor (scale_x_n/scale_x_d).
895///
896/// The NEAREST_NEIGHBOR mode returns the value of the input tensor closest to
897/// the calculated sample position for both floating-point and integer data
898/// formats.
899///
900/// Floating-point BILINEAR mode returns a bilinearly interpolated output value
901/// based on the four closest input sample positions.
902///
903/// For integer BILINEAR interpolation mode, the output value must be scaled by
904/// 1/(scale_y_n * scale_x_n) in a following operation to complete the
905/// interpolation (for example with a RESCALE operator).
906///
907/// The output dimensions can be derived from the input dimensions by inverting
908/// the scale as described in the pseudocode. The [border_y, border_x] values
909/// adjust the output size to allow fractional sampling beyond integer input
910/// position (IH - 1,IW - 1).
911///
912/// The limit MAX_SCALE is applied to each scale ratio after reduction of the
913/// ratio. Individual scale numerator and denominator values are allowed to be
914/// larger than MAX_SCALE.
915class ResizeOp;
916
917} // namespace mlir::tosa
918namespace mlir::tosa {
919
920/// Reverse operator.
921/// Returns a tensor with the same type/values as the input, with the data
922/// reversed along the given axis. No data conversion happens during a reverse
923/// operation.
924class ReverseOp;
925
926} // namespace mlir::tosa
927namespace mlir::tosa {
928
929/// Row gather operation for block-scaled and non-block-scaled data.
930/// Generate a tensor-list which contains a data tensor and an optional scale
931/// tensor based on the input indices and row_count. The number of consecutive
932/// rows gathered for each index is specified in row_count.
933///
934/// The variadic `values` operands and results model the flattened
935/// `tensor_list_t` form from the TOSA spec:
936/// - non-block-scaled: 1 input value tensor and 1 result tensor
937/// - block-scaled: data + scale input tensors and data + scale result tensors
938///
939/// This operation is not pure. Undefined behaviour may occur if the specified
940/// indices are out of range.
941///
942/// Note: This operation is deprecated. It will be removed in the future.
943class RowGatherBlockScaledOp;
944
945} // namespace mlir::tosa
946namespace mlir::tosa {
947
948/// Row gather operation.
949/// Generate a tensor based on the input indices and row_count. The number of
950/// consecutive rows gathered for each index is specified in row_count. N is
951/// the number of batches, W is the number of indices in each batch, K is
952/// the range of each index, and C is the number of data channels for each
953/// index. The values tensor has shape [N, K, C] and the output tensor has shape
954/// [N, W * row_count, C].
955///
956/// This operation is not pure. Undefined behaviour may occur if the specified
957/// indices are out of range.
958class RowGatherOp;
959
960} // namespace mlir::tosa
961namespace mlir::tosa {
962
963/// Elementwise 1/sqrt operator.
964/// Elementwise reciprocal square root operation. For integer operation, a TABLE
965/// should be used with the appropriate ranges.
966class RsqrtOp;
967
968} // namespace mlir::tosa
969namespace mlir::tosa {
970
971/// Scatter operation.
972/// The values_out tensor is set to the values_in tensor with data modified as
973/// follows: data from the input tensor is inserted at the positions specified
974/// by the indices tensor. N is the number of batches, W the number of indices
975/// in each batch, K the range of each index and C the number data channels for
976/// each index. It is not permitted to repeat the same output index within a
977/// single SCATTER operation and so each output index occurs at most once. It
978/// follows that K >= W. In use cases that require multiple updates to the same
979/// output position, these must be decomposed into multiple SCATTER operations.
980///
981/// This operation is not pure. Undefined behaviour may occur if the specified
982/// indices are out of range or duplicate indices are provided.
983class ScatterOp;
984
985} // namespace mlir::tosa
986namespace mlir::tosa {
987
988/// Elementwise select operator.
989/// Elementwise select of the output based on a condition.
990class SelectOp;
991
992} // namespace mlir::tosa
993namespace mlir::tosa {
994
995/// Computes elementwise sigmoid of input.
996/// Applies the sigmoid logistic function to each element of the input tensor:
997/// $ sigmoid(x) = \frac{1}{1 + e^{-x}} $.
998///
999/// For quantized integer data types, the TABLE operator should be used instead.
1000/// Each implementation may choose an appropriate TABLE given the scale and zero
1001/// point of the input data. Eight or sixteen bit precision tables may be used
1002/// based on the input tensor to the sigmoid function.
1003class SigmoidOp;
1004
1005} // namespace mlir::tosa
1006namespace mlir::tosa {
1007
1008/// Elementwise sin operator.
1009/// Elementwise sine operation for values given in radians.
1010class SinOp;
1011
1012} // namespace mlir::tosa
1013namespace mlir::tosa {
1014
1015/// Slice operator.
1016/// Extracts a slice of input1, beginning at the start coordinates,
1017/// and extending for size elements in each direction.
1018/// No data conversion happens during a slice operation.
1019class SliceOp;
1020
1021} // namespace mlir::tosa
1022namespace mlir::tosa {
1023
1024/// Extract slice of a shape.
1025/// Extract a shape of size from input.
1026class SliceShapeOp;
1027
1028} // namespace mlir::tosa
1029namespace mlir::tosa {
1030
1031/// Elementwise subtraction operator.
1032/// Elementwise subtraction of input1 and input2. Axis of size 1 will be
1033/// broadcast as necessary. Rank of input tensors must match.
1034///
1035/// This operation is not pure. Undefined behaviour may occur if the calculated
1036/// result underflows.
1037class SubOp;
1038
1039} // namespace mlir::tosa
1040namespace mlir::tosa {
1041
1042/// Elementwise subtraction of shapes.
1043/// Elementwise subtraction of input1 and input2. Size of shapes must match.
1044class SubShapeOp;
1045
1046} // namespace mlir::tosa
1047namespace mlir::tosa {
1048
1049/// Table lookup operator.
1050/// Table lookup operation. For int8_t TABLE operation, perform a 256 entry
1051/// table lookup returning an int8_t value. For int16_t tables, the int16_t
1052/// input is treated as a fixed-point 9.7 value. The most significant 9 bits
1053/// are used to index into the table. The fractional 7 bits are used to
1054/// interpolate based on table[index] and table[index+1]. For int16_t inputs,
1055/// the TABLE operator returns a 16.7 interpolated value in an int32_t. This
1056/// value can then be input to the RESCALE operator to scale to the required
1057/// output data type. Note that int16_t table has 513 values to handle
1058/// table[index+1] when index=511.
1059///
1060/// An int16_t to int16_t table lookup can be constructed in TOSA as follows:
1061/// * Use the TABLE operator to produce a fixed point 16.7 interpolated result
1062/// * Use RESCALE (in_t=int32_t, out_t=int16_t, scale=1<<14, shift=21) to
1063/// scale the output to int16_t range (or alternate scale as required)
1064///
1065/// This operation is not pure. Undefined behaviour may occur if the calculated
1066/// slope is out of range.
1067class TableOp;
1068
1069} // namespace mlir::tosa
1070namespace mlir::tosa {
1071
1072/// Computes elementwise hyperbolic tangent of input.
1073/// Parameterized hyperbolic tangent: $ tanh(x) = \frac{1 - e^{-2x}}{1 + e^{-2x}} $.
1074///
1075/// For quantized integer data types, the TABLE operator should be used instead.
1076/// Each implementation may choose an appropriate TABLE given the scale and zero
1077/// point of the input data. Eight or sixteen bit precision tables may be used
1078/// based on the input tensor to the tanh function.
1079class TanhOp;
1080
1081} // namespace mlir::tosa
1082namespace mlir::tosa {
1083
1084/// Tile operator.
1085/// Replicates input1 multiples times along each dimension.
1086class TileOp;
1087
1088} // namespace mlir::tosa
1089namespace mlir::tosa {
1090
1091/// Transpose 2D Convolution operator.
1092/// Performs a 2D transposed convolution over the given tensor input, using the
1093/// weights tensor. Implementations may choose to skip calculation of multiplies
1094/// by zero at fractional input positions.
1095///
1096/// This operation is not pure. Undefined behaviour may occur if the accumulated
1097/// result overflows.
1098class TransposeConv2DOp;
1099
1100} // namespace mlir::tosa
1101namespace mlir::tosa {
1102
1103/// Transpose operator.
1104/// Permutes the dimensions of the input tensor input1 based on the perms
1105/// argument. Each value in the perms list must be a valid dimension of the
1106/// input tensor and may not be repeated.
1107class TransposeOp;
1108
1109} // namespace mlir::tosa
1110namespace mlir::tosa {
1111
1112/// Defines a variable
1113/// Defines a new TOSA variable. This is a persistent mutable value across multiple
1114/// TOSA graph invocations. Modifications are expressed using read/write semantics.
1115class VariableOp;
1116
1117} // namespace mlir::tosa
1118namespace mlir::tosa {
1119
1120/// read_buffer operator
1121/// Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.
1122class VariableReadOp;
1123
1124} // namespace mlir::tosa
1125namespace mlir::tosa {
1126
1127/// write_buffer operator
1128/// Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.
1129class VariableWriteOp;
1130
1131} // namespace mlir::tosa
1132namespace mlir::tosa {
1133
1134/// output = input; While (Cond(output)) {output = Body(output)}
1135/// Generates and evaluates a Boolean condition and either executes a loop body
1136/// or exits the loop. This action is performed repeatedly after
1137/// updating and re-evaluating the Boolean condition every iteration. This
1138/// implements the semantic foreach or while iterative loop structure.
1139class WhileOp;
1140
1141} // namespace mlir::tosa
1142namespace mlir::tosa {
1143
1144/// yield operator
1145/// return operation within the conditional and body of
1146/// structured control flow. Operation takes variadic operands
1147/// but produces no results of its own.
1148class YieldOp;
1149
1150} // namespace mlir::tosa
1151#ifdef GET_OP_CLASSES
1152#undef GET_OP_CLASSES
1153
1154#include "mlir/Bytecode/BytecodeOpInterface.h"
1155#include "mlir/Dialect/Tosa/IR/TosaOps.h"
1156#include "mlir/Dialect/Traits.h"
1157#include "mlir/IR/Attributes.h"
1158#include "mlir/IR/BuiltinAttributeInterfaces.h"
1159#include "mlir/IR/BuiltinAttributes.h"
1160#include "mlir/IR/BuiltinTypes.h"
1161#include "mlir/IR/OpDefinition.h"
1162#include "mlir/IR/OpImplementation.h"
1163#include "mlir/IR/SymbolTable.h"
1164#include "mlir/IR/Types.h"
1165#include "mlir/Interfaces/InferTypeOpInterface.h"
1166#include "mlir/Interfaces/LoopLikeInterface.h"
1167#include "mlir/Interfaces/SideEffectInterfaces.h"
1168
1169namespace mlir::tosa {
1170
1171
1172//===----------------------------------------------------------------------===//
1173// mlir::tosa::AbsOp declarations
1174//===----------------------------------------------------------------------===//
1175
1176namespace detail {
1177
1178class AbsOpGenericAdaptorBase {
1179public:
1180 using Properties = ::mlir::EmptyProperties;
1181protected:
1182 ::mlir::DictionaryAttr odsAttrs;
1183 ::std::optional<::mlir::OperationName> odsOpName;
1184 Properties properties;
1185 ::mlir::RegionRange odsRegions;
1186public:
1187 AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
1188 odsOpName.emplace(args: "tosa.abs", args: odsAttrs.getContext());
1189 }
1190
1191 AbsOpGenericAdaptorBase(AbsOp op);
1192
1193 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1194 return {index, 1};
1195 }
1196
1197 const Properties &getProperties() {
1198 return properties;
1199 }
1200
1201 ::mlir::DictionaryAttr getAttributes() {
1202 return odsAttrs;
1203 }
1204
1205};
1206
1207} // namespace detail
1208template <typename RangeT>
1209class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase {
1210 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
1211 using Base = detail::AbsOpGenericAdaptorBase;
1212 static constexpr int odsIndex_input1 = 0;
1213public:
1214 AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
1215
1216 AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
1217
1218 AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AbsOpGenericAdaptor(values, attrs, Properties{}, {}) {}
1219
1220 AbsOpGenericAdaptor(RangeT values, const AbsOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
1221
1222 template <typename LateInst = AbsOp, typename = std::enable_if_t<std::is_same_v<LateInst, AbsOp>>>
1223 AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
1224
1225 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
1226 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
1227 }
1228
1229 RangeT getODSOperands(unsigned index) {
1230 auto valueRange = getODSOperandIndexAndLength(index);
1231 return {std::next(odsOperands.begin(), valueRange.first),
1232 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1233 }
1234
1235 ValueT getInput1() {
1236 return (*getODSOperands(index: 0).begin());
1237 }
1238
1239 RangeT getOperands() {
1240 return odsOperands;
1241 }
1242
1243private:
1244 RangeT odsOperands;
1245};
1246class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> {
1247public:
1248 using AbsOpGenericAdaptor::AbsOpGenericAdaptor;
1249 AbsOpAdaptor(AbsOp op);
1250
1251 ::llvm::LogicalResult verify(::mlir::Location loc);
1252};
1253class AbsOp : public ::mlir::Op<AbsOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
1254public:
1255 using Op::Op;
1256 using Op::print;
1257 using Adaptor = AbsOpAdaptor;
1258 template <typename RangeT>
1259 using GenericAdaptor = AbsOpGenericAdaptor<RangeT>;
1260 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
1261 static constexpr int odsIndex_input1 = 0;
1262 static constexpr int odsIndex_output = 0;
1263 using Properties = FoldAdaptor::Properties;
1264 using ::mlir::InferShapedTypeOpInterface::Trait<AbsOp>::reifyReturnTypeShapes;
1265 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
1266 return {};
1267 }
1268
1269 static constexpr ::llvm::StringLiteral getOperationName() {
1270 return ::llvm::StringLiteral("tosa.abs");
1271 }
1272
1273 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
1274 return {index, 1};
1275 }
1276
1277 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
1278 auto [start, length] = getODSOperandIndexAndLength(index);
1279 return getOperation()->getOperands().slice(n: start, m: length);
1280 }
1281
1282 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
1283 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
1284 }
1285
1286 ::mlir::OpOperand &getInput1Mutable() {
1287 auto range = getODSOperandIndexAndLength(index: 0);
1288 return getOperation()->getOpOperand(idx: range.first);
1289 }
1290
1291 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
1292 return {index, 1};
1293 }
1294
1295 ::mlir::Operation::result_range getODSResults(unsigned index) {
1296 auto valueRange = getODSResultIndexAndLength(index);
1297 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
1298 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
1299 }
1300
1301 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
1302 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
1303 }
1304
1305 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
1306 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
1307 static llvm::hash_code computePropertiesHash(const Properties &prop);
1308 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
1309 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
1310 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
1311 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
1312 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
1313 static AbsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
1314 static AbsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
1315 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
1316 static AbsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
1317 static AbsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
1318 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1319 static AbsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1320 static AbsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1321 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1322 static AbsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1323 static AbsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1324 ::llvm::LogicalResult verifyInvariantsImpl();
1325 ::llvm::LogicalResult verifyInvariants();
1326 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
1327 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
1328 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
1329 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
1330 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
1331public:
1332};
1333
1334} // namespace mlir::tosa
1335MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::AbsOp)
1336
1337namespace mlir::tosa {
1338
1339
1340//===----------------------------------------------------------------------===//
1341// mlir::tosa::AddOp declarations
1342//===----------------------------------------------------------------------===//
1343
1344namespace detail {
1345
1346class AddOpGenericAdaptorBase {
1347public:
1348 using Properties = ::mlir::EmptyProperties;
1349protected:
1350 ::mlir::DictionaryAttr odsAttrs;
1351 ::std::optional<::mlir::OperationName> odsOpName;
1352 Properties properties;
1353 ::mlir::RegionRange odsRegions;
1354public:
1355 AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
1356 odsOpName.emplace(args: "tosa.add", args: odsAttrs.getContext());
1357 }
1358
1359 AddOpGenericAdaptorBase(AddOp op);
1360
1361 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1362 return {index, 1};
1363 }
1364
1365 const Properties &getProperties() {
1366 return properties;
1367 }
1368
1369 ::mlir::DictionaryAttr getAttributes() {
1370 return odsAttrs;
1371 }
1372
1373};
1374
1375} // namespace detail
1376template <typename RangeT>
1377class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase {
1378 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
1379 using Base = detail::AddOpGenericAdaptorBase;
1380 static constexpr int odsIndex_input1 = 0;
1381 static constexpr int odsIndex_input2 = 1;
1382public:
1383 AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
1384
1385 AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
1386
1387 AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AddOpGenericAdaptor(values, attrs, Properties{}, {}) {}
1388
1389 AddOpGenericAdaptor(RangeT values, const AddOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
1390
1391 template <typename LateInst = AddOp, typename = std::enable_if_t<std::is_same_v<LateInst, AddOp>>>
1392 AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
1393
1394 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
1395 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
1396 }
1397
1398 RangeT getODSOperands(unsigned index) {
1399 auto valueRange = getODSOperandIndexAndLength(index);
1400 return {std::next(odsOperands.begin(), valueRange.first),
1401 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1402 }
1403
1404 ValueT getInput1() {
1405 return (*getODSOperands(index: 0).begin());
1406 }
1407
1408 ValueT getInput2() {
1409 return (*getODSOperands(index: 1).begin());
1410 }
1411
1412 RangeT getOperands() {
1413 return odsOperands;
1414 }
1415
1416private:
1417 RangeT odsOperands;
1418};
1419class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> {
1420public:
1421 using AddOpGenericAdaptor::AddOpGenericAdaptor;
1422 AddOpAdaptor(AddOp op);
1423
1424 ::llvm::LogicalResult verify(::mlir::Location loc);
1425};
1426class AddOp : public ::mlir::Op<AddOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
1427public:
1428 using Op::Op;
1429 using Op::print;
1430 using Adaptor = AddOpAdaptor;
1431 template <typename RangeT>
1432 using GenericAdaptor = AddOpGenericAdaptor<RangeT>;
1433 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
1434 static constexpr int odsIndex_input1 = 0;
1435 static constexpr int odsIndex_input2 = 1;
1436 static constexpr int odsIndex_output = 0;
1437 using Properties = FoldAdaptor::Properties;
1438 using ::mlir::InferShapedTypeOpInterface::Trait<AddOp>::reifyReturnTypeShapes;
1439 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
1440 return {};
1441 }
1442
1443 static constexpr ::llvm::StringLiteral getOperationName() {
1444 return ::llvm::StringLiteral("tosa.add");
1445 }
1446
1447 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
1448 return {index, 1};
1449 }
1450
1451 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
1452 auto [start, length] = getODSOperandIndexAndLength(index);
1453 return getOperation()->getOperands().slice(n: start, m: length);
1454 }
1455
1456 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
1457 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
1458 }
1459
1460 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
1461 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
1462 }
1463
1464 ::mlir::OpOperand &getInput1Mutable() {
1465 auto range = getODSOperandIndexAndLength(index: 0);
1466 return getOperation()->getOpOperand(idx: range.first);
1467 }
1468
1469 ::mlir::OpOperand &getInput2Mutable() {
1470 auto range = getODSOperandIndexAndLength(index: 1);
1471 return getOperation()->getOpOperand(idx: range.first);
1472 }
1473
1474 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
1475 return {index, 1};
1476 }
1477
1478 ::mlir::Operation::result_range getODSResults(unsigned index) {
1479 auto valueRange = getODSResultIndexAndLength(index);
1480 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
1481 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
1482 }
1483
1484 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
1485 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
1486 }
1487
1488 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
1489 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
1490 static llvm::hash_code computePropertiesHash(const Properties &prop);
1491 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
1492 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
1493 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
1494 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
1495 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
1496 static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
1497 static AddOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
1498 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
1499 static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
1500 static AddOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
1501 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1502 static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1503 static AddOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1504 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1505 static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1506 static AddOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1507 ::llvm::LogicalResult verifyInvariantsImpl();
1508 ::llvm::LogicalResult verifyInvariants();
1509 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
1510 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
1511 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
1512 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
1513 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
1514public:
1515};
1516
1517} // namespace mlir::tosa
1518MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::AddOp)
1519
1520namespace mlir::tosa {
1521
1522
1523//===----------------------------------------------------------------------===//
1524// mlir::tosa::AddShapeOp declarations
1525//===----------------------------------------------------------------------===//
1526
1527namespace detail {
1528
1529class AddShapeOpGenericAdaptorBase {
1530public:
1531 using Properties = ::mlir::EmptyProperties;
1532protected:
1533 ::mlir::DictionaryAttr odsAttrs;
1534 ::std::optional<::mlir::OperationName> odsOpName;
1535 Properties properties;
1536 ::mlir::RegionRange odsRegions;
1537public:
1538 AddShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
1539 odsOpName.emplace(args: "tosa.add_shape", args: odsAttrs.getContext());
1540 }
1541
1542 AddShapeOpGenericAdaptorBase(AddShapeOp op);
1543
1544 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1545 return {index, 1};
1546 }
1547
1548 const Properties &getProperties() {
1549 return properties;
1550 }
1551
1552 ::mlir::DictionaryAttr getAttributes() {
1553 return odsAttrs;
1554 }
1555
1556};
1557
1558} // namespace detail
1559template <typename RangeT>
1560class AddShapeOpGenericAdaptor : public detail::AddShapeOpGenericAdaptorBase {
1561 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
1562 using Base = detail::AddShapeOpGenericAdaptorBase;
1563 static constexpr int odsIndex_input1 = 0;
1564 static constexpr int odsIndex_input2 = 1;
1565public:
1566 AddShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
1567
1568 AddShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AddShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
1569
1570 AddShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AddShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
1571
1572 AddShapeOpGenericAdaptor(RangeT values, const AddShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
1573
1574 template <typename LateInst = AddShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, AddShapeOp>>>
1575 AddShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
1576
1577 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
1578 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
1579 }
1580
1581 RangeT getODSOperands(unsigned index) {
1582 auto valueRange = getODSOperandIndexAndLength(index);
1583 return {std::next(odsOperands.begin(), valueRange.first),
1584 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1585 }
1586
1587 ValueT getInput1() {
1588 return (*getODSOperands(index: 0).begin());
1589 }
1590
1591 ValueT getInput2() {
1592 return (*getODSOperands(index: 1).begin());
1593 }
1594
1595 RangeT getOperands() {
1596 return odsOperands;
1597 }
1598
1599private:
1600 RangeT odsOperands;
1601};
1602class AddShapeOpAdaptor : public AddShapeOpGenericAdaptor<::mlir::ValueRange> {
1603public:
1604 using AddShapeOpGenericAdaptor::AddShapeOpGenericAdaptor;
1605 AddShapeOpAdaptor(AddShapeOp op);
1606
1607 ::llvm::LogicalResult verify(::mlir::Location loc);
1608};
1609class AddShapeOp : public ::mlir::Op<AddShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
1610public:
1611 using Op::Op;
1612 using Op::print;
1613 using Adaptor = AddShapeOpAdaptor;
1614 template <typename RangeT>
1615 using GenericAdaptor = AddShapeOpGenericAdaptor<RangeT>;
1616 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
1617 static constexpr int odsIndex_input1 = 0;
1618 static constexpr int odsIndex_input2 = 1;
1619 static constexpr int odsIndex_output = 0;
1620 using Properties = FoldAdaptor::Properties;
1621 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
1622 return {};
1623 }
1624
1625 static constexpr ::llvm::StringLiteral getOperationName() {
1626 return ::llvm::StringLiteral("tosa.add_shape");
1627 }
1628
1629 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
1630 return {index, 1};
1631 }
1632
1633 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
1634 auto [start, length] = getODSOperandIndexAndLength(index);
1635 return getOperation()->getOperands().slice(n: start, m: length);
1636 }
1637
1638 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
1639 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
1640 }
1641
1642 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
1643 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
1644 }
1645
1646 ::mlir::OpOperand &getInput1Mutable() {
1647 auto range = getODSOperandIndexAndLength(index: 0);
1648 return getOperation()->getOpOperand(idx: range.first);
1649 }
1650
1651 ::mlir::OpOperand &getInput2Mutable() {
1652 auto range = getODSOperandIndexAndLength(index: 1);
1653 return getOperation()->getOpOperand(idx: range.first);
1654 }
1655
1656 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
1657 return {index, 1};
1658 }
1659
1660 ::mlir::Operation::result_range getODSResults(unsigned index) {
1661 auto valueRange = getODSResultIndexAndLength(index);
1662 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
1663 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
1664 }
1665
1666 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
1667 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
1668 }
1669
1670 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
1671 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
1672 static llvm::hash_code computePropertiesHash(const Properties &prop);
1673 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
1674 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
1675 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
1676 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
1677 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
1678 static AddShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
1679 static AddShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
1680 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
1681 static AddShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
1682 static AddShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
1683 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1684 static AddShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1685 static AddShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1686 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1687 static AddShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1688 static AddShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1689 ::llvm::LogicalResult verifyInvariantsImpl();
1690 ::llvm::LogicalResult verifyInvariants();
1691 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
1692 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
1693 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
1694 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
1695public:
1696};
1697
1698} // namespace mlir::tosa
1699MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::AddShapeOp)
1700
1701namespace mlir::tosa {
1702
1703
1704//===----------------------------------------------------------------------===//
1705// mlir::tosa::ApplyScaleOp declarations
1706//===----------------------------------------------------------------------===//
1707
1708namespace detail {
1709
1710class ApplyScaleOpGenericAdaptorBase {
1711public:
1712 struct Properties {
1713 using rounding_modeTy = mlir::tosa::RoundingModeAttr;
1714 rounding_modeTy rounding_mode;
1715
1716 auto getRoundingMode() const {
1717 auto &propStorage = this->rounding_mode;
1718 return ::llvm::cast<mlir::tosa::RoundingModeAttr>(Val: propStorage);
1719 }
1720 void setRoundingMode(const mlir::tosa::RoundingModeAttr &propValue) {
1721 this->rounding_mode = propValue;
1722 }
1723 bool operator==(const Properties &rhs) const {
1724 return
1725 rhs.rounding_mode == this->rounding_mode &&
1726 true;
1727 }
1728 bool operator!=(const Properties &rhs) const {
1729 return !(*this == rhs);
1730 }
1731 };
1732protected:
1733 ::mlir::DictionaryAttr odsAttrs;
1734 ::std::optional<::mlir::OperationName> odsOpName;
1735 Properties properties;
1736 ::mlir::RegionRange odsRegions;
1737public:
1738 ApplyScaleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
1739 odsOpName.emplace(args: "tosa.apply_scale", args: odsAttrs.getContext());
1740 }
1741
1742 ApplyScaleOpGenericAdaptorBase(ApplyScaleOp op);
1743
1744 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1745 return {index, 1};
1746 }
1747
1748 const Properties &getProperties() {
1749 return properties;
1750 }
1751
1752 ::mlir::DictionaryAttr getAttributes() {
1753 return odsAttrs;
1754 }
1755
1756 mlir::tosa::RoundingModeAttr getRoundingModeAttr() {
1757 auto attr = ::llvm::cast<mlir::tosa::RoundingModeAttr>(Val: getProperties().rounding_mode);
1758 return attr;
1759 }
1760
1761 ::mlir::tosa::RoundingMode getRoundingMode();
1762};
1763
1764} // namespace detail
1765template <typename RangeT>
1766class ApplyScaleOpGenericAdaptor : public detail::ApplyScaleOpGenericAdaptorBase {
1767 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
1768 using Base = detail::ApplyScaleOpGenericAdaptorBase;
1769 static constexpr int odsIndex_value = 0;
1770 static constexpr int odsIndex_multiplier = 1;
1771 static constexpr int odsIndex_shift = 2;
1772public:
1773 ApplyScaleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
1774
1775 ApplyScaleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ApplyScaleOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
1776
1777 ApplyScaleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ApplyScaleOpGenericAdaptor(values, attrs, Properties{}, {}) {}
1778
1779 ApplyScaleOpGenericAdaptor(RangeT values, const ApplyScaleOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
1780
1781 template <typename LateInst = ApplyScaleOp, typename = std::enable_if_t<std::is_same_v<LateInst, ApplyScaleOp>>>
1782 ApplyScaleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
1783
1784 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
1785 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
1786 }
1787
1788 RangeT getODSOperands(unsigned index) {
1789 auto valueRange = getODSOperandIndexAndLength(index);
1790 return {std::next(odsOperands.begin(), valueRange.first),
1791 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1792 }
1793
1794 ValueT getValue() {
1795 return (*getODSOperands(index: 0).begin());
1796 }
1797
1798 ValueT getMultiplier() {
1799 return (*getODSOperands(index: 1).begin());
1800 }
1801
1802 ValueT getShift() {
1803 return (*getODSOperands(index: 2).begin());
1804 }
1805
1806 RangeT getOperands() {
1807 return odsOperands;
1808 }
1809
1810private:
1811 RangeT odsOperands;
1812};
1813class ApplyScaleOpAdaptor : public ApplyScaleOpGenericAdaptor<::mlir::ValueRange> {
1814public:
1815 using ApplyScaleOpGenericAdaptor::ApplyScaleOpGenericAdaptor;
1816 ApplyScaleOpAdaptor(ApplyScaleOp op);
1817
1818 ::llvm::LogicalResult verify(::mlir::Location loc);
1819};
1820class ApplyScaleOp : public ::mlir::Op<ApplyScaleOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::Type>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::Scalarizable, ::mlir::OpTrait::Vectorizable, ::mlir::OpTrait::Tensorizable, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
1821public:
1822 using Op::Op;
1823 using Op::print;
1824 using Adaptor = ApplyScaleOpAdaptor;
1825 template <typename RangeT>
1826 using GenericAdaptor = ApplyScaleOpGenericAdaptor<RangeT>;
1827 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
1828 static constexpr int odsIndex_value = 0;
1829 static constexpr int odsIndex_multiplier = 1;
1830 static constexpr int odsIndex_shift = 2;
1831 static constexpr int odsIndex_output = 0;
1832 using Properties = FoldAdaptor::Properties;
1833 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
1834 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("rounding_mode")};
1835 return ::llvm::ArrayRef(attrNames);
1836 }
1837
1838 ::mlir::StringAttr getRoundingModeAttrName() {
1839 return getAttributeNameForIndex(index: 0);
1840 }
1841
1842 static ::mlir::StringAttr getRoundingModeAttrName(::mlir::OperationName name) {
1843 return getAttributeNameForIndex(name, index: 0);
1844 }
1845
1846 static constexpr ::llvm::StringLiteral getOperationName() {
1847 return ::llvm::StringLiteral("tosa.apply_scale");
1848 }
1849
1850 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
1851 return {index, 1};
1852 }
1853
1854 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
1855 auto [start, length] = getODSOperandIndexAndLength(index);
1856 return getOperation()->getOperands().slice(n: start, m: length);
1857 }
1858
1859 ::mlir::TypedValue<::mlir::Type> getValue() {
1860 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 0).begin());
1861 }
1862
1863 ::mlir::TypedValue<::mlir::Type> getMultiplier() {
1864 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 1).begin());
1865 }
1866
1867 ::mlir::TypedValue<::mlir::Type> getShift() {
1868 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 2).begin());
1869 }
1870
1871 ::mlir::OpOperand &getValueMutable() {
1872 auto range = getODSOperandIndexAndLength(index: 0);
1873 return getOperation()->getOpOperand(idx: range.first);
1874 }
1875
1876 ::mlir::OpOperand &getMultiplierMutable() {
1877 auto range = getODSOperandIndexAndLength(index: 1);
1878 return getOperation()->getOpOperand(idx: range.first);
1879 }
1880
1881 ::mlir::OpOperand &getShiftMutable() {
1882 auto range = getODSOperandIndexAndLength(index: 2);
1883 return getOperation()->getOpOperand(idx: range.first);
1884 }
1885
1886 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
1887 return {index, 1};
1888 }
1889
1890 ::mlir::Operation::result_range getODSResults(unsigned index) {
1891 auto valueRange = getODSResultIndexAndLength(index);
1892 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
1893 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
1894 }
1895
1896 ::mlir::TypedValue<::mlir::Type> getOutput() {
1897 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSResults(index: 0).begin());
1898 }
1899
1900 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
1901 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
1902 static llvm::hash_code computePropertiesHash(const Properties &prop);
1903 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
1904 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
1905 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
1906 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
1907 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
1908 void writeProperties(::mlir::DialectBytecodeWriter &writer);
1909 mlir::tosa::RoundingModeAttr getRoundingModeAttr() {
1910 return ::llvm::cast<mlir::tosa::RoundingModeAttr>(Val&: getProperties().rounding_mode);
1911 }
1912
1913 ::mlir::tosa::RoundingMode getRoundingMode();
1914 void setRoundingModeAttr(mlir::tosa::RoundingModeAttr attr) {
1915 getProperties().rounding_mode = attr;
1916 }
1917
1918 void setRoundingMode(::mlir::tosa::RoundingMode attrValue);
1919 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, mlir::tosa::RoundingModeAttr rounding_mode);
1920 static ApplyScaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, mlir::tosa::RoundingModeAttr rounding_mode);
1921 static ApplyScaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, mlir::tosa::RoundingModeAttr rounding_mode);
1922 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, mlir::tosa::RoundingModeAttr rounding_mode);
1923 static ApplyScaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, mlir::tosa::RoundingModeAttr rounding_mode);
1924 static ApplyScaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, mlir::tosa::RoundingModeAttr rounding_mode);
1925 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::tosa::RoundingMode rounding_mode);
1926 static ApplyScaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::tosa::RoundingMode rounding_mode);
1927 static ApplyScaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::tosa::RoundingMode rounding_mode);
1928 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::tosa::RoundingMode rounding_mode);
1929 static ApplyScaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::tosa::RoundingMode rounding_mode);
1930 static ApplyScaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::tosa::RoundingMode rounding_mode);
1931 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
1932 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1933 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
1934 static ApplyScaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1935 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
1936 static ApplyScaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
1937 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1938 static ApplyScaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1939 static ApplyScaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
1940 ::llvm::LogicalResult verifyInvariantsImpl();
1941 ::llvm::LogicalResult verifyInvariants();
1942 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
1943 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
1944 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
1945private:
1946 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
1947 return getAttributeNameForIndex(name: (*this)->getName(), index);
1948 }
1949
1950 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
1951 assert(index < 1 && "invalid attribute index");
1952 assert(name.getStringRef() == getOperationName() && "invalid operation name");
1953 assert(name.isRegistered() && "Operation isn't registered, missing a "
1954 "dependent dialect loading?");
1955 return name.getAttributeNames()[index];
1956 }
1957
1958 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
1959public:
1960};
1961
1962} // namespace mlir::tosa
1963MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ApplyScaleOp)
1964MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ApplyScaleOpGenericAdaptorBase::Properties)
1965
1966namespace mlir::tosa {
1967
1968
1969//===----------------------------------------------------------------------===//
1970// mlir::tosa::ArgMaxOp declarations
1971//===----------------------------------------------------------------------===//
1972
1973namespace detail {
1974
1975class ArgMaxOpGenericAdaptorBase {
1976public:
1977 struct Properties {
1978 using axisTy = ::mlir::IntegerAttr;
1979 axisTy axis;
1980
1981 auto getAxis() const {
1982 auto &propStorage = this->axis;
1983 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
1984 }
1985 void setAxis(const ::mlir::IntegerAttr &propValue) {
1986 this->axis = propValue;
1987 }
1988 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
1989 nan_modeTy nan_mode;
1990
1991 auto getNanMode() const {
1992 auto &propStorage = this->nan_mode;
1993 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
1994 }
1995 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
1996 this->nan_mode = propValue;
1997 }
1998 bool operator==(const Properties &rhs) const {
1999 return
2000 rhs.axis == this->axis &&
2001 rhs.nan_mode == this->nan_mode &&
2002 true;
2003 }
2004 bool operator!=(const Properties &rhs) const {
2005 return !(*this == rhs);
2006 }
2007 };
2008protected:
2009 ::mlir::DictionaryAttr odsAttrs;
2010 ::std::optional<::mlir::OperationName> odsOpName;
2011 Properties properties;
2012 ::mlir::RegionRange odsRegions;
2013public:
2014 ArgMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
2015 odsOpName.emplace(args: "tosa.argmax", args: odsAttrs.getContext());
2016 }
2017
2018 ArgMaxOpGenericAdaptorBase(ArgMaxOp op);
2019
2020 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
2021 return {index, 1};
2022 }
2023
2024 const Properties &getProperties() {
2025 return properties;
2026 }
2027
2028 ::mlir::DictionaryAttr getAttributes() {
2029 return odsAttrs;
2030 }
2031
2032 ::mlir::IntegerAttr getAxisAttr() {
2033 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
2034 return attr;
2035 }
2036
2037 uint32_t getAxis();
2038 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
2039 ::mlir::tosa::NanPropagationMode getNanMode();
2040};
2041
2042} // namespace detail
2043template <typename RangeT>
2044class ArgMaxOpGenericAdaptor : public detail::ArgMaxOpGenericAdaptorBase {
2045 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
2046 using Base = detail::ArgMaxOpGenericAdaptorBase;
2047 static constexpr int odsIndex_input = 0;
2048public:
2049 ArgMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
2050
2051 ArgMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ArgMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
2052
2053 ArgMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ArgMaxOpGenericAdaptor(values, attrs, Properties{}, {}) {}
2054
2055 ArgMaxOpGenericAdaptor(RangeT values, const ArgMaxOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
2056
2057 template <typename LateInst = ArgMaxOp, typename = std::enable_if_t<std::is_same_v<LateInst, ArgMaxOp>>>
2058 ArgMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
2059
2060 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
2061 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
2062 }
2063
2064 RangeT getODSOperands(unsigned index) {
2065 auto valueRange = getODSOperandIndexAndLength(index);
2066 return {std::next(odsOperands.begin(), valueRange.first),
2067 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2068 }
2069
2070 ValueT getInput() {
2071 return (*getODSOperands(index: 0).begin());
2072 }
2073
2074 RangeT getOperands() {
2075 return odsOperands;
2076 }
2077
2078private:
2079 RangeT odsOperands;
2080};
2081class ArgMaxOpAdaptor : public ArgMaxOpGenericAdaptor<::mlir::ValueRange> {
2082public:
2083 using ArgMaxOpGenericAdaptor::ArgMaxOpGenericAdaptor;
2084 ArgMaxOpAdaptor(ArgMaxOp op);
2085
2086 ::llvm::LogicalResult verify(::mlir::Location loc);
2087};
2088class ArgMaxOp : public ::mlir::Op<ArgMaxOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
2089public:
2090 using Op::Op;
2091 using Op::print;
2092 using Adaptor = ArgMaxOpAdaptor;
2093 template <typename RangeT>
2094 using GenericAdaptor = ArgMaxOpGenericAdaptor<RangeT>;
2095 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
2096 static constexpr int odsIndex_input = 0;
2097 static constexpr int odsIndex_output = 0;
2098 using Properties = FoldAdaptor::Properties;
2099 using ::mlir::InferShapedTypeOpInterface::Trait<ArgMaxOp>::reifyReturnTypeShapes;
2100 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
2101 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis"), ::llvm::StringRef("nan_mode")};
2102 return ::llvm::ArrayRef(attrNames);
2103 }
2104
2105 ::mlir::StringAttr getAxisAttrName() {
2106 return getAttributeNameForIndex(index: 0);
2107 }
2108
2109 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
2110 return getAttributeNameForIndex(name, index: 0);
2111 }
2112
2113 ::mlir::StringAttr getNanModeAttrName() {
2114 return getAttributeNameForIndex(index: 1);
2115 }
2116
2117 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
2118 return getAttributeNameForIndex(name, index: 1);
2119 }
2120
2121 static constexpr ::llvm::StringLiteral getOperationName() {
2122 return ::llvm::StringLiteral("tosa.argmax");
2123 }
2124
2125 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
2126 return {index, 1};
2127 }
2128
2129 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
2130 auto [start, length] = getODSOperandIndexAndLength(index);
2131 return getOperation()->getOperands().slice(n: start, m: length);
2132 }
2133
2134 ::mlir::TypedValue<::mlir::TensorType> getInput() {
2135 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
2136 }
2137
2138 ::mlir::OpOperand &getInputMutable() {
2139 auto range = getODSOperandIndexAndLength(index: 0);
2140 return getOperation()->getOpOperand(idx: range.first);
2141 }
2142
2143 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
2144 return {index, 1};
2145 }
2146
2147 ::mlir::Operation::result_range getODSResults(unsigned index) {
2148 auto valueRange = getODSResultIndexAndLength(index);
2149 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
2150 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
2151 }
2152
2153 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
2154 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
2155 }
2156
2157 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
2158 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
2159 static llvm::hash_code computePropertiesHash(const Properties &prop);
2160 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
2161 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
2162 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
2163 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
2164 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
2165 void writeProperties(::mlir::DialectBytecodeWriter &writer);
2166 ::mlir::IntegerAttr getAxisAttr() {
2167 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
2168 }
2169
2170 uint32_t getAxis();
2171 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
2172 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
2173 }
2174
2175 ::mlir::tosa::NanPropagationMode getNanMode();
2176 void setAxisAttr(::mlir::IntegerAttr attr) {
2177 getProperties().axis = attr;
2178 }
2179
2180 void setAxis(uint32_t attrValue);
2181 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
2182 getProperties().nan_mode = attr;
2183 }
2184
2185 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
2186 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2187 static ArgMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2188 static ArgMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2189 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2190 static ArgMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2191 static ArgMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2192 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2193 static ArgMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2194 static ArgMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2195 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2196 static ArgMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2197 static ArgMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2198 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2199 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2200 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2201 static ArgMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2202 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2203 static ArgMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2204 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2205 static ArgMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2206 static ArgMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2207 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
2208 ::llvm::LogicalResult verifyInvariantsImpl();
2209 ::llvm::LogicalResult verifyInvariants();
2210 ::llvm::LogicalResult verify();
2211 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
2212 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
2213 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
2214 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
2215 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
2216private:
2217 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
2218 return getAttributeNameForIndex(name: (*this)->getName(), index);
2219 }
2220
2221 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
2222 assert(index < 2 && "invalid attribute index");
2223 assert(name.getStringRef() == getOperationName() && "invalid operation name");
2224 assert(name.isRegistered() && "Operation isn't registered, missing a "
2225 "dependent dialect loading?");
2226 return name.getAttributeNames()[index];
2227 }
2228
2229 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
2230public:
2231 static ::llvm::LogicalResult
2232 inferReturnTypeComponents(::mlir::MLIRContext *context,
2233 std::optional<::mlir::Location> location,
2234 Adaptor adaptor,
2235 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
2236
2237};
2238
2239} // namespace mlir::tosa
2240MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ArgMaxOp)
2241MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ArgMaxOpGenericAdaptorBase::Properties)
2242
2243namespace mlir::tosa {
2244
2245
2246//===----------------------------------------------------------------------===//
2247// mlir::tosa::ArgMinOp declarations
2248//===----------------------------------------------------------------------===//
2249
2250namespace detail {
2251
2252class ArgMinOpGenericAdaptorBase {
2253public:
2254 struct Properties {
2255 using axisTy = ::mlir::IntegerAttr;
2256 axisTy axis;
2257
2258 auto getAxis() const {
2259 auto &propStorage = this->axis;
2260 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
2261 }
2262 void setAxis(const ::mlir::IntegerAttr &propValue) {
2263 this->axis = propValue;
2264 }
2265 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
2266 nan_modeTy nan_mode;
2267
2268 auto getNanMode() const {
2269 auto &propStorage = this->nan_mode;
2270 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
2271 }
2272 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
2273 this->nan_mode = propValue;
2274 }
2275 bool operator==(const Properties &rhs) const {
2276 return
2277 rhs.axis == this->axis &&
2278 rhs.nan_mode == this->nan_mode &&
2279 true;
2280 }
2281 bool operator!=(const Properties &rhs) const {
2282 return !(*this == rhs);
2283 }
2284 };
2285protected:
2286 ::mlir::DictionaryAttr odsAttrs;
2287 ::std::optional<::mlir::OperationName> odsOpName;
2288 Properties properties;
2289 ::mlir::RegionRange odsRegions;
2290public:
2291 ArgMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
2292 odsOpName.emplace(args: "tosa.argmin", args: odsAttrs.getContext());
2293 }
2294
2295 ArgMinOpGenericAdaptorBase(ArgMinOp op);
2296
2297 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
2298 return {index, 1};
2299 }
2300
2301 const Properties &getProperties() {
2302 return properties;
2303 }
2304
2305 ::mlir::DictionaryAttr getAttributes() {
2306 return odsAttrs;
2307 }
2308
2309 ::mlir::IntegerAttr getAxisAttr() {
2310 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
2311 return attr;
2312 }
2313
2314 uint32_t getAxis();
2315 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
2316 ::mlir::tosa::NanPropagationMode getNanMode();
2317};
2318
2319} // namespace detail
2320template <typename RangeT>
2321class ArgMinOpGenericAdaptor : public detail::ArgMinOpGenericAdaptorBase {
2322 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
2323 using Base = detail::ArgMinOpGenericAdaptorBase;
2324 static constexpr int odsIndex_input = 0;
2325public:
2326 ArgMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
2327
2328 ArgMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ArgMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
2329
2330 ArgMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ArgMinOpGenericAdaptor(values, attrs, Properties{}, {}) {}
2331
2332 ArgMinOpGenericAdaptor(RangeT values, const ArgMinOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
2333
2334 template <typename LateInst = ArgMinOp, typename = std::enable_if_t<std::is_same_v<LateInst, ArgMinOp>>>
2335 ArgMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
2336
2337 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
2338 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
2339 }
2340
2341 RangeT getODSOperands(unsigned index) {
2342 auto valueRange = getODSOperandIndexAndLength(index);
2343 return {std::next(odsOperands.begin(), valueRange.first),
2344 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2345 }
2346
2347 ValueT getInput() {
2348 return (*getODSOperands(index: 0).begin());
2349 }
2350
2351 RangeT getOperands() {
2352 return odsOperands;
2353 }
2354
2355private:
2356 RangeT odsOperands;
2357};
2358class ArgMinOpAdaptor : public ArgMinOpGenericAdaptor<::mlir::ValueRange> {
2359public:
2360 using ArgMinOpGenericAdaptor::ArgMinOpGenericAdaptor;
2361 ArgMinOpAdaptor(ArgMinOp op);
2362
2363 ::llvm::LogicalResult verify(::mlir::Location loc);
2364};
2365class ArgMinOp : public ::mlir::Op<ArgMinOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
2366public:
2367 using Op::Op;
2368 using Op::print;
2369 using Adaptor = ArgMinOpAdaptor;
2370 template <typename RangeT>
2371 using GenericAdaptor = ArgMinOpGenericAdaptor<RangeT>;
2372 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
2373 static constexpr int odsIndex_input = 0;
2374 static constexpr int odsIndex_output = 0;
2375 using Properties = FoldAdaptor::Properties;
2376 using ::mlir::InferShapedTypeOpInterface::Trait<ArgMinOp>::reifyReturnTypeShapes;
2377 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
2378 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis"), ::llvm::StringRef("nan_mode")};
2379 return ::llvm::ArrayRef(attrNames);
2380 }
2381
2382 ::mlir::StringAttr getAxisAttrName() {
2383 return getAttributeNameForIndex(index: 0);
2384 }
2385
2386 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
2387 return getAttributeNameForIndex(name, index: 0);
2388 }
2389
2390 ::mlir::StringAttr getNanModeAttrName() {
2391 return getAttributeNameForIndex(index: 1);
2392 }
2393
2394 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
2395 return getAttributeNameForIndex(name, index: 1);
2396 }
2397
2398 static constexpr ::llvm::StringLiteral getOperationName() {
2399 return ::llvm::StringLiteral("tosa.argmin");
2400 }
2401
2402 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
2403 return {index, 1};
2404 }
2405
2406 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
2407 auto [start, length] = getODSOperandIndexAndLength(index);
2408 return getOperation()->getOperands().slice(n: start, m: length);
2409 }
2410
2411 ::mlir::TypedValue<::mlir::TensorType> getInput() {
2412 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
2413 }
2414
2415 ::mlir::OpOperand &getInputMutable() {
2416 auto range = getODSOperandIndexAndLength(index: 0);
2417 return getOperation()->getOpOperand(idx: range.first);
2418 }
2419
2420 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
2421 return {index, 1};
2422 }
2423
2424 ::mlir::Operation::result_range getODSResults(unsigned index) {
2425 auto valueRange = getODSResultIndexAndLength(index);
2426 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
2427 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
2428 }
2429
2430 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
2431 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
2432 }
2433
2434 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
2435 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
2436 static llvm::hash_code computePropertiesHash(const Properties &prop);
2437 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
2438 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
2439 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
2440 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
2441 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
2442 void writeProperties(::mlir::DialectBytecodeWriter &writer);
2443 ::mlir::IntegerAttr getAxisAttr() {
2444 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
2445 }
2446
2447 uint32_t getAxis();
2448 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
2449 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
2450 }
2451
2452 ::mlir::tosa::NanPropagationMode getNanMode();
2453 void setAxisAttr(::mlir::IntegerAttr attr) {
2454 getProperties().axis = attr;
2455 }
2456
2457 void setAxis(uint32_t attrValue);
2458 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
2459 getProperties().nan_mode = attr;
2460 }
2461
2462 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
2463 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2464 static ArgMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2465 static ArgMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2466 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2467 static ArgMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2468 static ArgMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
2469 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2470 static ArgMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2471 static ArgMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2472 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2473 static ArgMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2474 static ArgMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
2475 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2476 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2477 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2478 static ArgMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2479 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2480 static ArgMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2481 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2482 static ArgMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2483 static ArgMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2484 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
2485 ::llvm::LogicalResult verifyInvariantsImpl();
2486 ::llvm::LogicalResult verifyInvariants();
2487 ::llvm::LogicalResult verify();
2488 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
2489 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
2490 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
2491 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
2492 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
2493private:
2494 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
2495 return getAttributeNameForIndex(name: (*this)->getName(), index);
2496 }
2497
2498 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
2499 assert(index < 2 && "invalid attribute index");
2500 assert(name.getStringRef() == getOperationName() && "invalid operation name");
2501 assert(name.isRegistered() && "Operation isn't registered, missing a "
2502 "dependent dialect loading?");
2503 return name.getAttributeNames()[index];
2504 }
2505
2506 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
2507public:
2508 static ::llvm::LogicalResult
2509 inferReturnTypeComponents(::mlir::MLIRContext *context,
2510 std::optional<::mlir::Location> location,
2511 Adaptor adaptor,
2512 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
2513
2514};
2515
2516} // namespace mlir::tosa
2517MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ArgMinOp)
2518MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ArgMinOpGenericAdaptorBase::Properties)
2519
2520namespace mlir::tosa {
2521
2522
2523//===----------------------------------------------------------------------===//
2524// mlir::tosa::ArithmeticRightShiftOp declarations
2525//===----------------------------------------------------------------------===//
2526
2527namespace detail {
2528
2529class ArithmeticRightShiftOpGenericAdaptorBase {
2530public:
2531 struct Properties {
2532 using roundTy = ::mlir::BoolAttr;
2533 roundTy round;
2534
2535 auto getRound() const {
2536 auto &propStorage = this->round;
2537 return ::llvm::cast<::mlir::BoolAttr>(Val: propStorage);
2538 }
2539 void setRound(const ::mlir::BoolAttr &propValue) {
2540 this->round = propValue;
2541 }
2542 bool operator==(const Properties &rhs) const {
2543 return
2544 rhs.round == this->round &&
2545 true;
2546 }
2547 bool operator!=(const Properties &rhs) const {
2548 return !(*this == rhs);
2549 }
2550 };
2551protected:
2552 ::mlir::DictionaryAttr odsAttrs;
2553 ::std::optional<::mlir::OperationName> odsOpName;
2554 Properties properties;
2555 ::mlir::RegionRange odsRegions;
2556public:
2557 ArithmeticRightShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
2558 odsOpName.emplace(args: "tosa.arithmetic_right_shift", args: odsAttrs.getContext());
2559 }
2560
2561 ArithmeticRightShiftOpGenericAdaptorBase(ArithmeticRightShiftOp op);
2562
2563 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
2564 return {index, 1};
2565 }
2566
2567 const Properties &getProperties() {
2568 return properties;
2569 }
2570
2571 ::mlir::DictionaryAttr getAttributes() {
2572 return odsAttrs;
2573 }
2574
2575 ::mlir::BoolAttr getRoundAttr() {
2576 auto attr = ::llvm::cast<::mlir::BoolAttr>(Val: getProperties().round);
2577 return attr;
2578 }
2579
2580 bool getRound();
2581};
2582
2583} // namespace detail
2584template <typename RangeT>
2585class ArithmeticRightShiftOpGenericAdaptor : public detail::ArithmeticRightShiftOpGenericAdaptorBase {
2586 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
2587 using Base = detail::ArithmeticRightShiftOpGenericAdaptorBase;
2588 static constexpr int odsIndex_input1 = 0;
2589 static constexpr int odsIndex_input2 = 1;
2590public:
2591 ArithmeticRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
2592
2593 ArithmeticRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ArithmeticRightShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
2594
2595 ArithmeticRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ArithmeticRightShiftOpGenericAdaptor(values, attrs, Properties{}, {}) {}
2596
2597 ArithmeticRightShiftOpGenericAdaptor(RangeT values, const ArithmeticRightShiftOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
2598
2599 template <typename LateInst = ArithmeticRightShiftOp, typename = std::enable_if_t<std::is_same_v<LateInst, ArithmeticRightShiftOp>>>
2600 ArithmeticRightShiftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
2601
2602 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
2603 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
2604 }
2605
2606 RangeT getODSOperands(unsigned index) {
2607 auto valueRange = getODSOperandIndexAndLength(index);
2608 return {std::next(odsOperands.begin(), valueRange.first),
2609 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2610 }
2611
2612 ValueT getInput1() {
2613 return (*getODSOperands(index: 0).begin());
2614 }
2615
2616 ValueT getInput2() {
2617 return (*getODSOperands(index: 1).begin());
2618 }
2619
2620 RangeT getOperands() {
2621 return odsOperands;
2622 }
2623
2624private:
2625 RangeT odsOperands;
2626};
2627class ArithmeticRightShiftOpAdaptor : public ArithmeticRightShiftOpGenericAdaptor<::mlir::ValueRange> {
2628public:
2629 using ArithmeticRightShiftOpGenericAdaptor::ArithmeticRightShiftOpGenericAdaptor;
2630 ArithmeticRightShiftOpAdaptor(ArithmeticRightShiftOp op);
2631
2632 ::llvm::LogicalResult verify(::mlir::Location loc);
2633};
2634class ArithmeticRightShiftOp : public ::mlir::Op<ArithmeticRightShiftOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
2635public:
2636 using Op::Op;
2637 using Op::print;
2638 using Adaptor = ArithmeticRightShiftOpAdaptor;
2639 template <typename RangeT>
2640 using GenericAdaptor = ArithmeticRightShiftOpGenericAdaptor<RangeT>;
2641 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
2642 static constexpr int odsIndex_input1 = 0;
2643 static constexpr int odsIndex_input2 = 1;
2644 static constexpr int odsIndex_output = 0;
2645 using Properties = FoldAdaptor::Properties;
2646 using ::mlir::InferShapedTypeOpInterface::Trait<ArithmeticRightShiftOp>::reifyReturnTypeShapes;
2647 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
2648 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("round")};
2649 return ::llvm::ArrayRef(attrNames);
2650 }
2651
2652 ::mlir::StringAttr getRoundAttrName() {
2653 return getAttributeNameForIndex(index: 0);
2654 }
2655
2656 static ::mlir::StringAttr getRoundAttrName(::mlir::OperationName name) {
2657 return getAttributeNameForIndex(name, index: 0);
2658 }
2659
2660 static constexpr ::llvm::StringLiteral getOperationName() {
2661 return ::llvm::StringLiteral("tosa.arithmetic_right_shift");
2662 }
2663
2664 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
2665 return {index, 1};
2666 }
2667
2668 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
2669 auto [start, length] = getODSOperandIndexAndLength(index);
2670 return getOperation()->getOperands().slice(n: start, m: length);
2671 }
2672
2673 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
2674 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
2675 }
2676
2677 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
2678 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
2679 }
2680
2681 ::mlir::OpOperand &getInput1Mutable() {
2682 auto range = getODSOperandIndexAndLength(index: 0);
2683 return getOperation()->getOpOperand(idx: range.first);
2684 }
2685
2686 ::mlir::OpOperand &getInput2Mutable() {
2687 auto range = getODSOperandIndexAndLength(index: 1);
2688 return getOperation()->getOpOperand(idx: range.first);
2689 }
2690
2691 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
2692 return {index, 1};
2693 }
2694
2695 ::mlir::Operation::result_range getODSResults(unsigned index) {
2696 auto valueRange = getODSResultIndexAndLength(index);
2697 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
2698 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
2699 }
2700
2701 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
2702 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
2703 }
2704
2705 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
2706 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
2707 static llvm::hash_code computePropertiesHash(const Properties &prop);
2708 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
2709 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
2710 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
2711 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
2712 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
2713 void writeProperties(::mlir::DialectBytecodeWriter &writer);
2714 ::mlir::BoolAttr getRoundAttr() {
2715 return ::llvm::cast<::mlir::BoolAttr>(Val&: getProperties().round);
2716 }
2717
2718 bool getRound();
2719 void setRoundAttr(::mlir::BoolAttr attr) {
2720 getProperties().round = attr;
2721 }
2722
2723 void setRound(bool attrValue);
2724 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr round);
2725 static ArithmeticRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr round);
2726 static ArithmeticRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr round);
2727 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr round);
2728 static ArithmeticRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr round);
2729 static ArithmeticRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr round);
2730 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, bool round);
2731 static ArithmeticRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, bool round);
2732 static ArithmeticRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, bool round);
2733 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, bool round);
2734 static ArithmeticRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, bool round);
2735 static ArithmeticRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, bool round);
2736 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2737 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2738 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2739 static ArithmeticRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2740 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2741 static ArithmeticRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2742 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2743 static ArithmeticRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2744 static ArithmeticRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2745 ::llvm::LogicalResult verifyInvariantsImpl();
2746 ::llvm::LogicalResult verifyInvariants();
2747 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
2748 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
2749 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
2750 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
2751private:
2752 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
2753 return getAttributeNameForIndex(name: (*this)->getName(), index);
2754 }
2755
2756 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
2757 assert(index < 1 && "invalid attribute index");
2758 assert(name.getStringRef() == getOperationName() && "invalid operation name");
2759 assert(name.isRegistered() && "Operation isn't registered, missing a "
2760 "dependent dialect loading?");
2761 return name.getAttributeNames()[index];
2762 }
2763
2764 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
2765public:
2766};
2767
2768} // namespace mlir::tosa
2769MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ArithmeticRightShiftOp)
2770MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ArithmeticRightShiftOpGenericAdaptorBase::Properties)
2771
2772namespace mlir::tosa {
2773
2774
2775//===----------------------------------------------------------------------===//
2776// mlir::tosa::AssertEqualShapeOp declarations
2777//===----------------------------------------------------------------------===//
2778
2779namespace detail {
2780
2781class AssertEqualShapeOpGenericAdaptorBase {
2782public:
2783 struct Properties {
2784 using allow_broadcastTy = ::mlir::BoolAttr;
2785 allow_broadcastTy allow_broadcast;
2786
2787 auto getAllowBroadcast() const {
2788 auto &propStorage = this->allow_broadcast;
2789 return ::llvm::cast<::mlir::BoolAttr>(Val: propStorage);
2790 }
2791 void setAllowBroadcast(const ::mlir::BoolAttr &propValue) {
2792 this->allow_broadcast = propValue;
2793 }
2794 bool operator==(const Properties &rhs) const {
2795 return
2796 rhs.allow_broadcast == this->allow_broadcast &&
2797 true;
2798 }
2799 bool operator!=(const Properties &rhs) const {
2800 return !(*this == rhs);
2801 }
2802 };
2803protected:
2804 ::mlir::DictionaryAttr odsAttrs;
2805 ::std::optional<::mlir::OperationName> odsOpName;
2806 Properties properties;
2807 ::mlir::RegionRange odsRegions;
2808public:
2809 AssertEqualShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
2810 odsOpName.emplace(args: "tosa.assert_equal_shape", args: odsAttrs.getContext());
2811 }
2812
2813 AssertEqualShapeOpGenericAdaptorBase(AssertEqualShapeOp op);
2814
2815 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
2816 return {index, 1};
2817 }
2818
2819 const Properties &getProperties() {
2820 return properties;
2821 }
2822
2823 ::mlir::DictionaryAttr getAttributes() {
2824 return odsAttrs;
2825 }
2826
2827 ::mlir::BoolAttr getAllowBroadcastAttr() {
2828 auto attr = ::llvm::cast<::mlir::BoolAttr>(Val: getProperties().allow_broadcast);
2829 return attr;
2830 }
2831
2832 bool getAllowBroadcast();
2833};
2834
2835} // namespace detail
2836template <typename RangeT>
2837class AssertEqualShapeOpGenericAdaptor : public detail::AssertEqualShapeOpGenericAdaptorBase {
2838 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
2839 using Base = detail::AssertEqualShapeOpGenericAdaptorBase;
2840 static constexpr int odsIndex_input1 = 0;
2841 static constexpr int odsIndex_input2 = 1;
2842public:
2843 AssertEqualShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
2844
2845 AssertEqualShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AssertEqualShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
2846
2847 AssertEqualShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AssertEqualShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
2848
2849 AssertEqualShapeOpGenericAdaptor(RangeT values, const AssertEqualShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
2850
2851 template <typename LateInst = AssertEqualShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, AssertEqualShapeOp>>>
2852 AssertEqualShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
2853
2854 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
2855 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
2856 }
2857
2858 RangeT getODSOperands(unsigned index) {
2859 auto valueRange = getODSOperandIndexAndLength(index);
2860 return {std::next(odsOperands.begin(), valueRange.first),
2861 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2862 }
2863
2864 ValueT getInput1() {
2865 return (*getODSOperands(index: 0).begin());
2866 }
2867
2868 ValueT getInput2() {
2869 return (*getODSOperands(index: 1).begin());
2870 }
2871
2872 RangeT getOperands() {
2873 return odsOperands;
2874 }
2875
2876private:
2877 RangeT odsOperands;
2878};
2879class AssertEqualShapeOpAdaptor : public AssertEqualShapeOpGenericAdaptor<::mlir::ValueRange> {
2880public:
2881 using AssertEqualShapeOpGenericAdaptor::AssertEqualShapeOpGenericAdaptor;
2882 AssertEqualShapeOpAdaptor(AssertEqualShapeOp op);
2883
2884 ::llvm::LogicalResult verify(::mlir::Location loc);
2885};
2886class AssertEqualShapeOp : public ::mlir::Op<AssertEqualShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
2887public:
2888 using Op::Op;
2889 using Op::print;
2890 using Adaptor = AssertEqualShapeOpAdaptor;
2891 template <typename RangeT>
2892 using GenericAdaptor = AssertEqualShapeOpGenericAdaptor<RangeT>;
2893 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
2894 static constexpr int odsIndex_input1 = 0;
2895 static constexpr int odsIndex_input2 = 1;
2896 using Properties = FoldAdaptor::Properties;
2897 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
2898 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("allow_broadcast")};
2899 return ::llvm::ArrayRef(attrNames);
2900 }
2901
2902 ::mlir::StringAttr getAllowBroadcastAttrName() {
2903 return getAttributeNameForIndex(index: 0);
2904 }
2905
2906 static ::mlir::StringAttr getAllowBroadcastAttrName(::mlir::OperationName name) {
2907 return getAttributeNameForIndex(name, index: 0);
2908 }
2909
2910 static constexpr ::llvm::StringLiteral getOperationName() {
2911 return ::llvm::StringLiteral("tosa.assert_equal_shape");
2912 }
2913
2914 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
2915 return {index, 1};
2916 }
2917
2918 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
2919 auto [start, length] = getODSOperandIndexAndLength(index);
2920 return getOperation()->getOperands().slice(n: start, m: length);
2921 }
2922
2923 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
2924 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
2925 }
2926
2927 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
2928 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
2929 }
2930
2931 ::mlir::OpOperand &getInput1Mutable() {
2932 auto range = getODSOperandIndexAndLength(index: 0);
2933 return getOperation()->getOpOperand(idx: range.first);
2934 }
2935
2936 ::mlir::OpOperand &getInput2Mutable() {
2937 auto range = getODSOperandIndexAndLength(index: 1);
2938 return getOperation()->getOpOperand(idx: range.first);
2939 }
2940
2941 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
2942 return {index, 1};
2943 }
2944
2945 ::mlir::Operation::result_range getODSResults(unsigned index) {
2946 auto valueRange = getODSResultIndexAndLength(index);
2947 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
2948 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
2949 }
2950
2951 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
2952 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
2953 static llvm::hash_code computePropertiesHash(const Properties &prop);
2954 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
2955 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
2956 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
2957 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
2958 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
2959 void writeProperties(::mlir::DialectBytecodeWriter &writer);
2960 ::mlir::BoolAttr getAllowBroadcastAttr() {
2961 return ::llvm::cast<::mlir::BoolAttr>(Val&: getProperties().allow_broadcast);
2962 }
2963
2964 bool getAllowBroadcast();
2965 void setAllowBroadcastAttr(::mlir::BoolAttr attr) {
2966 getProperties().allow_broadcast = attr;
2967 }
2968
2969 void setAllowBroadcast(bool attrValue);
2970 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr allow_broadcast);
2971 static AssertEqualShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr allow_broadcast);
2972 static AssertEqualShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr allow_broadcast);
2973 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr allow_broadcast);
2974 static AssertEqualShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr allow_broadcast);
2975 static AssertEqualShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::BoolAttr allow_broadcast);
2976 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1, ::mlir::Value input2, bool allow_broadcast);
2977 static AssertEqualShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1, ::mlir::Value input2, bool allow_broadcast);
2978 static AssertEqualShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1, ::mlir::Value input2, bool allow_broadcast);
2979 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, bool allow_broadcast);
2980 static AssertEqualShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, bool allow_broadcast);
2981 static AssertEqualShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, bool allow_broadcast);
2982 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2983 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2984 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2985 static AssertEqualShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2986 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
2987 static AssertEqualShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
2988 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2989 static AssertEqualShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2990 static AssertEqualShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
2991 ::llvm::LogicalResult verifyInvariantsImpl();
2992 ::llvm::LogicalResult verifyInvariants();
2993 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
2994 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
2995private:
2996 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
2997 return getAttributeNameForIndex(name: (*this)->getName(), index);
2998 }
2999
3000 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
3001 assert(index < 1 && "invalid attribute index");
3002 assert(name.getStringRef() == getOperationName() && "invalid operation name");
3003 assert(name.isRegistered() && "Operation isn't registered, missing a "
3004 "dependent dialect loading?");
3005 return name.getAttributeNames()[index];
3006 }
3007
3008 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
3009public:
3010};
3011
3012} // namespace mlir::tosa
3013MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::AssertEqualShapeOp)
3014MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::AssertEqualShapeOpGenericAdaptorBase::Properties)
3015
3016namespace mlir::tosa {
3017
3018
3019//===----------------------------------------------------------------------===//
3020// mlir::tosa::AvgPool2dAdaptiveOp declarations
3021//===----------------------------------------------------------------------===//
3022
3023namespace detail {
3024
3025class AvgPool2dAdaptiveOpGenericAdaptorBase {
3026public:
3027 struct Properties {
3028 using acc_typeTy = ::mlir::TypeAttr;
3029 acc_typeTy acc_type;
3030
3031 auto getAccType() const {
3032 auto &propStorage = this->acc_type;
3033 return ::llvm::cast<::mlir::TypeAttr>(Val: propStorage);
3034 }
3035 void setAccType(const ::mlir::TypeAttr &propValue) {
3036 this->acc_type = propValue;
3037 }
3038 bool operator==(const Properties &rhs) const {
3039 return
3040 rhs.acc_type == this->acc_type &&
3041 true;
3042 }
3043 bool operator!=(const Properties &rhs) const {
3044 return !(*this == rhs);
3045 }
3046 };
3047protected:
3048 ::mlir::DictionaryAttr odsAttrs;
3049 ::std::optional<::mlir::OperationName> odsOpName;
3050 Properties properties;
3051 ::mlir::RegionRange odsRegions;
3052public:
3053 AvgPool2dAdaptiveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
3054 odsOpName.emplace(args: "tosa.avg_pool2d_adaptive", args: odsAttrs.getContext());
3055 }
3056
3057 AvgPool2dAdaptiveOpGenericAdaptorBase(AvgPool2dAdaptiveOp op);
3058
3059 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
3060 return {index, 1};
3061 }
3062
3063 const Properties &getProperties() {
3064 return properties;
3065 }
3066
3067 ::mlir::DictionaryAttr getAttributes() {
3068 return odsAttrs;
3069 }
3070
3071 ::mlir::TypeAttr getAccTypeAttr() {
3072 auto attr = ::llvm::cast<::mlir::TypeAttr>(Val: getProperties().acc_type);
3073 return attr;
3074 }
3075
3076 ::mlir::Type getAccType();
3077};
3078
3079} // namespace detail
3080template <typename RangeT>
3081class AvgPool2dAdaptiveOpGenericAdaptor : public detail::AvgPool2dAdaptiveOpGenericAdaptorBase {
3082 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
3083 using Base = detail::AvgPool2dAdaptiveOpGenericAdaptorBase;
3084 static constexpr int odsIndex_input = 0;
3085 static constexpr int odsIndex_input_zp = 1;
3086 static constexpr int odsIndex_output_zp = 2;
3087 static constexpr int odsIndex_kernel = 3;
3088 static constexpr int odsIndex_stride = 4;
3089 static constexpr int odsIndex_pad = 5;
3090public:
3091 AvgPool2dAdaptiveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
3092
3093 AvgPool2dAdaptiveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AvgPool2dAdaptiveOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
3094
3095 AvgPool2dAdaptiveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AvgPool2dAdaptiveOpGenericAdaptor(values, attrs, Properties{}, {}) {}
3096
3097 AvgPool2dAdaptiveOpGenericAdaptor(RangeT values, const AvgPool2dAdaptiveOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
3098
3099 template <typename LateInst = AvgPool2dAdaptiveOp, typename = std::enable_if_t<std::is_same_v<LateInst, AvgPool2dAdaptiveOp>>>
3100 AvgPool2dAdaptiveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
3101
3102 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
3103 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
3104 }
3105
3106 RangeT getODSOperands(unsigned index) {
3107 auto valueRange = getODSOperandIndexAndLength(index);
3108 return {std::next(odsOperands.begin(), valueRange.first),
3109 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3110 }
3111
3112 ValueT getInput() {
3113 return (*getODSOperands(index: 0).begin());
3114 }
3115
3116 ValueT getInputZp() {
3117 return (*getODSOperands(index: 1).begin());
3118 }
3119
3120 ValueT getOutputZp() {
3121 return (*getODSOperands(index: 2).begin());
3122 }
3123
3124 ValueT getKernel() {
3125 return (*getODSOperands(index: 3).begin());
3126 }
3127
3128 ValueT getStride() {
3129 return (*getODSOperands(index: 4).begin());
3130 }
3131
3132 ValueT getPad() {
3133 return (*getODSOperands(index: 5).begin());
3134 }
3135
3136 RangeT getOperands() {
3137 return odsOperands;
3138 }
3139
3140private:
3141 RangeT odsOperands;
3142};
3143class AvgPool2dAdaptiveOpAdaptor : public AvgPool2dAdaptiveOpGenericAdaptor<::mlir::ValueRange> {
3144public:
3145 using AvgPool2dAdaptiveOpGenericAdaptor::AvgPool2dAdaptiveOpGenericAdaptor;
3146 AvgPool2dAdaptiveOpAdaptor(AvgPool2dAdaptiveOp op);
3147
3148 ::llvm::LogicalResult verify(::mlir::Location loc);
3149};
3150class AvgPool2dAdaptiveOp : public ::mlir::Op<AvgPool2dAdaptiveOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
3151public:
3152 using Op::Op;
3153 using Op::print;
3154 using Adaptor = AvgPool2dAdaptiveOpAdaptor;
3155 template <typename RangeT>
3156 using GenericAdaptor = AvgPool2dAdaptiveOpGenericAdaptor<RangeT>;
3157 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
3158 static constexpr int odsIndex_input = 0;
3159 static constexpr int odsIndex_input_zp = 1;
3160 static constexpr int odsIndex_output_zp = 2;
3161 static constexpr int odsIndex_kernel = 3;
3162 static constexpr int odsIndex_stride = 4;
3163 static constexpr int odsIndex_pad = 5;
3164 static constexpr int odsIndex_output = 0;
3165 using Properties = FoldAdaptor::Properties;
3166 using ::mlir::InferShapedTypeOpInterface::Trait<AvgPool2dAdaptiveOp>::reifyReturnTypeShapes;
3167 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
3168 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acc_type")};
3169 return ::llvm::ArrayRef(attrNames);
3170 }
3171
3172 ::mlir::StringAttr getAccTypeAttrName() {
3173 return getAttributeNameForIndex(index: 0);
3174 }
3175
3176 static ::mlir::StringAttr getAccTypeAttrName(::mlir::OperationName name) {
3177 return getAttributeNameForIndex(name, index: 0);
3178 }
3179
3180 static constexpr ::llvm::StringLiteral getOperationName() {
3181 return ::llvm::StringLiteral("tosa.avg_pool2d_adaptive");
3182 }
3183
3184 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
3185 return {index, 1};
3186 }
3187
3188 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
3189 auto [start, length] = getODSOperandIndexAndLength(index);
3190 return getOperation()->getOperands().slice(n: start, m: length);
3191 }
3192
3193 ::mlir::TypedValue<::mlir::TensorType> getInput() {
3194 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
3195 }
3196
3197 ::mlir::TypedValue<::mlir::TensorType> getInputZp() {
3198 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
3199 }
3200
3201 ::mlir::TypedValue<::mlir::TensorType> getOutputZp() {
3202 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
3203 }
3204
3205 ::mlir::TypedValue<::mlir::Type> getKernel() {
3206 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 3).begin());
3207 }
3208
3209 ::mlir::TypedValue<::mlir::Type> getStride() {
3210 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 4).begin());
3211 }
3212
3213 ::mlir::TypedValue<::mlir::Type> getPad() {
3214 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 5).begin());
3215 }
3216
3217 ::mlir::OpOperand &getInputMutable() {
3218 auto range = getODSOperandIndexAndLength(index: 0);
3219 return getOperation()->getOpOperand(idx: range.first);
3220 }
3221
3222 ::mlir::OpOperand &getInputZpMutable() {
3223 auto range = getODSOperandIndexAndLength(index: 1);
3224 return getOperation()->getOpOperand(idx: range.first);
3225 }
3226
3227 ::mlir::OpOperand &getOutputZpMutable() {
3228 auto range = getODSOperandIndexAndLength(index: 2);
3229 return getOperation()->getOpOperand(idx: range.first);
3230 }
3231
3232 ::mlir::OpOperand &getKernelMutable() {
3233 auto range = getODSOperandIndexAndLength(index: 3);
3234 return getOperation()->getOpOperand(idx: range.first);
3235 }
3236
3237 ::mlir::OpOperand &getStrideMutable() {
3238 auto range = getODSOperandIndexAndLength(index: 4);
3239 return getOperation()->getOpOperand(idx: range.first);
3240 }
3241
3242 ::mlir::OpOperand &getPadMutable() {
3243 auto range = getODSOperandIndexAndLength(index: 5);
3244 return getOperation()->getOpOperand(idx: range.first);
3245 }
3246
3247 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
3248 return {index, 1};
3249 }
3250
3251 ::mlir::Operation::result_range getODSResults(unsigned index) {
3252 auto valueRange = getODSResultIndexAndLength(index);
3253 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
3254 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
3255 }
3256
3257 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
3258 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
3259 }
3260
3261 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
3262 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
3263 static llvm::hash_code computePropertiesHash(const Properties &prop);
3264 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
3265 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
3266 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
3267 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
3268 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
3269 void writeProperties(::mlir::DialectBytecodeWriter &writer);
3270 ::mlir::TypeAttr getAccTypeAttr() {
3271 return ::llvm::cast<::mlir::TypeAttr>(Val&: getProperties().acc_type);
3272 }
3273
3274 ::mlir::Type getAccType();
3275 void setAccTypeAttr(::mlir::TypeAttr attr) {
3276 getProperties().acc_type = attr;
3277 }
3278
3279 void setAccType(::mlir::Type attrValue);
3280 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputType, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3281 static AvgPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type outputType, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3282 static AvgPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type outputType, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3283 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::TypeAttr acc_type);
3284 static AvgPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::TypeAttr acc_type);
3285 static AvgPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::TypeAttr acc_type);
3286 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::TypeAttr acc_type);
3287 static AvgPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::TypeAttr acc_type);
3288 static AvgPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::TypeAttr acc_type);
3289 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::Type acc_type);
3290 static AvgPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::Type acc_type);
3291 static AvgPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::Type acc_type);
3292 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::Type acc_type);
3293 static AvgPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::Type acc_type);
3294 static AvgPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::Type acc_type);
3295 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
3296 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3297 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
3298 static AvgPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3299 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
3300 static AvgPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3301 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3302 static AvgPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3303 static AvgPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3304 ::llvm::LogicalResult verifyInvariantsImpl();
3305 ::llvm::LogicalResult verifyInvariants();
3306 ::llvm::LogicalResult verify();
3307 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
3308 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
3309 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
3310 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
3311 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
3312private:
3313 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
3314 return getAttributeNameForIndex(name: (*this)->getName(), index);
3315 }
3316
3317 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
3318 assert(index < 1 && "invalid attribute index");
3319 assert(name.getStringRef() == getOperationName() && "invalid operation name");
3320 assert(name.isRegistered() && "Operation isn't registered, missing a "
3321 "dependent dialect loading?");
3322 return name.getAttributeNames()[index];
3323 }
3324
3325 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
3326public:
3327 static ::llvm::LogicalResult
3328 inferReturnTypeComponents(::mlir::MLIRContext *context,
3329 std::optional<::mlir::Location> location,
3330 Adaptor adaptor,
3331 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
3332
3333
3334 FailureOr<int64_t> getInputZeroPoint();
3335 FailureOr<int64_t> getOutputZeroPoint();
3336 LogicalResult verifyInputZeroPoint(int64_t zp);
3337 LogicalResult verifyOutputZeroPoint(int64_t zp);
3338};
3339
3340} // namespace mlir::tosa
3341MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::AvgPool2dAdaptiveOp)
3342MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::AvgPool2dAdaptiveOpGenericAdaptorBase::Properties)
3343
3344namespace mlir::tosa {
3345
3346
3347//===----------------------------------------------------------------------===//
3348// mlir::tosa::AvgPool2dOp declarations
3349//===----------------------------------------------------------------------===//
3350
3351namespace detail {
3352
3353class AvgPool2dOpGenericAdaptorBase {
3354public:
3355 struct Properties {
3356 using acc_typeTy = ::mlir::TypeAttr;
3357 acc_typeTy acc_type;
3358
3359 auto getAccType() const {
3360 auto &propStorage = this->acc_type;
3361 return ::llvm::cast<::mlir::TypeAttr>(Val: propStorage);
3362 }
3363 void setAccType(const ::mlir::TypeAttr &propValue) {
3364 this->acc_type = propValue;
3365 }
3366 using kernelTy = ::mlir::DenseI64ArrayAttr;
3367 kernelTy kernel;
3368
3369 auto getKernel() const {
3370 auto &propStorage = this->kernel;
3371 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
3372 }
3373 void setKernel(const ::mlir::DenseI64ArrayAttr &propValue) {
3374 this->kernel = propValue;
3375 }
3376 using padTy = ::mlir::DenseI64ArrayAttr;
3377 padTy pad;
3378
3379 auto getPad() const {
3380 auto &propStorage = this->pad;
3381 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
3382 }
3383 void setPad(const ::mlir::DenseI64ArrayAttr &propValue) {
3384 this->pad = propValue;
3385 }
3386 using strideTy = ::mlir::DenseI64ArrayAttr;
3387 strideTy stride;
3388
3389 auto getStride() const {
3390 auto &propStorage = this->stride;
3391 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
3392 }
3393 void setStride(const ::mlir::DenseI64ArrayAttr &propValue) {
3394 this->stride = propValue;
3395 }
3396 bool operator==(const Properties &rhs) const {
3397 return
3398 rhs.acc_type == this->acc_type &&
3399 rhs.kernel == this->kernel &&
3400 rhs.pad == this->pad &&
3401 rhs.stride == this->stride &&
3402 true;
3403 }
3404 bool operator!=(const Properties &rhs) const {
3405 return !(*this == rhs);
3406 }
3407 };
3408protected:
3409 ::mlir::DictionaryAttr odsAttrs;
3410 ::std::optional<::mlir::OperationName> odsOpName;
3411 Properties properties;
3412 ::mlir::RegionRange odsRegions;
3413public:
3414 AvgPool2dOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
3415 odsOpName.emplace(args: "tosa.avg_pool2d", args: odsAttrs.getContext());
3416 }
3417
3418 AvgPool2dOpGenericAdaptorBase(AvgPool2dOp op);
3419
3420 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
3421 return {index, 1};
3422 }
3423
3424 const Properties &getProperties() {
3425 return properties;
3426 }
3427
3428 ::mlir::DictionaryAttr getAttributes() {
3429 return odsAttrs;
3430 }
3431
3432 ::mlir::DenseI64ArrayAttr getKernelAttr() {
3433 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().kernel);
3434 return attr;
3435 }
3436
3437 ::llvm::ArrayRef<int64_t> getKernel();
3438 ::mlir::DenseI64ArrayAttr getStrideAttr() {
3439 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().stride);
3440 return attr;
3441 }
3442
3443 ::llvm::ArrayRef<int64_t> getStride();
3444 ::mlir::DenseI64ArrayAttr getPadAttr() {
3445 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().pad);
3446 return attr;
3447 }
3448
3449 ::llvm::ArrayRef<int64_t> getPad();
3450 ::mlir::TypeAttr getAccTypeAttr() {
3451 auto attr = ::llvm::cast<::mlir::TypeAttr>(Val: getProperties().acc_type);
3452 return attr;
3453 }
3454
3455 ::mlir::Type getAccType();
3456};
3457
3458} // namespace detail
3459template <typename RangeT>
3460class AvgPool2dOpGenericAdaptor : public detail::AvgPool2dOpGenericAdaptorBase {
3461 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
3462 using Base = detail::AvgPool2dOpGenericAdaptorBase;
3463 static constexpr int odsIndex_input = 0;
3464 static constexpr int odsIndex_input_zp = 1;
3465 static constexpr int odsIndex_output_zp = 2;
3466public:
3467 AvgPool2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
3468
3469 AvgPool2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AvgPool2dOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
3470
3471 AvgPool2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AvgPool2dOpGenericAdaptor(values, attrs, Properties{}, {}) {}
3472
3473 AvgPool2dOpGenericAdaptor(RangeT values, const AvgPool2dOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
3474
3475 template <typename LateInst = AvgPool2dOp, typename = std::enable_if_t<std::is_same_v<LateInst, AvgPool2dOp>>>
3476 AvgPool2dOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
3477
3478 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
3479 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
3480 }
3481
3482 RangeT getODSOperands(unsigned index) {
3483 auto valueRange = getODSOperandIndexAndLength(index);
3484 return {std::next(odsOperands.begin(), valueRange.first),
3485 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3486 }
3487
3488 ValueT getInput() {
3489 return (*getODSOperands(index: 0).begin());
3490 }
3491
3492 ValueT getInputZp() {
3493 return (*getODSOperands(index: 1).begin());
3494 }
3495
3496 ValueT getOutputZp() {
3497 return (*getODSOperands(index: 2).begin());
3498 }
3499
3500 RangeT getOperands() {
3501 return odsOperands;
3502 }
3503
3504private:
3505 RangeT odsOperands;
3506};
3507class AvgPool2dOpAdaptor : public AvgPool2dOpGenericAdaptor<::mlir::ValueRange> {
3508public:
3509 using AvgPool2dOpGenericAdaptor::AvgPool2dOpGenericAdaptor;
3510 AvgPool2dOpAdaptor(AvgPool2dOp op);
3511
3512 ::llvm::LogicalResult verify(::mlir::Location loc);
3513};
3514class AvgPool2dOp : public ::mlir::Op<AvgPool2dOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
3515public:
3516 using Op::Op;
3517 using Op::print;
3518 using Adaptor = AvgPool2dOpAdaptor;
3519 template <typename RangeT>
3520 using GenericAdaptor = AvgPool2dOpGenericAdaptor<RangeT>;
3521 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
3522 static constexpr int odsIndex_input = 0;
3523 static constexpr int odsIndex_input_zp = 1;
3524 static constexpr int odsIndex_output_zp = 2;
3525 static constexpr int odsIndex_output = 0;
3526 using Properties = FoldAdaptor::Properties;
3527 using ::mlir::InferShapedTypeOpInterface::Trait<AvgPool2dOp>::reifyReturnTypeShapes;
3528 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
3529 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acc_type"), ::llvm::StringRef("kernel"), ::llvm::StringRef("pad"), ::llvm::StringRef("stride")};
3530 return ::llvm::ArrayRef(attrNames);
3531 }
3532
3533 ::mlir::StringAttr getAccTypeAttrName() {
3534 return getAttributeNameForIndex(index: 0);
3535 }
3536
3537 static ::mlir::StringAttr getAccTypeAttrName(::mlir::OperationName name) {
3538 return getAttributeNameForIndex(name, index: 0);
3539 }
3540
3541 ::mlir::StringAttr getKernelAttrName() {
3542 return getAttributeNameForIndex(index: 1);
3543 }
3544
3545 static ::mlir::StringAttr getKernelAttrName(::mlir::OperationName name) {
3546 return getAttributeNameForIndex(name, index: 1);
3547 }
3548
3549 ::mlir::StringAttr getPadAttrName() {
3550 return getAttributeNameForIndex(index: 2);
3551 }
3552
3553 static ::mlir::StringAttr getPadAttrName(::mlir::OperationName name) {
3554 return getAttributeNameForIndex(name, index: 2);
3555 }
3556
3557 ::mlir::StringAttr getStrideAttrName() {
3558 return getAttributeNameForIndex(index: 3);
3559 }
3560
3561 static ::mlir::StringAttr getStrideAttrName(::mlir::OperationName name) {
3562 return getAttributeNameForIndex(name, index: 3);
3563 }
3564
3565 static constexpr ::llvm::StringLiteral getOperationName() {
3566 return ::llvm::StringLiteral("tosa.avg_pool2d");
3567 }
3568
3569 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
3570 return {index, 1};
3571 }
3572
3573 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
3574 auto [start, length] = getODSOperandIndexAndLength(index);
3575 return getOperation()->getOperands().slice(n: start, m: length);
3576 }
3577
3578 ::mlir::TypedValue<::mlir::TensorType> getInput() {
3579 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
3580 }
3581
3582 ::mlir::TypedValue<::mlir::TensorType> getInputZp() {
3583 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
3584 }
3585
3586 ::mlir::TypedValue<::mlir::TensorType> getOutputZp() {
3587 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
3588 }
3589
3590 ::mlir::OpOperand &getInputMutable() {
3591 auto range = getODSOperandIndexAndLength(index: 0);
3592 return getOperation()->getOpOperand(idx: range.first);
3593 }
3594
3595 ::mlir::OpOperand &getInputZpMutable() {
3596 auto range = getODSOperandIndexAndLength(index: 1);
3597 return getOperation()->getOpOperand(idx: range.first);
3598 }
3599
3600 ::mlir::OpOperand &getOutputZpMutable() {
3601 auto range = getODSOperandIndexAndLength(index: 2);
3602 return getOperation()->getOpOperand(idx: range.first);
3603 }
3604
3605 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
3606 return {index, 1};
3607 }
3608
3609 ::mlir::Operation::result_range getODSResults(unsigned index) {
3610 auto valueRange = getODSResultIndexAndLength(index);
3611 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
3612 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
3613 }
3614
3615 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
3616 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
3617 }
3618
3619 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
3620 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
3621 static llvm::hash_code computePropertiesHash(const Properties &prop);
3622 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
3623 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
3624 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
3625 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
3626 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
3627 void writeProperties(::mlir::DialectBytecodeWriter &writer);
3628 ::mlir::DenseI64ArrayAttr getKernelAttr() {
3629 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().kernel);
3630 }
3631
3632 ::llvm::ArrayRef<int64_t> getKernel();
3633 ::mlir::DenseI64ArrayAttr getStrideAttr() {
3634 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().stride);
3635 }
3636
3637 ::llvm::ArrayRef<int64_t> getStride();
3638 ::mlir::DenseI64ArrayAttr getPadAttr() {
3639 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().pad);
3640 }
3641
3642 ::llvm::ArrayRef<int64_t> getPad();
3643 ::mlir::TypeAttr getAccTypeAttr() {
3644 return ::llvm::cast<::mlir::TypeAttr>(Val&: getProperties().acc_type);
3645 }
3646
3647 ::mlir::Type getAccType();
3648 void setKernelAttr(::mlir::DenseI64ArrayAttr attr) {
3649 getProperties().kernel = attr;
3650 }
3651
3652 void setKernel(::llvm::ArrayRef<int64_t> attrValue);
3653 void setStrideAttr(::mlir::DenseI64ArrayAttr attr) {
3654 getProperties().stride = attr;
3655 }
3656
3657 void setStride(::llvm::ArrayRef<int64_t> attrValue);
3658 void setPadAttr(::mlir::DenseI64ArrayAttr attr) {
3659 getProperties().pad = attr;
3660 }
3661
3662 void setPad(::llvm::ArrayRef<int64_t> attrValue);
3663 void setAccTypeAttr(::mlir::TypeAttr attr) {
3664 getProperties().acc_type = attr;
3665 }
3666
3667 void setAccType(::mlir::Type attrValue);
3668 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputType, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3669 static AvgPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type outputType, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3670 static AvgPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type outputType, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3671 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3672 static AvgPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3673 static AvgPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3674 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3675 static AvgPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3676 static AvgPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, ::mlir::TypeAttr acc_type);
3677 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::Type acc_type);
3678 static AvgPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::Type acc_type);
3679 static AvgPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::Type acc_type);
3680 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::Type acc_type);
3681 static AvgPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::Type acc_type);
3682 static AvgPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_zp, ::mlir::Value output_zp, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::Type acc_type);
3683 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
3684 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3685 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
3686 static AvgPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3687 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
3688 static AvgPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3689 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3690 static AvgPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3691 static AvgPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3692 ::llvm::LogicalResult verifyInvariantsImpl();
3693 ::llvm::LogicalResult verifyInvariants();
3694 ::llvm::LogicalResult verify();
3695 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
3696 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
3697 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
3698 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
3699 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
3700private:
3701 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
3702 return getAttributeNameForIndex(name: (*this)->getName(), index);
3703 }
3704
3705 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
3706 assert(index < 4 && "invalid attribute index");
3707 assert(name.getStringRef() == getOperationName() && "invalid operation name");
3708 assert(name.isRegistered() && "Operation isn't registered, missing a "
3709 "dependent dialect loading?");
3710 return name.getAttributeNames()[index];
3711 }
3712
3713 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
3714public:
3715 static ::llvm::LogicalResult
3716 inferReturnTypeComponents(::mlir::MLIRContext *context,
3717 std::optional<::mlir::Location> location,
3718 Adaptor adaptor,
3719 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
3720
3721
3722 FailureOr<int64_t> getInputZeroPoint();
3723 FailureOr<int64_t> getOutputZeroPoint();
3724 LogicalResult verifyInputZeroPoint(int64_t zp);
3725 LogicalResult verifyOutputZeroPoint(int64_t zp);
3726};
3727
3728} // namespace mlir::tosa
3729MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::AvgPool2dOp)
3730MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::AvgPool2dOpGenericAdaptorBase::Properties)
3731
3732namespace mlir::tosa {
3733
3734
3735//===----------------------------------------------------------------------===//
3736// mlir::tosa::BitwiseAndOp declarations
3737//===----------------------------------------------------------------------===//
3738
3739namespace detail {
3740
3741class BitwiseAndOpGenericAdaptorBase {
3742public:
3743 using Properties = ::mlir::EmptyProperties;
3744protected:
3745 ::mlir::DictionaryAttr odsAttrs;
3746 ::std::optional<::mlir::OperationName> odsOpName;
3747 Properties properties;
3748 ::mlir::RegionRange odsRegions;
3749public:
3750 BitwiseAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
3751 odsOpName.emplace(args: "tosa.bitwise_and", args: odsAttrs.getContext());
3752 }
3753
3754 BitwiseAndOpGenericAdaptorBase(BitwiseAndOp op);
3755
3756 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
3757 return {index, 1};
3758 }
3759
3760 const Properties &getProperties() {
3761 return properties;
3762 }
3763
3764 ::mlir::DictionaryAttr getAttributes() {
3765 return odsAttrs;
3766 }
3767
3768};
3769
3770} // namespace detail
3771template <typename RangeT>
3772class BitwiseAndOpGenericAdaptor : public detail::BitwiseAndOpGenericAdaptorBase {
3773 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
3774 using Base = detail::BitwiseAndOpGenericAdaptorBase;
3775 static constexpr int odsIndex_input1 = 0;
3776 static constexpr int odsIndex_input2 = 1;
3777public:
3778 BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
3779
3780 BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseAndOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
3781
3782 BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseAndOpGenericAdaptor(values, attrs, Properties{}, {}) {}
3783
3784 BitwiseAndOpGenericAdaptor(RangeT values, const BitwiseAndOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
3785
3786 template <typename LateInst = BitwiseAndOp, typename = std::enable_if_t<std::is_same_v<LateInst, BitwiseAndOp>>>
3787 BitwiseAndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
3788
3789 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
3790 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
3791 }
3792
3793 RangeT getODSOperands(unsigned index) {
3794 auto valueRange = getODSOperandIndexAndLength(index);
3795 return {std::next(odsOperands.begin(), valueRange.first),
3796 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3797 }
3798
3799 ValueT getInput1() {
3800 return (*getODSOperands(index: 0).begin());
3801 }
3802
3803 ValueT getInput2() {
3804 return (*getODSOperands(index: 1).begin());
3805 }
3806
3807 RangeT getOperands() {
3808 return odsOperands;
3809 }
3810
3811private:
3812 RangeT odsOperands;
3813};
3814class BitwiseAndOpAdaptor : public BitwiseAndOpGenericAdaptor<::mlir::ValueRange> {
3815public:
3816 using BitwiseAndOpGenericAdaptor::BitwiseAndOpGenericAdaptor;
3817 BitwiseAndOpAdaptor(BitwiseAndOp op);
3818
3819 ::llvm::LogicalResult verify(::mlir::Location loc);
3820};
3821class BitwiseAndOp : public ::mlir::Op<BitwiseAndOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
3822public:
3823 using Op::Op;
3824 using Op::print;
3825 using Adaptor = BitwiseAndOpAdaptor;
3826 template <typename RangeT>
3827 using GenericAdaptor = BitwiseAndOpGenericAdaptor<RangeT>;
3828 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
3829 static constexpr int odsIndex_input1 = 0;
3830 static constexpr int odsIndex_input2 = 1;
3831 static constexpr int odsIndex_output = 0;
3832 using Properties = FoldAdaptor::Properties;
3833 using ::mlir::InferShapedTypeOpInterface::Trait<BitwiseAndOp>::reifyReturnTypeShapes;
3834 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
3835 return {};
3836 }
3837
3838 static constexpr ::llvm::StringLiteral getOperationName() {
3839 return ::llvm::StringLiteral("tosa.bitwise_and");
3840 }
3841
3842 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
3843 return {index, 1};
3844 }
3845
3846 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
3847 auto [start, length] = getODSOperandIndexAndLength(index);
3848 return getOperation()->getOperands().slice(n: start, m: length);
3849 }
3850
3851 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
3852 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
3853 }
3854
3855 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
3856 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
3857 }
3858
3859 ::mlir::OpOperand &getInput1Mutable() {
3860 auto range = getODSOperandIndexAndLength(index: 0);
3861 return getOperation()->getOpOperand(idx: range.first);
3862 }
3863
3864 ::mlir::OpOperand &getInput2Mutable() {
3865 auto range = getODSOperandIndexAndLength(index: 1);
3866 return getOperation()->getOpOperand(idx: range.first);
3867 }
3868
3869 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
3870 return {index, 1};
3871 }
3872
3873 ::mlir::Operation::result_range getODSResults(unsigned index) {
3874 auto valueRange = getODSResultIndexAndLength(index);
3875 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
3876 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
3877 }
3878
3879 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
3880 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
3881 }
3882
3883 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
3884 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
3885 static llvm::hash_code computePropertiesHash(const Properties &prop);
3886 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
3887 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
3888 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
3889 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
3890 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
3891 static BitwiseAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
3892 static BitwiseAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
3893 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
3894 static BitwiseAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
3895 static BitwiseAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
3896 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3897 static BitwiseAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3898 static BitwiseAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
3899 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3900 static BitwiseAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3901 static BitwiseAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
3902 ::llvm::LogicalResult verifyInvariantsImpl();
3903 ::llvm::LogicalResult verifyInvariants();
3904 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
3905 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
3906 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
3907 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
3908public:
3909};
3910
3911} // namespace mlir::tosa
3912MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::BitwiseAndOp)
3913
3914namespace mlir::tosa {
3915
3916
3917//===----------------------------------------------------------------------===//
3918// mlir::tosa::BitwiseNotOp declarations
3919//===----------------------------------------------------------------------===//
3920
3921namespace detail {
3922
3923class BitwiseNotOpGenericAdaptorBase {
3924public:
3925 using Properties = ::mlir::EmptyProperties;
3926protected:
3927 ::mlir::DictionaryAttr odsAttrs;
3928 ::std::optional<::mlir::OperationName> odsOpName;
3929 Properties properties;
3930 ::mlir::RegionRange odsRegions;
3931public:
3932 BitwiseNotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
3933 odsOpName.emplace(args: "tosa.bitwise_not", args: odsAttrs.getContext());
3934 }
3935
3936 BitwiseNotOpGenericAdaptorBase(BitwiseNotOp op);
3937
3938 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
3939 return {index, 1};
3940 }
3941
3942 const Properties &getProperties() {
3943 return properties;
3944 }
3945
3946 ::mlir::DictionaryAttr getAttributes() {
3947 return odsAttrs;
3948 }
3949
3950};
3951
3952} // namespace detail
3953template <typename RangeT>
3954class BitwiseNotOpGenericAdaptor : public detail::BitwiseNotOpGenericAdaptorBase {
3955 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
3956 using Base = detail::BitwiseNotOpGenericAdaptorBase;
3957 static constexpr int odsIndex_input1 = 0;
3958public:
3959 BitwiseNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
3960
3961 BitwiseNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseNotOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
3962
3963 BitwiseNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseNotOpGenericAdaptor(values, attrs, Properties{}, {}) {}
3964
3965 BitwiseNotOpGenericAdaptor(RangeT values, const BitwiseNotOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
3966
3967 template <typename LateInst = BitwiseNotOp, typename = std::enable_if_t<std::is_same_v<LateInst, BitwiseNotOp>>>
3968 BitwiseNotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
3969
3970 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
3971 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
3972 }
3973
3974 RangeT getODSOperands(unsigned index) {
3975 auto valueRange = getODSOperandIndexAndLength(index);
3976 return {std::next(odsOperands.begin(), valueRange.first),
3977 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3978 }
3979
3980 ValueT getInput1() {
3981 return (*getODSOperands(index: 0).begin());
3982 }
3983
3984 RangeT getOperands() {
3985 return odsOperands;
3986 }
3987
3988private:
3989 RangeT odsOperands;
3990};
3991class BitwiseNotOpAdaptor : public BitwiseNotOpGenericAdaptor<::mlir::ValueRange> {
3992public:
3993 using BitwiseNotOpGenericAdaptor::BitwiseNotOpGenericAdaptor;
3994 BitwiseNotOpAdaptor(BitwiseNotOp op);
3995
3996 ::llvm::LogicalResult verify(::mlir::Location loc);
3997};
3998class BitwiseNotOp : public ::mlir::Op<BitwiseNotOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
3999public:
4000 using Op::Op;
4001 using Op::print;
4002 using Adaptor = BitwiseNotOpAdaptor;
4003 template <typename RangeT>
4004 using GenericAdaptor = BitwiseNotOpGenericAdaptor<RangeT>;
4005 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
4006 static constexpr int odsIndex_input1 = 0;
4007 static constexpr int odsIndex_output = 0;
4008 using Properties = FoldAdaptor::Properties;
4009 using ::mlir::InferShapedTypeOpInterface::Trait<BitwiseNotOp>::reifyReturnTypeShapes;
4010 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
4011 return {};
4012 }
4013
4014 static constexpr ::llvm::StringLiteral getOperationName() {
4015 return ::llvm::StringLiteral("tosa.bitwise_not");
4016 }
4017
4018 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4019 return {index, 1};
4020 }
4021
4022 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
4023 auto [start, length] = getODSOperandIndexAndLength(index);
4024 return getOperation()->getOperands().slice(n: start, m: length);
4025 }
4026
4027 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
4028 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
4029 }
4030
4031 ::mlir::OpOperand &getInput1Mutable() {
4032 auto range = getODSOperandIndexAndLength(index: 0);
4033 return getOperation()->getOpOperand(idx: range.first);
4034 }
4035
4036 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
4037 return {index, 1};
4038 }
4039
4040 ::mlir::Operation::result_range getODSResults(unsigned index) {
4041 auto valueRange = getODSResultIndexAndLength(index);
4042 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
4043 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
4044 }
4045
4046 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
4047 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
4048 }
4049
4050 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4051 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
4052 static llvm::hash_code computePropertiesHash(const Properties &prop);
4053 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
4054 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
4055 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
4056 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4057 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
4058 static BitwiseNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
4059 static BitwiseNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
4060 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
4061 static BitwiseNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
4062 static BitwiseNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
4063 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4064 static BitwiseNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4065 static BitwiseNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4066 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4067 static BitwiseNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4068 static BitwiseNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4069 ::llvm::LogicalResult verifyInvariantsImpl();
4070 ::llvm::LogicalResult verifyInvariants();
4071 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
4072 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
4073 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
4074 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
4075public:
4076};
4077
4078} // namespace mlir::tosa
4079MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::BitwiseNotOp)
4080
4081namespace mlir::tosa {
4082
4083
4084//===----------------------------------------------------------------------===//
4085// mlir::tosa::BitwiseOrOp declarations
4086//===----------------------------------------------------------------------===//
4087
4088namespace detail {
4089
4090class BitwiseOrOpGenericAdaptorBase {
4091public:
4092 using Properties = ::mlir::EmptyProperties;
4093protected:
4094 ::mlir::DictionaryAttr odsAttrs;
4095 ::std::optional<::mlir::OperationName> odsOpName;
4096 Properties properties;
4097 ::mlir::RegionRange odsRegions;
4098public:
4099 BitwiseOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
4100 odsOpName.emplace(args: "tosa.bitwise_or", args: odsAttrs.getContext());
4101 }
4102
4103 BitwiseOrOpGenericAdaptorBase(BitwiseOrOp op);
4104
4105 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
4106 return {index, 1};
4107 }
4108
4109 const Properties &getProperties() {
4110 return properties;
4111 }
4112
4113 ::mlir::DictionaryAttr getAttributes() {
4114 return odsAttrs;
4115 }
4116
4117};
4118
4119} // namespace detail
4120template <typename RangeT>
4121class BitwiseOrOpGenericAdaptor : public detail::BitwiseOrOpGenericAdaptorBase {
4122 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
4123 using Base = detail::BitwiseOrOpGenericAdaptorBase;
4124 static constexpr int odsIndex_input1 = 0;
4125 static constexpr int odsIndex_input2 = 1;
4126public:
4127 BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
4128
4129 BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
4130
4131 BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseOrOpGenericAdaptor(values, attrs, Properties{}, {}) {}
4132
4133 BitwiseOrOpGenericAdaptor(RangeT values, const BitwiseOrOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
4134
4135 template <typename LateInst = BitwiseOrOp, typename = std::enable_if_t<std::is_same_v<LateInst, BitwiseOrOp>>>
4136 BitwiseOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
4137
4138 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4139 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
4140 }
4141
4142 RangeT getODSOperands(unsigned index) {
4143 auto valueRange = getODSOperandIndexAndLength(index);
4144 return {std::next(odsOperands.begin(), valueRange.first),
4145 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4146 }
4147
4148 ValueT getInput1() {
4149 return (*getODSOperands(index: 0).begin());
4150 }
4151
4152 ValueT getInput2() {
4153 return (*getODSOperands(index: 1).begin());
4154 }
4155
4156 RangeT getOperands() {
4157 return odsOperands;
4158 }
4159
4160private:
4161 RangeT odsOperands;
4162};
4163class BitwiseOrOpAdaptor : public BitwiseOrOpGenericAdaptor<::mlir::ValueRange> {
4164public:
4165 using BitwiseOrOpGenericAdaptor::BitwiseOrOpGenericAdaptor;
4166 BitwiseOrOpAdaptor(BitwiseOrOp op);
4167
4168 ::llvm::LogicalResult verify(::mlir::Location loc);
4169};
4170class BitwiseOrOp : public ::mlir::Op<BitwiseOrOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
4171public:
4172 using Op::Op;
4173 using Op::print;
4174 using Adaptor = BitwiseOrOpAdaptor;
4175 template <typename RangeT>
4176 using GenericAdaptor = BitwiseOrOpGenericAdaptor<RangeT>;
4177 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
4178 static constexpr int odsIndex_input1 = 0;
4179 static constexpr int odsIndex_input2 = 1;
4180 static constexpr int odsIndex_output = 0;
4181 using Properties = FoldAdaptor::Properties;
4182 using ::mlir::InferShapedTypeOpInterface::Trait<BitwiseOrOp>::reifyReturnTypeShapes;
4183 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
4184 return {};
4185 }
4186
4187 static constexpr ::llvm::StringLiteral getOperationName() {
4188 return ::llvm::StringLiteral("tosa.bitwise_or");
4189 }
4190
4191 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4192 return {index, 1};
4193 }
4194
4195 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
4196 auto [start, length] = getODSOperandIndexAndLength(index);
4197 return getOperation()->getOperands().slice(n: start, m: length);
4198 }
4199
4200 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
4201 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
4202 }
4203
4204 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
4205 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
4206 }
4207
4208 ::mlir::OpOperand &getInput1Mutable() {
4209 auto range = getODSOperandIndexAndLength(index: 0);
4210 return getOperation()->getOpOperand(idx: range.first);
4211 }
4212
4213 ::mlir::OpOperand &getInput2Mutable() {
4214 auto range = getODSOperandIndexAndLength(index: 1);
4215 return getOperation()->getOpOperand(idx: range.first);
4216 }
4217
4218 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
4219 return {index, 1};
4220 }
4221
4222 ::mlir::Operation::result_range getODSResults(unsigned index) {
4223 auto valueRange = getODSResultIndexAndLength(index);
4224 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
4225 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
4226 }
4227
4228 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
4229 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
4230 }
4231
4232 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4233 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
4234 static llvm::hash_code computePropertiesHash(const Properties &prop);
4235 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
4236 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
4237 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
4238 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4239 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
4240 static BitwiseOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
4241 static BitwiseOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
4242 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
4243 static BitwiseOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
4244 static BitwiseOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
4245 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4246 static BitwiseOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4247 static BitwiseOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4248 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4249 static BitwiseOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4250 static BitwiseOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4251 ::llvm::LogicalResult verifyInvariantsImpl();
4252 ::llvm::LogicalResult verifyInvariants();
4253 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
4254 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
4255 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
4256 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
4257public:
4258};
4259
4260} // namespace mlir::tosa
4261MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::BitwiseOrOp)
4262
4263namespace mlir::tosa {
4264
4265
4266//===----------------------------------------------------------------------===//
4267// mlir::tosa::BitwiseXorOp declarations
4268//===----------------------------------------------------------------------===//
4269
4270namespace detail {
4271
4272class BitwiseXorOpGenericAdaptorBase {
4273public:
4274 using Properties = ::mlir::EmptyProperties;
4275protected:
4276 ::mlir::DictionaryAttr odsAttrs;
4277 ::std::optional<::mlir::OperationName> odsOpName;
4278 Properties properties;
4279 ::mlir::RegionRange odsRegions;
4280public:
4281 BitwiseXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
4282 odsOpName.emplace(args: "tosa.bitwise_xor", args: odsAttrs.getContext());
4283 }
4284
4285 BitwiseXorOpGenericAdaptorBase(BitwiseXorOp op);
4286
4287 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
4288 return {index, 1};
4289 }
4290
4291 const Properties &getProperties() {
4292 return properties;
4293 }
4294
4295 ::mlir::DictionaryAttr getAttributes() {
4296 return odsAttrs;
4297 }
4298
4299};
4300
4301} // namespace detail
4302template <typename RangeT>
4303class BitwiseXorOpGenericAdaptor : public detail::BitwiseXorOpGenericAdaptorBase {
4304 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
4305 using Base = detail::BitwiseXorOpGenericAdaptorBase;
4306 static constexpr int odsIndex_input1 = 0;
4307 static constexpr int odsIndex_input2 = 1;
4308public:
4309 BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
4310
4311 BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseXorOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
4312
4313 BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseXorOpGenericAdaptor(values, attrs, Properties{}, {}) {}
4314
4315 BitwiseXorOpGenericAdaptor(RangeT values, const BitwiseXorOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
4316
4317 template <typename LateInst = BitwiseXorOp, typename = std::enable_if_t<std::is_same_v<LateInst, BitwiseXorOp>>>
4318 BitwiseXorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
4319
4320 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4321 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
4322 }
4323
4324 RangeT getODSOperands(unsigned index) {
4325 auto valueRange = getODSOperandIndexAndLength(index);
4326 return {std::next(odsOperands.begin(), valueRange.first),
4327 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4328 }
4329
4330 ValueT getInput1() {
4331 return (*getODSOperands(index: 0).begin());
4332 }
4333
4334 ValueT getInput2() {
4335 return (*getODSOperands(index: 1).begin());
4336 }
4337
4338 RangeT getOperands() {
4339 return odsOperands;
4340 }
4341
4342private:
4343 RangeT odsOperands;
4344};
4345class BitwiseXorOpAdaptor : public BitwiseXorOpGenericAdaptor<::mlir::ValueRange> {
4346public:
4347 using BitwiseXorOpGenericAdaptor::BitwiseXorOpGenericAdaptor;
4348 BitwiseXorOpAdaptor(BitwiseXorOp op);
4349
4350 ::llvm::LogicalResult verify(::mlir::Location loc);
4351};
4352class BitwiseXorOp : public ::mlir::Op<BitwiseXorOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
4353public:
4354 using Op::Op;
4355 using Op::print;
4356 using Adaptor = BitwiseXorOpAdaptor;
4357 template <typename RangeT>
4358 using GenericAdaptor = BitwiseXorOpGenericAdaptor<RangeT>;
4359 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
4360 static constexpr int odsIndex_input1 = 0;
4361 static constexpr int odsIndex_input2 = 1;
4362 static constexpr int odsIndex_output = 0;
4363 using Properties = FoldAdaptor::Properties;
4364 using ::mlir::InferShapedTypeOpInterface::Trait<BitwiseXorOp>::reifyReturnTypeShapes;
4365 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
4366 return {};
4367 }
4368
4369 static constexpr ::llvm::StringLiteral getOperationName() {
4370 return ::llvm::StringLiteral("tosa.bitwise_xor");
4371 }
4372
4373 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4374 return {index, 1};
4375 }
4376
4377 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
4378 auto [start, length] = getODSOperandIndexAndLength(index);
4379 return getOperation()->getOperands().slice(n: start, m: length);
4380 }
4381
4382 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
4383 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
4384 }
4385
4386 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
4387 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
4388 }
4389
4390 ::mlir::OpOperand &getInput1Mutable() {
4391 auto range = getODSOperandIndexAndLength(index: 0);
4392 return getOperation()->getOpOperand(idx: range.first);
4393 }
4394
4395 ::mlir::OpOperand &getInput2Mutable() {
4396 auto range = getODSOperandIndexAndLength(index: 1);
4397 return getOperation()->getOpOperand(idx: range.first);
4398 }
4399
4400 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
4401 return {index, 1};
4402 }
4403
4404 ::mlir::Operation::result_range getODSResults(unsigned index) {
4405 auto valueRange = getODSResultIndexAndLength(index);
4406 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
4407 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
4408 }
4409
4410 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
4411 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
4412 }
4413
4414 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4415 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
4416 static llvm::hash_code computePropertiesHash(const Properties &prop);
4417 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
4418 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
4419 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
4420 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4421 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
4422 static BitwiseXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
4423 static BitwiseXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
4424 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
4425 static BitwiseXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
4426 static BitwiseXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
4427 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4428 static BitwiseXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4429 static BitwiseXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4430 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4431 static BitwiseXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4432 static BitwiseXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4433 ::llvm::LogicalResult verifyInvariantsImpl();
4434 ::llvm::LogicalResult verifyInvariants();
4435 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
4436 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
4437 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
4438 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
4439public:
4440};
4441
4442} // namespace mlir::tosa
4443MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::BitwiseXorOp)
4444
4445namespace mlir::tosa {
4446
4447
4448//===----------------------------------------------------------------------===//
4449// mlir::tosa::CastFromBlockScaledOp declarations
4450//===----------------------------------------------------------------------===//
4451
4452namespace detail {
4453
4454class CastFromBlockScaledOpGenericAdaptorBase {
4455public:
4456 struct Properties {
4457 using block_sizeTy = mlir::tosa::BlockSizeAttr;
4458 block_sizeTy block_size;
4459
4460 auto getBlockSize() const {
4461 auto &propStorage = this->block_size;
4462 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: propStorage);
4463 }
4464 void setBlockSize(const mlir::tosa::BlockSizeAttr &propValue) {
4465 this->block_size = propValue;
4466 }
4467 bool operator==(const Properties &rhs) const {
4468 return
4469 rhs.block_size == this->block_size &&
4470 true;
4471 }
4472 bool operator!=(const Properties &rhs) const {
4473 return !(*this == rhs);
4474 }
4475 };
4476protected:
4477 ::mlir::DictionaryAttr odsAttrs;
4478 ::std::optional<::mlir::OperationName> odsOpName;
4479 Properties properties;
4480 ::mlir::RegionRange odsRegions;
4481public:
4482 CastFromBlockScaledOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
4483 odsOpName.emplace(args: "tosa.cast_from_block_scaled", args: odsAttrs.getContext());
4484 }
4485
4486 CastFromBlockScaledOpGenericAdaptorBase(CastFromBlockScaledOp op);
4487
4488 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
4489 return {index, 1};
4490 }
4491
4492 const Properties &getProperties() {
4493 return properties;
4494 }
4495
4496 ::mlir::DictionaryAttr getAttributes() {
4497 return odsAttrs;
4498 }
4499
4500 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
4501 auto attr = ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: getProperties().block_size);
4502 return attr;
4503 }
4504
4505 ::mlir::tosa::BlockSize getBlockSize();
4506};
4507
4508} // namespace detail
4509template <typename RangeT>
4510class CastFromBlockScaledOpGenericAdaptor : public detail::CastFromBlockScaledOpGenericAdaptorBase {
4511 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
4512 using Base = detail::CastFromBlockScaledOpGenericAdaptorBase;
4513 static constexpr int odsIndex_input_data = 0;
4514 static constexpr int odsIndex_input_scale = 1;
4515public:
4516 CastFromBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
4517
4518 CastFromBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CastFromBlockScaledOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
4519
4520 CastFromBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CastFromBlockScaledOpGenericAdaptor(values, attrs, Properties{}, {}) {}
4521
4522 CastFromBlockScaledOpGenericAdaptor(RangeT values, const CastFromBlockScaledOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
4523
4524 template <typename LateInst = CastFromBlockScaledOp, typename = std::enable_if_t<std::is_same_v<LateInst, CastFromBlockScaledOp>>>
4525 CastFromBlockScaledOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
4526
4527 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4528 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
4529 }
4530
4531 RangeT getODSOperands(unsigned index) {
4532 auto valueRange = getODSOperandIndexAndLength(index);
4533 return {std::next(odsOperands.begin(), valueRange.first),
4534 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4535 }
4536
4537 ValueT getInputData() {
4538 return (*getODSOperands(index: 0).begin());
4539 }
4540
4541 ValueT getInputScale() {
4542 return (*getODSOperands(index: 1).begin());
4543 }
4544
4545 RangeT getOperands() {
4546 return odsOperands;
4547 }
4548
4549private:
4550 RangeT odsOperands;
4551};
4552class CastFromBlockScaledOpAdaptor : public CastFromBlockScaledOpGenericAdaptor<::mlir::ValueRange> {
4553public:
4554 using CastFromBlockScaledOpGenericAdaptor::CastFromBlockScaledOpGenericAdaptor;
4555 CastFromBlockScaledOpAdaptor(CastFromBlockScaledOp op);
4556
4557 ::llvm::LogicalResult verify(::mlir::Location loc);
4558};
4559class CastFromBlockScaledOp : public ::mlir::Op<CastFromBlockScaledOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
4560public:
4561 using Op::Op;
4562 using Op::print;
4563 using Adaptor = CastFromBlockScaledOpAdaptor;
4564 template <typename RangeT>
4565 using GenericAdaptor = CastFromBlockScaledOpGenericAdaptor<RangeT>;
4566 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
4567 static constexpr int odsIndex_input_data = 0;
4568 static constexpr int odsIndex_input_scale = 1;
4569 static constexpr int odsIndex_output_data = 0;
4570 using Properties = FoldAdaptor::Properties;
4571 using ::mlir::InferShapedTypeOpInterface::Trait<CastFromBlockScaledOp>::reifyReturnTypeShapes;
4572 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
4573 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("block_size")};
4574 return ::llvm::ArrayRef(attrNames);
4575 }
4576
4577 ::mlir::StringAttr getBlockSizeAttrName() {
4578 return getAttributeNameForIndex(index: 0);
4579 }
4580
4581 static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) {
4582 return getAttributeNameForIndex(name, index: 0);
4583 }
4584
4585 static constexpr ::llvm::StringLiteral getOperationName() {
4586 return ::llvm::StringLiteral("tosa.cast_from_block_scaled");
4587 }
4588
4589 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4590 return {index, 1};
4591 }
4592
4593 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
4594 auto [start, length] = getODSOperandIndexAndLength(index);
4595 return getOperation()->getOperands().slice(n: start, m: length);
4596 }
4597
4598 ::mlir::TypedValue<::mlir::TensorType> getInputData() {
4599 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
4600 }
4601
4602 ::mlir::TypedValue<::mlir::TensorType> getInputScale() {
4603 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
4604 }
4605
4606 ::mlir::OpOperand &getInputDataMutable() {
4607 auto range = getODSOperandIndexAndLength(index: 0);
4608 return getOperation()->getOpOperand(idx: range.first);
4609 }
4610
4611 ::mlir::OpOperand &getInputScaleMutable() {
4612 auto range = getODSOperandIndexAndLength(index: 1);
4613 return getOperation()->getOpOperand(idx: range.first);
4614 }
4615
4616 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
4617 return {index, 1};
4618 }
4619
4620 ::mlir::Operation::result_range getODSResults(unsigned index) {
4621 auto valueRange = getODSResultIndexAndLength(index);
4622 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
4623 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
4624 }
4625
4626 ::mlir::TypedValue<::mlir::TensorType> getOutputData() {
4627 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
4628 }
4629
4630 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4631 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
4632 static llvm::hash_code computePropertiesHash(const Properties &prop);
4633 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
4634 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
4635 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
4636 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4637 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
4638 void writeProperties(::mlir::DialectBytecodeWriter &writer);
4639 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
4640 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val&: getProperties().block_size);
4641 }
4642
4643 ::mlir::tosa::BlockSize getBlockSize();
4644 void setBlockSizeAttr(mlir::tosa::BlockSizeAttr attr) {
4645 getProperties().block_size = attr;
4646 }
4647
4648 void setBlockSize(::mlir::tosa::BlockSize attrValue);
4649 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_data, ::mlir::Value input_data, ::mlir::Value input_scale, mlir::tosa::BlockSizeAttr block_size);
4650 static CastFromBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_data, ::mlir::Value input_data, ::mlir::Value input_scale, mlir::tosa::BlockSizeAttr block_size);
4651 static CastFromBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_data, ::mlir::Value input_data, ::mlir::Value input_scale, mlir::tosa::BlockSizeAttr block_size);
4652 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, mlir::tosa::BlockSizeAttr block_size);
4653 static CastFromBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, mlir::tosa::BlockSizeAttr block_size);
4654 static CastFromBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, mlir::tosa::BlockSizeAttr block_size);
4655 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_data, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::tosa::BlockSize block_size);
4656 static CastFromBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_data, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::tosa::BlockSize block_size);
4657 static CastFromBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_data, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::tosa::BlockSize block_size);
4658 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::tosa::BlockSize block_size);
4659 static CastFromBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::tosa::BlockSize block_size);
4660 static CastFromBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::tosa::BlockSize block_size);
4661 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
4662 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4663 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
4664 static CastFromBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4665 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
4666 static CastFromBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4667 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4668 static CastFromBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4669 static CastFromBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4670 ::llvm::LogicalResult verifyInvariantsImpl();
4671 ::llvm::LogicalResult verifyInvariants();
4672 ::llvm::LogicalResult verify();
4673 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
4674 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
4675 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
4676 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
4677private:
4678 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
4679 return getAttributeNameForIndex(name: (*this)->getName(), index);
4680 }
4681
4682 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
4683 assert(index < 1 && "invalid attribute index");
4684 assert(name.getStringRef() == getOperationName() && "invalid operation name");
4685 assert(name.isRegistered() && "Operation isn't registered, missing a "
4686 "dependent dialect loading?");
4687 return name.getAttributeNames()[index];
4688 }
4689
4690 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
4691public:
4692 static ::llvm::LogicalResult
4693 inferReturnTypeComponents(::mlir::MLIRContext *context,
4694 std::optional<::mlir::Location> location,
4695 Adaptor adaptor,
4696 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
4697
4698};
4699
4700} // namespace mlir::tosa
4701MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::CastFromBlockScaledOp)
4702MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::CastFromBlockScaledOpGenericAdaptorBase::Properties)
4703
4704namespace mlir::tosa {
4705
4706
4707//===----------------------------------------------------------------------===//
4708// mlir::tosa::CastOp declarations
4709//===----------------------------------------------------------------------===//
4710
4711namespace detail {
4712
4713class CastOpGenericAdaptorBase {
4714public:
4715 struct Properties {
4716 using input_unsignedTy = ::mlir::BoolAttr;
4717 input_unsignedTy input_unsigned;
4718
4719 auto getInputUnsigned() const {
4720 auto &propStorage = this->input_unsigned;
4721 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val: propStorage);
4722 }
4723 void setInputUnsigned(const ::mlir::BoolAttr &propValue) {
4724 this->input_unsigned = propValue;
4725 }
4726 bool operator==(const Properties &rhs) const {
4727 return
4728 rhs.input_unsigned == this->input_unsigned &&
4729 true;
4730 }
4731 bool operator!=(const Properties &rhs) const {
4732 return !(*this == rhs);
4733 }
4734 };
4735protected:
4736 ::mlir::DictionaryAttr odsAttrs;
4737 ::std::optional<::mlir::OperationName> odsOpName;
4738 Properties properties;
4739 ::mlir::RegionRange odsRegions;
4740public:
4741 CastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
4742 odsOpName.emplace(args: "tosa.cast", args: odsAttrs.getContext());
4743 }
4744
4745 CastOpGenericAdaptorBase(CastOp op);
4746
4747 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
4748 return {index, 1};
4749 }
4750
4751 const Properties &getProperties() {
4752 return properties;
4753 }
4754
4755 ::mlir::DictionaryAttr getAttributes() {
4756 return odsAttrs;
4757 }
4758
4759 ::mlir::BoolAttr getInputUnsignedAttr();
4760 bool getInputUnsigned();
4761};
4762
4763} // namespace detail
4764template <typename RangeT>
4765class CastOpGenericAdaptor : public detail::CastOpGenericAdaptorBase {
4766 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
4767 using Base = detail::CastOpGenericAdaptorBase;
4768 static constexpr int odsIndex_input = 0;
4769public:
4770 CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
4771
4772 CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CastOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
4773
4774 CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CastOpGenericAdaptor(values, attrs, Properties{}, {}) {}
4775
4776 CastOpGenericAdaptor(RangeT values, const CastOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
4777
4778 template <typename LateInst = CastOp, typename = std::enable_if_t<std::is_same_v<LateInst, CastOp>>>
4779 CastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
4780
4781 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4782 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
4783 }
4784
4785 RangeT getODSOperands(unsigned index) {
4786 auto valueRange = getODSOperandIndexAndLength(index);
4787 return {std::next(odsOperands.begin(), valueRange.first),
4788 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4789 }
4790
4791 ValueT getInput() {
4792 return (*getODSOperands(index: 0).begin());
4793 }
4794
4795 RangeT getOperands() {
4796 return odsOperands;
4797 }
4798
4799private:
4800 RangeT odsOperands;
4801};
4802class CastOpAdaptor : public CastOpGenericAdaptor<::mlir::ValueRange> {
4803public:
4804 using CastOpGenericAdaptor::CastOpGenericAdaptor;
4805 CastOpAdaptor(CastOp op);
4806
4807 ::llvm::LogicalResult verify(::mlir::Location loc);
4808};
4809class CastOp : public ::mlir::Op<CastOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
4810public:
4811 using Op::Op;
4812 using Op::print;
4813 using Adaptor = CastOpAdaptor;
4814 template <typename RangeT>
4815 using GenericAdaptor = CastOpGenericAdaptor<RangeT>;
4816 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
4817 static constexpr int odsIndex_input = 0;
4818 static constexpr int odsIndex_output = 0;
4819 using Properties = FoldAdaptor::Properties;
4820 using ::mlir::InferShapedTypeOpInterface::Trait<CastOp>::reifyReturnTypeShapes;
4821 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
4822 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("input_unsigned")};
4823 return ::llvm::ArrayRef(attrNames);
4824 }
4825
4826 ::mlir::StringAttr getInputUnsignedAttrName() {
4827 return getAttributeNameForIndex(index: 0);
4828 }
4829
4830 static ::mlir::StringAttr getInputUnsignedAttrName(::mlir::OperationName name) {
4831 return getAttributeNameForIndex(name, index: 0);
4832 }
4833
4834 static constexpr ::llvm::StringLiteral getOperationName() {
4835 return ::llvm::StringLiteral("tosa.cast");
4836 }
4837
4838 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
4839 return {index, 1};
4840 }
4841
4842 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
4843 auto [start, length] = getODSOperandIndexAndLength(index);
4844 return getOperation()->getOperands().slice(n: start, m: length);
4845 }
4846
4847 ::mlir::TypedValue<::mlir::TensorType> getInput() {
4848 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
4849 }
4850
4851 ::mlir::OpOperand &getInputMutable() {
4852 auto range = getODSOperandIndexAndLength(index: 0);
4853 return getOperation()->getOpOperand(idx: range.first);
4854 }
4855
4856 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
4857 return {index, 1};
4858 }
4859
4860 ::mlir::Operation::result_range getODSResults(unsigned index) {
4861 auto valueRange = getODSResultIndexAndLength(index);
4862 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
4863 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
4864 }
4865
4866 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
4867 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
4868 }
4869
4870 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4871 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
4872 static llvm::hash_code computePropertiesHash(const Properties &prop);
4873 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
4874 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
4875 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
4876 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
4877 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
4878 void writeProperties(::mlir::DialectBytecodeWriter &writer);
4879 ::mlir::BoolAttr getInputUnsignedAttr() {
4880 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val&: getProperties().input_unsigned);
4881 }
4882
4883 bool getInputUnsigned();
4884 void setInputUnsignedAttr(::mlir::BoolAttr attr) {
4885 getProperties().input_unsigned = attr;
4886 }
4887
4888 void setInputUnsigned(::std::optional<bool> attrValue);
4889 ::mlir::Attribute removeInputUnsignedAttr() {
4890 auto attr = getProperties().input_unsigned;
4891 getProperties().input_unsigned = {};
4892 return attr;
4893 }
4894
4895 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::BoolAttr input_unsigned);
4896 static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::BoolAttr input_unsigned);
4897 static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::BoolAttr input_unsigned);
4898 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr input_unsigned);
4899 static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr input_unsigned);
4900 static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr input_unsigned);
4901 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/bool input_unsigned = false);
4902 static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, /*optional*/bool input_unsigned = false);
4903 static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, /*optional*/bool input_unsigned = false);
4904 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool input_unsigned = false);
4905 static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool input_unsigned = false);
4906 static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool input_unsigned = false);
4907 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
4908 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4909 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
4910 static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4911 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
4912 static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
4913 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4914 static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4915 static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
4916 ::llvm::LogicalResult verifyInvariantsImpl();
4917 ::llvm::LogicalResult verifyInvariants();
4918 ::llvm::LogicalResult verify();
4919 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
4920 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
4921 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
4922 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
4923 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
4924 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
4925private:
4926 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
4927 return getAttributeNameForIndex(name: (*this)->getName(), index);
4928 }
4929
4930 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
4931 assert(index < 1 && "invalid attribute index");
4932 assert(name.getStringRef() == getOperationName() && "invalid operation name");
4933 assert(name.isRegistered() && "Operation isn't registered, missing a "
4934 "dependent dialect loading?");
4935 return name.getAttributeNames()[index];
4936 }
4937
4938 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
4939public:
4940};
4941
4942} // namespace mlir::tosa
4943MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::CastOp)
4944MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::CastOpGenericAdaptorBase::Properties)
4945
4946namespace mlir::tosa {
4947
4948
4949//===----------------------------------------------------------------------===//
4950// mlir::tosa::CastToBlockScaledOp declarations
4951//===----------------------------------------------------------------------===//
4952
4953namespace detail {
4954
4955class CastToBlockScaledOpGenericAdaptorBase {
4956public:
4957 struct Properties {
4958 using block_sizeTy = mlir::tosa::BlockSizeAttr;
4959 block_sizeTy block_size;
4960
4961 auto getBlockSize() const {
4962 auto &propStorage = this->block_size;
4963 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: propStorage);
4964 }
4965 void setBlockSize(const mlir::tosa::BlockSizeAttr &propValue) {
4966 this->block_size = propValue;
4967 }
4968 bool operator==(const Properties &rhs) const {
4969 return
4970 rhs.block_size == this->block_size &&
4971 true;
4972 }
4973 bool operator!=(const Properties &rhs) const {
4974 return !(*this == rhs);
4975 }
4976 };
4977protected:
4978 ::mlir::DictionaryAttr odsAttrs;
4979 ::std::optional<::mlir::OperationName> odsOpName;
4980 Properties properties;
4981 ::mlir::RegionRange odsRegions;
4982public:
4983 CastToBlockScaledOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
4984 odsOpName.emplace(args: "tosa.cast_to_block_scaled", args: odsAttrs.getContext());
4985 }
4986
4987 CastToBlockScaledOpGenericAdaptorBase(CastToBlockScaledOp op);
4988
4989 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
4990 return {index, 1};
4991 }
4992
4993 const Properties &getProperties() {
4994 return properties;
4995 }
4996
4997 ::mlir::DictionaryAttr getAttributes() {
4998 return odsAttrs;
4999 }
5000
5001 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
5002 auto attr = ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: getProperties().block_size);
5003 return attr;
5004 }
5005
5006 ::mlir::tosa::BlockSize getBlockSize();
5007};
5008
5009} // namespace detail
5010template <typename RangeT>
5011class CastToBlockScaledOpGenericAdaptor : public detail::CastToBlockScaledOpGenericAdaptorBase {
5012 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
5013 using Base = detail::CastToBlockScaledOpGenericAdaptorBase;
5014 static constexpr int odsIndex_input_data = 0;
5015public:
5016 CastToBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
5017
5018 CastToBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CastToBlockScaledOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
5019
5020 CastToBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CastToBlockScaledOpGenericAdaptor(values, attrs, Properties{}, {}) {}
5021
5022 CastToBlockScaledOpGenericAdaptor(RangeT values, const CastToBlockScaledOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
5023
5024 template <typename LateInst = CastToBlockScaledOp, typename = std::enable_if_t<std::is_same_v<LateInst, CastToBlockScaledOp>>>
5025 CastToBlockScaledOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
5026
5027 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5028 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
5029 }
5030
5031 RangeT getODSOperands(unsigned index) {
5032 auto valueRange = getODSOperandIndexAndLength(index);
5033 return {std::next(odsOperands.begin(), valueRange.first),
5034 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5035 }
5036
5037 ValueT getInputData() {
5038 return (*getODSOperands(index: 0).begin());
5039 }
5040
5041 RangeT getOperands() {
5042 return odsOperands;
5043 }
5044
5045private:
5046 RangeT odsOperands;
5047};
5048class CastToBlockScaledOpAdaptor : public CastToBlockScaledOpGenericAdaptor<::mlir::ValueRange> {
5049public:
5050 using CastToBlockScaledOpGenericAdaptor::CastToBlockScaledOpGenericAdaptor;
5051 CastToBlockScaledOpAdaptor(CastToBlockScaledOp op);
5052
5053 ::llvm::LogicalResult verify(::mlir::Location loc);
5054};
5055class CastToBlockScaledOp : public ::mlir::Op<CastToBlockScaledOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::NResults<2>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands, ::mlir::OpAsmOpInterface::Trait> {
5056public:
5057 using Op::Op;
5058 using Op::print;
5059 using Adaptor = CastToBlockScaledOpAdaptor;
5060 template <typename RangeT>
5061 using GenericAdaptor = CastToBlockScaledOpGenericAdaptor<RangeT>;
5062 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
5063 static constexpr int odsIndex_input_data = 0;
5064 static constexpr int odsIndex_output_data = 0;
5065 static constexpr int odsIndex_output_scale = 1;
5066 using Properties = FoldAdaptor::Properties;
5067 using ::mlir::InferShapedTypeOpInterface::Trait<CastToBlockScaledOp>::reifyReturnTypeShapes;
5068 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
5069 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("block_size")};
5070 return ::llvm::ArrayRef(attrNames);
5071 }
5072
5073 ::mlir::StringAttr getBlockSizeAttrName() {
5074 return getAttributeNameForIndex(index: 0);
5075 }
5076
5077 static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) {
5078 return getAttributeNameForIndex(name, index: 0);
5079 }
5080
5081 void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn);
5082 static constexpr ::llvm::StringLiteral getOperationName() {
5083 return ::llvm::StringLiteral("tosa.cast_to_block_scaled");
5084 }
5085
5086 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5087 return {index, 1};
5088 }
5089
5090 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
5091 auto [start, length] = getODSOperandIndexAndLength(index);
5092 return getOperation()->getOperands().slice(n: start, m: length);
5093 }
5094
5095 ::mlir::TypedValue<::mlir::TensorType> getInputData() {
5096 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
5097 }
5098
5099 ::mlir::OpOperand &getInputDataMutable() {
5100 auto range = getODSOperandIndexAndLength(index: 0);
5101 return getOperation()->getOpOperand(idx: range.first);
5102 }
5103
5104 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
5105 return {index, 1};
5106 }
5107
5108 ::mlir::Operation::result_range getODSResults(unsigned index) {
5109 auto valueRange = getODSResultIndexAndLength(index);
5110 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
5111 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
5112 }
5113
5114 ::mlir::TypedValue<::mlir::TensorType> getOutputData() {
5115 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
5116 }
5117
5118 ::mlir::TypedValue<::mlir::TensorType> getOutputScale() {
5119 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 1).begin());
5120 }
5121
5122 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5123 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
5124 static llvm::hash_code computePropertiesHash(const Properties &prop);
5125 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
5126 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
5127 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
5128 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5129 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
5130 void writeProperties(::mlir::DialectBytecodeWriter &writer);
5131 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
5132 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val&: getProperties().block_size);
5133 }
5134
5135 ::mlir::tosa::BlockSize getBlockSize();
5136 void setBlockSizeAttr(mlir::tosa::BlockSizeAttr attr) {
5137 getProperties().block_size = attr;
5138 }
5139
5140 void setBlockSize(::mlir::tosa::BlockSize attrValue);
5141 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_data, ::mlir::Type output_scale, ::mlir::Value input_data, mlir::tosa::BlockSizeAttr block_size);
5142 static CastToBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_data, ::mlir::Type output_scale, ::mlir::Value input_data, mlir::tosa::BlockSizeAttr block_size);
5143 static CastToBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_data, ::mlir::Type output_scale, ::mlir::Value input_data, mlir::tosa::BlockSizeAttr block_size);
5144 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, mlir::tosa::BlockSizeAttr block_size);
5145 static CastToBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, mlir::tosa::BlockSizeAttr block_size);
5146 static CastToBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, mlir::tosa::BlockSizeAttr block_size);
5147 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_data, ::mlir::Type output_scale, ::mlir::Value input_data, ::mlir::tosa::BlockSize block_size);
5148 static CastToBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_data, ::mlir::Type output_scale, ::mlir::Value input_data, ::mlir::tosa::BlockSize block_size);
5149 static CastToBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_data, ::mlir::Type output_scale, ::mlir::Value input_data, ::mlir::tosa::BlockSize block_size);
5150 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::tosa::BlockSize block_size);
5151 static CastToBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::tosa::BlockSize block_size);
5152 static CastToBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::tosa::BlockSize block_size);
5153 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
5154 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5155 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
5156 static CastToBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5157 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
5158 static CastToBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5159 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5160 static CastToBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5161 static CastToBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5162 ::llvm::LogicalResult verifyInvariantsImpl();
5163 ::llvm::LogicalResult verifyInvariants();
5164 ::llvm::LogicalResult verify();
5165 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
5166 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
5167 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
5168 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
5169 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
5170private:
5171 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
5172 return getAttributeNameForIndex(name: (*this)->getName(), index);
5173 }
5174
5175 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
5176 assert(index < 1 && "invalid attribute index");
5177 assert(name.getStringRef() == getOperationName() && "invalid operation name");
5178 assert(name.isRegistered() && "Operation isn't registered, missing a "
5179 "dependent dialect loading?");
5180 return name.getAttributeNames()[index];
5181 }
5182
5183 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
5184public:
5185 static ::llvm::LogicalResult
5186 inferReturnTypeComponents(::mlir::MLIRContext *context,
5187 std::optional<::mlir::Location> location,
5188 Adaptor adaptor,
5189 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
5190
5191};
5192
5193} // namespace mlir::tosa
5194MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::CastToBlockScaledOp)
5195MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::CastToBlockScaledOpGenericAdaptorBase::Properties)
5196
5197namespace mlir::tosa {
5198
5199
5200//===----------------------------------------------------------------------===//
5201// mlir::tosa::CeilOp declarations
5202//===----------------------------------------------------------------------===//
5203
5204namespace detail {
5205
5206class CeilOpGenericAdaptorBase {
5207public:
5208 using Properties = ::mlir::EmptyProperties;
5209protected:
5210 ::mlir::DictionaryAttr odsAttrs;
5211 ::std::optional<::mlir::OperationName> odsOpName;
5212 Properties properties;
5213 ::mlir::RegionRange odsRegions;
5214public:
5215 CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
5216 odsOpName.emplace(args: "tosa.ceil", args: odsAttrs.getContext());
5217 }
5218
5219 CeilOpGenericAdaptorBase(CeilOp op);
5220
5221 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
5222 return {index, 1};
5223 }
5224
5225 const Properties &getProperties() {
5226 return properties;
5227 }
5228
5229 ::mlir::DictionaryAttr getAttributes() {
5230 return odsAttrs;
5231 }
5232
5233};
5234
5235} // namespace detail
5236template <typename RangeT>
5237class CeilOpGenericAdaptor : public detail::CeilOpGenericAdaptorBase {
5238 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
5239 using Base = detail::CeilOpGenericAdaptorBase;
5240 static constexpr int odsIndex_input1 = 0;
5241public:
5242 CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
5243
5244 CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CeilOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
5245
5246 CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CeilOpGenericAdaptor(values, attrs, Properties{}, {}) {}
5247
5248 CeilOpGenericAdaptor(RangeT values, const CeilOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
5249
5250 template <typename LateInst = CeilOp, typename = std::enable_if_t<std::is_same_v<LateInst, CeilOp>>>
5251 CeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
5252
5253 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5254 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
5255 }
5256
5257 RangeT getODSOperands(unsigned index) {
5258 auto valueRange = getODSOperandIndexAndLength(index);
5259 return {std::next(odsOperands.begin(), valueRange.first),
5260 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5261 }
5262
5263 ValueT getInput1() {
5264 return (*getODSOperands(index: 0).begin());
5265 }
5266
5267 RangeT getOperands() {
5268 return odsOperands;
5269 }
5270
5271private:
5272 RangeT odsOperands;
5273};
5274class CeilOpAdaptor : public CeilOpGenericAdaptor<::mlir::ValueRange> {
5275public:
5276 using CeilOpGenericAdaptor::CeilOpGenericAdaptor;
5277 CeilOpAdaptor(CeilOp op);
5278
5279 ::llvm::LogicalResult verify(::mlir::Location loc);
5280};
5281class CeilOp : public ::mlir::Op<CeilOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
5282public:
5283 using Op::Op;
5284 using Op::print;
5285 using Adaptor = CeilOpAdaptor;
5286 template <typename RangeT>
5287 using GenericAdaptor = CeilOpGenericAdaptor<RangeT>;
5288 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
5289 static constexpr int odsIndex_input1 = 0;
5290 static constexpr int odsIndex_output = 0;
5291 using Properties = FoldAdaptor::Properties;
5292 using ::mlir::InferShapedTypeOpInterface::Trait<CeilOp>::reifyReturnTypeShapes;
5293 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
5294 return {};
5295 }
5296
5297 static constexpr ::llvm::StringLiteral getOperationName() {
5298 return ::llvm::StringLiteral("tosa.ceil");
5299 }
5300
5301 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5302 return {index, 1};
5303 }
5304
5305 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
5306 auto [start, length] = getODSOperandIndexAndLength(index);
5307 return getOperation()->getOperands().slice(n: start, m: length);
5308 }
5309
5310 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
5311 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
5312 }
5313
5314 ::mlir::OpOperand &getInput1Mutable() {
5315 auto range = getODSOperandIndexAndLength(index: 0);
5316 return getOperation()->getOpOperand(idx: range.first);
5317 }
5318
5319 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
5320 return {index, 1};
5321 }
5322
5323 ::mlir::Operation::result_range getODSResults(unsigned index) {
5324 auto valueRange = getODSResultIndexAndLength(index);
5325 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
5326 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
5327 }
5328
5329 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
5330 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
5331 }
5332
5333 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5334 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
5335 static llvm::hash_code computePropertiesHash(const Properties &prop);
5336 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
5337 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
5338 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
5339 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5340 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
5341 static CeilOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
5342 static CeilOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
5343 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
5344 static CeilOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
5345 static CeilOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
5346 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5347 static CeilOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5348 static CeilOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5349 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5350 static CeilOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5351 static CeilOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5352 ::llvm::LogicalResult verifyInvariantsImpl();
5353 ::llvm::LogicalResult verifyInvariants();
5354 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
5355 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
5356 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
5357 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
5358public:
5359};
5360
5361} // namespace mlir::tosa
5362MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::CeilOp)
5363
5364namespace mlir::tosa {
5365
5366
5367//===----------------------------------------------------------------------===//
5368// mlir::tosa::ClampOp declarations
5369//===----------------------------------------------------------------------===//
5370
5371namespace detail {
5372
5373class ClampOpGenericAdaptorBase {
5374public:
5375 struct Properties {
5376 using max_valTy = ::mlir::Attribute;
5377 max_valTy max_val;
5378
5379 auto getMaxVal() const {
5380 auto &propStorage = this->max_val;
5381 return ::llvm::cast<::mlir::Attribute>(Val: propStorage);
5382 }
5383 void setMaxVal(const ::mlir::Attribute &propValue) {
5384 this->max_val = propValue;
5385 }
5386 using min_valTy = ::mlir::Attribute;
5387 min_valTy min_val;
5388
5389 auto getMinVal() const {
5390 auto &propStorage = this->min_val;
5391 return ::llvm::cast<::mlir::Attribute>(Val: propStorage);
5392 }
5393 void setMinVal(const ::mlir::Attribute &propValue) {
5394 this->min_val = propValue;
5395 }
5396 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
5397 nan_modeTy nan_mode;
5398
5399 auto getNanMode() const {
5400 auto &propStorage = this->nan_mode;
5401 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
5402 }
5403 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
5404 this->nan_mode = propValue;
5405 }
5406 bool operator==(const Properties &rhs) const {
5407 return
5408 rhs.max_val == this->max_val &&
5409 rhs.min_val == this->min_val &&
5410 rhs.nan_mode == this->nan_mode &&
5411 true;
5412 }
5413 bool operator!=(const Properties &rhs) const {
5414 return !(*this == rhs);
5415 }
5416 };
5417protected:
5418 ::mlir::DictionaryAttr odsAttrs;
5419 ::std::optional<::mlir::OperationName> odsOpName;
5420 Properties properties;
5421 ::mlir::RegionRange odsRegions;
5422public:
5423 ClampOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
5424 odsOpName.emplace(args: "tosa.clamp", args: odsAttrs.getContext());
5425 }
5426
5427 ClampOpGenericAdaptorBase(ClampOp op);
5428
5429 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
5430 return {index, 1};
5431 }
5432
5433 const Properties &getProperties() {
5434 return properties;
5435 }
5436
5437 ::mlir::DictionaryAttr getAttributes() {
5438 return odsAttrs;
5439 }
5440
5441 ::mlir::Attribute getMinValAttr() {
5442 auto attr = ::llvm::cast<::mlir::Attribute>(Val: getProperties().min_val);
5443 return attr;
5444 }
5445
5446 ::mlir::Attribute getMinVal();
5447 ::mlir::Attribute getMaxValAttr() {
5448 auto attr = ::llvm::cast<::mlir::Attribute>(Val: getProperties().max_val);
5449 return attr;
5450 }
5451
5452 ::mlir::Attribute getMaxVal();
5453 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
5454 ::mlir::tosa::NanPropagationMode getNanMode();
5455};
5456
5457} // namespace detail
5458template <typename RangeT>
5459class ClampOpGenericAdaptor : public detail::ClampOpGenericAdaptorBase {
5460 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
5461 using Base = detail::ClampOpGenericAdaptorBase;
5462 static constexpr int odsIndex_input = 0;
5463public:
5464 ClampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
5465
5466 ClampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ClampOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
5467
5468 ClampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ClampOpGenericAdaptor(values, attrs, Properties{}, {}) {}
5469
5470 ClampOpGenericAdaptor(RangeT values, const ClampOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
5471
5472 template <typename LateInst = ClampOp, typename = std::enable_if_t<std::is_same_v<LateInst, ClampOp>>>
5473 ClampOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
5474
5475 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5476 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
5477 }
5478
5479 RangeT getODSOperands(unsigned index) {
5480 auto valueRange = getODSOperandIndexAndLength(index);
5481 return {std::next(odsOperands.begin(), valueRange.first),
5482 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5483 }
5484
5485 ValueT getInput() {
5486 return (*getODSOperands(index: 0).begin());
5487 }
5488
5489 RangeT getOperands() {
5490 return odsOperands;
5491 }
5492
5493private:
5494 RangeT odsOperands;
5495};
5496class ClampOpAdaptor : public ClampOpGenericAdaptor<::mlir::ValueRange> {
5497public:
5498 using ClampOpGenericAdaptor::ClampOpGenericAdaptor;
5499 ClampOpAdaptor(ClampOp op);
5500
5501 ::llvm::LogicalResult verify(::mlir::Location loc);
5502};
5503class ClampOp : public ::mlir::Op<ClampOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
5504public:
5505 using Op::Op;
5506 using Op::print;
5507 using Adaptor = ClampOpAdaptor;
5508 template <typename RangeT>
5509 using GenericAdaptor = ClampOpGenericAdaptor<RangeT>;
5510 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
5511 static constexpr int odsIndex_input = 0;
5512 static constexpr int odsIndex_output = 0;
5513 using Properties = FoldAdaptor::Properties;
5514 using ::mlir::InferShapedTypeOpInterface::Trait<ClampOp>::reifyReturnTypeShapes;
5515 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
5516 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("max_val"), ::llvm::StringRef("min_val"), ::llvm::StringRef("nan_mode")};
5517 return ::llvm::ArrayRef(attrNames);
5518 }
5519
5520 ::mlir::StringAttr getMaxValAttrName() {
5521 return getAttributeNameForIndex(index: 0);
5522 }
5523
5524 static ::mlir::StringAttr getMaxValAttrName(::mlir::OperationName name) {
5525 return getAttributeNameForIndex(name, index: 0);
5526 }
5527
5528 ::mlir::StringAttr getMinValAttrName() {
5529 return getAttributeNameForIndex(index: 1);
5530 }
5531
5532 static ::mlir::StringAttr getMinValAttrName(::mlir::OperationName name) {
5533 return getAttributeNameForIndex(name, index: 1);
5534 }
5535
5536 ::mlir::StringAttr getNanModeAttrName() {
5537 return getAttributeNameForIndex(index: 2);
5538 }
5539
5540 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
5541 return getAttributeNameForIndex(name, index: 2);
5542 }
5543
5544 static constexpr ::llvm::StringLiteral getOperationName() {
5545 return ::llvm::StringLiteral("tosa.clamp");
5546 }
5547
5548 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5549 return {index, 1};
5550 }
5551
5552 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
5553 auto [start, length] = getODSOperandIndexAndLength(index);
5554 return getOperation()->getOperands().slice(n: start, m: length);
5555 }
5556
5557 ::mlir::TypedValue<::mlir::TensorType> getInput() {
5558 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
5559 }
5560
5561 ::mlir::OpOperand &getInputMutable() {
5562 auto range = getODSOperandIndexAndLength(index: 0);
5563 return getOperation()->getOpOperand(idx: range.first);
5564 }
5565
5566 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
5567 return {index, 1};
5568 }
5569
5570 ::mlir::Operation::result_range getODSResults(unsigned index) {
5571 auto valueRange = getODSResultIndexAndLength(index);
5572 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
5573 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
5574 }
5575
5576 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
5577 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
5578 }
5579
5580 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5581 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
5582 static llvm::hash_code computePropertiesHash(const Properties &prop);
5583 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
5584 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
5585 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
5586 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5587 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
5588 void writeProperties(::mlir::DialectBytecodeWriter &writer);
5589 ::mlir::Attribute getMinValAttr() {
5590 return ::llvm::cast<::mlir::Attribute>(Val&: getProperties().min_val);
5591 }
5592
5593 ::mlir::Attribute getMinVal();
5594 ::mlir::Attribute getMaxValAttr() {
5595 return ::llvm::cast<::mlir::Attribute>(Val&: getProperties().max_val);
5596 }
5597
5598 ::mlir::Attribute getMaxVal();
5599 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
5600 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
5601 }
5602
5603 ::mlir::tosa::NanPropagationMode getNanMode();
5604 void setMinValAttr(::mlir::Attribute attr) {
5605 getProperties().min_val = attr;
5606 }
5607
5608 void setMaxValAttr(::mlir::Attribute attr) {
5609 getProperties().max_val = attr;
5610 }
5611
5612 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
5613 getProperties().nan_mode = attr;
5614 }
5615
5616 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
5617 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, mlir::tosa::NanPropagationModeAttr nan_mode);
5618 static ClampOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, mlir::tosa::NanPropagationModeAttr nan_mode);
5619 static ClampOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, mlir::tosa::NanPropagationModeAttr nan_mode);
5620 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, mlir::tosa::NanPropagationModeAttr nan_mode);
5621 static ClampOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, mlir::tosa::NanPropagationModeAttr nan_mode);
5622 static ClampOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, mlir::tosa::NanPropagationModeAttr nan_mode);
5623 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
5624 static ClampOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
5625 static ClampOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
5626 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
5627 static ClampOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
5628 static ClampOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Attribute min_val, ::mlir::Attribute max_val, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
5629 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
5630 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5631 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
5632 static ClampOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5633 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
5634 static ClampOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5635 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5636 static ClampOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5637 static ClampOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5638 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
5639 ::llvm::LogicalResult verifyInvariantsImpl();
5640 ::llvm::LogicalResult verifyInvariants();
5641 ::llvm::LogicalResult verify();
5642 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
5643 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
5644 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
5645 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
5646 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
5647private:
5648 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
5649 return getAttributeNameForIndex(name: (*this)->getName(), index);
5650 }
5651
5652 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
5653 assert(index < 3 && "invalid attribute index");
5654 assert(name.getStringRef() == getOperationName() && "invalid operation name");
5655 assert(name.isRegistered() && "Operation isn't registered, missing a "
5656 "dependent dialect loading?");
5657 return name.getAttributeNames()[index];
5658 }
5659
5660 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
5661public:
5662};
5663
5664} // namespace mlir::tosa
5665MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ClampOp)
5666MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ClampOpGenericAdaptorBase::Properties)
5667
5668namespace mlir::tosa {
5669
5670
5671//===----------------------------------------------------------------------===//
5672// mlir::tosa::ClzOp declarations
5673//===----------------------------------------------------------------------===//
5674
5675namespace detail {
5676
5677class ClzOpGenericAdaptorBase {
5678public:
5679 using Properties = ::mlir::EmptyProperties;
5680protected:
5681 ::mlir::DictionaryAttr odsAttrs;
5682 ::std::optional<::mlir::OperationName> odsOpName;
5683 Properties properties;
5684 ::mlir::RegionRange odsRegions;
5685public:
5686 ClzOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
5687 odsOpName.emplace(args: "tosa.clz", args: odsAttrs.getContext());
5688 }
5689
5690 ClzOpGenericAdaptorBase(ClzOp op);
5691
5692 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
5693 return {index, 1};
5694 }
5695
5696 const Properties &getProperties() {
5697 return properties;
5698 }
5699
5700 ::mlir::DictionaryAttr getAttributes() {
5701 return odsAttrs;
5702 }
5703
5704};
5705
5706} // namespace detail
5707template <typename RangeT>
5708class ClzOpGenericAdaptor : public detail::ClzOpGenericAdaptorBase {
5709 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
5710 using Base = detail::ClzOpGenericAdaptorBase;
5711 static constexpr int odsIndex_input1 = 0;
5712public:
5713 ClzOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
5714
5715 ClzOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ClzOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
5716
5717 ClzOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ClzOpGenericAdaptor(values, attrs, Properties{}, {}) {}
5718
5719 ClzOpGenericAdaptor(RangeT values, const ClzOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
5720
5721 template <typename LateInst = ClzOp, typename = std::enable_if_t<std::is_same_v<LateInst, ClzOp>>>
5722 ClzOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
5723
5724 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5725 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
5726 }
5727
5728 RangeT getODSOperands(unsigned index) {
5729 auto valueRange = getODSOperandIndexAndLength(index);
5730 return {std::next(odsOperands.begin(), valueRange.first),
5731 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5732 }
5733
5734 ValueT getInput1() {
5735 return (*getODSOperands(index: 0).begin());
5736 }
5737
5738 RangeT getOperands() {
5739 return odsOperands;
5740 }
5741
5742private:
5743 RangeT odsOperands;
5744};
5745class ClzOpAdaptor : public ClzOpGenericAdaptor<::mlir::ValueRange> {
5746public:
5747 using ClzOpGenericAdaptor::ClzOpGenericAdaptor;
5748 ClzOpAdaptor(ClzOp op);
5749
5750 ::llvm::LogicalResult verify(::mlir::Location loc);
5751};
5752class ClzOp : public ::mlir::Op<ClzOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
5753public:
5754 using Op::Op;
5755 using Op::print;
5756 using Adaptor = ClzOpAdaptor;
5757 template <typename RangeT>
5758 using GenericAdaptor = ClzOpGenericAdaptor<RangeT>;
5759 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
5760 static constexpr int odsIndex_input1 = 0;
5761 static constexpr int odsIndex_output = 0;
5762 using Properties = FoldAdaptor::Properties;
5763 using ::mlir::InferShapedTypeOpInterface::Trait<ClzOp>::reifyReturnTypeShapes;
5764 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
5765 return {};
5766 }
5767
5768 static constexpr ::llvm::StringLiteral getOperationName() {
5769 return ::llvm::StringLiteral("tosa.clz");
5770 }
5771
5772 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5773 return {index, 1};
5774 }
5775
5776 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
5777 auto [start, length] = getODSOperandIndexAndLength(index);
5778 return getOperation()->getOperands().slice(n: start, m: length);
5779 }
5780
5781 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
5782 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
5783 }
5784
5785 ::mlir::OpOperand &getInput1Mutable() {
5786 auto range = getODSOperandIndexAndLength(index: 0);
5787 return getOperation()->getOpOperand(idx: range.first);
5788 }
5789
5790 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
5791 return {index, 1};
5792 }
5793
5794 ::mlir::Operation::result_range getODSResults(unsigned index) {
5795 auto valueRange = getODSResultIndexAndLength(index);
5796 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
5797 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
5798 }
5799
5800 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
5801 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
5802 }
5803
5804 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5805 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
5806 static llvm::hash_code computePropertiesHash(const Properties &prop);
5807 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
5808 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
5809 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
5810 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5811 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
5812 static ClzOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
5813 static ClzOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
5814 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
5815 static ClzOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
5816 static ClzOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
5817 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5818 static ClzOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5819 static ClzOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
5820 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5821 static ClzOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5822 static ClzOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
5823 ::llvm::LogicalResult verifyInvariantsImpl();
5824 ::llvm::LogicalResult verifyInvariants();
5825 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
5826 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
5827 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
5828 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
5829public:
5830};
5831
5832} // namespace mlir::tosa
5833MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ClzOp)
5834
5835namespace mlir::tosa {
5836
5837
5838//===----------------------------------------------------------------------===//
5839// mlir::tosa::ConcatOp declarations
5840//===----------------------------------------------------------------------===//
5841
5842namespace detail {
5843
5844class ConcatOpGenericAdaptorBase {
5845public:
5846 struct Properties {
5847 using axisTy = ::mlir::IntegerAttr;
5848 axisTy axis;
5849
5850 auto getAxis() const {
5851 auto &propStorage = this->axis;
5852 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
5853 }
5854 void setAxis(const ::mlir::IntegerAttr &propValue) {
5855 this->axis = propValue;
5856 }
5857 bool operator==(const Properties &rhs) const {
5858 return
5859 rhs.axis == this->axis &&
5860 true;
5861 }
5862 bool operator!=(const Properties &rhs) const {
5863 return !(*this == rhs);
5864 }
5865 };
5866protected:
5867 ::mlir::DictionaryAttr odsAttrs;
5868 ::std::optional<::mlir::OperationName> odsOpName;
5869 Properties properties;
5870 ::mlir::RegionRange odsRegions;
5871public:
5872 ConcatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
5873 odsOpName.emplace(args: "tosa.concat", args: odsAttrs.getContext());
5874 }
5875
5876 ConcatOpGenericAdaptorBase(ConcatOp op);
5877
5878 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
5879 const Properties &getProperties() {
5880 return properties;
5881 }
5882
5883 ::mlir::DictionaryAttr getAttributes() {
5884 return odsAttrs;
5885 }
5886
5887 ::mlir::IntegerAttr getAxisAttr() {
5888 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
5889 return attr;
5890 }
5891
5892 uint32_t getAxis();
5893};
5894
5895} // namespace detail
5896template <typename RangeT>
5897class ConcatOpGenericAdaptor : public detail::ConcatOpGenericAdaptorBase {
5898 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
5899 using Base = detail::ConcatOpGenericAdaptorBase;
5900 static constexpr int odsIndex_input1 = 0;
5901public:
5902 ConcatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
5903
5904 ConcatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ConcatOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
5905
5906 ConcatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ConcatOpGenericAdaptor(values, attrs, Properties{}, {}) {}
5907
5908 ConcatOpGenericAdaptor(RangeT values, const ConcatOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
5909
5910 template <typename LateInst = ConcatOp, typename = std::enable_if_t<std::is_same_v<LateInst, ConcatOp>>>
5911 ConcatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
5912
5913 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
5914 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
5915 }
5916
5917 RangeT getODSOperands(unsigned index) {
5918 auto valueRange = getODSOperandIndexAndLength(index);
5919 return {std::next(odsOperands.begin(), valueRange.first),
5920 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5921 }
5922
5923 RangeT getInput1() {
5924 return getODSOperands(index: 0);
5925 }
5926
5927 RangeT getOperands() {
5928 return odsOperands;
5929 }
5930
5931private:
5932 RangeT odsOperands;
5933};
5934class ConcatOpAdaptor : public ConcatOpGenericAdaptor<::mlir::ValueRange> {
5935public:
5936 using ConcatOpGenericAdaptor::ConcatOpGenericAdaptor;
5937 ConcatOpAdaptor(ConcatOp op);
5938
5939 ::llvm::LogicalResult verify(::mlir::Location loc);
5940};
5941class ConcatOp : public ::mlir::Op<ConcatOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
5942public:
5943 using Op::Op;
5944 using Op::print;
5945 using Adaptor = ConcatOpAdaptor;
5946 template <typename RangeT>
5947 using GenericAdaptor = ConcatOpGenericAdaptor<RangeT>;
5948 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
5949 static constexpr int odsIndex_input1 = 0;
5950 static constexpr int odsIndex_output = 0;
5951 using Properties = FoldAdaptor::Properties;
5952 using ::mlir::InferTypeOpInterface::Trait<ConcatOp>::refineReturnTypes;
5953 using ::mlir::InferShapedTypeOpInterface::Trait<ConcatOp>::reifyReturnTypeShapes;
5954 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
5955 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis")};
5956 return ::llvm::ArrayRef(attrNames);
5957 }
5958
5959 ::mlir::StringAttr getAxisAttrName() {
5960 return getAttributeNameForIndex(index: 0);
5961 }
5962
5963 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
5964 return getAttributeNameForIndex(name, index: 0);
5965 }
5966
5967 static constexpr ::llvm::StringLiteral getOperationName() {
5968 return ::llvm::StringLiteral("tosa.concat");
5969 }
5970
5971 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
5972 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
5973 auto [start, length] = getODSOperandIndexAndLength(index);
5974 return getOperation()->getOperands().slice(n: start, m: length);
5975 }
5976
5977 ::mlir::Operation::operand_range getInput1() {
5978 return getODSOperands(index: 0);
5979 }
5980
5981 ::mlir::MutableOperandRange getInput1Mutable();
5982 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
5983 return {index, 1};
5984 }
5985
5986 ::mlir::Operation::result_range getODSResults(unsigned index) {
5987 auto valueRange = getODSResultIndexAndLength(index);
5988 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
5989 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
5990 }
5991
5992 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
5993 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
5994 }
5995
5996 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
5997 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
5998 static llvm::hash_code computePropertiesHash(const Properties &prop);
5999 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
6000 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
6001 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
6002 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6003 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
6004 void writeProperties(::mlir::DialectBytecodeWriter &writer);
6005 ::mlir::IntegerAttr getAxisAttr() {
6006 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
6007 }
6008
6009 uint32_t getAxis();
6010 void setAxisAttr(::mlir::IntegerAttr attr) {
6011 getProperties().axis = attr;
6012 }
6013
6014 void setAxis(uint32_t attrValue);
6015 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6016 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6017 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6018 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6019 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6020 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6021 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6022 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6023 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange input1, ::mlir::IntegerAttr axis);
6024 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange input1, uint32_t axis);
6025 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::ValueRange input1, uint32_t axis);
6026 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::ValueRange input1, uint32_t axis);
6027 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange input1, uint32_t axis);
6028 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange input1, uint32_t axis);
6029 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange input1, uint32_t axis);
6030 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange input1, uint32_t axis);
6031 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange input1, uint32_t axis);
6032 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange input1, uint32_t axis);
6033 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6034 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6035 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6036 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6037 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6038 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6039 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6040 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6041 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6042 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6043 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6044 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6045 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6046 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6047 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6048 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6049 static ConcatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6050 static ConcatOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6051 ::llvm::LogicalResult verifyInvariantsImpl();
6052 ::llvm::LogicalResult verifyInvariants();
6053 ::llvm::LogicalResult verify();
6054 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
6055 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
6056 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
6057 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
6058 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
6059 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
6060private:
6061 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
6062 return getAttributeNameForIndex(name: (*this)->getName(), index);
6063 }
6064
6065 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
6066 assert(index < 1 && "invalid attribute index");
6067 assert(name.getStringRef() == getOperationName() && "invalid operation name");
6068 assert(name.isRegistered() && "Operation isn't registered, missing a "
6069 "dependent dialect loading?");
6070 return name.getAttributeNames()[index];
6071 }
6072
6073 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
6074public:
6075 static ::llvm::LogicalResult
6076 inferReturnTypeComponents(::mlir::MLIRContext *context,
6077 std::optional<::mlir::Location> location,
6078 Adaptor adaptor,
6079 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
6080
6081
6082 /// Returns true when two result types are compatible for this op;
6083 /// Method used by InferTypeOpInterface.
6084 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
6085};
6086
6087} // namespace mlir::tosa
6088MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ConcatOp)
6089MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ConcatOpGenericAdaptorBase::Properties)
6090
6091namespace mlir::tosa {
6092
6093
6094//===----------------------------------------------------------------------===//
6095// mlir::tosa::ConcatShapeOp declarations
6096//===----------------------------------------------------------------------===//
6097
6098namespace detail {
6099
6100class ConcatShapeOpGenericAdaptorBase {
6101public:
6102 using Properties = ::mlir::EmptyProperties;
6103protected:
6104 ::mlir::DictionaryAttr odsAttrs;
6105 ::std::optional<::mlir::OperationName> odsOpName;
6106 Properties properties;
6107 ::mlir::RegionRange odsRegions;
6108public:
6109 ConcatShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
6110 odsOpName.emplace(args: "tosa.concat_shape", args: odsAttrs.getContext());
6111 }
6112
6113 ConcatShapeOpGenericAdaptorBase(ConcatShapeOp op);
6114
6115 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
6116 const Properties &getProperties() {
6117 return properties;
6118 }
6119
6120 ::mlir::DictionaryAttr getAttributes() {
6121 return odsAttrs;
6122 }
6123
6124};
6125
6126} // namespace detail
6127template <typename RangeT>
6128class ConcatShapeOpGenericAdaptor : public detail::ConcatShapeOpGenericAdaptorBase {
6129 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
6130 using Base = detail::ConcatShapeOpGenericAdaptorBase;
6131 static constexpr int odsIndex_input = 0;
6132public:
6133 ConcatShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
6134
6135 ConcatShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ConcatShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
6136
6137 ConcatShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ConcatShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
6138
6139 ConcatShapeOpGenericAdaptor(RangeT values, const ConcatShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
6140
6141 template <typename LateInst = ConcatShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, ConcatShapeOp>>>
6142 ConcatShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
6143
6144 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
6145 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
6146 }
6147
6148 RangeT getODSOperands(unsigned index) {
6149 auto valueRange = getODSOperandIndexAndLength(index);
6150 return {std::next(odsOperands.begin(), valueRange.first),
6151 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6152 }
6153
6154 RangeT getInput() {
6155 return getODSOperands(index: 0);
6156 }
6157
6158 RangeT getOperands() {
6159 return odsOperands;
6160 }
6161
6162private:
6163 RangeT odsOperands;
6164};
6165class ConcatShapeOpAdaptor : public ConcatShapeOpGenericAdaptor<::mlir::ValueRange> {
6166public:
6167 using ConcatShapeOpGenericAdaptor::ConcatShapeOpGenericAdaptor;
6168 ConcatShapeOpAdaptor(ConcatShapeOp op);
6169
6170 ::llvm::LogicalResult verify(::mlir::Location loc);
6171};
6172class ConcatShapeOp : public ::mlir::Op<ConcatShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
6173public:
6174 using Op::Op;
6175 using Op::print;
6176 using Adaptor = ConcatShapeOpAdaptor;
6177 template <typename RangeT>
6178 using GenericAdaptor = ConcatShapeOpGenericAdaptor<RangeT>;
6179 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
6180 static constexpr int odsIndex_input = 0;
6181 static constexpr int odsIndex_output = 0;
6182 using Properties = FoldAdaptor::Properties;
6183 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
6184 return {};
6185 }
6186
6187 static constexpr ::llvm::StringLiteral getOperationName() {
6188 return ::llvm::StringLiteral("tosa.concat_shape");
6189 }
6190
6191 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
6192 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
6193 auto [start, length] = getODSOperandIndexAndLength(index);
6194 return getOperation()->getOperands().slice(n: start, m: length);
6195 }
6196
6197 ::mlir::Operation::operand_range getInput() {
6198 return getODSOperands(index: 0);
6199 }
6200
6201 ::mlir::MutableOperandRange getInputMutable();
6202 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
6203 return {index, 1};
6204 }
6205
6206 ::mlir::Operation::result_range getODSResults(unsigned index) {
6207 auto valueRange = getODSResultIndexAndLength(index);
6208 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
6209 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
6210 }
6211
6212 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
6213 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
6214 }
6215
6216 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6217 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
6218 static llvm::hash_code computePropertiesHash(const Properties &prop);
6219 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
6220 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
6221 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
6222 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6223 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange input);
6224 static ConcatShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::ValueRange input);
6225 static ConcatShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::ValueRange input);
6226 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6227 static ConcatShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6228 static ConcatShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6229 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6230 static ConcatShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6231 static ConcatShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6232 ::llvm::LogicalResult verifyInvariantsImpl();
6233 ::llvm::LogicalResult verifyInvariants();
6234 ::llvm::LogicalResult verify();
6235 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
6236 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
6237 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
6238 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
6239public:
6240};
6241
6242} // namespace mlir::tosa
6243MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ConcatShapeOp)
6244
6245namespace mlir::tosa {
6246
6247
6248//===----------------------------------------------------------------------===//
6249// mlir::tosa::ConstOp declarations
6250//===----------------------------------------------------------------------===//
6251
6252namespace detail {
6253
6254class ConstOpGenericAdaptorBase {
6255public:
6256 struct Properties {
6257 using valuesTy = ::mlir::ElementsAttr;
6258 valuesTy values;
6259
6260 auto getValues() const {
6261 auto &propStorage = this->values;
6262 return ::llvm::cast<::mlir::ElementsAttr>(Val: propStorage);
6263 }
6264 void setValues(const ::mlir::ElementsAttr &propValue) {
6265 this->values = propValue;
6266 }
6267 bool operator==(const Properties &rhs) const {
6268 return
6269 rhs.values == this->values &&
6270 true;
6271 }
6272 bool operator!=(const Properties &rhs) const {
6273 return !(*this == rhs);
6274 }
6275 };
6276protected:
6277 ::mlir::DictionaryAttr odsAttrs;
6278 ::std::optional<::mlir::OperationName> odsOpName;
6279 Properties properties;
6280 ::mlir::RegionRange odsRegions;
6281public:
6282 ConstOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
6283 odsOpName.emplace(args: "tosa.const", args: odsAttrs.getContext());
6284 }
6285
6286 ConstOpGenericAdaptorBase(ConstOp op);
6287
6288 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
6289 return {index, 1};
6290 }
6291
6292 const Properties &getProperties() {
6293 return properties;
6294 }
6295
6296 ::mlir::DictionaryAttr getAttributes() {
6297 return odsAttrs;
6298 }
6299
6300 ::mlir::ElementsAttr getValuesAttr() {
6301 auto attr = ::llvm::cast<::mlir::ElementsAttr>(Val: getProperties().values);
6302 return attr;
6303 }
6304
6305 ::mlir::ElementsAttr getValues();
6306};
6307
6308} // namespace detail
6309template <typename RangeT>
6310class ConstOpGenericAdaptor : public detail::ConstOpGenericAdaptorBase {
6311 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
6312 using Base = detail::ConstOpGenericAdaptorBase;
6313public:
6314 ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
6315
6316 ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ConstOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
6317
6318 ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ConstOpGenericAdaptor(values, attrs, Properties{}, {}) {}
6319
6320 ConstOpGenericAdaptor(RangeT values, const ConstOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
6321
6322 template <typename LateInst = ConstOp, typename = std::enable_if_t<std::is_same_v<LateInst, ConstOp>>>
6323 ConstOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
6324
6325 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
6326 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
6327 }
6328
6329 RangeT getODSOperands(unsigned index) {
6330 auto valueRange = getODSOperandIndexAndLength(index);
6331 return {std::next(odsOperands.begin(), valueRange.first),
6332 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6333 }
6334
6335 RangeT getOperands() {
6336 return odsOperands;
6337 }
6338
6339private:
6340 RangeT odsOperands;
6341};
6342class ConstOpAdaptor : public ConstOpGenericAdaptor<::mlir::ValueRange> {
6343public:
6344 using ConstOpGenericAdaptor::ConstOpGenericAdaptor;
6345 ConstOpAdaptor(ConstOp op);
6346
6347 ::llvm::LogicalResult verify(::mlir::Location loc);
6348};
6349class ConstOp : public ::mlir::Op<ConstOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
6350public:
6351 using Op::Op;
6352 using Op::print;
6353 using Adaptor = ConstOpAdaptor;
6354 template <typename RangeT>
6355 using GenericAdaptor = ConstOpGenericAdaptor<RangeT>;
6356 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
6357 static constexpr int odsIndex_output = 0;
6358 using Properties = FoldAdaptor::Properties;
6359 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
6360 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("values")};
6361 return ::llvm::ArrayRef(attrNames);
6362 }
6363
6364 ::mlir::StringAttr getValuesAttrName() {
6365 return getAttributeNameForIndex(index: 0);
6366 }
6367
6368 static ::mlir::StringAttr getValuesAttrName(::mlir::OperationName name) {
6369 return getAttributeNameForIndex(name, index: 0);
6370 }
6371
6372 static constexpr ::llvm::StringLiteral getOperationName() {
6373 return ::llvm::StringLiteral("tosa.const");
6374 }
6375
6376 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
6377 return {index, 1};
6378 }
6379
6380 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
6381 auto [start, length] = getODSOperandIndexAndLength(index);
6382 return getOperation()->getOperands().slice(n: start, m: length);
6383 }
6384
6385 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
6386 return {index, 1};
6387 }
6388
6389 ::mlir::Operation::result_range getODSResults(unsigned index) {
6390 auto valueRange = getODSResultIndexAndLength(index);
6391 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
6392 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
6393 }
6394
6395 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
6396 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
6397 }
6398
6399 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6400 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
6401 static llvm::hash_code computePropertiesHash(const Properties &prop);
6402 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
6403 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
6404 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
6405 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6406 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
6407 void writeProperties(::mlir::DialectBytecodeWriter &writer);
6408 ::mlir::ElementsAttr getValuesAttr() {
6409 return ::llvm::cast<::mlir::ElementsAttr>(Val&: getProperties().values);
6410 }
6411
6412 ::mlir::ElementsAttr getValues();
6413 void setValuesAttr(::mlir::ElementsAttr attr) {
6414 getProperties().values = attr;
6415 }
6416
6417 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ElementsAttr values);
6418 static ConstOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::ElementsAttr values);
6419 static ConstOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::ElementsAttr values);
6420 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ElementsAttr values);
6421 static ConstOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ElementsAttr values);
6422 static ConstOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ElementsAttr values);
6423 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6424 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6425 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6426 static ConstOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6427 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6428 static ConstOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6429 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6430 static ConstOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6431 static ConstOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6432 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6433 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6434 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6435 static ConstOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6436 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6437 static ConstOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6438 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6439 static ConstOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6440 static ConstOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6441 ::llvm::LogicalResult verifyInvariantsImpl();
6442 ::llvm::LogicalResult verifyInvariants();
6443 ::llvm::LogicalResult verify();
6444 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
6445 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
6446 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
6447 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
6448private:
6449 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
6450 return getAttributeNameForIndex(name: (*this)->getName(), index);
6451 }
6452
6453 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
6454 assert(index < 1 && "invalid attribute index");
6455 assert(name.getStringRef() == getOperationName() && "invalid operation name");
6456 assert(name.isRegistered() && "Operation isn't registered, missing a "
6457 "dependent dialect loading?");
6458 return name.getAttributeNames()[index];
6459 }
6460
6461 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
6462public:
6463};
6464
6465} // namespace mlir::tosa
6466MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ConstOp)
6467MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ConstOpGenericAdaptorBase::Properties)
6468
6469namespace mlir::tosa {
6470
6471
6472//===----------------------------------------------------------------------===//
6473// mlir::tosa::ConstShapeOp declarations
6474//===----------------------------------------------------------------------===//
6475
6476namespace detail {
6477
6478class ConstShapeOpGenericAdaptorBase {
6479public:
6480 struct Properties {
6481 using valuesTy = ::mlir::DenseIntElementsAttr;
6482 valuesTy values;
6483
6484 auto getValues() const {
6485 auto &propStorage = this->values;
6486 return ::llvm::cast<::mlir::DenseIntElementsAttr>(Val: propStorage);
6487 }
6488 void setValues(const ::mlir::DenseIntElementsAttr &propValue) {
6489 this->values = propValue;
6490 }
6491 bool operator==(const Properties &rhs) const {
6492 return
6493 rhs.values == this->values &&
6494 true;
6495 }
6496 bool operator!=(const Properties &rhs) const {
6497 return !(*this == rhs);
6498 }
6499 };
6500protected:
6501 ::mlir::DictionaryAttr odsAttrs;
6502 ::std::optional<::mlir::OperationName> odsOpName;
6503 Properties properties;
6504 ::mlir::RegionRange odsRegions;
6505public:
6506 ConstShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
6507 odsOpName.emplace(args: "tosa.const_shape", args: odsAttrs.getContext());
6508 }
6509
6510 ConstShapeOpGenericAdaptorBase(ConstShapeOp op);
6511
6512 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
6513 return {index, 1};
6514 }
6515
6516 const Properties &getProperties() {
6517 return properties;
6518 }
6519
6520 ::mlir::DictionaryAttr getAttributes() {
6521 return odsAttrs;
6522 }
6523
6524 ::mlir::DenseIntElementsAttr getValuesAttr() {
6525 auto attr = ::llvm::cast<::mlir::DenseIntElementsAttr>(Val: getProperties().values);
6526 return attr;
6527 }
6528
6529 ::mlir::DenseIntElementsAttr getValues();
6530};
6531
6532} // namespace detail
6533template <typename RangeT>
6534class ConstShapeOpGenericAdaptor : public detail::ConstShapeOpGenericAdaptorBase {
6535 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
6536 using Base = detail::ConstShapeOpGenericAdaptorBase;
6537public:
6538 ConstShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
6539
6540 ConstShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ConstShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
6541
6542 ConstShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ConstShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
6543
6544 ConstShapeOpGenericAdaptor(RangeT values, const ConstShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
6545
6546 template <typename LateInst = ConstShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, ConstShapeOp>>>
6547 ConstShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
6548
6549 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
6550 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
6551 }
6552
6553 RangeT getODSOperands(unsigned index) {
6554 auto valueRange = getODSOperandIndexAndLength(index);
6555 return {std::next(odsOperands.begin(), valueRange.first),
6556 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6557 }
6558
6559 RangeT getOperands() {
6560 return odsOperands;
6561 }
6562
6563private:
6564 RangeT odsOperands;
6565};
6566class ConstShapeOpAdaptor : public ConstShapeOpGenericAdaptor<::mlir::ValueRange> {
6567public:
6568 using ConstShapeOpGenericAdaptor::ConstShapeOpGenericAdaptor;
6569 ConstShapeOpAdaptor(ConstShapeOp op);
6570
6571 ::llvm::LogicalResult verify(::mlir::Location loc);
6572};
6573class ConstShapeOp : public ::mlir::Op<ConstShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
6574public:
6575 using Op::Op;
6576 using Op::print;
6577 using Adaptor = ConstShapeOpAdaptor;
6578 template <typename RangeT>
6579 using GenericAdaptor = ConstShapeOpGenericAdaptor<RangeT>;
6580 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
6581 static constexpr int odsIndex_output = 0;
6582 using Properties = FoldAdaptor::Properties;
6583 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
6584 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("values")};
6585 return ::llvm::ArrayRef(attrNames);
6586 }
6587
6588 ::mlir::StringAttr getValuesAttrName() {
6589 return getAttributeNameForIndex(index: 0);
6590 }
6591
6592 static ::mlir::StringAttr getValuesAttrName(::mlir::OperationName name) {
6593 return getAttributeNameForIndex(name, index: 0);
6594 }
6595
6596 static constexpr ::llvm::StringLiteral getOperationName() {
6597 return ::llvm::StringLiteral("tosa.const_shape");
6598 }
6599
6600 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
6601 return {index, 1};
6602 }
6603
6604 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
6605 auto [start, length] = getODSOperandIndexAndLength(index);
6606 return getOperation()->getOperands().slice(n: start, m: length);
6607 }
6608
6609 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
6610 return {index, 1};
6611 }
6612
6613 ::mlir::Operation::result_range getODSResults(unsigned index) {
6614 auto valueRange = getODSResultIndexAndLength(index);
6615 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
6616 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
6617 }
6618
6619 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
6620 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
6621 }
6622
6623 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6624 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
6625 static llvm::hash_code computePropertiesHash(const Properties &prop);
6626 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
6627 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
6628 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
6629 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6630 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
6631 void writeProperties(::mlir::DialectBytecodeWriter &writer);
6632 ::mlir::DenseIntElementsAttr getValuesAttr() {
6633 return ::llvm::cast<::mlir::DenseIntElementsAttr>(Val&: getProperties().values);
6634 }
6635
6636 ::mlir::DenseIntElementsAttr getValues();
6637 void setValuesAttr(::mlir::DenseIntElementsAttr attr) {
6638 getProperties().values = attr;
6639 }
6640
6641 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::DenseIntElementsAttr values);
6642 static ConstShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::DenseIntElementsAttr values);
6643 static ConstShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::DenseIntElementsAttr values);
6644 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr values);
6645 static ConstShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr values);
6646 static ConstShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr values);
6647 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6648 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6649 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6650 static ConstShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6651 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6652 static ConstShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6653 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6654 static ConstShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6655 static ConstShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6656 ::llvm::LogicalResult verifyInvariantsImpl();
6657 ::llvm::LogicalResult verifyInvariants();
6658 ::llvm::LogicalResult verify();
6659 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
6660 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
6661 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
6662 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
6663private:
6664 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
6665 return getAttributeNameForIndex(name: (*this)->getName(), index);
6666 }
6667
6668 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
6669 assert(index < 1 && "invalid attribute index");
6670 assert(name.getStringRef() == getOperationName() && "invalid operation name");
6671 assert(name.isRegistered() && "Operation isn't registered, missing a "
6672 "dependent dialect loading?");
6673 return name.getAttributeNames()[index];
6674 }
6675
6676 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
6677public:
6678};
6679
6680} // namespace mlir::tosa
6681MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ConstShapeOp)
6682MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ConstShapeOpGenericAdaptorBase::Properties)
6683
6684namespace mlir::tosa {
6685
6686
6687//===----------------------------------------------------------------------===//
6688// mlir::tosa::Conv2DBlockScaledOp declarations
6689//===----------------------------------------------------------------------===//
6690
6691namespace detail {
6692
6693class Conv2DBlockScaledOpGenericAdaptorBase {
6694public:
6695 struct Properties {
6696 using block_sizeTy = mlir::tosa::BlockSizeAttr;
6697 block_sizeTy block_size;
6698
6699 auto getBlockSize() const {
6700 auto &propStorage = this->block_size;
6701 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: propStorage);
6702 }
6703 void setBlockSize(const mlir::tosa::BlockSizeAttr &propValue) {
6704 this->block_size = propValue;
6705 }
6706 bool operator==(const Properties &rhs) const {
6707 return
6708 rhs.block_size == this->block_size &&
6709 true;
6710 }
6711 bool operator!=(const Properties &rhs) const {
6712 return !(*this == rhs);
6713 }
6714 };
6715protected:
6716 ::mlir::DictionaryAttr odsAttrs;
6717 ::std::optional<::mlir::OperationName> odsOpName;
6718 Properties properties;
6719 ::mlir::RegionRange odsRegions;
6720public:
6721 Conv2DBlockScaledOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
6722 odsOpName.emplace(args: "tosa.conv2d_block_scaled", args: odsAttrs.getContext());
6723 }
6724
6725 Conv2DBlockScaledOpGenericAdaptorBase(Conv2DBlockScaledOp op);
6726
6727 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
6728 return {index, 1};
6729 }
6730
6731 const Properties &getProperties() {
6732 return properties;
6733 }
6734
6735 ::mlir::DictionaryAttr getAttributes() {
6736 return odsAttrs;
6737 }
6738
6739 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
6740 auto attr = ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: getProperties().block_size);
6741 return attr;
6742 }
6743
6744 ::mlir::tosa::BlockSize getBlockSize();
6745};
6746
6747} // namespace detail
6748template <typename RangeT>
6749class Conv2DBlockScaledOpGenericAdaptor : public detail::Conv2DBlockScaledOpGenericAdaptorBase {
6750 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
6751 using Base = detail::Conv2DBlockScaledOpGenericAdaptorBase;
6752 static constexpr int odsIndex_input_data = 0;
6753 static constexpr int odsIndex_input_scale = 1;
6754 static constexpr int odsIndex_weight_data = 2;
6755 static constexpr int odsIndex_weight_scale = 3;
6756 static constexpr int odsIndex_bias = 4;
6757 static constexpr int odsIndex_pad = 5;
6758 static constexpr int odsIndex_stride = 6;
6759 static constexpr int odsIndex_dilation = 7;
6760public:
6761 Conv2DBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
6762
6763 Conv2DBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DBlockScaledOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
6764
6765 Conv2DBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : Conv2DBlockScaledOpGenericAdaptor(values, attrs, Properties{}, {}) {}
6766
6767 Conv2DBlockScaledOpGenericAdaptor(RangeT values, const Conv2DBlockScaledOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
6768
6769 template <typename LateInst = Conv2DBlockScaledOp, typename = std::enable_if_t<std::is_same_v<LateInst, Conv2DBlockScaledOp>>>
6770 Conv2DBlockScaledOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
6771
6772 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
6773 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
6774 }
6775
6776 RangeT getODSOperands(unsigned index) {
6777 auto valueRange = getODSOperandIndexAndLength(index);
6778 return {std::next(odsOperands.begin(), valueRange.first),
6779 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6780 }
6781
6782 ValueT getInputData() {
6783 return (*getODSOperands(index: 0).begin());
6784 }
6785
6786 ValueT getInputScale() {
6787 return (*getODSOperands(index: 1).begin());
6788 }
6789
6790 ValueT getWeightData() {
6791 return (*getODSOperands(index: 2).begin());
6792 }
6793
6794 ValueT getWeightScale() {
6795 return (*getODSOperands(index: 3).begin());
6796 }
6797
6798 ValueT getBias() {
6799 return (*getODSOperands(index: 4).begin());
6800 }
6801
6802 ValueT getPad() {
6803 return (*getODSOperands(index: 5).begin());
6804 }
6805
6806 ValueT getStride() {
6807 return (*getODSOperands(index: 6).begin());
6808 }
6809
6810 ValueT getDilation() {
6811 return (*getODSOperands(index: 7).begin());
6812 }
6813
6814 RangeT getOperands() {
6815 return odsOperands;
6816 }
6817
6818private:
6819 RangeT odsOperands;
6820};
6821class Conv2DBlockScaledOpAdaptor : public Conv2DBlockScaledOpGenericAdaptor<::mlir::ValueRange> {
6822public:
6823 using Conv2DBlockScaledOpGenericAdaptor::Conv2DBlockScaledOpGenericAdaptor;
6824 Conv2DBlockScaledOpAdaptor(Conv2DBlockScaledOp op);
6825
6826 ::llvm::LogicalResult verify(::mlir::Location loc);
6827};
6828class Conv2DBlockScaledOp : public ::mlir::Op<Conv2DBlockScaledOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
6829public:
6830 using Op::Op;
6831 using Op::print;
6832 using Adaptor = Conv2DBlockScaledOpAdaptor;
6833 template <typename RangeT>
6834 using GenericAdaptor = Conv2DBlockScaledOpGenericAdaptor<RangeT>;
6835 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
6836 static constexpr int odsIndex_input_data = 0;
6837 static constexpr int odsIndex_input_scale = 1;
6838 static constexpr int odsIndex_weight_data = 2;
6839 static constexpr int odsIndex_weight_scale = 3;
6840 static constexpr int odsIndex_bias = 4;
6841 static constexpr int odsIndex_pad = 5;
6842 static constexpr int odsIndex_stride = 6;
6843 static constexpr int odsIndex_dilation = 7;
6844 static constexpr int odsIndex_output = 0;
6845 using Properties = FoldAdaptor::Properties;
6846 using ::mlir::InferShapedTypeOpInterface::Trait<Conv2DBlockScaledOp>::reifyReturnTypeShapes;
6847 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
6848 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("block_size")};
6849 return ::llvm::ArrayRef(attrNames);
6850 }
6851
6852 ::mlir::StringAttr getBlockSizeAttrName() {
6853 return getAttributeNameForIndex(index: 0);
6854 }
6855
6856 static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) {
6857 return getAttributeNameForIndex(name, index: 0);
6858 }
6859
6860 static constexpr ::llvm::StringLiteral getOperationName() {
6861 return ::llvm::StringLiteral("tosa.conv2d_block_scaled");
6862 }
6863
6864 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
6865 return {index, 1};
6866 }
6867
6868 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
6869 auto [start, length] = getODSOperandIndexAndLength(index);
6870 return getOperation()->getOperands().slice(n: start, m: length);
6871 }
6872
6873 ::mlir::TypedValue<::mlir::TensorType> getInputData() {
6874 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
6875 }
6876
6877 ::mlir::TypedValue<::mlir::TensorType> getInputScale() {
6878 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
6879 }
6880
6881 ::mlir::TypedValue<::mlir::TensorType> getWeightData() {
6882 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
6883 }
6884
6885 ::mlir::TypedValue<::mlir::TensorType> getWeightScale() {
6886 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
6887 }
6888
6889 ::mlir::TypedValue<::mlir::TensorType> getBias() {
6890 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 4).begin());
6891 }
6892
6893 ::mlir::TypedValue<::mlir::Type> getPad() {
6894 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 5).begin());
6895 }
6896
6897 ::mlir::TypedValue<::mlir::Type> getStride() {
6898 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 6).begin());
6899 }
6900
6901 ::mlir::TypedValue<::mlir::Type> getDilation() {
6902 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 7).begin());
6903 }
6904
6905 ::mlir::OpOperand &getInputDataMutable() {
6906 auto range = getODSOperandIndexAndLength(index: 0);
6907 return getOperation()->getOpOperand(idx: range.first);
6908 }
6909
6910 ::mlir::OpOperand &getInputScaleMutable() {
6911 auto range = getODSOperandIndexAndLength(index: 1);
6912 return getOperation()->getOpOperand(idx: range.first);
6913 }
6914
6915 ::mlir::OpOperand &getWeightDataMutable() {
6916 auto range = getODSOperandIndexAndLength(index: 2);
6917 return getOperation()->getOpOperand(idx: range.first);
6918 }
6919
6920 ::mlir::OpOperand &getWeightScaleMutable() {
6921 auto range = getODSOperandIndexAndLength(index: 3);
6922 return getOperation()->getOpOperand(idx: range.first);
6923 }
6924
6925 ::mlir::OpOperand &getBiasMutable() {
6926 auto range = getODSOperandIndexAndLength(index: 4);
6927 return getOperation()->getOpOperand(idx: range.first);
6928 }
6929
6930 ::mlir::OpOperand &getPadMutable() {
6931 auto range = getODSOperandIndexAndLength(index: 5);
6932 return getOperation()->getOpOperand(idx: range.first);
6933 }
6934
6935 ::mlir::OpOperand &getStrideMutable() {
6936 auto range = getODSOperandIndexAndLength(index: 6);
6937 return getOperation()->getOpOperand(idx: range.first);
6938 }
6939
6940 ::mlir::OpOperand &getDilationMutable() {
6941 auto range = getODSOperandIndexAndLength(index: 7);
6942 return getOperation()->getOpOperand(idx: range.first);
6943 }
6944
6945 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
6946 return {index, 1};
6947 }
6948
6949 ::mlir::Operation::result_range getODSResults(unsigned index) {
6950 auto valueRange = getODSResultIndexAndLength(index);
6951 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
6952 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
6953 }
6954
6955 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
6956 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
6957 }
6958
6959 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6960 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
6961 static llvm::hash_code computePropertiesHash(const Properties &prop);
6962 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
6963 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
6964 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
6965 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
6966 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
6967 void writeProperties(::mlir::DialectBytecodeWriter &writer);
6968 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
6969 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val&: getProperties().block_size);
6970 }
6971
6972 ::mlir::tosa::BlockSize getBlockSize();
6973 void setBlockSizeAttr(mlir::tosa::BlockSizeAttr attr) {
6974 getProperties().block_size = attr;
6975 }
6976
6977 void setBlockSize(::mlir::tosa::BlockSize attrValue);
6978 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, mlir::tosa::BlockSizeAttr block_size);
6979 static Conv2DBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, mlir::tosa::BlockSizeAttr block_size);
6980 static Conv2DBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, mlir::tosa::BlockSizeAttr block_size);
6981 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, mlir::tosa::BlockSizeAttr block_size);
6982 static Conv2DBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, mlir::tosa::BlockSizeAttr block_size);
6983 static Conv2DBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, mlir::tosa::BlockSizeAttr block_size);
6984 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, ::mlir::tosa::BlockSize block_size);
6985 static Conv2DBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, ::mlir::tosa::BlockSize block_size);
6986 static Conv2DBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, ::mlir::tosa::BlockSize block_size);
6987 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, ::mlir::tosa::BlockSize block_size);
6988 static Conv2DBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, ::mlir::tosa::BlockSize block_size);
6989 static Conv2DBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_data, ::mlir::Value input_scale, ::mlir::Value weight_data, ::mlir::Value weight_scale, ::mlir::Value bias, ::mlir::Value pad, ::mlir::Value stride, ::mlir::Value dilation, ::mlir::tosa::BlockSize block_size);
6990 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6991 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6992 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6993 static Conv2DBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6994 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
6995 static Conv2DBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
6996 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6997 static Conv2DBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6998 static Conv2DBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
6999 ::llvm::LogicalResult verifyInvariantsImpl();
7000 ::llvm::LogicalResult verifyInvariants();
7001 ::llvm::LogicalResult verify();
7002 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
7003 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
7004 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
7005 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
7006private:
7007 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
7008 return getAttributeNameForIndex(name: (*this)->getName(), index);
7009 }
7010
7011 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
7012 assert(index < 1 && "invalid attribute index");
7013 assert(name.getStringRef() == getOperationName() && "invalid operation name");
7014 assert(name.isRegistered() && "Operation isn't registered, missing a "
7015 "dependent dialect loading?");
7016 return name.getAttributeNames()[index];
7017 }
7018
7019 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
7020public:
7021 static ::llvm::LogicalResult
7022 inferReturnTypeComponents(::mlir::MLIRContext *context,
7023 std::optional<::mlir::Location> location,
7024 Adaptor adaptor,
7025 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
7026
7027};
7028
7029} // namespace mlir::tosa
7030MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::Conv2DBlockScaledOp)
7031MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::Conv2DBlockScaledOpGenericAdaptorBase::Properties)
7032
7033namespace mlir::tosa {
7034
7035
7036//===----------------------------------------------------------------------===//
7037// mlir::tosa::Conv2DOp declarations
7038//===----------------------------------------------------------------------===//
7039
7040namespace detail {
7041
7042class Conv2DOpGenericAdaptorBase {
7043public:
7044 struct Properties {
7045 using acc_typeTy = ::mlir::TypeAttr;
7046 acc_typeTy acc_type;
7047
7048 auto getAccType() const {
7049 auto &propStorage = this->acc_type;
7050 return ::llvm::cast<::mlir::TypeAttr>(Val: propStorage);
7051 }
7052 void setAccType(const ::mlir::TypeAttr &propValue) {
7053 this->acc_type = propValue;
7054 }
7055 using dilationTy = ::mlir::DenseI64ArrayAttr;
7056 dilationTy dilation;
7057
7058 auto getDilation() const {
7059 auto &propStorage = this->dilation;
7060 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
7061 }
7062 void setDilation(const ::mlir::DenseI64ArrayAttr &propValue) {
7063 this->dilation = propValue;
7064 }
7065 using local_boundTy = ::mlir::BoolAttr;
7066 local_boundTy local_bound;
7067
7068 auto getLocalBound() const {
7069 auto &propStorage = this->local_bound;
7070 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val: propStorage);
7071 }
7072 void setLocalBound(const ::mlir::BoolAttr &propValue) {
7073 this->local_bound = propValue;
7074 }
7075 using padTy = ::mlir::DenseI64ArrayAttr;
7076 padTy pad;
7077
7078 auto getPad() const {
7079 auto &propStorage = this->pad;
7080 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
7081 }
7082 void setPad(const ::mlir::DenseI64ArrayAttr &propValue) {
7083 this->pad = propValue;
7084 }
7085 using strideTy = ::mlir::DenseI64ArrayAttr;
7086 strideTy stride;
7087
7088 auto getStride() const {
7089 auto &propStorage = this->stride;
7090 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
7091 }
7092 void setStride(const ::mlir::DenseI64ArrayAttr &propValue) {
7093 this->stride = propValue;
7094 }
7095 bool operator==(const Properties &rhs) const {
7096 return
7097 rhs.acc_type == this->acc_type &&
7098 rhs.dilation == this->dilation &&
7099 rhs.local_bound == this->local_bound &&
7100 rhs.pad == this->pad &&
7101 rhs.stride == this->stride &&
7102 true;
7103 }
7104 bool operator!=(const Properties &rhs) const {
7105 return !(*this == rhs);
7106 }
7107 };
7108protected:
7109 ::mlir::DictionaryAttr odsAttrs;
7110 ::std::optional<::mlir::OperationName> odsOpName;
7111 Properties properties;
7112 ::mlir::RegionRange odsRegions;
7113public:
7114 Conv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
7115 odsOpName.emplace(args: "tosa.conv2d", args: odsAttrs.getContext());
7116 }
7117
7118 Conv2DOpGenericAdaptorBase(Conv2DOp op);
7119
7120 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
7121 return {index, 1};
7122 }
7123
7124 const Properties &getProperties() {
7125 return properties;
7126 }
7127
7128 ::mlir::DictionaryAttr getAttributes() {
7129 return odsAttrs;
7130 }
7131
7132 ::mlir::DenseI64ArrayAttr getPadAttr() {
7133 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().pad);
7134 return attr;
7135 }
7136
7137 ::llvm::ArrayRef<int64_t> getPad();
7138 ::mlir::DenseI64ArrayAttr getStrideAttr() {
7139 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().stride);
7140 return attr;
7141 }
7142
7143 ::llvm::ArrayRef<int64_t> getStride();
7144 ::mlir::DenseI64ArrayAttr getDilationAttr() {
7145 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().dilation);
7146 return attr;
7147 }
7148
7149 ::llvm::ArrayRef<int64_t> getDilation();
7150 ::mlir::TypeAttr getAccTypeAttr() {
7151 auto attr = ::llvm::cast<::mlir::TypeAttr>(Val: getProperties().acc_type);
7152 return attr;
7153 }
7154
7155 ::mlir::Type getAccType();
7156 ::mlir::BoolAttr getLocalBoundAttr();
7157 bool getLocalBound();
7158};
7159
7160} // namespace detail
7161template <typename RangeT>
7162class Conv2DOpGenericAdaptor : public detail::Conv2DOpGenericAdaptorBase {
7163 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
7164 using Base = detail::Conv2DOpGenericAdaptorBase;
7165 static constexpr int odsIndex_input = 0;
7166 static constexpr int odsIndex_weight = 1;
7167 static constexpr int odsIndex_bias = 2;
7168 static constexpr int odsIndex_input_zp = 3;
7169 static constexpr int odsIndex_weight_zp = 4;
7170public:
7171 Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
7172
7173 Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
7174
7175 Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : Conv2DOpGenericAdaptor(values, attrs, Properties{}, {}) {}
7176
7177 Conv2DOpGenericAdaptor(RangeT values, const Conv2DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
7178
7179 template <typename LateInst = Conv2DOp, typename = std::enable_if_t<std::is_same_v<LateInst, Conv2DOp>>>
7180 Conv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
7181
7182 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
7183 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
7184 }
7185
7186 RangeT getODSOperands(unsigned index) {
7187 auto valueRange = getODSOperandIndexAndLength(index);
7188 return {std::next(odsOperands.begin(), valueRange.first),
7189 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
7190 }
7191
7192 ValueT getInput() {
7193 return (*getODSOperands(index: 0).begin());
7194 }
7195
7196 ValueT getWeight() {
7197 return (*getODSOperands(index: 1).begin());
7198 }
7199
7200 ValueT getBias() {
7201 return (*getODSOperands(index: 2).begin());
7202 }
7203
7204 ValueT getInputZp() {
7205 return (*getODSOperands(index: 3).begin());
7206 }
7207
7208 ValueT getWeightZp() {
7209 return (*getODSOperands(index: 4).begin());
7210 }
7211
7212 RangeT getOperands() {
7213 return odsOperands;
7214 }
7215
7216private:
7217 RangeT odsOperands;
7218};
7219class Conv2DOpAdaptor : public Conv2DOpGenericAdaptor<::mlir::ValueRange> {
7220public:
7221 using Conv2DOpGenericAdaptor::Conv2DOpGenericAdaptor;
7222 Conv2DOpAdaptor(Conv2DOp op);
7223
7224 ::llvm::LogicalResult verify(::mlir::Location loc);
7225};
7226class Conv2DOp : public ::mlir::Op<Conv2DOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
7227public:
7228 using Op::Op;
7229 using Op::print;
7230 using Adaptor = Conv2DOpAdaptor;
7231 template <typename RangeT>
7232 using GenericAdaptor = Conv2DOpGenericAdaptor<RangeT>;
7233 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
7234 static constexpr int odsIndex_input = 0;
7235 static constexpr int odsIndex_weight = 1;
7236 static constexpr int odsIndex_bias = 2;
7237 static constexpr int odsIndex_input_zp = 3;
7238 static constexpr int odsIndex_weight_zp = 4;
7239 static constexpr int odsIndex_output = 0;
7240 using Properties = FoldAdaptor::Properties;
7241 using ::mlir::InferShapedTypeOpInterface::Trait<Conv2DOp>::reifyReturnTypeShapes;
7242 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
7243 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acc_type"), ::llvm::StringRef("dilation"), ::llvm::StringRef("local_bound"), ::llvm::StringRef("pad"), ::llvm::StringRef("stride")};
7244 return ::llvm::ArrayRef(attrNames);
7245 }
7246
7247 ::mlir::StringAttr getAccTypeAttrName() {
7248 return getAttributeNameForIndex(index: 0);
7249 }
7250
7251 static ::mlir::StringAttr getAccTypeAttrName(::mlir::OperationName name) {
7252 return getAttributeNameForIndex(name, index: 0);
7253 }
7254
7255 ::mlir::StringAttr getDilationAttrName() {
7256 return getAttributeNameForIndex(index: 1);
7257 }
7258
7259 static ::mlir::StringAttr getDilationAttrName(::mlir::OperationName name) {
7260 return getAttributeNameForIndex(name, index: 1);
7261 }
7262
7263 ::mlir::StringAttr getLocalBoundAttrName() {
7264 return getAttributeNameForIndex(index: 2);
7265 }
7266
7267 static ::mlir::StringAttr getLocalBoundAttrName(::mlir::OperationName name) {
7268 return getAttributeNameForIndex(name, index: 2);
7269 }
7270
7271 ::mlir::StringAttr getPadAttrName() {
7272 return getAttributeNameForIndex(index: 3);
7273 }
7274
7275 static ::mlir::StringAttr getPadAttrName(::mlir::OperationName name) {
7276 return getAttributeNameForIndex(name, index: 3);
7277 }
7278
7279 ::mlir::StringAttr getStrideAttrName() {
7280 return getAttributeNameForIndex(index: 4);
7281 }
7282
7283 static ::mlir::StringAttr getStrideAttrName(::mlir::OperationName name) {
7284 return getAttributeNameForIndex(name, index: 4);
7285 }
7286
7287 static constexpr ::llvm::StringLiteral getOperationName() {
7288 return ::llvm::StringLiteral("tosa.conv2d");
7289 }
7290
7291 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
7292 return {index, 1};
7293 }
7294
7295 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
7296 auto [start, length] = getODSOperandIndexAndLength(index);
7297 return getOperation()->getOperands().slice(n: start, m: length);
7298 }
7299
7300 ::mlir::TypedValue<::mlir::TensorType> getInput() {
7301 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
7302 }
7303
7304 ::mlir::TypedValue<::mlir::TensorType> getWeight() {
7305 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
7306 }
7307
7308 ::mlir::TypedValue<::mlir::TensorType> getBias() {
7309 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
7310 }
7311
7312 ::mlir::TypedValue<::mlir::TensorType> getInputZp() {
7313 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
7314 }
7315
7316 ::mlir::TypedValue<::mlir::TensorType> getWeightZp() {
7317 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 4).begin());
7318 }
7319
7320 ::mlir::OpOperand &getInputMutable() {
7321 auto range = getODSOperandIndexAndLength(index: 0);
7322 return getOperation()->getOpOperand(idx: range.first);
7323 }
7324
7325 ::mlir::OpOperand &getWeightMutable() {
7326 auto range = getODSOperandIndexAndLength(index: 1);
7327 return getOperation()->getOpOperand(idx: range.first);
7328 }
7329
7330 ::mlir::OpOperand &getBiasMutable() {
7331 auto range = getODSOperandIndexAndLength(index: 2);
7332 return getOperation()->getOpOperand(idx: range.first);
7333 }
7334
7335 ::mlir::OpOperand &getInputZpMutable() {
7336 auto range = getODSOperandIndexAndLength(index: 3);
7337 return getOperation()->getOpOperand(idx: range.first);
7338 }
7339
7340 ::mlir::OpOperand &getWeightZpMutable() {
7341 auto range = getODSOperandIndexAndLength(index: 4);
7342 return getOperation()->getOpOperand(idx: range.first);
7343 }
7344
7345 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
7346 return {index, 1};
7347 }
7348
7349 ::mlir::Operation::result_range getODSResults(unsigned index) {
7350 auto valueRange = getODSResultIndexAndLength(index);
7351 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
7352 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
7353 }
7354
7355 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
7356 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
7357 }
7358
7359 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
7360 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
7361 static llvm::hash_code computePropertiesHash(const Properties &prop);
7362 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
7363 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
7364 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
7365 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
7366 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
7367 void writeProperties(::mlir::DialectBytecodeWriter &writer);
7368 ::mlir::DenseI64ArrayAttr getPadAttr() {
7369 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().pad);
7370 }
7371
7372 ::llvm::ArrayRef<int64_t> getPad();
7373 ::mlir::DenseI64ArrayAttr getStrideAttr() {
7374 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().stride);
7375 }
7376
7377 ::llvm::ArrayRef<int64_t> getStride();
7378 ::mlir::DenseI64ArrayAttr getDilationAttr() {
7379 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().dilation);
7380 }
7381
7382 ::llvm::ArrayRef<int64_t> getDilation();
7383 ::mlir::TypeAttr getAccTypeAttr() {
7384 return ::llvm::cast<::mlir::TypeAttr>(Val&: getProperties().acc_type);
7385 }
7386
7387 ::mlir::Type getAccType();
7388 ::mlir::BoolAttr getLocalBoundAttr() {
7389 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val&: getProperties().local_bound);
7390 }
7391
7392 bool getLocalBound();
7393 void setPadAttr(::mlir::DenseI64ArrayAttr attr) {
7394 getProperties().pad = attr;
7395 }
7396
7397 void setPad(::llvm::ArrayRef<int64_t> attrValue);
7398 void setStrideAttr(::mlir::DenseI64ArrayAttr attr) {
7399 getProperties().stride = attr;
7400 }
7401
7402 void setStride(::llvm::ArrayRef<int64_t> attrValue);
7403 void setDilationAttr(::mlir::DenseI64ArrayAttr attr) {
7404 getProperties().dilation = attr;
7405 }
7406
7407 void setDilation(::llvm::ArrayRef<int64_t> attrValue);
7408 void setAccTypeAttr(::mlir::TypeAttr attr) {
7409 getProperties().acc_type = attr;
7410 }
7411
7412 void setAccType(::mlir::Type attrValue);
7413 void setLocalBoundAttr(::mlir::BoolAttr attr) {
7414 getProperties().local_bound = attr;
7415 }
7416
7417 void setLocalBound(::std::optional<bool> attrValue);
7418 ::mlir::Attribute removeLocalBoundAttr() {
7419 auto attr = getProperties().local_bound;
7420 getProperties().local_bound = {};
7421 return attr;
7422 }
7423
7424 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
7425 static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
7426 static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
7427 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7428 static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7429 static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7430 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7431 static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7432 static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7433 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7434 static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7435 static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7436 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7437 static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7438 static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7439 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
7440 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
7441 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
7442 static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
7443 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
7444 static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
7445 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
7446 static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
7447 static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
7448 ::llvm::LogicalResult verifyInvariantsImpl();
7449 ::llvm::LogicalResult verifyInvariants();
7450 ::llvm::LogicalResult verify();
7451 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
7452 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
7453 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
7454 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
7455 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
7456private:
7457 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
7458 return getAttributeNameForIndex(name: (*this)->getName(), index);
7459 }
7460
7461 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
7462 assert(index < 5 && "invalid attribute index");
7463 assert(name.getStringRef() == getOperationName() && "invalid operation name");
7464 assert(name.isRegistered() && "Operation isn't registered, missing a "
7465 "dependent dialect loading?");
7466 return name.getAttributeNames()[index];
7467 }
7468
7469 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
7470public:
7471 static ::llvm::LogicalResult
7472 inferReturnTypeComponents(::mlir::MLIRContext *context,
7473 std::optional<::mlir::Location> location,
7474 Adaptor adaptor,
7475 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
7476
7477
7478 FailureOr<int64_t> getInputZeroPoint();
7479 FailureOr<int64_t> getWeightZeroPoint();
7480 LogicalResult verifyInputZeroPoint(int64_t zp);
7481 LogicalResult verifyWeightZeroPoint(int64_t zp);
7482};
7483
7484} // namespace mlir::tosa
7485MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::Conv2DOp)
7486MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::Conv2DOpGenericAdaptorBase::Properties)
7487
7488namespace mlir::tosa {
7489
7490
7491//===----------------------------------------------------------------------===//
7492// mlir::tosa::Conv3DOp declarations
7493//===----------------------------------------------------------------------===//
7494
7495namespace detail {
7496
7497class Conv3DOpGenericAdaptorBase {
7498public:
7499 struct Properties {
7500 using acc_typeTy = ::mlir::TypeAttr;
7501 acc_typeTy acc_type;
7502
7503 auto getAccType() const {
7504 auto &propStorage = this->acc_type;
7505 return ::llvm::cast<::mlir::TypeAttr>(Val: propStorage);
7506 }
7507 void setAccType(const ::mlir::TypeAttr &propValue) {
7508 this->acc_type = propValue;
7509 }
7510 using dilationTy = ::mlir::DenseI64ArrayAttr;
7511 dilationTy dilation;
7512
7513 auto getDilation() const {
7514 auto &propStorage = this->dilation;
7515 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
7516 }
7517 void setDilation(const ::mlir::DenseI64ArrayAttr &propValue) {
7518 this->dilation = propValue;
7519 }
7520 using local_boundTy = ::mlir::BoolAttr;
7521 local_boundTy local_bound;
7522
7523 auto getLocalBound() const {
7524 auto &propStorage = this->local_bound;
7525 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val: propStorage);
7526 }
7527 void setLocalBound(const ::mlir::BoolAttr &propValue) {
7528 this->local_bound = propValue;
7529 }
7530 using padTy = ::mlir::DenseI64ArrayAttr;
7531 padTy pad;
7532
7533 auto getPad() const {
7534 auto &propStorage = this->pad;
7535 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
7536 }
7537 void setPad(const ::mlir::DenseI64ArrayAttr &propValue) {
7538 this->pad = propValue;
7539 }
7540 using strideTy = ::mlir::DenseI64ArrayAttr;
7541 strideTy stride;
7542
7543 auto getStride() const {
7544 auto &propStorage = this->stride;
7545 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
7546 }
7547 void setStride(const ::mlir::DenseI64ArrayAttr &propValue) {
7548 this->stride = propValue;
7549 }
7550 bool operator==(const Properties &rhs) const {
7551 return
7552 rhs.acc_type == this->acc_type &&
7553 rhs.dilation == this->dilation &&
7554 rhs.local_bound == this->local_bound &&
7555 rhs.pad == this->pad &&
7556 rhs.stride == this->stride &&
7557 true;
7558 }
7559 bool operator!=(const Properties &rhs) const {
7560 return !(*this == rhs);
7561 }
7562 };
7563protected:
7564 ::mlir::DictionaryAttr odsAttrs;
7565 ::std::optional<::mlir::OperationName> odsOpName;
7566 Properties properties;
7567 ::mlir::RegionRange odsRegions;
7568public:
7569 Conv3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
7570 odsOpName.emplace(args: "tosa.conv3d", args: odsAttrs.getContext());
7571 }
7572
7573 Conv3DOpGenericAdaptorBase(Conv3DOp op);
7574
7575 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
7576 return {index, 1};
7577 }
7578
7579 const Properties &getProperties() {
7580 return properties;
7581 }
7582
7583 ::mlir::DictionaryAttr getAttributes() {
7584 return odsAttrs;
7585 }
7586
7587 ::mlir::DenseI64ArrayAttr getPadAttr() {
7588 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().pad);
7589 return attr;
7590 }
7591
7592 ::llvm::ArrayRef<int64_t> getPad();
7593 ::mlir::DenseI64ArrayAttr getStrideAttr() {
7594 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().stride);
7595 return attr;
7596 }
7597
7598 ::llvm::ArrayRef<int64_t> getStride();
7599 ::mlir::DenseI64ArrayAttr getDilationAttr() {
7600 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().dilation);
7601 return attr;
7602 }
7603
7604 ::llvm::ArrayRef<int64_t> getDilation();
7605 ::mlir::TypeAttr getAccTypeAttr() {
7606 auto attr = ::llvm::cast<::mlir::TypeAttr>(Val: getProperties().acc_type);
7607 return attr;
7608 }
7609
7610 ::mlir::Type getAccType();
7611 ::mlir::BoolAttr getLocalBoundAttr();
7612 bool getLocalBound();
7613};
7614
7615} // namespace detail
7616template <typename RangeT>
7617class Conv3DOpGenericAdaptor : public detail::Conv3DOpGenericAdaptorBase {
7618 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
7619 using Base = detail::Conv3DOpGenericAdaptorBase;
7620 static constexpr int odsIndex_input = 0;
7621 static constexpr int odsIndex_weight = 1;
7622 static constexpr int odsIndex_bias = 2;
7623 static constexpr int odsIndex_input_zp = 3;
7624 static constexpr int odsIndex_weight_zp = 4;
7625public:
7626 Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
7627
7628 Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
7629
7630 Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : Conv3DOpGenericAdaptor(values, attrs, Properties{}, {}) {}
7631
7632 Conv3DOpGenericAdaptor(RangeT values, const Conv3DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
7633
7634 template <typename LateInst = Conv3DOp, typename = std::enable_if_t<std::is_same_v<LateInst, Conv3DOp>>>
7635 Conv3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
7636
7637 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
7638 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
7639 }
7640
7641 RangeT getODSOperands(unsigned index) {
7642 auto valueRange = getODSOperandIndexAndLength(index);
7643 return {std::next(odsOperands.begin(), valueRange.first),
7644 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
7645 }
7646
7647 ValueT getInput() {
7648 return (*getODSOperands(index: 0).begin());
7649 }
7650
7651 ValueT getWeight() {
7652 return (*getODSOperands(index: 1).begin());
7653 }
7654
7655 ValueT getBias() {
7656 return (*getODSOperands(index: 2).begin());
7657 }
7658
7659 ValueT getInputZp() {
7660 return (*getODSOperands(index: 3).begin());
7661 }
7662
7663 ValueT getWeightZp() {
7664 return (*getODSOperands(index: 4).begin());
7665 }
7666
7667 RangeT getOperands() {
7668 return odsOperands;
7669 }
7670
7671private:
7672 RangeT odsOperands;
7673};
7674class Conv3DOpAdaptor : public Conv3DOpGenericAdaptor<::mlir::ValueRange> {
7675public:
7676 using Conv3DOpGenericAdaptor::Conv3DOpGenericAdaptor;
7677 Conv3DOpAdaptor(Conv3DOp op);
7678
7679 ::llvm::LogicalResult verify(::mlir::Location loc);
7680};
7681class Conv3DOp : public ::mlir::Op<Conv3DOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
7682public:
7683 using Op::Op;
7684 using Op::print;
7685 using Adaptor = Conv3DOpAdaptor;
7686 template <typename RangeT>
7687 using GenericAdaptor = Conv3DOpGenericAdaptor<RangeT>;
7688 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
7689 static constexpr int odsIndex_input = 0;
7690 static constexpr int odsIndex_weight = 1;
7691 static constexpr int odsIndex_bias = 2;
7692 static constexpr int odsIndex_input_zp = 3;
7693 static constexpr int odsIndex_weight_zp = 4;
7694 static constexpr int odsIndex_output = 0;
7695 using Properties = FoldAdaptor::Properties;
7696 using ::mlir::InferShapedTypeOpInterface::Trait<Conv3DOp>::reifyReturnTypeShapes;
7697 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
7698 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acc_type"), ::llvm::StringRef("dilation"), ::llvm::StringRef("local_bound"), ::llvm::StringRef("pad"), ::llvm::StringRef("stride")};
7699 return ::llvm::ArrayRef(attrNames);
7700 }
7701
7702 ::mlir::StringAttr getAccTypeAttrName() {
7703 return getAttributeNameForIndex(index: 0);
7704 }
7705
7706 static ::mlir::StringAttr getAccTypeAttrName(::mlir::OperationName name) {
7707 return getAttributeNameForIndex(name, index: 0);
7708 }
7709
7710 ::mlir::StringAttr getDilationAttrName() {
7711 return getAttributeNameForIndex(index: 1);
7712 }
7713
7714 static ::mlir::StringAttr getDilationAttrName(::mlir::OperationName name) {
7715 return getAttributeNameForIndex(name, index: 1);
7716 }
7717
7718 ::mlir::StringAttr getLocalBoundAttrName() {
7719 return getAttributeNameForIndex(index: 2);
7720 }
7721
7722 static ::mlir::StringAttr getLocalBoundAttrName(::mlir::OperationName name) {
7723 return getAttributeNameForIndex(name, index: 2);
7724 }
7725
7726 ::mlir::StringAttr getPadAttrName() {
7727 return getAttributeNameForIndex(index: 3);
7728 }
7729
7730 static ::mlir::StringAttr getPadAttrName(::mlir::OperationName name) {
7731 return getAttributeNameForIndex(name, index: 3);
7732 }
7733
7734 ::mlir::StringAttr getStrideAttrName() {
7735 return getAttributeNameForIndex(index: 4);
7736 }
7737
7738 static ::mlir::StringAttr getStrideAttrName(::mlir::OperationName name) {
7739 return getAttributeNameForIndex(name, index: 4);
7740 }
7741
7742 static constexpr ::llvm::StringLiteral getOperationName() {
7743 return ::llvm::StringLiteral("tosa.conv3d");
7744 }
7745
7746 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
7747 return {index, 1};
7748 }
7749
7750 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
7751 auto [start, length] = getODSOperandIndexAndLength(index);
7752 return getOperation()->getOperands().slice(n: start, m: length);
7753 }
7754
7755 ::mlir::TypedValue<::mlir::TensorType> getInput() {
7756 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
7757 }
7758
7759 ::mlir::TypedValue<::mlir::TensorType> getWeight() {
7760 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
7761 }
7762
7763 ::mlir::TypedValue<::mlir::TensorType> getBias() {
7764 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
7765 }
7766
7767 ::mlir::TypedValue<::mlir::TensorType> getInputZp() {
7768 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
7769 }
7770
7771 ::mlir::TypedValue<::mlir::TensorType> getWeightZp() {
7772 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 4).begin());
7773 }
7774
7775 ::mlir::OpOperand &getInputMutable() {
7776 auto range = getODSOperandIndexAndLength(index: 0);
7777 return getOperation()->getOpOperand(idx: range.first);
7778 }
7779
7780 ::mlir::OpOperand &getWeightMutable() {
7781 auto range = getODSOperandIndexAndLength(index: 1);
7782 return getOperation()->getOpOperand(idx: range.first);
7783 }
7784
7785 ::mlir::OpOperand &getBiasMutable() {
7786 auto range = getODSOperandIndexAndLength(index: 2);
7787 return getOperation()->getOpOperand(idx: range.first);
7788 }
7789
7790 ::mlir::OpOperand &getInputZpMutable() {
7791 auto range = getODSOperandIndexAndLength(index: 3);
7792 return getOperation()->getOpOperand(idx: range.first);
7793 }
7794
7795 ::mlir::OpOperand &getWeightZpMutable() {
7796 auto range = getODSOperandIndexAndLength(index: 4);
7797 return getOperation()->getOpOperand(idx: range.first);
7798 }
7799
7800 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
7801 return {index, 1};
7802 }
7803
7804 ::mlir::Operation::result_range getODSResults(unsigned index) {
7805 auto valueRange = getODSResultIndexAndLength(index);
7806 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
7807 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
7808 }
7809
7810 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
7811 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
7812 }
7813
7814 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
7815 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
7816 static llvm::hash_code computePropertiesHash(const Properties &prop);
7817 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
7818 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
7819 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
7820 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
7821 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
7822 void writeProperties(::mlir::DialectBytecodeWriter &writer);
7823 ::mlir::DenseI64ArrayAttr getPadAttr() {
7824 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().pad);
7825 }
7826
7827 ::llvm::ArrayRef<int64_t> getPad();
7828 ::mlir::DenseI64ArrayAttr getStrideAttr() {
7829 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().stride);
7830 }
7831
7832 ::llvm::ArrayRef<int64_t> getStride();
7833 ::mlir::DenseI64ArrayAttr getDilationAttr() {
7834 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().dilation);
7835 }
7836
7837 ::llvm::ArrayRef<int64_t> getDilation();
7838 ::mlir::TypeAttr getAccTypeAttr() {
7839 return ::llvm::cast<::mlir::TypeAttr>(Val&: getProperties().acc_type);
7840 }
7841
7842 ::mlir::Type getAccType();
7843 ::mlir::BoolAttr getLocalBoundAttr() {
7844 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val&: getProperties().local_bound);
7845 }
7846
7847 bool getLocalBound();
7848 void setPadAttr(::mlir::DenseI64ArrayAttr attr) {
7849 getProperties().pad = attr;
7850 }
7851
7852 void setPad(::llvm::ArrayRef<int64_t> attrValue);
7853 void setStrideAttr(::mlir::DenseI64ArrayAttr attr) {
7854 getProperties().stride = attr;
7855 }
7856
7857 void setStride(::llvm::ArrayRef<int64_t> attrValue);
7858 void setDilationAttr(::mlir::DenseI64ArrayAttr attr) {
7859 getProperties().dilation = attr;
7860 }
7861
7862 void setDilation(::llvm::ArrayRef<int64_t> attrValue);
7863 void setAccTypeAttr(::mlir::TypeAttr attr) {
7864 getProperties().acc_type = attr;
7865 }
7866
7867 void setAccType(::mlir::Type attrValue);
7868 void setLocalBoundAttr(::mlir::BoolAttr attr) {
7869 getProperties().local_bound = attr;
7870 }
7871
7872 void setLocalBound(::std::optional<bool> attrValue);
7873 ::mlir::Attribute removeLocalBoundAttr() {
7874 auto attr = getProperties().local_bound;
7875 getProperties().local_bound = {};
7876 return attr;
7877 }
7878
7879 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
7880 static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
7881 static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
7882 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7883 static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7884 static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7885 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7886 static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7887 static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
7888 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7889 static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7890 static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7891 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7892 static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7893 static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
7894 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
7895 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
7896 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
7897 static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
7898 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
7899 static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
7900 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
7901 static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
7902 static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
7903 ::llvm::LogicalResult verifyInvariantsImpl();
7904 ::llvm::LogicalResult verifyInvariants();
7905 ::llvm::LogicalResult verify();
7906 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
7907 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
7908 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
7909 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
7910private:
7911 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
7912 return getAttributeNameForIndex(name: (*this)->getName(), index);
7913 }
7914
7915 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
7916 assert(index < 5 && "invalid attribute index");
7917 assert(name.getStringRef() == getOperationName() && "invalid operation name");
7918 assert(name.isRegistered() && "Operation isn't registered, missing a "
7919 "dependent dialect loading?");
7920 return name.getAttributeNames()[index];
7921 }
7922
7923 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
7924public:
7925 static ::llvm::LogicalResult
7926 inferReturnTypeComponents(::mlir::MLIRContext *context,
7927 std::optional<::mlir::Location> location,
7928 Adaptor adaptor,
7929 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
7930
7931
7932 FailureOr<int64_t> getInputZeroPoint();
7933 FailureOr<int64_t> getWeightZeroPoint();
7934 LogicalResult verifyInputZeroPoint(int64_t zp);
7935 LogicalResult verifyWeightZeroPoint(int64_t zp);
7936};
7937
7938} // namespace mlir::tosa
7939MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::Conv3DOp)
7940MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::Conv3DOpGenericAdaptorBase::Properties)
7941
7942namespace mlir::tosa {
7943
7944
7945//===----------------------------------------------------------------------===//
7946// mlir::tosa::CosOp declarations
7947//===----------------------------------------------------------------------===//
7948
7949namespace detail {
7950
7951class CosOpGenericAdaptorBase {
7952public:
7953 using Properties = ::mlir::EmptyProperties;
7954protected:
7955 ::mlir::DictionaryAttr odsAttrs;
7956 ::std::optional<::mlir::OperationName> odsOpName;
7957 Properties properties;
7958 ::mlir::RegionRange odsRegions;
7959public:
7960 CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
7961 odsOpName.emplace(args: "tosa.cos", args: odsAttrs.getContext());
7962 }
7963
7964 CosOpGenericAdaptorBase(CosOp op);
7965
7966 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
7967 return {index, 1};
7968 }
7969
7970 const Properties &getProperties() {
7971 return properties;
7972 }
7973
7974 ::mlir::DictionaryAttr getAttributes() {
7975 return odsAttrs;
7976 }
7977
7978};
7979
7980} // namespace detail
7981template <typename RangeT>
7982class CosOpGenericAdaptor : public detail::CosOpGenericAdaptorBase {
7983 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
7984 using Base = detail::CosOpGenericAdaptorBase;
7985 static constexpr int odsIndex_input1 = 0;
7986public:
7987 CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
7988
7989 CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CosOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
7990
7991 CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CosOpGenericAdaptor(values, attrs, Properties{}, {}) {}
7992
7993 CosOpGenericAdaptor(RangeT values, const CosOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
7994
7995 template <typename LateInst = CosOp, typename = std::enable_if_t<std::is_same_v<LateInst, CosOp>>>
7996 CosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
7997
7998 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
7999 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
8000 }
8001
8002 RangeT getODSOperands(unsigned index) {
8003 auto valueRange = getODSOperandIndexAndLength(index);
8004 return {std::next(odsOperands.begin(), valueRange.first),
8005 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8006 }
8007
8008 ValueT getInput1() {
8009 return (*getODSOperands(index: 0).begin());
8010 }
8011
8012 RangeT getOperands() {
8013 return odsOperands;
8014 }
8015
8016private:
8017 RangeT odsOperands;
8018};
8019class CosOpAdaptor : public CosOpGenericAdaptor<::mlir::ValueRange> {
8020public:
8021 using CosOpGenericAdaptor::CosOpGenericAdaptor;
8022 CosOpAdaptor(CosOp op);
8023
8024 ::llvm::LogicalResult verify(::mlir::Location loc);
8025};
8026class CosOp : public ::mlir::Op<CosOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
8027public:
8028 using Op::Op;
8029 using Op::print;
8030 using Adaptor = CosOpAdaptor;
8031 template <typename RangeT>
8032 using GenericAdaptor = CosOpGenericAdaptor<RangeT>;
8033 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
8034 static constexpr int odsIndex_input1 = 0;
8035 static constexpr int odsIndex_output = 0;
8036 using Properties = FoldAdaptor::Properties;
8037 using ::mlir::InferShapedTypeOpInterface::Trait<CosOp>::reifyReturnTypeShapes;
8038 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
8039 return {};
8040 }
8041
8042 static constexpr ::llvm::StringLiteral getOperationName() {
8043 return ::llvm::StringLiteral("tosa.cos");
8044 }
8045
8046 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
8047 return {index, 1};
8048 }
8049
8050 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
8051 auto [start, length] = getODSOperandIndexAndLength(index);
8052 return getOperation()->getOperands().slice(n: start, m: length);
8053 }
8054
8055 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
8056 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
8057 }
8058
8059 ::mlir::OpOperand &getInput1Mutable() {
8060 auto range = getODSOperandIndexAndLength(index: 0);
8061 return getOperation()->getOpOperand(idx: range.first);
8062 }
8063
8064 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
8065 return {index, 1};
8066 }
8067
8068 ::mlir::Operation::result_range getODSResults(unsigned index) {
8069 auto valueRange = getODSResultIndexAndLength(index);
8070 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
8071 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
8072 }
8073
8074 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
8075 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
8076 }
8077
8078 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
8079 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
8080 static llvm::hash_code computePropertiesHash(const Properties &prop);
8081 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
8082 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
8083 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
8084 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
8085 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
8086 static CosOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
8087 static CosOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
8088 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
8089 static CosOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
8090 static CosOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
8091 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8092 static CosOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8093 static CosOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8094 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8095 static CosOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8096 static CosOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8097 ::llvm::LogicalResult verifyInvariantsImpl();
8098 ::llvm::LogicalResult verifyInvariants();
8099 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
8100 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
8101 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
8102 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
8103public:
8104};
8105
8106} // namespace mlir::tosa
8107MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::CosOp)
8108
8109namespace mlir::tosa {
8110
8111
8112//===----------------------------------------------------------------------===//
8113// mlir::tosa::CustomOp declarations
8114//===----------------------------------------------------------------------===//
8115
8116namespace detail {
8117
8118class CustomOpGenericAdaptorBase {
8119public:
8120 struct Properties {
8121 using domain_nameTy = ::mlir::StringAttr;
8122 domain_nameTy domain_name;
8123
8124 auto getDomainName() const {
8125 auto &propStorage = this->domain_name;
8126 return ::llvm::cast<::mlir::StringAttr>(Val: propStorage);
8127 }
8128 void setDomainName(const ::mlir::StringAttr &propValue) {
8129 this->domain_name = propValue;
8130 }
8131 using implementation_attrsTy = ::mlir::StringAttr;
8132 implementation_attrsTy implementation_attrs;
8133
8134 auto getImplementationAttrs() const {
8135 auto &propStorage = this->implementation_attrs;
8136 return ::llvm::cast<::mlir::StringAttr>(Val: propStorage);
8137 }
8138 void setImplementationAttrs(const ::mlir::StringAttr &propValue) {
8139 this->implementation_attrs = propValue;
8140 }
8141 using operator_nameTy = ::mlir::StringAttr;
8142 operator_nameTy operator_name;
8143
8144 auto getOperatorName() const {
8145 auto &propStorage = this->operator_name;
8146 return ::llvm::cast<::mlir::StringAttr>(Val: propStorage);
8147 }
8148 void setOperatorName(const ::mlir::StringAttr &propValue) {
8149 this->operator_name = propValue;
8150 }
8151 bool operator==(const Properties &rhs) const {
8152 return
8153 rhs.domain_name == this->domain_name &&
8154 rhs.implementation_attrs == this->implementation_attrs &&
8155 rhs.operator_name == this->operator_name &&
8156 true;
8157 }
8158 bool operator!=(const Properties &rhs) const {
8159 return !(*this == rhs);
8160 }
8161 };
8162protected:
8163 ::mlir::DictionaryAttr odsAttrs;
8164 ::std::optional<::mlir::OperationName> odsOpName;
8165 Properties properties;
8166 ::mlir::RegionRange odsRegions;
8167public:
8168 CustomOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
8169 odsOpName.emplace(args: "tosa.custom", args: odsAttrs.getContext());
8170 }
8171
8172 CustomOpGenericAdaptorBase(CustomOp op);
8173
8174 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
8175 const Properties &getProperties() {
8176 return properties;
8177 }
8178
8179 ::mlir::DictionaryAttr getAttributes() {
8180 return odsAttrs;
8181 }
8182
8183 ::mlir::StringAttr getOperatorNameAttr() {
8184 auto attr = ::llvm::cast<::mlir::StringAttr>(Val: getProperties().operator_name);
8185 return attr;
8186 }
8187
8188 ::llvm::StringRef getOperatorName();
8189 ::mlir::StringAttr getDomainNameAttr() {
8190 auto attr = ::llvm::cast<::mlir::StringAttr>(Val: getProperties().domain_name);
8191 return attr;
8192 }
8193
8194 ::llvm::StringRef getDomainName();
8195 ::mlir::StringAttr getImplementationAttrsAttr() {
8196 auto attr = ::llvm::cast<::mlir::StringAttr>(Val: getProperties().implementation_attrs);
8197 return attr;
8198 }
8199
8200 ::llvm::StringRef getImplementationAttrs();
8201};
8202
8203} // namespace detail
8204template <typename RangeT>
8205class CustomOpGenericAdaptor : public detail::CustomOpGenericAdaptorBase {
8206 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
8207 using Base = detail::CustomOpGenericAdaptorBase;
8208 static constexpr int odsIndex_input_list = 0;
8209public:
8210 CustomOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
8211
8212 CustomOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CustomOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
8213
8214 CustomOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CustomOpGenericAdaptor(values, attrs, Properties{}, {}) {}
8215
8216 CustomOpGenericAdaptor(RangeT values, const CustomOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
8217
8218 template <typename LateInst = CustomOp, typename = std::enable_if_t<std::is_same_v<LateInst, CustomOp>>>
8219 CustomOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
8220
8221 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
8222 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
8223 }
8224
8225 RangeT getODSOperands(unsigned index) {
8226 auto valueRange = getODSOperandIndexAndLength(index);
8227 return {std::next(odsOperands.begin(), valueRange.first),
8228 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8229 }
8230
8231 RangeT getInputList() {
8232 return getODSOperands(index: 0);
8233 }
8234
8235 RangeT getOperands() {
8236 return odsOperands;
8237 }
8238
8239private:
8240 RangeT odsOperands;
8241};
8242class CustomOpAdaptor : public CustomOpGenericAdaptor<::mlir::ValueRange> {
8243public:
8244 using CustomOpGenericAdaptor::CustomOpGenericAdaptor;
8245 CustomOpAdaptor(CustomOp op);
8246
8247 ::llvm::LogicalResult verify(::mlir::Location loc);
8248};
8249class CustomOp : public ::mlir::Op<CustomOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
8250public:
8251 using Op::Op;
8252 using Op::print;
8253 using Adaptor = CustomOpAdaptor;
8254 template <typename RangeT>
8255 using GenericAdaptor = CustomOpGenericAdaptor<RangeT>;
8256 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
8257 static constexpr int odsIndex_input_list = 0;
8258 static constexpr int odsIndex_output_list = 0;
8259 using Properties = FoldAdaptor::Properties;
8260 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
8261 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("domain_name"), ::llvm::StringRef("implementation_attrs"), ::llvm::StringRef("operator_name")};
8262 return ::llvm::ArrayRef(attrNames);
8263 }
8264
8265 ::mlir::StringAttr getDomainNameAttrName() {
8266 return getAttributeNameForIndex(index: 0);
8267 }
8268
8269 static ::mlir::StringAttr getDomainNameAttrName(::mlir::OperationName name) {
8270 return getAttributeNameForIndex(name, index: 0);
8271 }
8272
8273 ::mlir::StringAttr getImplementationAttrsAttrName() {
8274 return getAttributeNameForIndex(index: 1);
8275 }
8276
8277 static ::mlir::StringAttr getImplementationAttrsAttrName(::mlir::OperationName name) {
8278 return getAttributeNameForIndex(name, index: 1);
8279 }
8280
8281 ::mlir::StringAttr getOperatorNameAttrName() {
8282 return getAttributeNameForIndex(index: 2);
8283 }
8284
8285 static ::mlir::StringAttr getOperatorNameAttrName(::mlir::OperationName name) {
8286 return getAttributeNameForIndex(name, index: 2);
8287 }
8288
8289 static constexpr ::llvm::StringLiteral getOperationName() {
8290 return ::llvm::StringLiteral("tosa.custom");
8291 }
8292
8293 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
8294 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
8295 auto [start, length] = getODSOperandIndexAndLength(index);
8296 return getOperation()->getOperands().slice(n: start, m: length);
8297 }
8298
8299 ::mlir::Operation::operand_range getInputList() {
8300 return getODSOperands(index: 0);
8301 }
8302
8303 ::mlir::MutableOperandRange getInputListMutable();
8304 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
8305 ::mlir::Operation::result_range getODSResults(unsigned index) {
8306 auto valueRange = getODSResultIndexAndLength(index);
8307 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
8308 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
8309 }
8310
8311 ::mlir::Operation::result_range getOutputList() {
8312 return getODSResults(index: 0);
8313 }
8314
8315 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
8316 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
8317 static llvm::hash_code computePropertiesHash(const Properties &prop);
8318 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
8319 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
8320 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
8321 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
8322 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
8323 void writeProperties(::mlir::DialectBytecodeWriter &writer);
8324 ::mlir::StringAttr getOperatorNameAttr() {
8325 return ::llvm::cast<::mlir::StringAttr>(Val&: getProperties().operator_name);
8326 }
8327
8328 ::llvm::StringRef getOperatorName();
8329 ::mlir::StringAttr getDomainNameAttr() {
8330 return ::llvm::cast<::mlir::StringAttr>(Val&: getProperties().domain_name);
8331 }
8332
8333 ::llvm::StringRef getDomainName();
8334 ::mlir::StringAttr getImplementationAttrsAttr() {
8335 return ::llvm::cast<::mlir::StringAttr>(Val&: getProperties().implementation_attrs);
8336 }
8337
8338 ::llvm::StringRef getImplementationAttrs();
8339 void setOperatorNameAttr(::mlir::StringAttr attr) {
8340 getProperties().operator_name = attr;
8341 }
8342
8343 void setOperatorName(::llvm::StringRef attrValue);
8344 void setDomainNameAttr(::mlir::StringAttr attr) {
8345 getProperties().domain_name = attr;
8346 }
8347
8348 void setDomainName(::llvm::StringRef attrValue);
8349 void setImplementationAttrsAttr(::mlir::StringAttr attr) {
8350 getProperties().implementation_attrs = attr;
8351 }
8352
8353 void setImplementationAttrs(::llvm::StringRef attrValue);
8354 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output_list, ::mlir::StringAttr operator_name, ::mlir::StringAttr domain_name, ::mlir::StringAttr implementation_attrs, ::mlir::ValueRange input_list);
8355 static CustomOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange output_list, ::mlir::StringAttr operator_name, ::mlir::StringAttr domain_name, ::mlir::StringAttr implementation_attrs, ::mlir::ValueRange input_list);
8356 static CustomOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange output_list, ::mlir::StringAttr operator_name, ::mlir::StringAttr domain_name, ::mlir::StringAttr implementation_attrs, ::mlir::ValueRange input_list);
8357 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output_list, ::llvm::StringRef operator_name, ::llvm::StringRef domain_name, ::llvm::StringRef implementation_attrs, ::mlir::ValueRange input_list);
8358 static CustomOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange output_list, ::llvm::StringRef operator_name, ::llvm::StringRef domain_name, ::llvm::StringRef implementation_attrs, ::mlir::ValueRange input_list);
8359 static CustomOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange output_list, ::llvm::StringRef operator_name, ::llvm::StringRef domain_name, ::llvm::StringRef implementation_attrs, ::mlir::ValueRange input_list);
8360 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
8361 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8362 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
8363 static CustomOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8364 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
8365 static CustomOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8366 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8367 static CustomOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8368 static CustomOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8369 ::llvm::LogicalResult verifyInvariantsImpl();
8370 ::llvm::LogicalResult verifyInvariants();
8371 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
8372 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
8373private:
8374 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
8375 return getAttributeNameForIndex(name: (*this)->getName(), index);
8376 }
8377
8378 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
8379 assert(index < 3 && "invalid attribute index");
8380 assert(name.getStringRef() == getOperationName() && "invalid operation name");
8381 assert(name.isRegistered() && "Operation isn't registered, missing a "
8382 "dependent dialect loading?");
8383 return name.getAttributeNames()[index];
8384 }
8385
8386 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
8387public:
8388};
8389
8390} // namespace mlir::tosa
8391MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::CustomOp)
8392MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::CustomOpGenericAdaptorBase::Properties)
8393
8394namespace mlir::tosa {
8395
8396
8397//===----------------------------------------------------------------------===//
8398// mlir::tosa::DepthwiseConv2DOp declarations
8399//===----------------------------------------------------------------------===//
8400
8401namespace detail {
8402
8403class DepthwiseConv2DOpGenericAdaptorBase {
8404public:
8405 struct Properties {
8406 using acc_typeTy = ::mlir::TypeAttr;
8407 acc_typeTy acc_type;
8408
8409 auto getAccType() const {
8410 auto &propStorage = this->acc_type;
8411 return ::llvm::cast<::mlir::TypeAttr>(Val: propStorage);
8412 }
8413 void setAccType(const ::mlir::TypeAttr &propValue) {
8414 this->acc_type = propValue;
8415 }
8416 using dilationTy = ::mlir::DenseI64ArrayAttr;
8417 dilationTy dilation;
8418
8419 auto getDilation() const {
8420 auto &propStorage = this->dilation;
8421 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
8422 }
8423 void setDilation(const ::mlir::DenseI64ArrayAttr &propValue) {
8424 this->dilation = propValue;
8425 }
8426 using local_boundTy = ::mlir::BoolAttr;
8427 local_boundTy local_bound;
8428
8429 auto getLocalBound() const {
8430 auto &propStorage = this->local_bound;
8431 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val: propStorage);
8432 }
8433 void setLocalBound(const ::mlir::BoolAttr &propValue) {
8434 this->local_bound = propValue;
8435 }
8436 using padTy = ::mlir::DenseI64ArrayAttr;
8437 padTy pad;
8438
8439 auto getPad() const {
8440 auto &propStorage = this->pad;
8441 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
8442 }
8443 void setPad(const ::mlir::DenseI64ArrayAttr &propValue) {
8444 this->pad = propValue;
8445 }
8446 using strideTy = ::mlir::DenseI64ArrayAttr;
8447 strideTy stride;
8448
8449 auto getStride() const {
8450 auto &propStorage = this->stride;
8451 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
8452 }
8453 void setStride(const ::mlir::DenseI64ArrayAttr &propValue) {
8454 this->stride = propValue;
8455 }
8456 bool operator==(const Properties &rhs) const {
8457 return
8458 rhs.acc_type == this->acc_type &&
8459 rhs.dilation == this->dilation &&
8460 rhs.local_bound == this->local_bound &&
8461 rhs.pad == this->pad &&
8462 rhs.stride == this->stride &&
8463 true;
8464 }
8465 bool operator!=(const Properties &rhs) const {
8466 return !(*this == rhs);
8467 }
8468 };
8469protected:
8470 ::mlir::DictionaryAttr odsAttrs;
8471 ::std::optional<::mlir::OperationName> odsOpName;
8472 Properties properties;
8473 ::mlir::RegionRange odsRegions;
8474public:
8475 DepthwiseConv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
8476 odsOpName.emplace(args: "tosa.depthwise_conv2d", args: odsAttrs.getContext());
8477 }
8478
8479 DepthwiseConv2DOpGenericAdaptorBase(DepthwiseConv2DOp op);
8480
8481 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
8482 return {index, 1};
8483 }
8484
8485 const Properties &getProperties() {
8486 return properties;
8487 }
8488
8489 ::mlir::DictionaryAttr getAttributes() {
8490 return odsAttrs;
8491 }
8492
8493 ::mlir::DenseI64ArrayAttr getPadAttr() {
8494 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().pad);
8495 return attr;
8496 }
8497
8498 ::llvm::ArrayRef<int64_t> getPad();
8499 ::mlir::DenseI64ArrayAttr getStrideAttr() {
8500 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().stride);
8501 return attr;
8502 }
8503
8504 ::llvm::ArrayRef<int64_t> getStride();
8505 ::mlir::DenseI64ArrayAttr getDilationAttr() {
8506 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().dilation);
8507 return attr;
8508 }
8509
8510 ::llvm::ArrayRef<int64_t> getDilation();
8511 ::mlir::TypeAttr getAccTypeAttr() {
8512 auto attr = ::llvm::cast<::mlir::TypeAttr>(Val: getProperties().acc_type);
8513 return attr;
8514 }
8515
8516 ::mlir::Type getAccType();
8517 ::mlir::BoolAttr getLocalBoundAttr();
8518 bool getLocalBound();
8519};
8520
8521} // namespace detail
8522template <typename RangeT>
8523class DepthwiseConv2DOpGenericAdaptor : public detail::DepthwiseConv2DOpGenericAdaptorBase {
8524 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
8525 using Base = detail::DepthwiseConv2DOpGenericAdaptorBase;
8526 static constexpr int odsIndex_input = 0;
8527 static constexpr int odsIndex_weight = 1;
8528 static constexpr int odsIndex_bias = 2;
8529 static constexpr int odsIndex_input_zp = 3;
8530 static constexpr int odsIndex_weight_zp = 4;
8531public:
8532 DepthwiseConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
8533
8534 DepthwiseConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
8535
8536 DepthwiseConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DepthwiseConv2DOpGenericAdaptor(values, attrs, Properties{}, {}) {}
8537
8538 DepthwiseConv2DOpGenericAdaptor(RangeT values, const DepthwiseConv2DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
8539
8540 template <typename LateInst = DepthwiseConv2DOp, typename = std::enable_if_t<std::is_same_v<LateInst, DepthwiseConv2DOp>>>
8541 DepthwiseConv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
8542
8543 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
8544 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
8545 }
8546
8547 RangeT getODSOperands(unsigned index) {
8548 auto valueRange = getODSOperandIndexAndLength(index);
8549 return {std::next(odsOperands.begin(), valueRange.first),
8550 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8551 }
8552
8553 ValueT getInput() {
8554 return (*getODSOperands(index: 0).begin());
8555 }
8556
8557 ValueT getWeight() {
8558 return (*getODSOperands(index: 1).begin());
8559 }
8560
8561 ValueT getBias() {
8562 return (*getODSOperands(index: 2).begin());
8563 }
8564
8565 ValueT getInputZp() {
8566 return (*getODSOperands(index: 3).begin());
8567 }
8568
8569 ValueT getWeightZp() {
8570 return (*getODSOperands(index: 4).begin());
8571 }
8572
8573 RangeT getOperands() {
8574 return odsOperands;
8575 }
8576
8577private:
8578 RangeT odsOperands;
8579};
8580class DepthwiseConv2DOpAdaptor : public DepthwiseConv2DOpGenericAdaptor<::mlir::ValueRange> {
8581public:
8582 using DepthwiseConv2DOpGenericAdaptor::DepthwiseConv2DOpGenericAdaptor;
8583 DepthwiseConv2DOpAdaptor(DepthwiseConv2DOp op);
8584
8585 ::llvm::LogicalResult verify(::mlir::Location loc);
8586};
8587class DepthwiseConv2DOp : public ::mlir::Op<DepthwiseConv2DOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
8588public:
8589 using Op::Op;
8590 using Op::print;
8591 using Adaptor = DepthwiseConv2DOpAdaptor;
8592 template <typename RangeT>
8593 using GenericAdaptor = DepthwiseConv2DOpGenericAdaptor<RangeT>;
8594 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
8595 static constexpr int odsIndex_input = 0;
8596 static constexpr int odsIndex_weight = 1;
8597 static constexpr int odsIndex_bias = 2;
8598 static constexpr int odsIndex_input_zp = 3;
8599 static constexpr int odsIndex_weight_zp = 4;
8600 static constexpr int odsIndex_output = 0;
8601 using Properties = FoldAdaptor::Properties;
8602 using ::mlir::InferShapedTypeOpInterface::Trait<DepthwiseConv2DOp>::reifyReturnTypeShapes;
8603 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
8604 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acc_type"), ::llvm::StringRef("dilation"), ::llvm::StringRef("local_bound"), ::llvm::StringRef("pad"), ::llvm::StringRef("stride")};
8605 return ::llvm::ArrayRef(attrNames);
8606 }
8607
8608 ::mlir::StringAttr getAccTypeAttrName() {
8609 return getAttributeNameForIndex(index: 0);
8610 }
8611
8612 static ::mlir::StringAttr getAccTypeAttrName(::mlir::OperationName name) {
8613 return getAttributeNameForIndex(name, index: 0);
8614 }
8615
8616 ::mlir::StringAttr getDilationAttrName() {
8617 return getAttributeNameForIndex(index: 1);
8618 }
8619
8620 static ::mlir::StringAttr getDilationAttrName(::mlir::OperationName name) {
8621 return getAttributeNameForIndex(name, index: 1);
8622 }
8623
8624 ::mlir::StringAttr getLocalBoundAttrName() {
8625 return getAttributeNameForIndex(index: 2);
8626 }
8627
8628 static ::mlir::StringAttr getLocalBoundAttrName(::mlir::OperationName name) {
8629 return getAttributeNameForIndex(name, index: 2);
8630 }
8631
8632 ::mlir::StringAttr getPadAttrName() {
8633 return getAttributeNameForIndex(index: 3);
8634 }
8635
8636 static ::mlir::StringAttr getPadAttrName(::mlir::OperationName name) {
8637 return getAttributeNameForIndex(name, index: 3);
8638 }
8639
8640 ::mlir::StringAttr getStrideAttrName() {
8641 return getAttributeNameForIndex(index: 4);
8642 }
8643
8644 static ::mlir::StringAttr getStrideAttrName(::mlir::OperationName name) {
8645 return getAttributeNameForIndex(name, index: 4);
8646 }
8647
8648 static constexpr ::llvm::StringLiteral getOperationName() {
8649 return ::llvm::StringLiteral("tosa.depthwise_conv2d");
8650 }
8651
8652 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
8653 return {index, 1};
8654 }
8655
8656 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
8657 auto [start, length] = getODSOperandIndexAndLength(index);
8658 return getOperation()->getOperands().slice(n: start, m: length);
8659 }
8660
8661 ::mlir::TypedValue<::mlir::TensorType> getInput() {
8662 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
8663 }
8664
8665 ::mlir::TypedValue<::mlir::TensorType> getWeight() {
8666 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
8667 }
8668
8669 ::mlir::TypedValue<::mlir::TensorType> getBias() {
8670 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
8671 }
8672
8673 ::mlir::TypedValue<::mlir::TensorType> getInputZp() {
8674 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
8675 }
8676
8677 ::mlir::TypedValue<::mlir::TensorType> getWeightZp() {
8678 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 4).begin());
8679 }
8680
8681 ::mlir::OpOperand &getInputMutable() {
8682 auto range = getODSOperandIndexAndLength(index: 0);
8683 return getOperation()->getOpOperand(idx: range.first);
8684 }
8685
8686 ::mlir::OpOperand &getWeightMutable() {
8687 auto range = getODSOperandIndexAndLength(index: 1);
8688 return getOperation()->getOpOperand(idx: range.first);
8689 }
8690
8691 ::mlir::OpOperand &getBiasMutable() {
8692 auto range = getODSOperandIndexAndLength(index: 2);
8693 return getOperation()->getOpOperand(idx: range.first);
8694 }
8695
8696 ::mlir::OpOperand &getInputZpMutable() {
8697 auto range = getODSOperandIndexAndLength(index: 3);
8698 return getOperation()->getOpOperand(idx: range.first);
8699 }
8700
8701 ::mlir::OpOperand &getWeightZpMutable() {
8702 auto range = getODSOperandIndexAndLength(index: 4);
8703 return getOperation()->getOpOperand(idx: range.first);
8704 }
8705
8706 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
8707 return {index, 1};
8708 }
8709
8710 ::mlir::Operation::result_range getODSResults(unsigned index) {
8711 auto valueRange = getODSResultIndexAndLength(index);
8712 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
8713 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
8714 }
8715
8716 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
8717 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
8718 }
8719
8720 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
8721 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
8722 static llvm::hash_code computePropertiesHash(const Properties &prop);
8723 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
8724 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
8725 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
8726 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
8727 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
8728 void writeProperties(::mlir::DialectBytecodeWriter &writer);
8729 ::mlir::DenseI64ArrayAttr getPadAttr() {
8730 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().pad);
8731 }
8732
8733 ::llvm::ArrayRef<int64_t> getPad();
8734 ::mlir::DenseI64ArrayAttr getStrideAttr() {
8735 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().stride);
8736 }
8737
8738 ::llvm::ArrayRef<int64_t> getStride();
8739 ::mlir::DenseI64ArrayAttr getDilationAttr() {
8740 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().dilation);
8741 }
8742
8743 ::llvm::ArrayRef<int64_t> getDilation();
8744 ::mlir::TypeAttr getAccTypeAttr() {
8745 return ::llvm::cast<::mlir::TypeAttr>(Val&: getProperties().acc_type);
8746 }
8747
8748 ::mlir::Type getAccType();
8749 ::mlir::BoolAttr getLocalBoundAttr() {
8750 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val&: getProperties().local_bound);
8751 }
8752
8753 bool getLocalBound();
8754 void setPadAttr(::mlir::DenseI64ArrayAttr attr) {
8755 getProperties().pad = attr;
8756 }
8757
8758 void setPad(::llvm::ArrayRef<int64_t> attrValue);
8759 void setStrideAttr(::mlir::DenseI64ArrayAttr attr) {
8760 getProperties().stride = attr;
8761 }
8762
8763 void setStride(::llvm::ArrayRef<int64_t> attrValue);
8764 void setDilationAttr(::mlir::DenseI64ArrayAttr attr) {
8765 getProperties().dilation = attr;
8766 }
8767
8768 void setDilation(::llvm::ArrayRef<int64_t> attrValue);
8769 void setAccTypeAttr(::mlir::TypeAttr attr) {
8770 getProperties().acc_type = attr;
8771 }
8772
8773 void setAccType(::mlir::Type attrValue);
8774 void setLocalBoundAttr(::mlir::BoolAttr attr) {
8775 getProperties().local_bound = attr;
8776 }
8777
8778 void setLocalBound(::std::optional<bool> attrValue);
8779 ::mlir::Attribute removeLocalBoundAttr() {
8780 auto attr = getProperties().local_bound;
8781 getProperties().local_bound = {};
8782 return attr;
8783 }
8784
8785 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
8786 static DepthwiseConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
8787 static DepthwiseConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type);
8788 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
8789 static DepthwiseConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
8790 static DepthwiseConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
8791 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
8792 static DepthwiseConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
8793 static DepthwiseConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr dilation, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
8794 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
8795 static DepthwiseConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
8796 static DepthwiseConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
8797 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
8798 static DepthwiseConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
8799 static DepthwiseConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> pad, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> dilation, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
8800 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
8801 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8802 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
8803 static DepthwiseConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8804 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
8805 static DepthwiseConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
8806 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8807 static DepthwiseConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8808 static DepthwiseConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
8809 ::llvm::LogicalResult verifyInvariantsImpl();
8810 ::llvm::LogicalResult verifyInvariants();
8811 ::llvm::LogicalResult verify();
8812 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
8813 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
8814 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
8815 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
8816 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
8817private:
8818 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
8819 return getAttributeNameForIndex(name: (*this)->getName(), index);
8820 }
8821
8822 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
8823 assert(index < 5 && "invalid attribute index");
8824 assert(name.getStringRef() == getOperationName() && "invalid operation name");
8825 assert(name.isRegistered() && "Operation isn't registered, missing a "
8826 "dependent dialect loading?");
8827 return name.getAttributeNames()[index];
8828 }
8829
8830 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
8831public:
8832 static ::llvm::LogicalResult
8833 inferReturnTypeComponents(::mlir::MLIRContext *context,
8834 std::optional<::mlir::Location> location,
8835 Adaptor adaptor,
8836 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
8837
8838
8839 FailureOr<int64_t> getInputZeroPoint();
8840 FailureOr<int64_t> getWeightZeroPoint();
8841 LogicalResult verifyInputZeroPoint(int64_t zp);
8842 LogicalResult verifyWeightZeroPoint(int64_t zp);
8843};
8844
8845} // namespace mlir::tosa
8846MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::DepthwiseConv2DOp)
8847MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::DepthwiseConv2DOpGenericAdaptorBase::Properties)
8848
8849namespace mlir::tosa {
8850
8851
8852//===----------------------------------------------------------------------===//
8853// mlir::tosa::DimOp declarations
8854//===----------------------------------------------------------------------===//
8855
8856namespace detail {
8857
8858class DimOpGenericAdaptorBase {
8859public:
8860 struct Properties {
8861 using axisTy = ::mlir::IntegerAttr;
8862 axisTy axis;
8863
8864 auto getAxis() const {
8865 auto &propStorage = this->axis;
8866 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
8867 }
8868 void setAxis(const ::mlir::IntegerAttr &propValue) {
8869 this->axis = propValue;
8870 }
8871 bool operator==(const Properties &rhs) const {
8872 return
8873 rhs.axis == this->axis &&
8874 true;
8875 }
8876 bool operator!=(const Properties &rhs) const {
8877 return !(*this == rhs);
8878 }
8879 };
8880protected:
8881 ::mlir::DictionaryAttr odsAttrs;
8882 ::std::optional<::mlir::OperationName> odsOpName;
8883 Properties properties;
8884 ::mlir::RegionRange odsRegions;
8885public:
8886 DimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
8887 odsOpName.emplace(args: "tosa.dim", args: odsAttrs.getContext());
8888 }
8889
8890 DimOpGenericAdaptorBase(DimOp op);
8891
8892 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
8893 return {index, 1};
8894 }
8895
8896 const Properties &getProperties() {
8897 return properties;
8898 }
8899
8900 ::mlir::DictionaryAttr getAttributes() {
8901 return odsAttrs;
8902 }
8903
8904 ::mlir::IntegerAttr getAxisAttr() {
8905 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
8906 return attr;
8907 }
8908
8909 uint32_t getAxis();
8910};
8911
8912} // namespace detail
8913template <typename RangeT>
8914class DimOpGenericAdaptor : public detail::DimOpGenericAdaptorBase {
8915 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
8916 using Base = detail::DimOpGenericAdaptorBase;
8917 static constexpr int odsIndex_input1 = 0;
8918public:
8919 DimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
8920
8921 DimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DimOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
8922
8923 DimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DimOpGenericAdaptor(values, attrs, Properties{}, {}) {}
8924
8925 DimOpGenericAdaptor(RangeT values, const DimOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
8926
8927 template <typename LateInst = DimOp, typename = std::enable_if_t<std::is_same_v<LateInst, DimOp>>>
8928 DimOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
8929
8930 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
8931 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
8932 }
8933
8934 RangeT getODSOperands(unsigned index) {
8935 auto valueRange = getODSOperandIndexAndLength(index);
8936 return {std::next(odsOperands.begin(), valueRange.first),
8937 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8938 }
8939
8940 ValueT getInput1() {
8941 return (*getODSOperands(index: 0).begin());
8942 }
8943
8944 RangeT getOperands() {
8945 return odsOperands;
8946 }
8947
8948private:
8949 RangeT odsOperands;
8950};
8951class DimOpAdaptor : public DimOpGenericAdaptor<::mlir::ValueRange> {
8952public:
8953 using DimOpGenericAdaptor::DimOpGenericAdaptor;
8954 DimOpAdaptor(DimOp op);
8955
8956 ::llvm::LogicalResult verify(::mlir::Location loc);
8957};
8958class DimOp : public ::mlir::Op<DimOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
8959public:
8960 using Op::Op;
8961 using Op::print;
8962 using Adaptor = DimOpAdaptor;
8963 template <typename RangeT>
8964 using GenericAdaptor = DimOpGenericAdaptor<RangeT>;
8965 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
8966 static constexpr int odsIndex_input1 = 0;
8967 static constexpr int odsIndex_output = 0;
8968 using Properties = FoldAdaptor::Properties;
8969 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
8970 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis")};
8971 return ::llvm::ArrayRef(attrNames);
8972 }
8973
8974 ::mlir::StringAttr getAxisAttrName() {
8975 return getAttributeNameForIndex(index: 0);
8976 }
8977
8978 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
8979 return getAttributeNameForIndex(name, index: 0);
8980 }
8981
8982 static constexpr ::llvm::StringLiteral getOperationName() {
8983 return ::llvm::StringLiteral("tosa.dim");
8984 }
8985
8986 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
8987 return {index, 1};
8988 }
8989
8990 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
8991 auto [start, length] = getODSOperandIndexAndLength(index);
8992 return getOperation()->getOperands().slice(n: start, m: length);
8993 }
8994
8995 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
8996 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
8997 }
8998
8999 ::mlir::OpOperand &getInput1Mutable() {
9000 auto range = getODSOperandIndexAndLength(index: 0);
9001 return getOperation()->getOpOperand(idx: range.first);
9002 }
9003
9004 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
9005 return {index, 1};
9006 }
9007
9008 ::mlir::Operation::result_range getODSResults(unsigned index) {
9009 auto valueRange = getODSResultIndexAndLength(index);
9010 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
9011 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
9012 }
9013
9014 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
9015 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
9016 }
9017
9018 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9019 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
9020 static llvm::hash_code computePropertiesHash(const Properties &prop);
9021 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
9022 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
9023 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
9024 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9025 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
9026 void writeProperties(::mlir::DialectBytecodeWriter &writer);
9027 ::mlir::IntegerAttr getAxisAttr() {
9028 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
9029 }
9030
9031 uint32_t getAxis();
9032 void setAxisAttr(::mlir::IntegerAttr attr) {
9033 getProperties().axis = attr;
9034 }
9035
9036 void setAxis(uint32_t attrValue);
9037 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::IntegerAttr axis);
9038 static DimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::IntegerAttr axis);
9039 static DimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::IntegerAttr axis);
9040 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::IntegerAttr axis);
9041 static DimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::IntegerAttr axis);
9042 static DimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::IntegerAttr axis);
9043 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, uint32_t axis);
9044 static DimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, uint32_t axis);
9045 static DimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, uint32_t axis);
9046 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, uint32_t axis);
9047 static DimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, uint32_t axis);
9048 static DimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, uint32_t axis);
9049 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
9050 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9051 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
9052 static DimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9053 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
9054 static DimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9055 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9056 static DimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9057 static DimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9058 ::llvm::LogicalResult verifyInvariantsImpl();
9059 ::llvm::LogicalResult verifyInvariants();
9060 ::llvm::LogicalResult verify();
9061 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
9062 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
9063 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
9064 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
9065private:
9066 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
9067 return getAttributeNameForIndex(name: (*this)->getName(), index);
9068 }
9069
9070 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
9071 assert(index < 1 && "invalid attribute index");
9072 assert(name.getStringRef() == getOperationName() && "invalid operation name");
9073 assert(name.isRegistered() && "Operation isn't registered, missing a "
9074 "dependent dialect loading?");
9075 return name.getAttributeNames()[index];
9076 }
9077
9078 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
9079public:
9080};
9081
9082} // namespace mlir::tosa
9083MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::DimOp)
9084MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::DimOpGenericAdaptorBase::Properties)
9085
9086namespace mlir::tosa {
9087
9088
9089//===----------------------------------------------------------------------===//
9090// mlir::tosa::DivCeilShapeOp declarations
9091//===----------------------------------------------------------------------===//
9092
9093namespace detail {
9094
9095class DivCeilShapeOpGenericAdaptorBase {
9096public:
9097 using Properties = ::mlir::EmptyProperties;
9098protected:
9099 ::mlir::DictionaryAttr odsAttrs;
9100 ::std::optional<::mlir::OperationName> odsOpName;
9101 Properties properties;
9102 ::mlir::RegionRange odsRegions;
9103public:
9104 DivCeilShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
9105 odsOpName.emplace(args: "tosa.div_ceil_shape", args: odsAttrs.getContext());
9106 }
9107
9108 DivCeilShapeOpGenericAdaptorBase(DivCeilShapeOp op);
9109
9110 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
9111 return {index, 1};
9112 }
9113
9114 const Properties &getProperties() {
9115 return properties;
9116 }
9117
9118 ::mlir::DictionaryAttr getAttributes() {
9119 return odsAttrs;
9120 }
9121
9122};
9123
9124} // namespace detail
9125template <typename RangeT>
9126class DivCeilShapeOpGenericAdaptor : public detail::DivCeilShapeOpGenericAdaptorBase {
9127 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
9128 using Base = detail::DivCeilShapeOpGenericAdaptorBase;
9129 static constexpr int odsIndex_input1 = 0;
9130 static constexpr int odsIndex_input2 = 1;
9131public:
9132 DivCeilShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
9133
9134 DivCeilShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DivCeilShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
9135
9136 DivCeilShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DivCeilShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
9137
9138 DivCeilShapeOpGenericAdaptor(RangeT values, const DivCeilShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
9139
9140 template <typename LateInst = DivCeilShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, DivCeilShapeOp>>>
9141 DivCeilShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
9142
9143 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9144 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
9145 }
9146
9147 RangeT getODSOperands(unsigned index) {
9148 auto valueRange = getODSOperandIndexAndLength(index);
9149 return {std::next(odsOperands.begin(), valueRange.first),
9150 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
9151 }
9152
9153 ValueT getInput1() {
9154 return (*getODSOperands(index: 0).begin());
9155 }
9156
9157 ValueT getInput2() {
9158 return (*getODSOperands(index: 1).begin());
9159 }
9160
9161 RangeT getOperands() {
9162 return odsOperands;
9163 }
9164
9165private:
9166 RangeT odsOperands;
9167};
9168class DivCeilShapeOpAdaptor : public DivCeilShapeOpGenericAdaptor<::mlir::ValueRange> {
9169public:
9170 using DivCeilShapeOpGenericAdaptor::DivCeilShapeOpGenericAdaptor;
9171 DivCeilShapeOpAdaptor(DivCeilShapeOp op);
9172
9173 ::llvm::LogicalResult verify(::mlir::Location loc);
9174};
9175class DivCeilShapeOp : public ::mlir::Op<DivCeilShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
9176public:
9177 using Op::Op;
9178 using Op::print;
9179 using Adaptor = DivCeilShapeOpAdaptor;
9180 template <typename RangeT>
9181 using GenericAdaptor = DivCeilShapeOpGenericAdaptor<RangeT>;
9182 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
9183 static constexpr int odsIndex_input1 = 0;
9184 static constexpr int odsIndex_input2 = 1;
9185 static constexpr int odsIndex_output = 0;
9186 using Properties = FoldAdaptor::Properties;
9187 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
9188 return {};
9189 }
9190
9191 static constexpr ::llvm::StringLiteral getOperationName() {
9192 return ::llvm::StringLiteral("tosa.div_ceil_shape");
9193 }
9194
9195 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9196 return {index, 1};
9197 }
9198
9199 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
9200 auto [start, length] = getODSOperandIndexAndLength(index);
9201 return getOperation()->getOperands().slice(n: start, m: length);
9202 }
9203
9204 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
9205 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
9206 }
9207
9208 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
9209 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
9210 }
9211
9212 ::mlir::OpOperand &getInput1Mutable() {
9213 auto range = getODSOperandIndexAndLength(index: 0);
9214 return getOperation()->getOpOperand(idx: range.first);
9215 }
9216
9217 ::mlir::OpOperand &getInput2Mutable() {
9218 auto range = getODSOperandIndexAndLength(index: 1);
9219 return getOperation()->getOpOperand(idx: range.first);
9220 }
9221
9222 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
9223 return {index, 1};
9224 }
9225
9226 ::mlir::Operation::result_range getODSResults(unsigned index) {
9227 auto valueRange = getODSResultIndexAndLength(index);
9228 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
9229 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
9230 }
9231
9232 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
9233 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
9234 }
9235
9236 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9237 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
9238 static llvm::hash_code computePropertiesHash(const Properties &prop);
9239 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
9240 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
9241 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
9242 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9243 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9244 static DivCeilShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9245 static DivCeilShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9246 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9247 static DivCeilShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9248 static DivCeilShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9249 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9250 static DivCeilShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9251 static DivCeilShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9252 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9253 static DivCeilShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9254 static DivCeilShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9255 ::llvm::LogicalResult verifyInvariantsImpl();
9256 ::llvm::LogicalResult verifyInvariants();
9257 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
9258 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
9259 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
9260 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
9261public:
9262};
9263
9264} // namespace mlir::tosa
9265MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::DivCeilShapeOp)
9266
9267namespace mlir::tosa {
9268
9269
9270//===----------------------------------------------------------------------===//
9271// mlir::tosa::DivFloorShapeOp declarations
9272//===----------------------------------------------------------------------===//
9273
9274namespace detail {
9275
9276class DivFloorShapeOpGenericAdaptorBase {
9277public:
9278 using Properties = ::mlir::EmptyProperties;
9279protected:
9280 ::mlir::DictionaryAttr odsAttrs;
9281 ::std::optional<::mlir::OperationName> odsOpName;
9282 Properties properties;
9283 ::mlir::RegionRange odsRegions;
9284public:
9285 DivFloorShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
9286 odsOpName.emplace(args: "tosa.div_floor_shape", args: odsAttrs.getContext());
9287 }
9288
9289 DivFloorShapeOpGenericAdaptorBase(DivFloorShapeOp op);
9290
9291 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
9292 return {index, 1};
9293 }
9294
9295 const Properties &getProperties() {
9296 return properties;
9297 }
9298
9299 ::mlir::DictionaryAttr getAttributes() {
9300 return odsAttrs;
9301 }
9302
9303};
9304
9305} // namespace detail
9306template <typename RangeT>
9307class DivFloorShapeOpGenericAdaptor : public detail::DivFloorShapeOpGenericAdaptorBase {
9308 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
9309 using Base = detail::DivFloorShapeOpGenericAdaptorBase;
9310 static constexpr int odsIndex_input1 = 0;
9311 static constexpr int odsIndex_input2 = 1;
9312public:
9313 DivFloorShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
9314
9315 DivFloorShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DivFloorShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
9316
9317 DivFloorShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DivFloorShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
9318
9319 DivFloorShapeOpGenericAdaptor(RangeT values, const DivFloorShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
9320
9321 template <typename LateInst = DivFloorShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, DivFloorShapeOp>>>
9322 DivFloorShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
9323
9324 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9325 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
9326 }
9327
9328 RangeT getODSOperands(unsigned index) {
9329 auto valueRange = getODSOperandIndexAndLength(index);
9330 return {std::next(odsOperands.begin(), valueRange.first),
9331 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
9332 }
9333
9334 ValueT getInput1() {
9335 return (*getODSOperands(index: 0).begin());
9336 }
9337
9338 ValueT getInput2() {
9339 return (*getODSOperands(index: 1).begin());
9340 }
9341
9342 RangeT getOperands() {
9343 return odsOperands;
9344 }
9345
9346private:
9347 RangeT odsOperands;
9348};
9349class DivFloorShapeOpAdaptor : public DivFloorShapeOpGenericAdaptor<::mlir::ValueRange> {
9350public:
9351 using DivFloorShapeOpGenericAdaptor::DivFloorShapeOpGenericAdaptor;
9352 DivFloorShapeOpAdaptor(DivFloorShapeOp op);
9353
9354 ::llvm::LogicalResult verify(::mlir::Location loc);
9355};
9356class DivFloorShapeOp : public ::mlir::Op<DivFloorShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
9357public:
9358 using Op::Op;
9359 using Op::print;
9360 using Adaptor = DivFloorShapeOpAdaptor;
9361 template <typename RangeT>
9362 using GenericAdaptor = DivFloorShapeOpGenericAdaptor<RangeT>;
9363 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
9364 static constexpr int odsIndex_input1 = 0;
9365 static constexpr int odsIndex_input2 = 1;
9366 static constexpr int odsIndex_output = 0;
9367 using Properties = FoldAdaptor::Properties;
9368 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
9369 return {};
9370 }
9371
9372 static constexpr ::llvm::StringLiteral getOperationName() {
9373 return ::llvm::StringLiteral("tosa.div_floor_shape");
9374 }
9375
9376 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9377 return {index, 1};
9378 }
9379
9380 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
9381 auto [start, length] = getODSOperandIndexAndLength(index);
9382 return getOperation()->getOperands().slice(n: start, m: length);
9383 }
9384
9385 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
9386 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
9387 }
9388
9389 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
9390 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
9391 }
9392
9393 ::mlir::OpOperand &getInput1Mutable() {
9394 auto range = getODSOperandIndexAndLength(index: 0);
9395 return getOperation()->getOpOperand(idx: range.first);
9396 }
9397
9398 ::mlir::OpOperand &getInput2Mutable() {
9399 auto range = getODSOperandIndexAndLength(index: 1);
9400 return getOperation()->getOpOperand(idx: range.first);
9401 }
9402
9403 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
9404 return {index, 1};
9405 }
9406
9407 ::mlir::Operation::result_range getODSResults(unsigned index) {
9408 auto valueRange = getODSResultIndexAndLength(index);
9409 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
9410 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
9411 }
9412
9413 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
9414 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
9415 }
9416
9417 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9418 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
9419 static llvm::hash_code computePropertiesHash(const Properties &prop);
9420 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
9421 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
9422 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
9423 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9424 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9425 static DivFloorShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9426 static DivFloorShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9427 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9428 static DivFloorShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9429 static DivFloorShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9430 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9431 static DivFloorShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9432 static DivFloorShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9433 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9434 static DivFloorShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9435 static DivFloorShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9436 ::llvm::LogicalResult verifyInvariantsImpl();
9437 ::llvm::LogicalResult verifyInvariants();
9438 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
9439 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
9440 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
9441 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
9442public:
9443};
9444
9445} // namespace mlir::tosa
9446MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::DivFloorShapeOp)
9447
9448namespace mlir::tosa {
9449
9450
9451//===----------------------------------------------------------------------===//
9452// mlir::tosa::EqualOp declarations
9453//===----------------------------------------------------------------------===//
9454
9455namespace detail {
9456
9457class EqualOpGenericAdaptorBase {
9458public:
9459 using Properties = ::mlir::EmptyProperties;
9460protected:
9461 ::mlir::DictionaryAttr odsAttrs;
9462 ::std::optional<::mlir::OperationName> odsOpName;
9463 Properties properties;
9464 ::mlir::RegionRange odsRegions;
9465public:
9466 EqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
9467 odsOpName.emplace(args: "tosa.equal", args: odsAttrs.getContext());
9468 }
9469
9470 EqualOpGenericAdaptorBase(EqualOp op);
9471
9472 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
9473 return {index, 1};
9474 }
9475
9476 const Properties &getProperties() {
9477 return properties;
9478 }
9479
9480 ::mlir::DictionaryAttr getAttributes() {
9481 return odsAttrs;
9482 }
9483
9484};
9485
9486} // namespace detail
9487template <typename RangeT>
9488class EqualOpGenericAdaptor : public detail::EqualOpGenericAdaptorBase {
9489 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
9490 using Base = detail::EqualOpGenericAdaptorBase;
9491 static constexpr int odsIndex_input1 = 0;
9492 static constexpr int odsIndex_input2 = 1;
9493public:
9494 EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
9495
9496 EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : EqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
9497
9498 EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : EqualOpGenericAdaptor(values, attrs, Properties{}, {}) {}
9499
9500 EqualOpGenericAdaptor(RangeT values, const EqualOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
9501
9502 template <typename LateInst = EqualOp, typename = std::enable_if_t<std::is_same_v<LateInst, EqualOp>>>
9503 EqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
9504
9505 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9506 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
9507 }
9508
9509 RangeT getODSOperands(unsigned index) {
9510 auto valueRange = getODSOperandIndexAndLength(index);
9511 return {std::next(odsOperands.begin(), valueRange.first),
9512 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
9513 }
9514
9515 ValueT getInput1() {
9516 return (*getODSOperands(index: 0).begin());
9517 }
9518
9519 ValueT getInput2() {
9520 return (*getODSOperands(index: 1).begin());
9521 }
9522
9523 RangeT getOperands() {
9524 return odsOperands;
9525 }
9526
9527private:
9528 RangeT odsOperands;
9529};
9530class EqualOpAdaptor : public EqualOpGenericAdaptor<::mlir::ValueRange> {
9531public:
9532 using EqualOpGenericAdaptor::EqualOpGenericAdaptor;
9533 EqualOpAdaptor(EqualOp op);
9534
9535 ::llvm::LogicalResult verify(::mlir::Location loc);
9536};
9537class EqualOp : public ::mlir::Op<EqualOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
9538public:
9539 using Op::Op;
9540 using Op::print;
9541 using Adaptor = EqualOpAdaptor;
9542 template <typename RangeT>
9543 using GenericAdaptor = EqualOpGenericAdaptor<RangeT>;
9544 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
9545 static constexpr int odsIndex_input1 = 0;
9546 static constexpr int odsIndex_input2 = 1;
9547 static constexpr int odsIndex_output = 0;
9548 using Properties = FoldAdaptor::Properties;
9549 using ::mlir::InferTypeOpInterface::Trait<EqualOp>::refineReturnTypes;
9550 using ::mlir::InferShapedTypeOpInterface::Trait<EqualOp>::reifyReturnTypeShapes;
9551 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
9552 return {};
9553 }
9554
9555 static constexpr ::llvm::StringLiteral getOperationName() {
9556 return ::llvm::StringLiteral("tosa.equal");
9557 }
9558
9559 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9560 return {index, 1};
9561 }
9562
9563 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
9564 auto [start, length] = getODSOperandIndexAndLength(index);
9565 return getOperation()->getOperands().slice(n: start, m: length);
9566 }
9567
9568 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
9569 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
9570 }
9571
9572 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
9573 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
9574 }
9575
9576 ::mlir::OpOperand &getInput1Mutable() {
9577 auto range = getODSOperandIndexAndLength(index: 0);
9578 return getOperation()->getOpOperand(idx: range.first);
9579 }
9580
9581 ::mlir::OpOperand &getInput2Mutable() {
9582 auto range = getODSOperandIndexAndLength(index: 1);
9583 return getOperation()->getOpOperand(idx: range.first);
9584 }
9585
9586 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
9587 return {index, 1};
9588 }
9589
9590 ::mlir::Operation::result_range getODSResults(unsigned index) {
9591 auto valueRange = getODSResultIndexAndLength(index);
9592 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
9593 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
9594 }
9595
9596 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
9597 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
9598 }
9599
9600 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9601 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
9602 static llvm::hash_code computePropertiesHash(const Properties &prop);
9603 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
9604 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
9605 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
9606 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9607 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9608 static EqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9609 static EqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
9610 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1, ::mlir::Value input2);
9611 static EqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1, ::mlir::Value input2);
9612 static EqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1, ::mlir::Value input2);
9613 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9614 static EqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9615 static EqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
9616 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9617 static EqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9618 static EqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9619 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9620 static EqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9621 static EqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9622 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9623 static EqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9624 static EqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9625 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9626 static EqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9627 static EqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9628 ::llvm::LogicalResult verifyInvariantsImpl();
9629 ::llvm::LogicalResult verifyInvariants();
9630 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
9631 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
9632 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
9633 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
9634 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
9635 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
9636public:
9637 /// Returns when two result types are compatible for this op; method used by
9638 /// InferTypeOpInterface.
9639 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
9640};
9641
9642} // namespace mlir::tosa
9643MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::EqualOp)
9644
9645namespace mlir::tosa {
9646
9647
9648//===----------------------------------------------------------------------===//
9649// mlir::tosa::ErfOp declarations
9650//===----------------------------------------------------------------------===//
9651
9652namespace detail {
9653
9654class ErfOpGenericAdaptorBase {
9655public:
9656 using Properties = ::mlir::EmptyProperties;
9657protected:
9658 ::mlir::DictionaryAttr odsAttrs;
9659 ::std::optional<::mlir::OperationName> odsOpName;
9660 Properties properties;
9661 ::mlir::RegionRange odsRegions;
9662public:
9663 ErfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
9664 odsOpName.emplace(args: "tosa.erf", args: odsAttrs.getContext());
9665 }
9666
9667 ErfOpGenericAdaptorBase(ErfOp op);
9668
9669 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
9670 return {index, 1};
9671 }
9672
9673 const Properties &getProperties() {
9674 return properties;
9675 }
9676
9677 ::mlir::DictionaryAttr getAttributes() {
9678 return odsAttrs;
9679 }
9680
9681};
9682
9683} // namespace detail
9684template <typename RangeT>
9685class ErfOpGenericAdaptor : public detail::ErfOpGenericAdaptorBase {
9686 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
9687 using Base = detail::ErfOpGenericAdaptorBase;
9688 static constexpr int odsIndex_input = 0;
9689public:
9690 ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
9691
9692 ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ErfOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
9693
9694 ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ErfOpGenericAdaptor(values, attrs, Properties{}, {}) {}
9695
9696 ErfOpGenericAdaptor(RangeT values, const ErfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
9697
9698 template <typename LateInst = ErfOp, typename = std::enable_if_t<std::is_same_v<LateInst, ErfOp>>>
9699 ErfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
9700
9701 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9702 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
9703 }
9704
9705 RangeT getODSOperands(unsigned index) {
9706 auto valueRange = getODSOperandIndexAndLength(index);
9707 return {std::next(odsOperands.begin(), valueRange.first),
9708 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
9709 }
9710
9711 ValueT getInput() {
9712 return (*getODSOperands(index: 0).begin());
9713 }
9714
9715 RangeT getOperands() {
9716 return odsOperands;
9717 }
9718
9719private:
9720 RangeT odsOperands;
9721};
9722class ErfOpAdaptor : public ErfOpGenericAdaptor<::mlir::ValueRange> {
9723public:
9724 using ErfOpGenericAdaptor::ErfOpGenericAdaptor;
9725 ErfOpAdaptor(ErfOp op);
9726
9727 ::llvm::LogicalResult verify(::mlir::Location loc);
9728};
9729class ErfOp : public ::mlir::Op<ErfOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
9730public:
9731 using Op::Op;
9732 using Op::print;
9733 using Adaptor = ErfOpAdaptor;
9734 template <typename RangeT>
9735 using GenericAdaptor = ErfOpGenericAdaptor<RangeT>;
9736 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
9737 static constexpr int odsIndex_input = 0;
9738 static constexpr int odsIndex_output = 0;
9739 using Properties = FoldAdaptor::Properties;
9740 using ::mlir::InferShapedTypeOpInterface::Trait<ErfOp>::reifyReturnTypeShapes;
9741 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
9742 return {};
9743 }
9744
9745 static constexpr ::llvm::StringLiteral getOperationName() {
9746 return ::llvm::StringLiteral("tosa.erf");
9747 }
9748
9749 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9750 return {index, 1};
9751 }
9752
9753 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
9754 auto [start, length] = getODSOperandIndexAndLength(index);
9755 return getOperation()->getOperands().slice(n: start, m: length);
9756 }
9757
9758 ::mlir::TypedValue<::mlir::TensorType> getInput() {
9759 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
9760 }
9761
9762 ::mlir::OpOperand &getInputMutable() {
9763 auto range = getODSOperandIndexAndLength(index: 0);
9764 return getOperation()->getOpOperand(idx: range.first);
9765 }
9766
9767 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
9768 return {index, 1};
9769 }
9770
9771 ::mlir::Operation::result_range getODSResults(unsigned index) {
9772 auto valueRange = getODSResultIndexAndLength(index);
9773 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
9774 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
9775 }
9776
9777 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
9778 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
9779 }
9780
9781 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9782 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
9783 static llvm::hash_code computePropertiesHash(const Properties &prop);
9784 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
9785 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
9786 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
9787 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9788 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input);
9789 static ErfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input);
9790 static ErfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input);
9791 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input);
9792 static ErfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input);
9793 static ErfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input);
9794 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9795 static ErfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9796 static ErfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9797 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9798 static ErfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9799 static ErfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9800 ::llvm::LogicalResult verifyInvariantsImpl();
9801 ::llvm::LogicalResult verifyInvariants();
9802 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
9803 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
9804 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
9805 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
9806public:
9807};
9808
9809} // namespace mlir::tosa
9810MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ErfOp)
9811
9812namespace mlir::tosa {
9813
9814
9815//===----------------------------------------------------------------------===//
9816// mlir::tosa::Exp2ShapeOp declarations
9817//===----------------------------------------------------------------------===//
9818
9819namespace detail {
9820
9821class Exp2ShapeOpGenericAdaptorBase {
9822public:
9823 using Properties = ::mlir::EmptyProperties;
9824protected:
9825 ::mlir::DictionaryAttr odsAttrs;
9826 ::std::optional<::mlir::OperationName> odsOpName;
9827 Properties properties;
9828 ::mlir::RegionRange odsRegions;
9829public:
9830 Exp2ShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
9831 odsOpName.emplace(args: "tosa.exp2_shape", args: odsAttrs.getContext());
9832 }
9833
9834 Exp2ShapeOpGenericAdaptorBase(Exp2ShapeOp op);
9835
9836 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
9837 return {index, 1};
9838 }
9839
9840 const Properties &getProperties() {
9841 return properties;
9842 }
9843
9844 ::mlir::DictionaryAttr getAttributes() {
9845 return odsAttrs;
9846 }
9847
9848};
9849
9850} // namespace detail
9851template <typename RangeT>
9852class Exp2ShapeOpGenericAdaptor : public detail::Exp2ShapeOpGenericAdaptorBase {
9853 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
9854 using Base = detail::Exp2ShapeOpGenericAdaptorBase;
9855 static constexpr int odsIndex_input = 0;
9856public:
9857 Exp2ShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
9858
9859 Exp2ShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Exp2ShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
9860
9861 Exp2ShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : Exp2ShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
9862
9863 Exp2ShapeOpGenericAdaptor(RangeT values, const Exp2ShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
9864
9865 template <typename LateInst = Exp2ShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, Exp2ShapeOp>>>
9866 Exp2ShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
9867
9868 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9869 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
9870 }
9871
9872 RangeT getODSOperands(unsigned index) {
9873 auto valueRange = getODSOperandIndexAndLength(index);
9874 return {std::next(odsOperands.begin(), valueRange.first),
9875 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
9876 }
9877
9878 ValueT getInput() {
9879 return (*getODSOperands(index: 0).begin());
9880 }
9881
9882 RangeT getOperands() {
9883 return odsOperands;
9884 }
9885
9886private:
9887 RangeT odsOperands;
9888};
9889class Exp2ShapeOpAdaptor : public Exp2ShapeOpGenericAdaptor<::mlir::ValueRange> {
9890public:
9891 using Exp2ShapeOpGenericAdaptor::Exp2ShapeOpGenericAdaptor;
9892 Exp2ShapeOpAdaptor(Exp2ShapeOp op);
9893
9894 ::llvm::LogicalResult verify(::mlir::Location loc);
9895};
9896class Exp2ShapeOp : public ::mlir::Op<Exp2ShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
9897public:
9898 using Op::Op;
9899 using Op::print;
9900 using Adaptor = Exp2ShapeOpAdaptor;
9901 template <typename RangeT>
9902 using GenericAdaptor = Exp2ShapeOpGenericAdaptor<RangeT>;
9903 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
9904 static constexpr int odsIndex_input = 0;
9905 static constexpr int odsIndex_output = 0;
9906 using Properties = FoldAdaptor::Properties;
9907 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
9908 return {};
9909 }
9910
9911 static constexpr ::llvm::StringLiteral getOperationName() {
9912 return ::llvm::StringLiteral("tosa.exp2_shape");
9913 }
9914
9915 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
9916 return {index, 1};
9917 }
9918
9919 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
9920 auto [start, length] = getODSOperandIndexAndLength(index);
9921 return getOperation()->getOperands().slice(n: start, m: length);
9922 }
9923
9924 ::mlir::TypedValue<mlir::tosa::shapeType> getInput() {
9925 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
9926 }
9927
9928 ::mlir::OpOperand &getInputMutable() {
9929 auto range = getODSOperandIndexAndLength(index: 0);
9930 return getOperation()->getOpOperand(idx: range.first);
9931 }
9932
9933 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
9934 return {index, 1};
9935 }
9936
9937 ::mlir::Operation::result_range getODSResults(unsigned index) {
9938 auto valueRange = getODSResultIndexAndLength(index);
9939 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
9940 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
9941 }
9942
9943 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
9944 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
9945 }
9946
9947 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9948 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
9949 static llvm::hash_code computePropertiesHash(const Properties &prop);
9950 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
9951 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
9952 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
9953 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
9954 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input);
9955 static Exp2ShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input);
9956 static Exp2ShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input);
9957 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input);
9958 static Exp2ShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input);
9959 static Exp2ShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input);
9960 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9961 static Exp2ShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9962 static Exp2ShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
9963 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9964 static Exp2ShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9965 static Exp2ShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
9966 ::llvm::LogicalResult verifyInvariantsImpl();
9967 ::llvm::LogicalResult verifyInvariants();
9968 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
9969 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
9970 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
9971 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
9972public:
9973};
9974
9975} // namespace mlir::tosa
9976MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::Exp2ShapeOp)
9977
9978namespace mlir::tosa {
9979
9980
9981//===----------------------------------------------------------------------===//
9982// mlir::tosa::ExpOp declarations
9983//===----------------------------------------------------------------------===//
9984
9985namespace detail {
9986
9987class ExpOpGenericAdaptorBase {
9988public:
9989 using Properties = ::mlir::EmptyProperties;
9990protected:
9991 ::mlir::DictionaryAttr odsAttrs;
9992 ::std::optional<::mlir::OperationName> odsOpName;
9993 Properties properties;
9994 ::mlir::RegionRange odsRegions;
9995public:
9996 ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
9997 odsOpName.emplace(args: "tosa.exp", args: odsAttrs.getContext());
9998 }
9999
10000 ExpOpGenericAdaptorBase(ExpOp op);
10001
10002 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
10003 return {index, 1};
10004 }
10005
10006 const Properties &getProperties() {
10007 return properties;
10008 }
10009
10010 ::mlir::DictionaryAttr getAttributes() {
10011 return odsAttrs;
10012 }
10013
10014};
10015
10016} // namespace detail
10017template <typename RangeT>
10018class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase {
10019 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
10020 using Base = detail::ExpOpGenericAdaptorBase;
10021 static constexpr int odsIndex_input1 = 0;
10022public:
10023 ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
10024
10025 ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
10026
10027 ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ExpOpGenericAdaptor(values, attrs, Properties{}, {}) {}
10028
10029 ExpOpGenericAdaptor(RangeT values, const ExpOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
10030
10031 template <typename LateInst = ExpOp, typename = std::enable_if_t<std::is_same_v<LateInst, ExpOp>>>
10032 ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
10033
10034 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10035 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
10036 }
10037
10038 RangeT getODSOperands(unsigned index) {
10039 auto valueRange = getODSOperandIndexAndLength(index);
10040 return {std::next(odsOperands.begin(), valueRange.first),
10041 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
10042 }
10043
10044 ValueT getInput1() {
10045 return (*getODSOperands(index: 0).begin());
10046 }
10047
10048 RangeT getOperands() {
10049 return odsOperands;
10050 }
10051
10052private:
10053 RangeT odsOperands;
10054};
10055class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> {
10056public:
10057 using ExpOpGenericAdaptor::ExpOpGenericAdaptor;
10058 ExpOpAdaptor(ExpOp op);
10059
10060 ::llvm::LogicalResult verify(::mlir::Location loc);
10061};
10062class ExpOp : public ::mlir::Op<ExpOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
10063public:
10064 using Op::Op;
10065 using Op::print;
10066 using Adaptor = ExpOpAdaptor;
10067 template <typename RangeT>
10068 using GenericAdaptor = ExpOpGenericAdaptor<RangeT>;
10069 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
10070 static constexpr int odsIndex_input1 = 0;
10071 static constexpr int odsIndex_output = 0;
10072 using Properties = FoldAdaptor::Properties;
10073 using ::mlir::InferShapedTypeOpInterface::Trait<ExpOp>::reifyReturnTypeShapes;
10074 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
10075 return {};
10076 }
10077
10078 static constexpr ::llvm::StringLiteral getOperationName() {
10079 return ::llvm::StringLiteral("tosa.exp");
10080 }
10081
10082 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10083 return {index, 1};
10084 }
10085
10086 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
10087 auto [start, length] = getODSOperandIndexAndLength(index);
10088 return getOperation()->getOperands().slice(n: start, m: length);
10089 }
10090
10091 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
10092 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
10093 }
10094
10095 ::mlir::OpOperand &getInput1Mutable() {
10096 auto range = getODSOperandIndexAndLength(index: 0);
10097 return getOperation()->getOpOperand(idx: range.first);
10098 }
10099
10100 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
10101 return {index, 1};
10102 }
10103
10104 ::mlir::Operation::result_range getODSResults(unsigned index) {
10105 auto valueRange = getODSResultIndexAndLength(index);
10106 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
10107 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
10108 }
10109
10110 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
10111 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
10112 }
10113
10114 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10115 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
10116 static llvm::hash_code computePropertiesHash(const Properties &prop);
10117 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
10118 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
10119 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
10120 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10121 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
10122 static ExpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
10123 static ExpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
10124 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
10125 static ExpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
10126 static ExpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
10127 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10128 static ExpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10129 static ExpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10130 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10131 static ExpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10132 static ExpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10133 ::llvm::LogicalResult verifyInvariantsImpl();
10134 ::llvm::LogicalResult verifyInvariants();
10135 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
10136 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
10137 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
10138 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
10139public:
10140};
10141
10142} // namespace mlir::tosa
10143MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ExpOp)
10144
10145namespace mlir::tosa {
10146
10147
10148//===----------------------------------------------------------------------===//
10149// mlir::tosa::FFT2dOp declarations
10150//===----------------------------------------------------------------------===//
10151
10152namespace detail {
10153
10154class FFT2dOpGenericAdaptorBase {
10155public:
10156 struct Properties {
10157 using inverseTy = ::mlir::BoolAttr;
10158 inverseTy inverse;
10159
10160 auto getInverse() const {
10161 auto &propStorage = this->inverse;
10162 return ::llvm::cast<::mlir::BoolAttr>(Val: propStorage);
10163 }
10164 void setInverse(const ::mlir::BoolAttr &propValue) {
10165 this->inverse = propValue;
10166 }
10167 using local_boundTy = ::mlir::BoolAttr;
10168 local_boundTy local_bound;
10169
10170 auto getLocalBound() const {
10171 auto &propStorage = this->local_bound;
10172 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val: propStorage);
10173 }
10174 void setLocalBound(const ::mlir::BoolAttr &propValue) {
10175 this->local_bound = propValue;
10176 }
10177 bool operator==(const Properties &rhs) const {
10178 return
10179 rhs.inverse == this->inverse &&
10180 rhs.local_bound == this->local_bound &&
10181 true;
10182 }
10183 bool operator!=(const Properties &rhs) const {
10184 return !(*this == rhs);
10185 }
10186 };
10187protected:
10188 ::mlir::DictionaryAttr odsAttrs;
10189 ::std::optional<::mlir::OperationName> odsOpName;
10190 Properties properties;
10191 ::mlir::RegionRange odsRegions;
10192public:
10193 FFT2dOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
10194 odsOpName.emplace(args: "tosa.fft2d", args: odsAttrs.getContext());
10195 }
10196
10197 FFT2dOpGenericAdaptorBase(FFT2dOp op);
10198
10199 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
10200 return {index, 1};
10201 }
10202
10203 const Properties &getProperties() {
10204 return properties;
10205 }
10206
10207 ::mlir::DictionaryAttr getAttributes() {
10208 return odsAttrs;
10209 }
10210
10211 ::mlir::BoolAttr getInverseAttr() {
10212 auto attr = ::llvm::cast<::mlir::BoolAttr>(Val: getProperties().inverse);
10213 return attr;
10214 }
10215
10216 bool getInverse();
10217 ::mlir::BoolAttr getLocalBoundAttr();
10218 bool getLocalBound();
10219};
10220
10221} // namespace detail
10222template <typename RangeT>
10223class FFT2dOpGenericAdaptor : public detail::FFT2dOpGenericAdaptorBase {
10224 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
10225 using Base = detail::FFT2dOpGenericAdaptorBase;
10226 static constexpr int odsIndex_input_real = 0;
10227 static constexpr int odsIndex_input_imag = 1;
10228public:
10229 FFT2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
10230
10231 FFT2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FFT2dOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
10232
10233 FFT2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FFT2dOpGenericAdaptor(values, attrs, Properties{}, {}) {}
10234
10235 FFT2dOpGenericAdaptor(RangeT values, const FFT2dOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
10236
10237 template <typename LateInst = FFT2dOp, typename = std::enable_if_t<std::is_same_v<LateInst, FFT2dOp>>>
10238 FFT2dOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
10239
10240 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10241 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
10242 }
10243
10244 RangeT getODSOperands(unsigned index) {
10245 auto valueRange = getODSOperandIndexAndLength(index);
10246 return {std::next(odsOperands.begin(), valueRange.first),
10247 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
10248 }
10249
10250 ValueT getInputReal() {
10251 return (*getODSOperands(index: 0).begin());
10252 }
10253
10254 ValueT getInputImag() {
10255 return (*getODSOperands(index: 1).begin());
10256 }
10257
10258 RangeT getOperands() {
10259 return odsOperands;
10260 }
10261
10262private:
10263 RangeT odsOperands;
10264};
10265class FFT2dOpAdaptor : public FFT2dOpGenericAdaptor<::mlir::ValueRange> {
10266public:
10267 using FFT2dOpGenericAdaptor::FFT2dOpGenericAdaptor;
10268 FFT2dOpAdaptor(FFT2dOp op);
10269
10270 ::llvm::LogicalResult verify(::mlir::Location loc);
10271};
10272class FFT2dOp : public ::mlir::Op<FFT2dOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::NResults<2>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::ResultsAreFloatLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands, ::mlir::OpAsmOpInterface::Trait> {
10273public:
10274 using Op::Op;
10275 using Op::print;
10276 using Adaptor = FFT2dOpAdaptor;
10277 template <typename RangeT>
10278 using GenericAdaptor = FFT2dOpGenericAdaptor<RangeT>;
10279 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
10280 static constexpr int odsIndex_input_real = 0;
10281 static constexpr int odsIndex_input_imag = 1;
10282 static constexpr int odsIndex_output_real = 0;
10283 static constexpr int odsIndex_output_imag = 1;
10284 using Properties = FoldAdaptor::Properties;
10285 using ::mlir::InferShapedTypeOpInterface::Trait<FFT2dOp>::reifyReturnTypeShapes;
10286 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
10287 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("inverse"), ::llvm::StringRef("local_bound")};
10288 return ::llvm::ArrayRef(attrNames);
10289 }
10290
10291 ::mlir::StringAttr getInverseAttrName() {
10292 return getAttributeNameForIndex(index: 0);
10293 }
10294
10295 static ::mlir::StringAttr getInverseAttrName(::mlir::OperationName name) {
10296 return getAttributeNameForIndex(name, index: 0);
10297 }
10298
10299 ::mlir::StringAttr getLocalBoundAttrName() {
10300 return getAttributeNameForIndex(index: 1);
10301 }
10302
10303 static ::mlir::StringAttr getLocalBoundAttrName(::mlir::OperationName name) {
10304 return getAttributeNameForIndex(name, index: 1);
10305 }
10306
10307 void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn);
10308 static constexpr ::llvm::StringLiteral getOperationName() {
10309 return ::llvm::StringLiteral("tosa.fft2d");
10310 }
10311
10312 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10313 return {index, 1};
10314 }
10315
10316 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
10317 auto [start, length] = getODSOperandIndexAndLength(index);
10318 return getOperation()->getOperands().slice(n: start, m: length);
10319 }
10320
10321 ::mlir::TypedValue<::mlir::TensorType> getInputReal() {
10322 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
10323 }
10324
10325 ::mlir::TypedValue<::mlir::TensorType> getInputImag() {
10326 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
10327 }
10328
10329 ::mlir::OpOperand &getInputRealMutable() {
10330 auto range = getODSOperandIndexAndLength(index: 0);
10331 return getOperation()->getOpOperand(idx: range.first);
10332 }
10333
10334 ::mlir::OpOperand &getInputImagMutable() {
10335 auto range = getODSOperandIndexAndLength(index: 1);
10336 return getOperation()->getOpOperand(idx: range.first);
10337 }
10338
10339 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
10340 return {index, 1};
10341 }
10342
10343 ::mlir::Operation::result_range getODSResults(unsigned index) {
10344 auto valueRange = getODSResultIndexAndLength(index);
10345 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
10346 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
10347 }
10348
10349 ::mlir::TypedValue<::mlir::TensorType> getOutputReal() {
10350 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
10351 }
10352
10353 ::mlir::TypedValue<::mlir::TensorType> getOutputImag() {
10354 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 1).begin());
10355 }
10356
10357 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10358 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
10359 static llvm::hash_code computePropertiesHash(const Properties &prop);
10360 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
10361 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
10362 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
10363 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10364 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
10365 void writeProperties(::mlir::DialectBytecodeWriter &writer);
10366 ::mlir::BoolAttr getInverseAttr() {
10367 return ::llvm::cast<::mlir::BoolAttr>(Val&: getProperties().inverse);
10368 }
10369
10370 bool getInverse();
10371 ::mlir::BoolAttr getLocalBoundAttr() {
10372 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val&: getProperties().local_bound);
10373 }
10374
10375 bool getLocalBound();
10376 void setInverseAttr(::mlir::BoolAttr attr) {
10377 getProperties().inverse = attr;
10378 }
10379
10380 void setInverse(bool attrValue);
10381 void setLocalBoundAttr(::mlir::BoolAttr attr) {
10382 getProperties().local_bound = attr;
10383 }
10384
10385 void setLocalBound(::std::optional<bool> attrValue);
10386 ::mlir::Attribute removeLocalBoundAttr() {
10387 auto attr = getProperties().local_bound;
10388 getProperties().local_bound = {};
10389 return attr;
10390 }
10391
10392 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, ::mlir::Value input_imag, ::mlir::BoolAttr inverse, /*optional*/::mlir::BoolAttr local_bound = nullptr);
10393 static FFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, ::mlir::Value input_imag, ::mlir::BoolAttr inverse, /*optional*/::mlir::BoolAttr local_bound = nullptr);
10394 static FFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, ::mlir::Value input_imag, ::mlir::BoolAttr inverse, /*optional*/::mlir::BoolAttr local_bound = nullptr);
10395 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, ::mlir::Value input_imag, ::mlir::BoolAttr inverse, /*optional*/::mlir::BoolAttr local_bound = nullptr);
10396 static FFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, ::mlir::Value input_imag, ::mlir::BoolAttr inverse, /*optional*/::mlir::BoolAttr local_bound = nullptr);
10397 static FFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, ::mlir::Value input_imag, ::mlir::BoolAttr inverse, /*optional*/::mlir::BoolAttr local_bound = nullptr);
10398 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, ::mlir::Value input_imag, bool inverse, /*optional*/bool local_bound = false);
10399 static FFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, ::mlir::Value input_imag, bool inverse, /*optional*/bool local_bound = false);
10400 static FFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, ::mlir::Value input_imag, bool inverse, /*optional*/bool local_bound = false);
10401 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, ::mlir::Value input_imag, bool inverse, /*optional*/bool local_bound = false);
10402 static FFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, ::mlir::Value input_imag, bool inverse, /*optional*/bool local_bound = false);
10403 static FFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, ::mlir::Value input_imag, bool inverse, /*optional*/bool local_bound = false);
10404 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
10405 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10406 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
10407 static FFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10408 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
10409 static FFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10410 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10411 static FFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10412 static FFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10413 ::llvm::LogicalResult verifyInvariantsImpl();
10414 ::llvm::LogicalResult verifyInvariants();
10415 ::llvm::LogicalResult verify();
10416 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
10417 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
10418 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
10419 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
10420private:
10421 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
10422 return getAttributeNameForIndex(name: (*this)->getName(), index);
10423 }
10424
10425 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
10426 assert(index < 2 && "invalid attribute index");
10427 assert(name.getStringRef() == getOperationName() && "invalid operation name");
10428 assert(name.isRegistered() && "Operation isn't registered, missing a "
10429 "dependent dialect loading?");
10430 return name.getAttributeNames()[index];
10431 }
10432
10433 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
10434public:
10435 static ::llvm::LogicalResult
10436 inferReturnTypeComponents(::mlir::MLIRContext *context,
10437 std::optional<::mlir::Location> location,
10438 Adaptor adaptor,
10439 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
10440
10441};
10442
10443} // namespace mlir::tosa
10444MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::FFT2dOp)
10445MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::FFT2dOpGenericAdaptorBase::Properties)
10446
10447namespace mlir::tosa {
10448
10449
10450//===----------------------------------------------------------------------===//
10451// mlir::tosa::FloorOp declarations
10452//===----------------------------------------------------------------------===//
10453
10454namespace detail {
10455
10456class FloorOpGenericAdaptorBase {
10457public:
10458 using Properties = ::mlir::EmptyProperties;
10459protected:
10460 ::mlir::DictionaryAttr odsAttrs;
10461 ::std::optional<::mlir::OperationName> odsOpName;
10462 Properties properties;
10463 ::mlir::RegionRange odsRegions;
10464public:
10465 FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
10466 odsOpName.emplace(args: "tosa.floor", args: odsAttrs.getContext());
10467 }
10468
10469 FloorOpGenericAdaptorBase(FloorOp op);
10470
10471 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
10472 return {index, 1};
10473 }
10474
10475 const Properties &getProperties() {
10476 return properties;
10477 }
10478
10479 ::mlir::DictionaryAttr getAttributes() {
10480 return odsAttrs;
10481 }
10482
10483};
10484
10485} // namespace detail
10486template <typename RangeT>
10487class FloorOpGenericAdaptor : public detail::FloorOpGenericAdaptorBase {
10488 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
10489 using Base = detail::FloorOpGenericAdaptorBase;
10490 static constexpr int odsIndex_input1 = 0;
10491public:
10492 FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
10493
10494 FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FloorOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
10495
10496 FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FloorOpGenericAdaptor(values, attrs, Properties{}, {}) {}
10497
10498 FloorOpGenericAdaptor(RangeT values, const FloorOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
10499
10500 template <typename LateInst = FloorOp, typename = std::enable_if_t<std::is_same_v<LateInst, FloorOp>>>
10501 FloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
10502
10503 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10504 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
10505 }
10506
10507 RangeT getODSOperands(unsigned index) {
10508 auto valueRange = getODSOperandIndexAndLength(index);
10509 return {std::next(odsOperands.begin(), valueRange.first),
10510 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
10511 }
10512
10513 ValueT getInput1() {
10514 return (*getODSOperands(index: 0).begin());
10515 }
10516
10517 RangeT getOperands() {
10518 return odsOperands;
10519 }
10520
10521private:
10522 RangeT odsOperands;
10523};
10524class FloorOpAdaptor : public FloorOpGenericAdaptor<::mlir::ValueRange> {
10525public:
10526 using FloorOpGenericAdaptor::FloorOpGenericAdaptor;
10527 FloorOpAdaptor(FloorOp op);
10528
10529 ::llvm::LogicalResult verify(::mlir::Location loc);
10530};
10531class FloorOp : public ::mlir::Op<FloorOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
10532public:
10533 using Op::Op;
10534 using Op::print;
10535 using Adaptor = FloorOpAdaptor;
10536 template <typename RangeT>
10537 using GenericAdaptor = FloorOpGenericAdaptor<RangeT>;
10538 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
10539 static constexpr int odsIndex_input1 = 0;
10540 static constexpr int odsIndex_output = 0;
10541 using Properties = FoldAdaptor::Properties;
10542 using ::mlir::InferShapedTypeOpInterface::Trait<FloorOp>::reifyReturnTypeShapes;
10543 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
10544 return {};
10545 }
10546
10547 static constexpr ::llvm::StringLiteral getOperationName() {
10548 return ::llvm::StringLiteral("tosa.floor");
10549 }
10550
10551 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10552 return {index, 1};
10553 }
10554
10555 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
10556 auto [start, length] = getODSOperandIndexAndLength(index);
10557 return getOperation()->getOperands().slice(n: start, m: length);
10558 }
10559
10560 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
10561 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
10562 }
10563
10564 ::mlir::OpOperand &getInput1Mutable() {
10565 auto range = getODSOperandIndexAndLength(index: 0);
10566 return getOperation()->getOpOperand(idx: range.first);
10567 }
10568
10569 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
10570 return {index, 1};
10571 }
10572
10573 ::mlir::Operation::result_range getODSResults(unsigned index) {
10574 auto valueRange = getODSResultIndexAndLength(index);
10575 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
10576 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
10577 }
10578
10579 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
10580 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
10581 }
10582
10583 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10584 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
10585 static llvm::hash_code computePropertiesHash(const Properties &prop);
10586 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
10587 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
10588 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
10589 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10590 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
10591 static FloorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
10592 static FloorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
10593 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
10594 static FloorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
10595 static FloorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
10596 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10597 static FloorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10598 static FloorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10599 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10600 static FloorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10601 static FloorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10602 ::llvm::LogicalResult verifyInvariantsImpl();
10603 ::llvm::LogicalResult verifyInvariants();
10604 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
10605 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
10606 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
10607 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
10608public:
10609};
10610
10611} // namespace mlir::tosa
10612MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::FloorOp)
10613
10614namespace mlir::tosa {
10615
10616
10617//===----------------------------------------------------------------------===//
10618// mlir::tosa::GatherOp declarations
10619//===----------------------------------------------------------------------===//
10620
10621namespace detail {
10622
10623class GatherOpGenericAdaptorBase {
10624public:
10625 using Properties = ::mlir::EmptyProperties;
10626protected:
10627 ::mlir::DictionaryAttr odsAttrs;
10628 ::std::optional<::mlir::OperationName> odsOpName;
10629 Properties properties;
10630 ::mlir::RegionRange odsRegions;
10631public:
10632 GatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
10633 odsOpName.emplace(args: "tosa.gather", args: odsAttrs.getContext());
10634 }
10635
10636 GatherOpGenericAdaptorBase(GatherOp op);
10637
10638 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
10639 return {index, 1};
10640 }
10641
10642 const Properties &getProperties() {
10643 return properties;
10644 }
10645
10646 ::mlir::DictionaryAttr getAttributes() {
10647 return odsAttrs;
10648 }
10649
10650};
10651
10652} // namespace detail
10653template <typename RangeT>
10654class GatherOpGenericAdaptor : public detail::GatherOpGenericAdaptorBase {
10655 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
10656 using Base = detail::GatherOpGenericAdaptorBase;
10657 static constexpr int odsIndex_values = 0;
10658 static constexpr int odsIndex_indices = 1;
10659public:
10660 GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
10661
10662 GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
10663
10664 GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GatherOpGenericAdaptor(values, attrs, Properties{}, {}) {}
10665
10666 GatherOpGenericAdaptor(RangeT values, const GatherOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
10667
10668 template <typename LateInst = GatherOp, typename = std::enable_if_t<std::is_same_v<LateInst, GatherOp>>>
10669 GatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
10670
10671 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10672 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
10673 }
10674
10675 RangeT getODSOperands(unsigned index) {
10676 auto valueRange = getODSOperandIndexAndLength(index);
10677 return {std::next(odsOperands.begin(), valueRange.first),
10678 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
10679 }
10680
10681 ValueT getValues() {
10682 return (*getODSOperands(index: 0).begin());
10683 }
10684
10685 ValueT getIndices() {
10686 return (*getODSOperands(index: 1).begin());
10687 }
10688
10689 RangeT getOperands() {
10690 return odsOperands;
10691 }
10692
10693private:
10694 RangeT odsOperands;
10695};
10696class GatherOpAdaptor : public GatherOpGenericAdaptor<::mlir::ValueRange> {
10697public:
10698 using GatherOpGenericAdaptor::GatherOpGenericAdaptor;
10699 GatherOpAdaptor(GatherOp op);
10700
10701 ::llvm::LogicalResult verify(::mlir::Location loc);
10702};
10703class GatherOp : public ::mlir::Op<GatherOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
10704public:
10705 using Op::Op;
10706 using Op::print;
10707 using Adaptor = GatherOpAdaptor;
10708 template <typename RangeT>
10709 using GenericAdaptor = GatherOpGenericAdaptor<RangeT>;
10710 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
10711 static constexpr int odsIndex_values = 0;
10712 static constexpr int odsIndex_indices = 1;
10713 static constexpr int odsIndex_output = 0;
10714 using Properties = FoldAdaptor::Properties;
10715 using ::mlir::InferShapedTypeOpInterface::Trait<GatherOp>::reifyReturnTypeShapes;
10716 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
10717 return {};
10718 }
10719
10720 static constexpr ::llvm::StringLiteral getOperationName() {
10721 return ::llvm::StringLiteral("tosa.gather");
10722 }
10723
10724 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10725 return {index, 1};
10726 }
10727
10728 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
10729 auto [start, length] = getODSOperandIndexAndLength(index);
10730 return getOperation()->getOperands().slice(n: start, m: length);
10731 }
10732
10733 ::mlir::TypedValue<::mlir::TensorType> getValues() {
10734 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
10735 }
10736
10737 ::mlir::TypedValue<::mlir::TensorType> getIndices() {
10738 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
10739 }
10740
10741 ::mlir::OpOperand &getValuesMutable() {
10742 auto range = getODSOperandIndexAndLength(index: 0);
10743 return getOperation()->getOpOperand(idx: range.first);
10744 }
10745
10746 ::mlir::OpOperand &getIndicesMutable() {
10747 auto range = getODSOperandIndexAndLength(index: 1);
10748 return getOperation()->getOpOperand(idx: range.first);
10749 }
10750
10751 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
10752 return {index, 1};
10753 }
10754
10755 ::mlir::Operation::result_range getODSResults(unsigned index) {
10756 auto valueRange = getODSResultIndexAndLength(index);
10757 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
10758 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
10759 }
10760
10761 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
10762 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
10763 }
10764
10765 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10766 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
10767 static llvm::hash_code computePropertiesHash(const Properties &prop);
10768 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
10769 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
10770 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
10771 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10772 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices);
10773 static GatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices);
10774 static GatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices);
10775 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices);
10776 static GatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices);
10777 static GatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices);
10778 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10779 static GatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10780 static GatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10781 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10782 static GatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10783 static GatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10784 ::llvm::LogicalResult verifyInvariantsImpl();
10785 ::llvm::LogicalResult verifyInvariants();
10786 ::llvm::LogicalResult verify();
10787 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
10788 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
10789 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
10790 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
10791public:
10792 static ::llvm::LogicalResult
10793 inferReturnTypeComponents(::mlir::MLIRContext *context,
10794 std::optional<::mlir::Location> location,
10795 Adaptor adaptor,
10796 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
10797
10798};
10799
10800} // namespace mlir::tosa
10801MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::GatherOp)
10802
10803namespace mlir::tosa {
10804
10805
10806//===----------------------------------------------------------------------===//
10807// mlir::tosa::GreaterEqualOp declarations
10808//===----------------------------------------------------------------------===//
10809
10810namespace detail {
10811
10812class GreaterEqualOpGenericAdaptorBase {
10813public:
10814 using Properties = ::mlir::EmptyProperties;
10815protected:
10816 ::mlir::DictionaryAttr odsAttrs;
10817 ::std::optional<::mlir::OperationName> odsOpName;
10818 Properties properties;
10819 ::mlir::RegionRange odsRegions;
10820public:
10821 GreaterEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
10822 odsOpName.emplace(args: "tosa.greater_equal", args: odsAttrs.getContext());
10823 }
10824
10825 GreaterEqualOpGenericAdaptorBase(GreaterEqualOp op);
10826
10827 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
10828 return {index, 1};
10829 }
10830
10831 const Properties &getProperties() {
10832 return properties;
10833 }
10834
10835 ::mlir::DictionaryAttr getAttributes() {
10836 return odsAttrs;
10837 }
10838
10839};
10840
10841} // namespace detail
10842template <typename RangeT>
10843class GreaterEqualOpGenericAdaptor : public detail::GreaterEqualOpGenericAdaptorBase {
10844 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
10845 using Base = detail::GreaterEqualOpGenericAdaptorBase;
10846 static constexpr int odsIndex_input1 = 0;
10847 static constexpr int odsIndex_input2 = 1;
10848public:
10849 GreaterEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
10850
10851 GreaterEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GreaterEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
10852
10853 GreaterEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GreaterEqualOpGenericAdaptor(values, attrs, Properties{}, {}) {}
10854
10855 GreaterEqualOpGenericAdaptor(RangeT values, const GreaterEqualOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
10856
10857 template <typename LateInst = GreaterEqualOp, typename = std::enable_if_t<std::is_same_v<LateInst, GreaterEqualOp>>>
10858 GreaterEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
10859
10860 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10861 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
10862 }
10863
10864 RangeT getODSOperands(unsigned index) {
10865 auto valueRange = getODSOperandIndexAndLength(index);
10866 return {std::next(odsOperands.begin(), valueRange.first),
10867 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
10868 }
10869
10870 ValueT getInput1() {
10871 return (*getODSOperands(index: 0).begin());
10872 }
10873
10874 ValueT getInput2() {
10875 return (*getODSOperands(index: 1).begin());
10876 }
10877
10878 RangeT getOperands() {
10879 return odsOperands;
10880 }
10881
10882private:
10883 RangeT odsOperands;
10884};
10885class GreaterEqualOpAdaptor : public GreaterEqualOpGenericAdaptor<::mlir::ValueRange> {
10886public:
10887 using GreaterEqualOpGenericAdaptor::GreaterEqualOpGenericAdaptor;
10888 GreaterEqualOpAdaptor(GreaterEqualOp op);
10889
10890 ::llvm::LogicalResult verify(::mlir::Location loc);
10891};
10892class GreaterEqualOp : public ::mlir::Op<GreaterEqualOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
10893public:
10894 using Op::Op;
10895 using Op::print;
10896 using Adaptor = GreaterEqualOpAdaptor;
10897 template <typename RangeT>
10898 using GenericAdaptor = GreaterEqualOpGenericAdaptor<RangeT>;
10899 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
10900 static constexpr int odsIndex_input1 = 0;
10901 static constexpr int odsIndex_input2 = 1;
10902 static constexpr int odsIndex_output = 0;
10903 using Properties = FoldAdaptor::Properties;
10904 using ::mlir::InferShapedTypeOpInterface::Trait<GreaterEqualOp>::reifyReturnTypeShapes;
10905 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
10906 return {};
10907 }
10908
10909 static constexpr ::llvm::StringLiteral getOperationName() {
10910 return ::llvm::StringLiteral("tosa.greater_equal");
10911 }
10912
10913 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
10914 return {index, 1};
10915 }
10916
10917 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
10918 auto [start, length] = getODSOperandIndexAndLength(index);
10919 return getOperation()->getOperands().slice(n: start, m: length);
10920 }
10921
10922 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
10923 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
10924 }
10925
10926 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
10927 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
10928 }
10929
10930 ::mlir::OpOperand &getInput1Mutable() {
10931 auto range = getODSOperandIndexAndLength(index: 0);
10932 return getOperation()->getOpOperand(idx: range.first);
10933 }
10934
10935 ::mlir::OpOperand &getInput2Mutable() {
10936 auto range = getODSOperandIndexAndLength(index: 1);
10937 return getOperation()->getOpOperand(idx: range.first);
10938 }
10939
10940 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
10941 return {index, 1};
10942 }
10943
10944 ::mlir::Operation::result_range getODSResults(unsigned index) {
10945 auto valueRange = getODSResultIndexAndLength(index);
10946 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
10947 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
10948 }
10949
10950 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
10951 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
10952 }
10953
10954 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10955 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
10956 static llvm::hash_code computePropertiesHash(const Properties &prop);
10957 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
10958 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
10959 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
10960 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
10961 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
10962 static GreaterEqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
10963 static GreaterEqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
10964 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
10965 static GreaterEqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
10966 static GreaterEqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
10967 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10968 static GreaterEqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10969 static GreaterEqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
10970 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10971 static GreaterEqualOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10972 static GreaterEqualOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
10973 ::llvm::LogicalResult verifyInvariantsImpl();
10974 ::llvm::LogicalResult verifyInvariants();
10975 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
10976 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
10977 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
10978 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
10979 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
10980public:
10981};
10982
10983} // namespace mlir::tosa
10984MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::GreaterEqualOp)
10985
10986namespace mlir::tosa {
10987
10988
10989//===----------------------------------------------------------------------===//
10990// mlir::tosa::GreaterOp declarations
10991//===----------------------------------------------------------------------===//
10992
10993namespace detail {
10994
10995class GreaterOpGenericAdaptorBase {
10996public:
10997 using Properties = ::mlir::EmptyProperties;
10998protected:
10999 ::mlir::DictionaryAttr odsAttrs;
11000 ::std::optional<::mlir::OperationName> odsOpName;
11001 Properties properties;
11002 ::mlir::RegionRange odsRegions;
11003public:
11004 GreaterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
11005 odsOpName.emplace(args: "tosa.greater", args: odsAttrs.getContext());
11006 }
11007
11008 GreaterOpGenericAdaptorBase(GreaterOp op);
11009
11010 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
11011 return {index, 1};
11012 }
11013
11014 const Properties &getProperties() {
11015 return properties;
11016 }
11017
11018 ::mlir::DictionaryAttr getAttributes() {
11019 return odsAttrs;
11020 }
11021
11022};
11023
11024} // namespace detail
11025template <typename RangeT>
11026class GreaterOpGenericAdaptor : public detail::GreaterOpGenericAdaptorBase {
11027 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
11028 using Base = detail::GreaterOpGenericAdaptorBase;
11029 static constexpr int odsIndex_input1 = 0;
11030 static constexpr int odsIndex_input2 = 1;
11031public:
11032 GreaterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
11033
11034 GreaterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GreaterOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
11035
11036 GreaterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GreaterOpGenericAdaptor(values, attrs, Properties{}, {}) {}
11037
11038 GreaterOpGenericAdaptor(RangeT values, const GreaterOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
11039
11040 template <typename LateInst = GreaterOp, typename = std::enable_if_t<std::is_same_v<LateInst, GreaterOp>>>
11041 GreaterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
11042
11043 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11044 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
11045 }
11046
11047 RangeT getODSOperands(unsigned index) {
11048 auto valueRange = getODSOperandIndexAndLength(index);
11049 return {std::next(odsOperands.begin(), valueRange.first),
11050 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
11051 }
11052
11053 ValueT getInput1() {
11054 return (*getODSOperands(index: 0).begin());
11055 }
11056
11057 ValueT getInput2() {
11058 return (*getODSOperands(index: 1).begin());
11059 }
11060
11061 RangeT getOperands() {
11062 return odsOperands;
11063 }
11064
11065private:
11066 RangeT odsOperands;
11067};
11068class GreaterOpAdaptor : public GreaterOpGenericAdaptor<::mlir::ValueRange> {
11069public:
11070 using GreaterOpGenericAdaptor::GreaterOpGenericAdaptor;
11071 GreaterOpAdaptor(GreaterOp op);
11072
11073 ::llvm::LogicalResult verify(::mlir::Location loc);
11074};
11075class GreaterOp : public ::mlir::Op<GreaterOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
11076public:
11077 using Op::Op;
11078 using Op::print;
11079 using Adaptor = GreaterOpAdaptor;
11080 template <typename RangeT>
11081 using GenericAdaptor = GreaterOpGenericAdaptor<RangeT>;
11082 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
11083 static constexpr int odsIndex_input1 = 0;
11084 static constexpr int odsIndex_input2 = 1;
11085 static constexpr int odsIndex_output = 0;
11086 using Properties = FoldAdaptor::Properties;
11087 using ::mlir::InferShapedTypeOpInterface::Trait<GreaterOp>::reifyReturnTypeShapes;
11088 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
11089 return {};
11090 }
11091
11092 static constexpr ::llvm::StringLiteral getOperationName() {
11093 return ::llvm::StringLiteral("tosa.greater");
11094 }
11095
11096 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11097 return {index, 1};
11098 }
11099
11100 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
11101 auto [start, length] = getODSOperandIndexAndLength(index);
11102 return getOperation()->getOperands().slice(n: start, m: length);
11103 }
11104
11105 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
11106 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
11107 }
11108
11109 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
11110 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
11111 }
11112
11113 ::mlir::OpOperand &getInput1Mutable() {
11114 auto range = getODSOperandIndexAndLength(index: 0);
11115 return getOperation()->getOpOperand(idx: range.first);
11116 }
11117
11118 ::mlir::OpOperand &getInput2Mutable() {
11119 auto range = getODSOperandIndexAndLength(index: 1);
11120 return getOperation()->getOpOperand(idx: range.first);
11121 }
11122
11123 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
11124 return {index, 1};
11125 }
11126
11127 ::mlir::Operation::result_range getODSResults(unsigned index) {
11128 auto valueRange = getODSResultIndexAndLength(index);
11129 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
11130 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
11131 }
11132
11133 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
11134 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
11135 }
11136
11137 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11138 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
11139 static llvm::hash_code computePropertiesHash(const Properties &prop);
11140 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
11141 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
11142 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
11143 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11144 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
11145 static GreaterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
11146 static GreaterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
11147 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
11148 static GreaterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
11149 static GreaterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
11150 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11151 static GreaterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11152 static GreaterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11153 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11154 static GreaterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11155 static GreaterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11156 ::llvm::LogicalResult verifyInvariantsImpl();
11157 ::llvm::LogicalResult verifyInvariants();
11158 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
11159 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
11160 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
11161 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
11162 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
11163public:
11164};
11165
11166} // namespace mlir::tosa
11167MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::GreaterOp)
11168
11169namespace mlir::tosa {
11170
11171
11172//===----------------------------------------------------------------------===//
11173// mlir::tosa::IdentityOp declarations
11174//===----------------------------------------------------------------------===//
11175
11176namespace detail {
11177
11178class IdentityOpGenericAdaptorBase {
11179public:
11180 using Properties = ::mlir::EmptyProperties;
11181protected:
11182 ::mlir::DictionaryAttr odsAttrs;
11183 ::std::optional<::mlir::OperationName> odsOpName;
11184 Properties properties;
11185 ::mlir::RegionRange odsRegions;
11186public:
11187 IdentityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
11188 odsOpName.emplace(args: "tosa.identity", args: odsAttrs.getContext());
11189 }
11190
11191 IdentityOpGenericAdaptorBase(IdentityOp op);
11192
11193 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
11194 return {index, 1};
11195 }
11196
11197 const Properties &getProperties() {
11198 return properties;
11199 }
11200
11201 ::mlir::DictionaryAttr getAttributes() {
11202 return odsAttrs;
11203 }
11204
11205};
11206
11207} // namespace detail
11208template <typename RangeT>
11209class IdentityOpGenericAdaptor : public detail::IdentityOpGenericAdaptorBase {
11210 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
11211 using Base = detail::IdentityOpGenericAdaptorBase;
11212 static constexpr int odsIndex_input1 = 0;
11213public:
11214 IdentityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
11215
11216 IdentityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : IdentityOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
11217
11218 IdentityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : IdentityOpGenericAdaptor(values, attrs, Properties{}, {}) {}
11219
11220 IdentityOpGenericAdaptor(RangeT values, const IdentityOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
11221
11222 template <typename LateInst = IdentityOp, typename = std::enable_if_t<std::is_same_v<LateInst, IdentityOp>>>
11223 IdentityOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
11224
11225 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11226 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
11227 }
11228
11229 RangeT getODSOperands(unsigned index) {
11230 auto valueRange = getODSOperandIndexAndLength(index);
11231 return {std::next(odsOperands.begin(), valueRange.first),
11232 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
11233 }
11234
11235 ValueT getInput1() {
11236 return (*getODSOperands(index: 0).begin());
11237 }
11238
11239 RangeT getOperands() {
11240 return odsOperands;
11241 }
11242
11243private:
11244 RangeT odsOperands;
11245};
11246class IdentityOpAdaptor : public IdentityOpGenericAdaptor<::mlir::ValueRange> {
11247public:
11248 using IdentityOpGenericAdaptor::IdentityOpGenericAdaptor;
11249 IdentityOpAdaptor(IdentityOp op);
11250
11251 ::llvm::LogicalResult verify(::mlir::Location loc);
11252};
11253class IdentityOp : public ::mlir::Op<IdentityOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
11254public:
11255 using Op::Op;
11256 using Op::print;
11257 using Adaptor = IdentityOpAdaptor;
11258 template <typename RangeT>
11259 using GenericAdaptor = IdentityOpGenericAdaptor<RangeT>;
11260 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
11261 static constexpr int odsIndex_input1 = 0;
11262 static constexpr int odsIndex_output = 0;
11263 using Properties = FoldAdaptor::Properties;
11264 using ::mlir::InferShapedTypeOpInterface::Trait<IdentityOp>::reifyReturnTypeShapes;
11265 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
11266 return {};
11267 }
11268
11269 static constexpr ::llvm::StringLiteral getOperationName() {
11270 return ::llvm::StringLiteral("tosa.identity");
11271 }
11272
11273 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11274 return {index, 1};
11275 }
11276
11277 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
11278 auto [start, length] = getODSOperandIndexAndLength(index);
11279 return getOperation()->getOperands().slice(n: start, m: length);
11280 }
11281
11282 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
11283 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
11284 }
11285
11286 ::mlir::OpOperand &getInput1Mutable() {
11287 auto range = getODSOperandIndexAndLength(index: 0);
11288 return getOperation()->getOpOperand(idx: range.first);
11289 }
11290
11291 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
11292 return {index, 1};
11293 }
11294
11295 ::mlir::Operation::result_range getODSResults(unsigned index) {
11296 auto valueRange = getODSResultIndexAndLength(index);
11297 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
11298 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
11299 }
11300
11301 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
11302 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
11303 }
11304
11305 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11306 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
11307 static llvm::hash_code computePropertiesHash(const Properties &prop);
11308 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
11309 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
11310 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
11311 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11312 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
11313 static IdentityOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
11314 static IdentityOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
11315 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
11316 static IdentityOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
11317 static IdentityOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
11318 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11319 static IdentityOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11320 static IdentityOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11321 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11322 static IdentityOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11323 static IdentityOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11324 ::llvm::LogicalResult verifyInvariantsImpl();
11325 ::llvm::LogicalResult verifyInvariants();
11326 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
11327 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
11328 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
11329 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
11330public:
11331};
11332
11333} // namespace mlir::tosa
11334MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::IdentityOp)
11335
11336namespace mlir::tosa {
11337
11338
11339//===----------------------------------------------------------------------===//
11340// mlir::tosa::IfOp declarations
11341//===----------------------------------------------------------------------===//
11342
11343namespace detail {
11344
11345class IfOpGenericAdaptorBase {
11346public:
11347 using Properties = ::mlir::EmptyProperties;
11348protected:
11349 ::mlir::DictionaryAttr odsAttrs;
11350 ::std::optional<::mlir::OperationName> odsOpName;
11351 Properties properties;
11352 ::mlir::RegionRange odsRegions;
11353public:
11354 IfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
11355 odsOpName.emplace(args: "tosa.cond_if", args: odsAttrs.getContext());
11356 }
11357
11358 IfOpGenericAdaptorBase(IfOp op);
11359
11360 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
11361 const Properties &getProperties() {
11362 return properties;
11363 }
11364
11365 ::mlir::DictionaryAttr getAttributes() {
11366 return odsAttrs;
11367 }
11368
11369 ::mlir::Region &getThenGraph() {
11370 return *odsRegions[0];
11371 }
11372
11373 ::mlir::Region &getElseGraph() {
11374 return *odsRegions[1];
11375 }
11376
11377 ::mlir::RegionRange getRegions() {
11378 return odsRegions;
11379 }
11380
11381};
11382
11383} // namespace detail
11384template <typename RangeT>
11385class IfOpGenericAdaptor : public detail::IfOpGenericAdaptorBase {
11386 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
11387 using Base = detail::IfOpGenericAdaptorBase;
11388 static constexpr int odsIndex_condition = 0;
11389 static constexpr int odsIndex_input_list = 1;
11390public:
11391 IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
11392
11393 IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : IfOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
11394
11395 IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : IfOpGenericAdaptor(values, attrs, Properties{}, {}) {}
11396
11397 IfOpGenericAdaptor(RangeT values, const IfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
11398
11399 template <typename LateInst = IfOp, typename = std::enable_if_t<std::is_same_v<LateInst, IfOp>>>
11400 IfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
11401
11402 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11403 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
11404 }
11405
11406 RangeT getODSOperands(unsigned index) {
11407 auto valueRange = getODSOperandIndexAndLength(index);
11408 return {std::next(odsOperands.begin(), valueRange.first),
11409 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
11410 }
11411
11412 ValueT getCondition() {
11413 return (*getODSOperands(index: 0).begin());
11414 }
11415
11416 RangeT getInputList() {
11417 return getODSOperands(index: 1);
11418 }
11419
11420 RangeT getOperands() {
11421 return odsOperands;
11422 }
11423
11424private:
11425 RangeT odsOperands;
11426};
11427class IfOpAdaptor : public IfOpGenericAdaptor<::mlir::ValueRange> {
11428public:
11429 using IfOpGenericAdaptor::IfOpGenericAdaptor;
11430 IfOpAdaptor(IfOp op);
11431
11432 ::llvm::LogicalResult verify(::mlir::Location loc);
11433};
11434class IfOp : public ::mlir::Op<IfOp, ::mlir::OpTrait::NRegions<2>::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator<YieldOp>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
11435public:
11436 using Op::Op;
11437 using Op::print;
11438 using Adaptor = IfOpAdaptor;
11439 template <typename RangeT>
11440 using GenericAdaptor = IfOpGenericAdaptor<RangeT>;
11441 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
11442 static constexpr int odsIndex_condition = 0;
11443 static constexpr int odsIndex_input_list = 1;
11444 static constexpr int odsIndex_output_list = 0;
11445 using Properties = FoldAdaptor::Properties;
11446 using ::mlir::InferShapedTypeOpInterface::Trait<IfOp>::reifyReturnTypeShapes;
11447 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
11448 return {};
11449 }
11450
11451 static constexpr ::llvm::StringLiteral getOperationName() {
11452 return ::llvm::StringLiteral("tosa.cond_if");
11453 }
11454
11455 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
11456 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
11457 auto [start, length] = getODSOperandIndexAndLength(index);
11458 return getOperation()->getOperands().slice(n: start, m: length);
11459 }
11460
11461 ::mlir::TypedValue<::mlir::TensorType> getCondition() {
11462 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
11463 }
11464
11465 ::mlir::Operation::operand_range getInputList() {
11466 return getODSOperands(index: 1);
11467 }
11468
11469 ::mlir::OpOperand &getConditionMutable() {
11470 auto range = getODSOperandIndexAndLength(index: 0);
11471 return getOperation()->getOpOperand(idx: range.first);
11472 }
11473
11474 ::mlir::MutableOperandRange getInputListMutable();
11475 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
11476 ::mlir::Operation::result_range getODSResults(unsigned index) {
11477 auto valueRange = getODSResultIndexAndLength(index);
11478 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
11479 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
11480 }
11481
11482 ::mlir::Operation::result_range getOutputList() {
11483 return getODSResults(index: 0);
11484 }
11485
11486 ::mlir::Region &getThenGraph() {
11487 return (*this)->getRegion(index: 0);
11488 }
11489
11490 ::mlir::Region &getElseGraph() {
11491 return (*this)->getRegion(index: 1);
11492 }
11493
11494 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11495 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
11496 static llvm::hash_code computePropertiesHash(const Properties &prop);
11497 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
11498 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
11499 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
11500 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11501 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output_list, ::mlir::Value condition, ::mlir::ValueRange input_list);
11502 static IfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange output_list, ::mlir::Value condition, ::mlir::ValueRange input_list);
11503 static IfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange output_list, ::mlir::Value condition, ::mlir::ValueRange input_list);
11504 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11505 static IfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11506 static IfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11507 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11508 static IfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11509 static IfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11510 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
11511 void print(::mlir::OpAsmPrinter &p);
11512 ::llvm::LogicalResult verifyInvariantsImpl();
11513 ::llvm::LogicalResult verifyInvariants();
11514 ::llvm::LogicalResult verify();
11515 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
11516 static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11517public:
11518 static ::llvm::LogicalResult
11519 inferReturnTypeComponents(::mlir::MLIRContext *context,
11520 std::optional<::mlir::Location> location,
11521 Adaptor adaptor,
11522 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
11523
11524};
11525
11526} // namespace mlir::tosa
11527MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::IfOp)
11528
11529namespace mlir::tosa {
11530
11531
11532//===----------------------------------------------------------------------===//
11533// mlir::tosa::IntDivOp declarations
11534//===----------------------------------------------------------------------===//
11535
11536namespace detail {
11537
11538class IntDivOpGenericAdaptorBase {
11539public:
11540 using Properties = ::mlir::EmptyProperties;
11541protected:
11542 ::mlir::DictionaryAttr odsAttrs;
11543 ::std::optional<::mlir::OperationName> odsOpName;
11544 Properties properties;
11545 ::mlir::RegionRange odsRegions;
11546public:
11547 IntDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
11548 odsOpName.emplace(args: "tosa.intdiv", args: odsAttrs.getContext());
11549 }
11550
11551 IntDivOpGenericAdaptorBase(IntDivOp op);
11552
11553 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
11554 return {index, 1};
11555 }
11556
11557 const Properties &getProperties() {
11558 return properties;
11559 }
11560
11561 ::mlir::DictionaryAttr getAttributes() {
11562 return odsAttrs;
11563 }
11564
11565};
11566
11567} // namespace detail
11568template <typename RangeT>
11569class IntDivOpGenericAdaptor : public detail::IntDivOpGenericAdaptorBase {
11570 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
11571 using Base = detail::IntDivOpGenericAdaptorBase;
11572 static constexpr int odsIndex_input1 = 0;
11573 static constexpr int odsIndex_input2 = 1;
11574public:
11575 IntDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
11576
11577 IntDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : IntDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
11578
11579 IntDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : IntDivOpGenericAdaptor(values, attrs, Properties{}, {}) {}
11580
11581 IntDivOpGenericAdaptor(RangeT values, const IntDivOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
11582
11583 template <typename LateInst = IntDivOp, typename = std::enable_if_t<std::is_same_v<LateInst, IntDivOp>>>
11584 IntDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
11585
11586 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11587 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
11588 }
11589
11590 RangeT getODSOperands(unsigned index) {
11591 auto valueRange = getODSOperandIndexAndLength(index);
11592 return {std::next(odsOperands.begin(), valueRange.first),
11593 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
11594 }
11595
11596 ValueT getInput1() {
11597 return (*getODSOperands(index: 0).begin());
11598 }
11599
11600 ValueT getInput2() {
11601 return (*getODSOperands(index: 1).begin());
11602 }
11603
11604 RangeT getOperands() {
11605 return odsOperands;
11606 }
11607
11608private:
11609 RangeT odsOperands;
11610};
11611class IntDivOpAdaptor : public IntDivOpGenericAdaptor<::mlir::ValueRange> {
11612public:
11613 using IntDivOpGenericAdaptor::IntDivOpGenericAdaptor;
11614 IntDivOpAdaptor(IntDivOp op);
11615
11616 ::llvm::LogicalResult verify(::mlir::Location loc);
11617};
11618class IntDivOp : public ::mlir::Op<IntDivOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
11619public:
11620 using Op::Op;
11621 using Op::print;
11622 using Adaptor = IntDivOpAdaptor;
11623 template <typename RangeT>
11624 using GenericAdaptor = IntDivOpGenericAdaptor<RangeT>;
11625 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
11626 static constexpr int odsIndex_input1 = 0;
11627 static constexpr int odsIndex_input2 = 1;
11628 static constexpr int odsIndex_output = 0;
11629 using Properties = FoldAdaptor::Properties;
11630 using ::mlir::InferShapedTypeOpInterface::Trait<IntDivOp>::reifyReturnTypeShapes;
11631 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
11632 return {};
11633 }
11634
11635 static constexpr ::llvm::StringLiteral getOperationName() {
11636 return ::llvm::StringLiteral("tosa.intdiv");
11637 }
11638
11639 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11640 return {index, 1};
11641 }
11642
11643 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
11644 auto [start, length] = getODSOperandIndexAndLength(index);
11645 return getOperation()->getOperands().slice(n: start, m: length);
11646 }
11647
11648 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
11649 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
11650 }
11651
11652 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
11653 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
11654 }
11655
11656 ::mlir::OpOperand &getInput1Mutable() {
11657 auto range = getODSOperandIndexAndLength(index: 0);
11658 return getOperation()->getOpOperand(idx: range.first);
11659 }
11660
11661 ::mlir::OpOperand &getInput2Mutable() {
11662 auto range = getODSOperandIndexAndLength(index: 1);
11663 return getOperation()->getOpOperand(idx: range.first);
11664 }
11665
11666 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
11667 return {index, 1};
11668 }
11669
11670 ::mlir::Operation::result_range getODSResults(unsigned index) {
11671 auto valueRange = getODSResultIndexAndLength(index);
11672 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
11673 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
11674 }
11675
11676 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
11677 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
11678 }
11679
11680 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11681 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
11682 static llvm::hash_code computePropertiesHash(const Properties &prop);
11683 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
11684 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
11685 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
11686 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11687 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
11688 static IntDivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
11689 static IntDivOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
11690 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
11691 static IntDivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
11692 static IntDivOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
11693 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11694 static IntDivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11695 static IntDivOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11696 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11697 static IntDivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11698 static IntDivOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11699 ::llvm::LogicalResult verifyInvariantsImpl();
11700 ::llvm::LogicalResult verifyInvariants();
11701 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
11702 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
11703 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
11704 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
11705 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
11706public:
11707};
11708
11709} // namespace mlir::tosa
11710MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::IntDivOp)
11711
11712namespace mlir::tosa {
11713
11714
11715//===----------------------------------------------------------------------===//
11716// mlir::tosa::Log2CeilShapeOp declarations
11717//===----------------------------------------------------------------------===//
11718
11719namespace detail {
11720
11721class Log2CeilShapeOpGenericAdaptorBase {
11722public:
11723 using Properties = ::mlir::EmptyProperties;
11724protected:
11725 ::mlir::DictionaryAttr odsAttrs;
11726 ::std::optional<::mlir::OperationName> odsOpName;
11727 Properties properties;
11728 ::mlir::RegionRange odsRegions;
11729public:
11730 Log2CeilShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
11731 odsOpName.emplace(args: "tosa.log2_ceil_shape", args: odsAttrs.getContext());
11732 }
11733
11734 Log2CeilShapeOpGenericAdaptorBase(Log2CeilShapeOp op);
11735
11736 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
11737 return {index, 1};
11738 }
11739
11740 const Properties &getProperties() {
11741 return properties;
11742 }
11743
11744 ::mlir::DictionaryAttr getAttributes() {
11745 return odsAttrs;
11746 }
11747
11748};
11749
11750} // namespace detail
11751template <typename RangeT>
11752class Log2CeilShapeOpGenericAdaptor : public detail::Log2CeilShapeOpGenericAdaptorBase {
11753 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
11754 using Base = detail::Log2CeilShapeOpGenericAdaptorBase;
11755 static constexpr int odsIndex_input = 0;
11756public:
11757 Log2CeilShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
11758
11759 Log2CeilShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Log2CeilShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
11760
11761 Log2CeilShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : Log2CeilShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
11762
11763 Log2CeilShapeOpGenericAdaptor(RangeT values, const Log2CeilShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
11764
11765 template <typename LateInst = Log2CeilShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, Log2CeilShapeOp>>>
11766 Log2CeilShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
11767
11768 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11769 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
11770 }
11771
11772 RangeT getODSOperands(unsigned index) {
11773 auto valueRange = getODSOperandIndexAndLength(index);
11774 return {std::next(odsOperands.begin(), valueRange.first),
11775 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
11776 }
11777
11778 ValueT getInput() {
11779 return (*getODSOperands(index: 0).begin());
11780 }
11781
11782 RangeT getOperands() {
11783 return odsOperands;
11784 }
11785
11786private:
11787 RangeT odsOperands;
11788};
11789class Log2CeilShapeOpAdaptor : public Log2CeilShapeOpGenericAdaptor<::mlir::ValueRange> {
11790public:
11791 using Log2CeilShapeOpGenericAdaptor::Log2CeilShapeOpGenericAdaptor;
11792 Log2CeilShapeOpAdaptor(Log2CeilShapeOp op);
11793
11794 ::llvm::LogicalResult verify(::mlir::Location loc);
11795};
11796class Log2CeilShapeOp : public ::mlir::Op<Log2CeilShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
11797public:
11798 using Op::Op;
11799 using Op::print;
11800 using Adaptor = Log2CeilShapeOpAdaptor;
11801 template <typename RangeT>
11802 using GenericAdaptor = Log2CeilShapeOpGenericAdaptor<RangeT>;
11803 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
11804 static constexpr int odsIndex_input = 0;
11805 static constexpr int odsIndex_output = 0;
11806 using Properties = FoldAdaptor::Properties;
11807 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
11808 return {};
11809 }
11810
11811 static constexpr ::llvm::StringLiteral getOperationName() {
11812 return ::llvm::StringLiteral("tosa.log2_ceil_shape");
11813 }
11814
11815 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11816 return {index, 1};
11817 }
11818
11819 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
11820 auto [start, length] = getODSOperandIndexAndLength(index);
11821 return getOperation()->getOperands().slice(n: start, m: length);
11822 }
11823
11824 ::mlir::TypedValue<mlir::tosa::shapeType> getInput() {
11825 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
11826 }
11827
11828 ::mlir::OpOperand &getInputMutable() {
11829 auto range = getODSOperandIndexAndLength(index: 0);
11830 return getOperation()->getOpOperand(idx: range.first);
11831 }
11832
11833 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
11834 return {index, 1};
11835 }
11836
11837 ::mlir::Operation::result_range getODSResults(unsigned index) {
11838 auto valueRange = getODSResultIndexAndLength(index);
11839 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
11840 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
11841 }
11842
11843 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
11844 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
11845 }
11846
11847 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11848 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
11849 static llvm::hash_code computePropertiesHash(const Properties &prop);
11850 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
11851 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
11852 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
11853 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
11854 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input);
11855 static Log2CeilShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input);
11856 static Log2CeilShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input);
11857 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input);
11858 static Log2CeilShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input);
11859 static Log2CeilShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input);
11860 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11861 static Log2CeilShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11862 static Log2CeilShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
11863 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11864 static Log2CeilShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11865 static Log2CeilShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
11866 ::llvm::LogicalResult verifyInvariantsImpl();
11867 ::llvm::LogicalResult verifyInvariants();
11868 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
11869 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
11870 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
11871 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
11872public:
11873};
11874
11875} // namespace mlir::tosa
11876MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::Log2CeilShapeOp)
11877
11878namespace mlir::tosa {
11879
11880
11881//===----------------------------------------------------------------------===//
11882// mlir::tosa::Log2FloorShapeOp declarations
11883//===----------------------------------------------------------------------===//
11884
11885namespace detail {
11886
11887class Log2FloorShapeOpGenericAdaptorBase {
11888public:
11889 using Properties = ::mlir::EmptyProperties;
11890protected:
11891 ::mlir::DictionaryAttr odsAttrs;
11892 ::std::optional<::mlir::OperationName> odsOpName;
11893 Properties properties;
11894 ::mlir::RegionRange odsRegions;
11895public:
11896 Log2FloorShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
11897 odsOpName.emplace(args: "tosa.log2_floor_shape", args: odsAttrs.getContext());
11898 }
11899
11900 Log2FloorShapeOpGenericAdaptorBase(Log2FloorShapeOp op);
11901
11902 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
11903 return {index, 1};
11904 }
11905
11906 const Properties &getProperties() {
11907 return properties;
11908 }
11909
11910 ::mlir::DictionaryAttr getAttributes() {
11911 return odsAttrs;
11912 }
11913
11914};
11915
11916} // namespace detail
11917template <typename RangeT>
11918class Log2FloorShapeOpGenericAdaptor : public detail::Log2FloorShapeOpGenericAdaptorBase {
11919 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
11920 using Base = detail::Log2FloorShapeOpGenericAdaptorBase;
11921 static constexpr int odsIndex_input = 0;
11922public:
11923 Log2FloorShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
11924
11925 Log2FloorShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Log2FloorShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
11926
11927 Log2FloorShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : Log2FloorShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
11928
11929 Log2FloorShapeOpGenericAdaptor(RangeT values, const Log2FloorShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
11930
11931 template <typename LateInst = Log2FloorShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, Log2FloorShapeOp>>>
11932 Log2FloorShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
11933
11934 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11935 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
11936 }
11937
11938 RangeT getODSOperands(unsigned index) {
11939 auto valueRange = getODSOperandIndexAndLength(index);
11940 return {std::next(odsOperands.begin(), valueRange.first),
11941 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
11942 }
11943
11944 ValueT getInput() {
11945 return (*getODSOperands(index: 0).begin());
11946 }
11947
11948 RangeT getOperands() {
11949 return odsOperands;
11950 }
11951
11952private:
11953 RangeT odsOperands;
11954};
11955class Log2FloorShapeOpAdaptor : public Log2FloorShapeOpGenericAdaptor<::mlir::ValueRange> {
11956public:
11957 using Log2FloorShapeOpGenericAdaptor::Log2FloorShapeOpGenericAdaptor;
11958 Log2FloorShapeOpAdaptor(Log2FloorShapeOp op);
11959
11960 ::llvm::LogicalResult verify(::mlir::Location loc);
11961};
11962class Log2FloorShapeOp : public ::mlir::Op<Log2FloorShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
11963public:
11964 using Op::Op;
11965 using Op::print;
11966 using Adaptor = Log2FloorShapeOpAdaptor;
11967 template <typename RangeT>
11968 using GenericAdaptor = Log2FloorShapeOpGenericAdaptor<RangeT>;
11969 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
11970 static constexpr int odsIndex_input = 0;
11971 static constexpr int odsIndex_output = 0;
11972 using Properties = FoldAdaptor::Properties;
11973 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
11974 return {};
11975 }
11976
11977 static constexpr ::llvm::StringLiteral getOperationName() {
11978 return ::llvm::StringLiteral("tosa.log2_floor_shape");
11979 }
11980
11981 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
11982 return {index, 1};
11983 }
11984
11985 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
11986 auto [start, length] = getODSOperandIndexAndLength(index);
11987 return getOperation()->getOperands().slice(n: start, m: length);
11988 }
11989
11990 ::mlir::TypedValue<mlir::tosa::shapeType> getInput() {
11991 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
11992 }
11993
11994 ::mlir::OpOperand &getInputMutable() {
11995 auto range = getODSOperandIndexAndLength(index: 0);
11996 return getOperation()->getOpOperand(idx: range.first);
11997 }
11998
11999 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
12000 return {index, 1};
12001 }
12002
12003 ::mlir::Operation::result_range getODSResults(unsigned index) {
12004 auto valueRange = getODSResultIndexAndLength(index);
12005 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
12006 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
12007 }
12008
12009 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
12010 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
12011 }
12012
12013 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12014 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
12015 static llvm::hash_code computePropertiesHash(const Properties &prop);
12016 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
12017 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
12018 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
12019 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12020 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input);
12021 static Log2FloorShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input);
12022 static Log2FloorShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input);
12023 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input);
12024 static Log2FloorShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input);
12025 static Log2FloorShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input);
12026 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12027 static Log2FloorShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12028 static Log2FloorShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12029 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12030 static Log2FloorShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12031 static Log2FloorShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12032 ::llvm::LogicalResult verifyInvariantsImpl();
12033 ::llvm::LogicalResult verifyInvariants();
12034 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
12035 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
12036 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
12037 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
12038public:
12039};
12040
12041} // namespace mlir::tosa
12042MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::Log2FloorShapeOp)
12043
12044namespace mlir::tosa {
12045
12046
12047//===----------------------------------------------------------------------===//
12048// mlir::tosa::LogOp declarations
12049//===----------------------------------------------------------------------===//
12050
12051namespace detail {
12052
12053class LogOpGenericAdaptorBase {
12054public:
12055 using Properties = ::mlir::EmptyProperties;
12056protected:
12057 ::mlir::DictionaryAttr odsAttrs;
12058 ::std::optional<::mlir::OperationName> odsOpName;
12059 Properties properties;
12060 ::mlir::RegionRange odsRegions;
12061public:
12062 LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
12063 odsOpName.emplace(args: "tosa.log", args: odsAttrs.getContext());
12064 }
12065
12066 LogOpGenericAdaptorBase(LogOp op);
12067
12068 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
12069 return {index, 1};
12070 }
12071
12072 const Properties &getProperties() {
12073 return properties;
12074 }
12075
12076 ::mlir::DictionaryAttr getAttributes() {
12077 return odsAttrs;
12078 }
12079
12080};
12081
12082} // namespace detail
12083template <typename RangeT>
12084class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase {
12085 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
12086 using Base = detail::LogOpGenericAdaptorBase;
12087 static constexpr int odsIndex_input1 = 0;
12088public:
12089 LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
12090
12091 LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
12092
12093 LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogOpGenericAdaptor(values, attrs, Properties{}, {}) {}
12094
12095 LogOpGenericAdaptor(RangeT values, const LogOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
12096
12097 template <typename LateInst = LogOp, typename = std::enable_if_t<std::is_same_v<LateInst, LogOp>>>
12098 LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
12099
12100 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12101 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
12102 }
12103
12104 RangeT getODSOperands(unsigned index) {
12105 auto valueRange = getODSOperandIndexAndLength(index);
12106 return {std::next(odsOperands.begin(), valueRange.first),
12107 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
12108 }
12109
12110 ValueT getInput1() {
12111 return (*getODSOperands(index: 0).begin());
12112 }
12113
12114 RangeT getOperands() {
12115 return odsOperands;
12116 }
12117
12118private:
12119 RangeT odsOperands;
12120};
12121class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> {
12122public:
12123 using LogOpGenericAdaptor::LogOpGenericAdaptor;
12124 LogOpAdaptor(LogOp op);
12125
12126 ::llvm::LogicalResult verify(::mlir::Location loc);
12127};
12128class LogOp : public ::mlir::Op<LogOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
12129public:
12130 using Op::Op;
12131 using Op::print;
12132 using Adaptor = LogOpAdaptor;
12133 template <typename RangeT>
12134 using GenericAdaptor = LogOpGenericAdaptor<RangeT>;
12135 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
12136 static constexpr int odsIndex_input1 = 0;
12137 static constexpr int odsIndex_output = 0;
12138 using Properties = FoldAdaptor::Properties;
12139 using ::mlir::InferShapedTypeOpInterface::Trait<LogOp>::reifyReturnTypeShapes;
12140 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
12141 return {};
12142 }
12143
12144 static constexpr ::llvm::StringLiteral getOperationName() {
12145 return ::llvm::StringLiteral("tosa.log");
12146 }
12147
12148 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12149 return {index, 1};
12150 }
12151
12152 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
12153 auto [start, length] = getODSOperandIndexAndLength(index);
12154 return getOperation()->getOperands().slice(n: start, m: length);
12155 }
12156
12157 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
12158 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
12159 }
12160
12161 ::mlir::OpOperand &getInput1Mutable() {
12162 auto range = getODSOperandIndexAndLength(index: 0);
12163 return getOperation()->getOpOperand(idx: range.first);
12164 }
12165
12166 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
12167 return {index, 1};
12168 }
12169
12170 ::mlir::Operation::result_range getODSResults(unsigned index) {
12171 auto valueRange = getODSResultIndexAndLength(index);
12172 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
12173 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
12174 }
12175
12176 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
12177 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
12178 }
12179
12180 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12181 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
12182 static llvm::hash_code computePropertiesHash(const Properties &prop);
12183 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
12184 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
12185 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
12186 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12187 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
12188 static LogOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
12189 static LogOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
12190 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
12191 static LogOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
12192 static LogOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
12193 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12194 static LogOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12195 static LogOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12196 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12197 static LogOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12198 static LogOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12199 ::llvm::LogicalResult verifyInvariantsImpl();
12200 ::llvm::LogicalResult verifyInvariants();
12201 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
12202 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
12203 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
12204 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
12205public:
12206};
12207
12208} // namespace mlir::tosa
12209MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::LogOp)
12210
12211namespace mlir::tosa {
12212
12213
12214//===----------------------------------------------------------------------===//
12215// mlir::tosa::LogicalAndOp declarations
12216//===----------------------------------------------------------------------===//
12217
12218namespace detail {
12219
12220class LogicalAndOpGenericAdaptorBase {
12221public:
12222 using Properties = ::mlir::EmptyProperties;
12223protected:
12224 ::mlir::DictionaryAttr odsAttrs;
12225 ::std::optional<::mlir::OperationName> odsOpName;
12226 Properties properties;
12227 ::mlir::RegionRange odsRegions;
12228public:
12229 LogicalAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
12230 odsOpName.emplace(args: "tosa.logical_and", args: odsAttrs.getContext());
12231 }
12232
12233 LogicalAndOpGenericAdaptorBase(LogicalAndOp op);
12234
12235 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
12236 return {index, 1};
12237 }
12238
12239 const Properties &getProperties() {
12240 return properties;
12241 }
12242
12243 ::mlir::DictionaryAttr getAttributes() {
12244 return odsAttrs;
12245 }
12246
12247};
12248
12249} // namespace detail
12250template <typename RangeT>
12251class LogicalAndOpGenericAdaptor : public detail::LogicalAndOpGenericAdaptorBase {
12252 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
12253 using Base = detail::LogicalAndOpGenericAdaptorBase;
12254 static constexpr int odsIndex_input1 = 0;
12255 static constexpr int odsIndex_input2 = 1;
12256public:
12257 LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
12258
12259 LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalAndOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
12260
12261 LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalAndOpGenericAdaptor(values, attrs, Properties{}, {}) {}
12262
12263 LogicalAndOpGenericAdaptor(RangeT values, const LogicalAndOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
12264
12265 template <typename LateInst = LogicalAndOp, typename = std::enable_if_t<std::is_same_v<LateInst, LogicalAndOp>>>
12266 LogicalAndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
12267
12268 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12269 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
12270 }
12271
12272 RangeT getODSOperands(unsigned index) {
12273 auto valueRange = getODSOperandIndexAndLength(index);
12274 return {std::next(odsOperands.begin(), valueRange.first),
12275 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
12276 }
12277
12278 ValueT getInput1() {
12279 return (*getODSOperands(index: 0).begin());
12280 }
12281
12282 ValueT getInput2() {
12283 return (*getODSOperands(index: 1).begin());
12284 }
12285
12286 RangeT getOperands() {
12287 return odsOperands;
12288 }
12289
12290private:
12291 RangeT odsOperands;
12292};
12293class LogicalAndOpAdaptor : public LogicalAndOpGenericAdaptor<::mlir::ValueRange> {
12294public:
12295 using LogicalAndOpGenericAdaptor::LogicalAndOpGenericAdaptor;
12296 LogicalAndOpAdaptor(LogicalAndOp op);
12297
12298 ::llvm::LogicalResult verify(::mlir::Location loc);
12299};
12300class LogicalAndOp : public ::mlir::Op<LogicalAndOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
12301public:
12302 using Op::Op;
12303 using Op::print;
12304 using Adaptor = LogicalAndOpAdaptor;
12305 template <typename RangeT>
12306 using GenericAdaptor = LogicalAndOpGenericAdaptor<RangeT>;
12307 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
12308 static constexpr int odsIndex_input1 = 0;
12309 static constexpr int odsIndex_input2 = 1;
12310 static constexpr int odsIndex_output = 0;
12311 using Properties = FoldAdaptor::Properties;
12312 using ::mlir::InferShapedTypeOpInterface::Trait<LogicalAndOp>::reifyReturnTypeShapes;
12313 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
12314 return {};
12315 }
12316
12317 static constexpr ::llvm::StringLiteral getOperationName() {
12318 return ::llvm::StringLiteral("tosa.logical_and");
12319 }
12320
12321 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12322 return {index, 1};
12323 }
12324
12325 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
12326 auto [start, length] = getODSOperandIndexAndLength(index);
12327 return getOperation()->getOperands().slice(n: start, m: length);
12328 }
12329
12330 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
12331 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
12332 }
12333
12334 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
12335 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
12336 }
12337
12338 ::mlir::OpOperand &getInput1Mutable() {
12339 auto range = getODSOperandIndexAndLength(index: 0);
12340 return getOperation()->getOpOperand(idx: range.first);
12341 }
12342
12343 ::mlir::OpOperand &getInput2Mutable() {
12344 auto range = getODSOperandIndexAndLength(index: 1);
12345 return getOperation()->getOpOperand(idx: range.first);
12346 }
12347
12348 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
12349 return {index, 1};
12350 }
12351
12352 ::mlir::Operation::result_range getODSResults(unsigned index) {
12353 auto valueRange = getODSResultIndexAndLength(index);
12354 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
12355 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
12356 }
12357
12358 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
12359 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
12360 }
12361
12362 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12363 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
12364 static llvm::hash_code computePropertiesHash(const Properties &prop);
12365 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
12366 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
12367 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
12368 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12369 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12370 static LogicalAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12371 static LogicalAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12372 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12373 static LogicalAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12374 static LogicalAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12375 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12376 static LogicalAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12377 static LogicalAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12378 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12379 static LogicalAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12380 static LogicalAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12381 ::llvm::LogicalResult verifyInvariantsImpl();
12382 ::llvm::LogicalResult verifyInvariants();
12383 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
12384 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
12385 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
12386 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
12387public:
12388};
12389
12390} // namespace mlir::tosa
12391MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::LogicalAndOp)
12392
12393namespace mlir::tosa {
12394
12395
12396//===----------------------------------------------------------------------===//
12397// mlir::tosa::LogicalLeftShiftOp declarations
12398//===----------------------------------------------------------------------===//
12399
12400namespace detail {
12401
12402class LogicalLeftShiftOpGenericAdaptorBase {
12403public:
12404 using Properties = ::mlir::EmptyProperties;
12405protected:
12406 ::mlir::DictionaryAttr odsAttrs;
12407 ::std::optional<::mlir::OperationName> odsOpName;
12408 Properties properties;
12409 ::mlir::RegionRange odsRegions;
12410public:
12411 LogicalLeftShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
12412 odsOpName.emplace(args: "tosa.logical_left_shift", args: odsAttrs.getContext());
12413 }
12414
12415 LogicalLeftShiftOpGenericAdaptorBase(LogicalLeftShiftOp op);
12416
12417 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
12418 return {index, 1};
12419 }
12420
12421 const Properties &getProperties() {
12422 return properties;
12423 }
12424
12425 ::mlir::DictionaryAttr getAttributes() {
12426 return odsAttrs;
12427 }
12428
12429};
12430
12431} // namespace detail
12432template <typename RangeT>
12433class LogicalLeftShiftOpGenericAdaptor : public detail::LogicalLeftShiftOpGenericAdaptorBase {
12434 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
12435 using Base = detail::LogicalLeftShiftOpGenericAdaptorBase;
12436 static constexpr int odsIndex_input1 = 0;
12437 static constexpr int odsIndex_input2 = 1;
12438public:
12439 LogicalLeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
12440
12441 LogicalLeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalLeftShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
12442
12443 LogicalLeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalLeftShiftOpGenericAdaptor(values, attrs, Properties{}, {}) {}
12444
12445 LogicalLeftShiftOpGenericAdaptor(RangeT values, const LogicalLeftShiftOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
12446
12447 template <typename LateInst = LogicalLeftShiftOp, typename = std::enable_if_t<std::is_same_v<LateInst, LogicalLeftShiftOp>>>
12448 LogicalLeftShiftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
12449
12450 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12451 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
12452 }
12453
12454 RangeT getODSOperands(unsigned index) {
12455 auto valueRange = getODSOperandIndexAndLength(index);
12456 return {std::next(odsOperands.begin(), valueRange.first),
12457 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
12458 }
12459
12460 ValueT getInput1() {
12461 return (*getODSOperands(index: 0).begin());
12462 }
12463
12464 ValueT getInput2() {
12465 return (*getODSOperands(index: 1).begin());
12466 }
12467
12468 RangeT getOperands() {
12469 return odsOperands;
12470 }
12471
12472private:
12473 RangeT odsOperands;
12474};
12475class LogicalLeftShiftOpAdaptor : public LogicalLeftShiftOpGenericAdaptor<::mlir::ValueRange> {
12476public:
12477 using LogicalLeftShiftOpGenericAdaptor::LogicalLeftShiftOpGenericAdaptor;
12478 LogicalLeftShiftOpAdaptor(LogicalLeftShiftOp op);
12479
12480 ::llvm::LogicalResult verify(::mlir::Location loc);
12481};
12482class LogicalLeftShiftOp : public ::mlir::Op<LogicalLeftShiftOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
12483public:
12484 using Op::Op;
12485 using Op::print;
12486 using Adaptor = LogicalLeftShiftOpAdaptor;
12487 template <typename RangeT>
12488 using GenericAdaptor = LogicalLeftShiftOpGenericAdaptor<RangeT>;
12489 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
12490 static constexpr int odsIndex_input1 = 0;
12491 static constexpr int odsIndex_input2 = 1;
12492 static constexpr int odsIndex_output = 0;
12493 using Properties = FoldAdaptor::Properties;
12494 using ::mlir::InferShapedTypeOpInterface::Trait<LogicalLeftShiftOp>::reifyReturnTypeShapes;
12495 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
12496 return {};
12497 }
12498
12499 static constexpr ::llvm::StringLiteral getOperationName() {
12500 return ::llvm::StringLiteral("tosa.logical_left_shift");
12501 }
12502
12503 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12504 return {index, 1};
12505 }
12506
12507 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
12508 auto [start, length] = getODSOperandIndexAndLength(index);
12509 return getOperation()->getOperands().slice(n: start, m: length);
12510 }
12511
12512 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
12513 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
12514 }
12515
12516 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
12517 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
12518 }
12519
12520 ::mlir::OpOperand &getInput1Mutable() {
12521 auto range = getODSOperandIndexAndLength(index: 0);
12522 return getOperation()->getOpOperand(idx: range.first);
12523 }
12524
12525 ::mlir::OpOperand &getInput2Mutable() {
12526 auto range = getODSOperandIndexAndLength(index: 1);
12527 return getOperation()->getOpOperand(idx: range.first);
12528 }
12529
12530 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
12531 return {index, 1};
12532 }
12533
12534 ::mlir::Operation::result_range getODSResults(unsigned index) {
12535 auto valueRange = getODSResultIndexAndLength(index);
12536 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
12537 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
12538 }
12539
12540 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
12541 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
12542 }
12543
12544 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12545 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
12546 static llvm::hash_code computePropertiesHash(const Properties &prop);
12547 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
12548 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
12549 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
12550 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12551 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12552 static LogicalLeftShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12553 static LogicalLeftShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12554 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12555 static LogicalLeftShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12556 static LogicalLeftShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12557 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12558 static LogicalLeftShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12559 static LogicalLeftShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12560 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12561 static LogicalLeftShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12562 static LogicalLeftShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12563 ::llvm::LogicalResult verifyInvariantsImpl();
12564 ::llvm::LogicalResult verifyInvariants();
12565 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
12566 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
12567 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
12568 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
12569public:
12570};
12571
12572} // namespace mlir::tosa
12573MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::LogicalLeftShiftOp)
12574
12575namespace mlir::tosa {
12576
12577
12578//===----------------------------------------------------------------------===//
12579// mlir::tosa::LogicalNotOp declarations
12580//===----------------------------------------------------------------------===//
12581
12582namespace detail {
12583
12584class LogicalNotOpGenericAdaptorBase {
12585public:
12586 using Properties = ::mlir::EmptyProperties;
12587protected:
12588 ::mlir::DictionaryAttr odsAttrs;
12589 ::std::optional<::mlir::OperationName> odsOpName;
12590 Properties properties;
12591 ::mlir::RegionRange odsRegions;
12592public:
12593 LogicalNotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
12594 odsOpName.emplace(args: "tosa.logical_not", args: odsAttrs.getContext());
12595 }
12596
12597 LogicalNotOpGenericAdaptorBase(LogicalNotOp op);
12598
12599 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
12600 return {index, 1};
12601 }
12602
12603 const Properties &getProperties() {
12604 return properties;
12605 }
12606
12607 ::mlir::DictionaryAttr getAttributes() {
12608 return odsAttrs;
12609 }
12610
12611};
12612
12613} // namespace detail
12614template <typename RangeT>
12615class LogicalNotOpGenericAdaptor : public detail::LogicalNotOpGenericAdaptorBase {
12616 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
12617 using Base = detail::LogicalNotOpGenericAdaptorBase;
12618 static constexpr int odsIndex_input1 = 0;
12619public:
12620 LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
12621
12622 LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalNotOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
12623
12624 LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalNotOpGenericAdaptor(values, attrs, Properties{}, {}) {}
12625
12626 LogicalNotOpGenericAdaptor(RangeT values, const LogicalNotOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
12627
12628 template <typename LateInst = LogicalNotOp, typename = std::enable_if_t<std::is_same_v<LateInst, LogicalNotOp>>>
12629 LogicalNotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
12630
12631 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12632 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
12633 }
12634
12635 RangeT getODSOperands(unsigned index) {
12636 auto valueRange = getODSOperandIndexAndLength(index);
12637 return {std::next(odsOperands.begin(), valueRange.first),
12638 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
12639 }
12640
12641 ValueT getInput1() {
12642 return (*getODSOperands(index: 0).begin());
12643 }
12644
12645 RangeT getOperands() {
12646 return odsOperands;
12647 }
12648
12649private:
12650 RangeT odsOperands;
12651};
12652class LogicalNotOpAdaptor : public LogicalNotOpGenericAdaptor<::mlir::ValueRange> {
12653public:
12654 using LogicalNotOpGenericAdaptor::LogicalNotOpGenericAdaptor;
12655 LogicalNotOpAdaptor(LogicalNotOp op);
12656
12657 ::llvm::LogicalResult verify(::mlir::Location loc);
12658};
12659class LogicalNotOp : public ::mlir::Op<LogicalNotOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
12660public:
12661 using Op::Op;
12662 using Op::print;
12663 using Adaptor = LogicalNotOpAdaptor;
12664 template <typename RangeT>
12665 using GenericAdaptor = LogicalNotOpGenericAdaptor<RangeT>;
12666 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
12667 static constexpr int odsIndex_input1 = 0;
12668 static constexpr int odsIndex_output = 0;
12669 using Properties = FoldAdaptor::Properties;
12670 using ::mlir::InferShapedTypeOpInterface::Trait<LogicalNotOp>::reifyReturnTypeShapes;
12671 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
12672 return {};
12673 }
12674
12675 static constexpr ::llvm::StringLiteral getOperationName() {
12676 return ::llvm::StringLiteral("tosa.logical_not");
12677 }
12678
12679 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12680 return {index, 1};
12681 }
12682
12683 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
12684 auto [start, length] = getODSOperandIndexAndLength(index);
12685 return getOperation()->getOperands().slice(n: start, m: length);
12686 }
12687
12688 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
12689 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
12690 }
12691
12692 ::mlir::OpOperand &getInput1Mutable() {
12693 auto range = getODSOperandIndexAndLength(index: 0);
12694 return getOperation()->getOpOperand(idx: range.first);
12695 }
12696
12697 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
12698 return {index, 1};
12699 }
12700
12701 ::mlir::Operation::result_range getODSResults(unsigned index) {
12702 auto valueRange = getODSResultIndexAndLength(index);
12703 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
12704 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
12705 }
12706
12707 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
12708 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
12709 }
12710
12711 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12712 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
12713 static llvm::hash_code computePropertiesHash(const Properties &prop);
12714 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
12715 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
12716 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
12717 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12718 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
12719 static LogicalNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
12720 static LogicalNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
12721 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
12722 static LogicalNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
12723 static LogicalNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
12724 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12725 static LogicalNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12726 static LogicalNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12727 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12728 static LogicalNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12729 static LogicalNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12730 ::llvm::LogicalResult verifyInvariantsImpl();
12731 ::llvm::LogicalResult verifyInvariants();
12732 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
12733 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
12734 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
12735 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
12736public:
12737};
12738
12739} // namespace mlir::tosa
12740MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::LogicalNotOp)
12741
12742namespace mlir::tosa {
12743
12744
12745//===----------------------------------------------------------------------===//
12746// mlir::tosa::LogicalOrOp declarations
12747//===----------------------------------------------------------------------===//
12748
12749namespace detail {
12750
12751class LogicalOrOpGenericAdaptorBase {
12752public:
12753 using Properties = ::mlir::EmptyProperties;
12754protected:
12755 ::mlir::DictionaryAttr odsAttrs;
12756 ::std::optional<::mlir::OperationName> odsOpName;
12757 Properties properties;
12758 ::mlir::RegionRange odsRegions;
12759public:
12760 LogicalOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
12761 odsOpName.emplace(args: "tosa.logical_or", args: odsAttrs.getContext());
12762 }
12763
12764 LogicalOrOpGenericAdaptorBase(LogicalOrOp op);
12765
12766 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
12767 return {index, 1};
12768 }
12769
12770 const Properties &getProperties() {
12771 return properties;
12772 }
12773
12774 ::mlir::DictionaryAttr getAttributes() {
12775 return odsAttrs;
12776 }
12777
12778};
12779
12780} // namespace detail
12781template <typename RangeT>
12782class LogicalOrOpGenericAdaptor : public detail::LogicalOrOpGenericAdaptorBase {
12783 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
12784 using Base = detail::LogicalOrOpGenericAdaptorBase;
12785 static constexpr int odsIndex_input1 = 0;
12786 static constexpr int odsIndex_input2 = 1;
12787public:
12788 LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
12789
12790 LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
12791
12792 LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalOrOpGenericAdaptor(values, attrs, Properties{}, {}) {}
12793
12794 LogicalOrOpGenericAdaptor(RangeT values, const LogicalOrOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
12795
12796 template <typename LateInst = LogicalOrOp, typename = std::enable_if_t<std::is_same_v<LateInst, LogicalOrOp>>>
12797 LogicalOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
12798
12799 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12800 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
12801 }
12802
12803 RangeT getODSOperands(unsigned index) {
12804 auto valueRange = getODSOperandIndexAndLength(index);
12805 return {std::next(odsOperands.begin(), valueRange.first),
12806 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
12807 }
12808
12809 ValueT getInput1() {
12810 return (*getODSOperands(index: 0).begin());
12811 }
12812
12813 ValueT getInput2() {
12814 return (*getODSOperands(index: 1).begin());
12815 }
12816
12817 RangeT getOperands() {
12818 return odsOperands;
12819 }
12820
12821private:
12822 RangeT odsOperands;
12823};
12824class LogicalOrOpAdaptor : public LogicalOrOpGenericAdaptor<::mlir::ValueRange> {
12825public:
12826 using LogicalOrOpGenericAdaptor::LogicalOrOpGenericAdaptor;
12827 LogicalOrOpAdaptor(LogicalOrOp op);
12828
12829 ::llvm::LogicalResult verify(::mlir::Location loc);
12830};
12831class LogicalOrOp : public ::mlir::Op<LogicalOrOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
12832public:
12833 using Op::Op;
12834 using Op::print;
12835 using Adaptor = LogicalOrOpAdaptor;
12836 template <typename RangeT>
12837 using GenericAdaptor = LogicalOrOpGenericAdaptor<RangeT>;
12838 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
12839 static constexpr int odsIndex_input1 = 0;
12840 static constexpr int odsIndex_input2 = 1;
12841 static constexpr int odsIndex_output = 0;
12842 using Properties = FoldAdaptor::Properties;
12843 using ::mlir::InferShapedTypeOpInterface::Trait<LogicalOrOp>::reifyReturnTypeShapes;
12844 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
12845 return {};
12846 }
12847
12848 static constexpr ::llvm::StringLiteral getOperationName() {
12849 return ::llvm::StringLiteral("tosa.logical_or");
12850 }
12851
12852 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12853 return {index, 1};
12854 }
12855
12856 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
12857 auto [start, length] = getODSOperandIndexAndLength(index);
12858 return getOperation()->getOperands().slice(n: start, m: length);
12859 }
12860
12861 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
12862 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
12863 }
12864
12865 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
12866 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
12867 }
12868
12869 ::mlir::OpOperand &getInput1Mutable() {
12870 auto range = getODSOperandIndexAndLength(index: 0);
12871 return getOperation()->getOpOperand(idx: range.first);
12872 }
12873
12874 ::mlir::OpOperand &getInput2Mutable() {
12875 auto range = getODSOperandIndexAndLength(index: 1);
12876 return getOperation()->getOpOperand(idx: range.first);
12877 }
12878
12879 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
12880 return {index, 1};
12881 }
12882
12883 ::mlir::Operation::result_range getODSResults(unsigned index) {
12884 auto valueRange = getODSResultIndexAndLength(index);
12885 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
12886 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
12887 }
12888
12889 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
12890 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
12891 }
12892
12893 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12894 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
12895 static llvm::hash_code computePropertiesHash(const Properties &prop);
12896 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
12897 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
12898 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
12899 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
12900 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12901 static LogicalOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12902 static LogicalOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
12903 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12904 static LogicalOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12905 static LogicalOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
12906 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12907 static LogicalOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12908 static LogicalOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
12909 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12910 static LogicalOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12911 static LogicalOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
12912 ::llvm::LogicalResult verifyInvariantsImpl();
12913 ::llvm::LogicalResult verifyInvariants();
12914 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
12915 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
12916 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
12917 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
12918public:
12919};
12920
12921} // namespace mlir::tosa
12922MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::LogicalOrOp)
12923
12924namespace mlir::tosa {
12925
12926
12927//===----------------------------------------------------------------------===//
12928// mlir::tosa::LogicalRightShiftOp declarations
12929//===----------------------------------------------------------------------===//
12930
12931namespace detail {
12932
12933class LogicalRightShiftOpGenericAdaptorBase {
12934public:
12935 using Properties = ::mlir::EmptyProperties;
12936protected:
12937 ::mlir::DictionaryAttr odsAttrs;
12938 ::std::optional<::mlir::OperationName> odsOpName;
12939 Properties properties;
12940 ::mlir::RegionRange odsRegions;
12941public:
12942 LogicalRightShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
12943 odsOpName.emplace(args: "tosa.logical_right_shift", args: odsAttrs.getContext());
12944 }
12945
12946 LogicalRightShiftOpGenericAdaptorBase(LogicalRightShiftOp op);
12947
12948 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
12949 return {index, 1};
12950 }
12951
12952 const Properties &getProperties() {
12953 return properties;
12954 }
12955
12956 ::mlir::DictionaryAttr getAttributes() {
12957 return odsAttrs;
12958 }
12959
12960};
12961
12962} // namespace detail
12963template <typename RangeT>
12964class LogicalRightShiftOpGenericAdaptor : public detail::LogicalRightShiftOpGenericAdaptorBase {
12965 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
12966 using Base = detail::LogicalRightShiftOpGenericAdaptorBase;
12967 static constexpr int odsIndex_input1 = 0;
12968 static constexpr int odsIndex_input2 = 1;
12969public:
12970 LogicalRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
12971
12972 LogicalRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalRightShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
12973
12974 LogicalRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalRightShiftOpGenericAdaptor(values, attrs, Properties{}, {}) {}
12975
12976 LogicalRightShiftOpGenericAdaptor(RangeT values, const LogicalRightShiftOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
12977
12978 template <typename LateInst = LogicalRightShiftOp, typename = std::enable_if_t<std::is_same_v<LateInst, LogicalRightShiftOp>>>
12979 LogicalRightShiftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
12980
12981 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
12982 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
12983 }
12984
12985 RangeT getODSOperands(unsigned index) {
12986 auto valueRange = getODSOperandIndexAndLength(index);
12987 return {std::next(odsOperands.begin(), valueRange.first),
12988 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
12989 }
12990
12991 ValueT getInput1() {
12992 return (*getODSOperands(index: 0).begin());
12993 }
12994
12995 ValueT getInput2() {
12996 return (*getODSOperands(index: 1).begin());
12997 }
12998
12999 RangeT getOperands() {
13000 return odsOperands;
13001 }
13002
13003private:
13004 RangeT odsOperands;
13005};
13006class LogicalRightShiftOpAdaptor : public LogicalRightShiftOpGenericAdaptor<::mlir::ValueRange> {
13007public:
13008 using LogicalRightShiftOpGenericAdaptor::LogicalRightShiftOpGenericAdaptor;
13009 LogicalRightShiftOpAdaptor(LogicalRightShiftOp op);
13010
13011 ::llvm::LogicalResult verify(::mlir::Location loc);
13012};
13013class LogicalRightShiftOp : public ::mlir::Op<LogicalRightShiftOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
13014public:
13015 using Op::Op;
13016 using Op::print;
13017 using Adaptor = LogicalRightShiftOpAdaptor;
13018 template <typename RangeT>
13019 using GenericAdaptor = LogicalRightShiftOpGenericAdaptor<RangeT>;
13020 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
13021 static constexpr int odsIndex_input1 = 0;
13022 static constexpr int odsIndex_input2 = 1;
13023 static constexpr int odsIndex_output = 0;
13024 using Properties = FoldAdaptor::Properties;
13025 using ::mlir::InferShapedTypeOpInterface::Trait<LogicalRightShiftOp>::reifyReturnTypeShapes;
13026 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
13027 return {};
13028 }
13029
13030 static constexpr ::llvm::StringLiteral getOperationName() {
13031 return ::llvm::StringLiteral("tosa.logical_right_shift");
13032 }
13033
13034 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13035 return {index, 1};
13036 }
13037
13038 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
13039 auto [start, length] = getODSOperandIndexAndLength(index);
13040 return getOperation()->getOperands().slice(n: start, m: length);
13041 }
13042
13043 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
13044 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
13045 }
13046
13047 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
13048 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
13049 }
13050
13051 ::mlir::OpOperand &getInput1Mutable() {
13052 auto range = getODSOperandIndexAndLength(index: 0);
13053 return getOperation()->getOpOperand(idx: range.first);
13054 }
13055
13056 ::mlir::OpOperand &getInput2Mutable() {
13057 auto range = getODSOperandIndexAndLength(index: 1);
13058 return getOperation()->getOpOperand(idx: range.first);
13059 }
13060
13061 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
13062 return {index, 1};
13063 }
13064
13065 ::mlir::Operation::result_range getODSResults(unsigned index) {
13066 auto valueRange = getODSResultIndexAndLength(index);
13067 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
13068 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
13069 }
13070
13071 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
13072 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
13073 }
13074
13075 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13076 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
13077 static llvm::hash_code computePropertiesHash(const Properties &prop);
13078 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
13079 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
13080 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
13081 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13082 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
13083 static LogicalRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
13084 static LogicalRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
13085 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
13086 static LogicalRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
13087 static LogicalRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
13088 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13089 static LogicalRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13090 static LogicalRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13091 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13092 static LogicalRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13093 static LogicalRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13094 ::llvm::LogicalResult verifyInvariantsImpl();
13095 ::llvm::LogicalResult verifyInvariants();
13096 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
13097 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
13098 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
13099 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
13100public:
13101};
13102
13103} // namespace mlir::tosa
13104MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::LogicalRightShiftOp)
13105
13106namespace mlir::tosa {
13107
13108
13109//===----------------------------------------------------------------------===//
13110// mlir::tosa::LogicalXorOp declarations
13111//===----------------------------------------------------------------------===//
13112
13113namespace detail {
13114
13115class LogicalXorOpGenericAdaptorBase {
13116public:
13117 using Properties = ::mlir::EmptyProperties;
13118protected:
13119 ::mlir::DictionaryAttr odsAttrs;
13120 ::std::optional<::mlir::OperationName> odsOpName;
13121 Properties properties;
13122 ::mlir::RegionRange odsRegions;
13123public:
13124 LogicalXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
13125 odsOpName.emplace(args: "tosa.logical_xor", args: odsAttrs.getContext());
13126 }
13127
13128 LogicalXorOpGenericAdaptorBase(LogicalXorOp op);
13129
13130 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
13131 return {index, 1};
13132 }
13133
13134 const Properties &getProperties() {
13135 return properties;
13136 }
13137
13138 ::mlir::DictionaryAttr getAttributes() {
13139 return odsAttrs;
13140 }
13141
13142};
13143
13144} // namespace detail
13145template <typename RangeT>
13146class LogicalXorOpGenericAdaptor : public detail::LogicalXorOpGenericAdaptorBase {
13147 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
13148 using Base = detail::LogicalXorOpGenericAdaptorBase;
13149 static constexpr int odsIndex_input1 = 0;
13150 static constexpr int odsIndex_input2 = 1;
13151public:
13152 LogicalXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
13153
13154 LogicalXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalXorOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
13155
13156 LogicalXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalXorOpGenericAdaptor(values, attrs, Properties{}, {}) {}
13157
13158 LogicalXorOpGenericAdaptor(RangeT values, const LogicalXorOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
13159
13160 template <typename LateInst = LogicalXorOp, typename = std::enable_if_t<std::is_same_v<LateInst, LogicalXorOp>>>
13161 LogicalXorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
13162
13163 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13164 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
13165 }
13166
13167 RangeT getODSOperands(unsigned index) {
13168 auto valueRange = getODSOperandIndexAndLength(index);
13169 return {std::next(odsOperands.begin(), valueRange.first),
13170 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
13171 }
13172
13173 ValueT getInput1() {
13174 return (*getODSOperands(index: 0).begin());
13175 }
13176
13177 ValueT getInput2() {
13178 return (*getODSOperands(index: 1).begin());
13179 }
13180
13181 RangeT getOperands() {
13182 return odsOperands;
13183 }
13184
13185private:
13186 RangeT odsOperands;
13187};
13188class LogicalXorOpAdaptor : public LogicalXorOpGenericAdaptor<::mlir::ValueRange> {
13189public:
13190 using LogicalXorOpGenericAdaptor::LogicalXorOpGenericAdaptor;
13191 LogicalXorOpAdaptor(LogicalXorOp op);
13192
13193 ::llvm::LogicalResult verify(::mlir::Location loc);
13194};
13195class LogicalXorOp : public ::mlir::Op<LogicalXorOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
13196public:
13197 using Op::Op;
13198 using Op::print;
13199 using Adaptor = LogicalXorOpAdaptor;
13200 template <typename RangeT>
13201 using GenericAdaptor = LogicalXorOpGenericAdaptor<RangeT>;
13202 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
13203 static constexpr int odsIndex_input1 = 0;
13204 static constexpr int odsIndex_input2 = 1;
13205 static constexpr int odsIndex_output = 0;
13206 using Properties = FoldAdaptor::Properties;
13207 using ::mlir::InferShapedTypeOpInterface::Trait<LogicalXorOp>::reifyReturnTypeShapes;
13208 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
13209 return {};
13210 }
13211
13212 static constexpr ::llvm::StringLiteral getOperationName() {
13213 return ::llvm::StringLiteral("tosa.logical_xor");
13214 }
13215
13216 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13217 return {index, 1};
13218 }
13219
13220 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
13221 auto [start, length] = getODSOperandIndexAndLength(index);
13222 return getOperation()->getOperands().slice(n: start, m: length);
13223 }
13224
13225 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
13226 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
13227 }
13228
13229 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
13230 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
13231 }
13232
13233 ::mlir::OpOperand &getInput1Mutable() {
13234 auto range = getODSOperandIndexAndLength(index: 0);
13235 return getOperation()->getOpOperand(idx: range.first);
13236 }
13237
13238 ::mlir::OpOperand &getInput2Mutable() {
13239 auto range = getODSOperandIndexAndLength(index: 1);
13240 return getOperation()->getOpOperand(idx: range.first);
13241 }
13242
13243 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
13244 return {index, 1};
13245 }
13246
13247 ::mlir::Operation::result_range getODSResults(unsigned index) {
13248 auto valueRange = getODSResultIndexAndLength(index);
13249 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
13250 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
13251 }
13252
13253 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
13254 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
13255 }
13256
13257 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13258 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
13259 static llvm::hash_code computePropertiesHash(const Properties &prop);
13260 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
13261 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
13262 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
13263 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13264 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
13265 static LogicalXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
13266 static LogicalXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
13267 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
13268 static LogicalXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
13269 static LogicalXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
13270 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13271 static LogicalXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13272 static LogicalXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13273 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13274 static LogicalXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13275 static LogicalXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13276 ::llvm::LogicalResult verifyInvariantsImpl();
13277 ::llvm::LogicalResult verifyInvariants();
13278 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
13279 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
13280 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
13281 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
13282public:
13283};
13284
13285} // namespace mlir::tosa
13286MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::LogicalXorOp)
13287
13288namespace mlir::tosa {
13289
13290
13291//===----------------------------------------------------------------------===//
13292// mlir::tosa::MatMulOp declarations
13293//===----------------------------------------------------------------------===//
13294
13295namespace detail {
13296
13297class MatMulOpGenericAdaptorBase {
13298public:
13299 using Properties = ::mlir::EmptyProperties;
13300protected:
13301 ::mlir::DictionaryAttr odsAttrs;
13302 ::std::optional<::mlir::OperationName> odsOpName;
13303 Properties properties;
13304 ::mlir::RegionRange odsRegions;
13305public:
13306 MatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
13307 odsOpName.emplace(args: "tosa.matmul", args: odsAttrs.getContext());
13308 }
13309
13310 MatMulOpGenericAdaptorBase(MatMulOp op);
13311
13312 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
13313 return {index, 1};
13314 }
13315
13316 const Properties &getProperties() {
13317 return properties;
13318 }
13319
13320 ::mlir::DictionaryAttr getAttributes() {
13321 return odsAttrs;
13322 }
13323
13324};
13325
13326} // namespace detail
13327template <typename RangeT>
13328class MatMulOpGenericAdaptor : public detail::MatMulOpGenericAdaptorBase {
13329 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
13330 using Base = detail::MatMulOpGenericAdaptorBase;
13331 static constexpr int odsIndex_a = 0;
13332 static constexpr int odsIndex_b = 1;
13333 static constexpr int odsIndex_a_zp = 2;
13334 static constexpr int odsIndex_b_zp = 3;
13335public:
13336 MatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
13337
13338 MatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
13339
13340 MatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MatMulOpGenericAdaptor(values, attrs, Properties{}, {}) {}
13341
13342 MatMulOpGenericAdaptor(RangeT values, const MatMulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
13343
13344 template <typename LateInst = MatMulOp, typename = std::enable_if_t<std::is_same_v<LateInst, MatMulOp>>>
13345 MatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
13346
13347 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13348 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
13349 }
13350
13351 RangeT getODSOperands(unsigned index) {
13352 auto valueRange = getODSOperandIndexAndLength(index);
13353 return {std::next(odsOperands.begin(), valueRange.first),
13354 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
13355 }
13356
13357 ValueT getA() {
13358 return (*getODSOperands(index: 0).begin());
13359 }
13360
13361 ValueT getB() {
13362 return (*getODSOperands(index: 1).begin());
13363 }
13364
13365 ValueT getAZp() {
13366 return (*getODSOperands(index: 2).begin());
13367 }
13368
13369 ValueT getBZp() {
13370 return (*getODSOperands(index: 3).begin());
13371 }
13372
13373 RangeT getOperands() {
13374 return odsOperands;
13375 }
13376
13377private:
13378 RangeT odsOperands;
13379};
13380class MatMulOpAdaptor : public MatMulOpGenericAdaptor<::mlir::ValueRange> {
13381public:
13382 using MatMulOpGenericAdaptor::MatMulOpGenericAdaptor;
13383 MatMulOpAdaptor(MatMulOp op);
13384
13385 ::llvm::LogicalResult verify(::mlir::Location loc);
13386};
13387class MatMulOp : public ::mlir::Op<MatMulOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
13388public:
13389 using Op::Op;
13390 using Op::print;
13391 using Adaptor = MatMulOpAdaptor;
13392 template <typename RangeT>
13393 using GenericAdaptor = MatMulOpGenericAdaptor<RangeT>;
13394 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
13395 static constexpr int odsIndex_a = 0;
13396 static constexpr int odsIndex_b = 1;
13397 static constexpr int odsIndex_a_zp = 2;
13398 static constexpr int odsIndex_b_zp = 3;
13399 static constexpr int odsIndex_output = 0;
13400 using Properties = FoldAdaptor::Properties;
13401 using ::mlir::InferShapedTypeOpInterface::Trait<MatMulOp>::reifyReturnTypeShapes;
13402 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
13403 return {};
13404 }
13405
13406 static constexpr ::llvm::StringLiteral getOperationName() {
13407 return ::llvm::StringLiteral("tosa.matmul");
13408 }
13409
13410 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13411 return {index, 1};
13412 }
13413
13414 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
13415 auto [start, length] = getODSOperandIndexAndLength(index);
13416 return getOperation()->getOperands().slice(n: start, m: length);
13417 }
13418
13419 ::mlir::TypedValue<::mlir::TensorType> getA() {
13420 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
13421 }
13422
13423 ::mlir::TypedValue<::mlir::TensorType> getB() {
13424 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
13425 }
13426
13427 ::mlir::TypedValue<::mlir::TensorType> getAZp() {
13428 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
13429 }
13430
13431 ::mlir::TypedValue<::mlir::TensorType> getBZp() {
13432 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
13433 }
13434
13435 ::mlir::OpOperand &getAMutable() {
13436 auto range = getODSOperandIndexAndLength(index: 0);
13437 return getOperation()->getOpOperand(idx: range.first);
13438 }
13439
13440 ::mlir::OpOperand &getBMutable() {
13441 auto range = getODSOperandIndexAndLength(index: 1);
13442 return getOperation()->getOpOperand(idx: range.first);
13443 }
13444
13445 ::mlir::OpOperand &getAZpMutable() {
13446 auto range = getODSOperandIndexAndLength(index: 2);
13447 return getOperation()->getOpOperand(idx: range.first);
13448 }
13449
13450 ::mlir::OpOperand &getBZpMutable() {
13451 auto range = getODSOperandIndexAndLength(index: 3);
13452 return getOperation()->getOpOperand(idx: range.first);
13453 }
13454
13455 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
13456 return {index, 1};
13457 }
13458
13459 ::mlir::Operation::result_range getODSResults(unsigned index) {
13460 auto valueRange = getODSResultIndexAndLength(index);
13461 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
13462 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
13463 }
13464
13465 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
13466 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
13467 }
13468
13469 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13470 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
13471 static llvm::hash_code computePropertiesHash(const Properties &prop);
13472 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
13473 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
13474 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
13475 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13476 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type outputType, Value a, Value b);
13477 static MatMulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Type outputType, Value a, Value b);
13478 static MatMulOp create(::mlir::ImplicitLocOpBuilder &builder, Type outputType, Value a, Value b);
13479 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13480 static MatMulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13481 static MatMulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13482 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13483 static MatMulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13484 static MatMulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13485 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13486 static MatMulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13487 static MatMulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13488 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13489 static MatMulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13490 static MatMulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13491 ::llvm::LogicalResult verifyInvariantsImpl();
13492 ::llvm::LogicalResult verifyInvariants();
13493 ::llvm::LogicalResult verify();
13494 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
13495 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
13496 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
13497 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
13498public:
13499 static ::llvm::LogicalResult
13500 inferReturnTypeComponents(::mlir::MLIRContext *context,
13501 std::optional<::mlir::Location> location,
13502 Adaptor adaptor,
13503 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
13504
13505
13506 FailureOr<int64_t> getAZeroPoint();
13507 FailureOr<int64_t> getBZeroPoint();
13508 LogicalResult verifyAZeroPoint(int64_t zp);
13509 LogicalResult verifyBZeroPoint(int64_t zp);
13510};
13511
13512} // namespace mlir::tosa
13513MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MatMulOp)
13514
13515namespace mlir::tosa {
13516
13517
13518//===----------------------------------------------------------------------===//
13519// mlir::tosa::MatMulTOp declarations
13520//===----------------------------------------------------------------------===//
13521
13522namespace detail {
13523
13524class MatMulTOpGenericAdaptorBase {
13525public:
13526 using Properties = ::mlir::EmptyProperties;
13527protected:
13528 ::mlir::DictionaryAttr odsAttrs;
13529 ::std::optional<::mlir::OperationName> odsOpName;
13530 Properties properties;
13531 ::mlir::RegionRange odsRegions;
13532public:
13533 MatMulTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
13534 odsOpName.emplace(args: "tosa.matmul_t", args: odsAttrs.getContext());
13535 }
13536
13537 MatMulTOpGenericAdaptorBase(MatMulTOp op);
13538
13539 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
13540 return {index, 1};
13541 }
13542
13543 const Properties &getProperties() {
13544 return properties;
13545 }
13546
13547 ::mlir::DictionaryAttr getAttributes() {
13548 return odsAttrs;
13549 }
13550
13551};
13552
13553} // namespace detail
13554template <typename RangeT>
13555class MatMulTOpGenericAdaptor : public detail::MatMulTOpGenericAdaptorBase {
13556 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
13557 using Base = detail::MatMulTOpGenericAdaptorBase;
13558 static constexpr int odsIndex_a = 0;
13559 static constexpr int odsIndex_b = 1;
13560 static constexpr int odsIndex_a_zp = 2;
13561 static constexpr int odsIndex_b_zp = 3;
13562public:
13563 MatMulTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
13564
13565 MatMulTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MatMulTOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
13566
13567 MatMulTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MatMulTOpGenericAdaptor(values, attrs, Properties{}, {}) {}
13568
13569 MatMulTOpGenericAdaptor(RangeT values, const MatMulTOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
13570
13571 template <typename LateInst = MatMulTOp, typename = std::enable_if_t<std::is_same_v<LateInst, MatMulTOp>>>
13572 MatMulTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
13573
13574 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13575 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
13576 }
13577
13578 RangeT getODSOperands(unsigned index) {
13579 auto valueRange = getODSOperandIndexAndLength(index);
13580 return {std::next(odsOperands.begin(), valueRange.first),
13581 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
13582 }
13583
13584 ValueT getA() {
13585 return (*getODSOperands(index: 0).begin());
13586 }
13587
13588 ValueT getB() {
13589 return (*getODSOperands(index: 1).begin());
13590 }
13591
13592 ValueT getAZp() {
13593 return (*getODSOperands(index: 2).begin());
13594 }
13595
13596 ValueT getBZp() {
13597 return (*getODSOperands(index: 3).begin());
13598 }
13599
13600 RangeT getOperands() {
13601 return odsOperands;
13602 }
13603
13604private:
13605 RangeT odsOperands;
13606};
13607class MatMulTOpAdaptor : public MatMulTOpGenericAdaptor<::mlir::ValueRange> {
13608public:
13609 using MatMulTOpGenericAdaptor::MatMulTOpGenericAdaptor;
13610 MatMulTOpAdaptor(MatMulTOp op);
13611
13612 ::llvm::LogicalResult verify(::mlir::Location loc);
13613};
13614class MatMulTOp : public ::mlir::Op<MatMulTOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
13615public:
13616 using Op::Op;
13617 using Op::print;
13618 using Adaptor = MatMulTOpAdaptor;
13619 template <typename RangeT>
13620 using GenericAdaptor = MatMulTOpGenericAdaptor<RangeT>;
13621 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
13622 static constexpr int odsIndex_a = 0;
13623 static constexpr int odsIndex_b = 1;
13624 static constexpr int odsIndex_a_zp = 2;
13625 static constexpr int odsIndex_b_zp = 3;
13626 static constexpr int odsIndex_output = 0;
13627 using Properties = FoldAdaptor::Properties;
13628 using ::mlir::InferShapedTypeOpInterface::Trait<MatMulTOp>::reifyReturnTypeShapes;
13629 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
13630 return {};
13631 }
13632
13633 static constexpr ::llvm::StringLiteral getOperationName() {
13634 return ::llvm::StringLiteral("tosa.matmul_t");
13635 }
13636
13637 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13638 return {index, 1};
13639 }
13640
13641 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
13642 auto [start, length] = getODSOperandIndexAndLength(index);
13643 return getOperation()->getOperands().slice(n: start, m: length);
13644 }
13645
13646 ::mlir::TypedValue<::mlir::TensorType> getA() {
13647 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
13648 }
13649
13650 ::mlir::TypedValue<::mlir::TensorType> getB() {
13651 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
13652 }
13653
13654 ::mlir::TypedValue<::mlir::TensorType> getAZp() {
13655 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
13656 }
13657
13658 ::mlir::TypedValue<::mlir::TensorType> getBZp() {
13659 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
13660 }
13661
13662 ::mlir::OpOperand &getAMutable() {
13663 auto range = getODSOperandIndexAndLength(index: 0);
13664 return getOperation()->getOpOperand(idx: range.first);
13665 }
13666
13667 ::mlir::OpOperand &getBMutable() {
13668 auto range = getODSOperandIndexAndLength(index: 1);
13669 return getOperation()->getOpOperand(idx: range.first);
13670 }
13671
13672 ::mlir::OpOperand &getAZpMutable() {
13673 auto range = getODSOperandIndexAndLength(index: 2);
13674 return getOperation()->getOpOperand(idx: range.first);
13675 }
13676
13677 ::mlir::OpOperand &getBZpMutable() {
13678 auto range = getODSOperandIndexAndLength(index: 3);
13679 return getOperation()->getOpOperand(idx: range.first);
13680 }
13681
13682 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
13683 return {index, 1};
13684 }
13685
13686 ::mlir::Operation::result_range getODSResults(unsigned index) {
13687 auto valueRange = getODSResultIndexAndLength(index);
13688 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
13689 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
13690 }
13691
13692 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
13693 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
13694 }
13695
13696 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13697 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
13698 static llvm::hash_code computePropertiesHash(const Properties &prop);
13699 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
13700 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
13701 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
13702 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13703 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type outputType, Value a, Value b);
13704 static MatMulTOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Type outputType, Value a, Value b);
13705 static MatMulTOp create(::mlir::ImplicitLocOpBuilder &builder, Type outputType, Value a, Value b);
13706 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13707 static MatMulTOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13708 static MatMulTOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13709 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13710 static MatMulTOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13711 static MatMulTOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value a_zp, ::mlir::Value b_zp);
13712 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13713 static MatMulTOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13714 static MatMulTOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13715 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13716 static MatMulTOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13717 static MatMulTOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13718 ::llvm::LogicalResult verifyInvariantsImpl();
13719 ::llvm::LogicalResult verifyInvariants();
13720 ::llvm::LogicalResult verify();
13721 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
13722 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
13723 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
13724 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
13725public:
13726 static ::llvm::LogicalResult
13727 inferReturnTypeComponents(::mlir::MLIRContext *context,
13728 std::optional<::mlir::Location> location,
13729 Adaptor adaptor,
13730 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
13731
13732
13733 FailureOr<int64_t> getAZeroPoint();
13734 FailureOr<int64_t> getBZeroPoint();
13735 LogicalResult verifyAZeroPoint(int64_t zp);
13736 LogicalResult verifyBZeroPoint(int64_t zp);
13737};
13738
13739} // namespace mlir::tosa
13740MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MatMulTOp)
13741
13742namespace mlir::tosa {
13743
13744
13745//===----------------------------------------------------------------------===//
13746// mlir::tosa::MatmulTBlockScaledOp declarations
13747//===----------------------------------------------------------------------===//
13748
13749namespace detail {
13750
13751class MatmulTBlockScaledOpGenericAdaptorBase {
13752public:
13753 struct Properties {
13754 using block_sizeTy = mlir::tosa::BlockSizeAttr;
13755 block_sizeTy block_size;
13756
13757 auto getBlockSize() const {
13758 auto &propStorage = this->block_size;
13759 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: propStorage);
13760 }
13761 void setBlockSize(const mlir::tosa::BlockSizeAttr &propValue) {
13762 this->block_size = propValue;
13763 }
13764 bool operator==(const Properties &rhs) const {
13765 return
13766 rhs.block_size == this->block_size &&
13767 true;
13768 }
13769 bool operator!=(const Properties &rhs) const {
13770 return !(*this == rhs);
13771 }
13772 };
13773protected:
13774 ::mlir::DictionaryAttr odsAttrs;
13775 ::std::optional<::mlir::OperationName> odsOpName;
13776 Properties properties;
13777 ::mlir::RegionRange odsRegions;
13778public:
13779 MatmulTBlockScaledOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
13780 odsOpName.emplace(args: "tosa.matmul_t_block_scaled", args: odsAttrs.getContext());
13781 }
13782
13783 MatmulTBlockScaledOpGenericAdaptorBase(MatmulTBlockScaledOp op);
13784
13785 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
13786 return {index, 1};
13787 }
13788
13789 const Properties &getProperties() {
13790 return properties;
13791 }
13792
13793 ::mlir::DictionaryAttr getAttributes() {
13794 return odsAttrs;
13795 }
13796
13797 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
13798 auto attr = ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: getProperties().block_size);
13799 return attr;
13800 }
13801
13802 ::mlir::tosa::BlockSize getBlockSize();
13803};
13804
13805} // namespace detail
13806template <typename RangeT>
13807class MatmulTBlockScaledOpGenericAdaptor : public detail::MatmulTBlockScaledOpGenericAdaptorBase {
13808 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
13809 using Base = detail::MatmulTBlockScaledOpGenericAdaptorBase;
13810 static constexpr int odsIndex_a_data = 0;
13811 static constexpr int odsIndex_a_scale = 1;
13812 static constexpr int odsIndex_b_data = 2;
13813 static constexpr int odsIndex_b_scale = 3;
13814public:
13815 MatmulTBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
13816
13817 MatmulTBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MatmulTBlockScaledOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
13818
13819 MatmulTBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MatmulTBlockScaledOpGenericAdaptor(values, attrs, Properties{}, {}) {}
13820
13821 MatmulTBlockScaledOpGenericAdaptor(RangeT values, const MatmulTBlockScaledOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
13822
13823 template <typename LateInst = MatmulTBlockScaledOp, typename = std::enable_if_t<std::is_same_v<LateInst, MatmulTBlockScaledOp>>>
13824 MatmulTBlockScaledOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
13825
13826 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13827 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
13828 }
13829
13830 RangeT getODSOperands(unsigned index) {
13831 auto valueRange = getODSOperandIndexAndLength(index);
13832 return {std::next(odsOperands.begin(), valueRange.first),
13833 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
13834 }
13835
13836 ValueT getAData() {
13837 return (*getODSOperands(index: 0).begin());
13838 }
13839
13840 ValueT getAScale() {
13841 return (*getODSOperands(index: 1).begin());
13842 }
13843
13844 ValueT getBData() {
13845 return (*getODSOperands(index: 2).begin());
13846 }
13847
13848 ValueT getBScale() {
13849 return (*getODSOperands(index: 3).begin());
13850 }
13851
13852 RangeT getOperands() {
13853 return odsOperands;
13854 }
13855
13856private:
13857 RangeT odsOperands;
13858};
13859class MatmulTBlockScaledOpAdaptor : public MatmulTBlockScaledOpGenericAdaptor<::mlir::ValueRange> {
13860public:
13861 using MatmulTBlockScaledOpGenericAdaptor::MatmulTBlockScaledOpGenericAdaptor;
13862 MatmulTBlockScaledOpAdaptor(MatmulTBlockScaledOp op);
13863
13864 ::llvm::LogicalResult verify(::mlir::Location loc);
13865};
13866class MatmulTBlockScaledOp : public ::mlir::Op<MatmulTBlockScaledOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
13867public:
13868 using Op::Op;
13869 using Op::print;
13870 using Adaptor = MatmulTBlockScaledOpAdaptor;
13871 template <typename RangeT>
13872 using GenericAdaptor = MatmulTBlockScaledOpGenericAdaptor<RangeT>;
13873 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
13874 static constexpr int odsIndex_a_data = 0;
13875 static constexpr int odsIndex_a_scale = 1;
13876 static constexpr int odsIndex_b_data = 2;
13877 static constexpr int odsIndex_b_scale = 3;
13878 static constexpr int odsIndex_output_data = 0;
13879 using Properties = FoldAdaptor::Properties;
13880 using ::mlir::InferShapedTypeOpInterface::Trait<MatmulTBlockScaledOp>::reifyReturnTypeShapes;
13881 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
13882 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("block_size")};
13883 return ::llvm::ArrayRef(attrNames);
13884 }
13885
13886 ::mlir::StringAttr getBlockSizeAttrName() {
13887 return getAttributeNameForIndex(index: 0);
13888 }
13889
13890 static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) {
13891 return getAttributeNameForIndex(name, index: 0);
13892 }
13893
13894 static constexpr ::llvm::StringLiteral getOperationName() {
13895 return ::llvm::StringLiteral("tosa.matmul_t_block_scaled");
13896 }
13897
13898 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
13899 return {index, 1};
13900 }
13901
13902 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
13903 auto [start, length] = getODSOperandIndexAndLength(index);
13904 return getOperation()->getOperands().slice(n: start, m: length);
13905 }
13906
13907 ::mlir::TypedValue<::mlir::TensorType> getAData() {
13908 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
13909 }
13910
13911 ::mlir::TypedValue<::mlir::TensorType> getAScale() {
13912 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
13913 }
13914
13915 ::mlir::TypedValue<::mlir::TensorType> getBData() {
13916 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
13917 }
13918
13919 ::mlir::TypedValue<::mlir::TensorType> getBScale() {
13920 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
13921 }
13922
13923 ::mlir::OpOperand &getADataMutable() {
13924 auto range = getODSOperandIndexAndLength(index: 0);
13925 return getOperation()->getOpOperand(idx: range.first);
13926 }
13927
13928 ::mlir::OpOperand &getAScaleMutable() {
13929 auto range = getODSOperandIndexAndLength(index: 1);
13930 return getOperation()->getOpOperand(idx: range.first);
13931 }
13932
13933 ::mlir::OpOperand &getBDataMutable() {
13934 auto range = getODSOperandIndexAndLength(index: 2);
13935 return getOperation()->getOpOperand(idx: range.first);
13936 }
13937
13938 ::mlir::OpOperand &getBScaleMutable() {
13939 auto range = getODSOperandIndexAndLength(index: 3);
13940 return getOperation()->getOpOperand(idx: range.first);
13941 }
13942
13943 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
13944 return {index, 1};
13945 }
13946
13947 ::mlir::Operation::result_range getODSResults(unsigned index) {
13948 auto valueRange = getODSResultIndexAndLength(index);
13949 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
13950 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
13951 }
13952
13953 ::mlir::TypedValue<::mlir::TensorType> getOutputData() {
13954 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
13955 }
13956
13957 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13958 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
13959 static llvm::hash_code computePropertiesHash(const Properties &prop);
13960 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
13961 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
13962 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
13963 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
13964 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
13965 void writeProperties(::mlir::DialectBytecodeWriter &writer);
13966 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
13967 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val&: getProperties().block_size);
13968 }
13969
13970 ::mlir::tosa::BlockSize getBlockSize();
13971 void setBlockSizeAttr(mlir::tosa::BlockSizeAttr attr) {
13972 getProperties().block_size = attr;
13973 }
13974
13975 void setBlockSize(::mlir::tosa::BlockSize attrValue);
13976 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_data, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, mlir::tosa::BlockSizeAttr block_size);
13977 static MatmulTBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_data, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, mlir::tosa::BlockSizeAttr block_size);
13978 static MatmulTBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_data, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, mlir::tosa::BlockSizeAttr block_size);
13979 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, mlir::tosa::BlockSizeAttr block_size);
13980 static MatmulTBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, mlir::tosa::BlockSizeAttr block_size);
13981 static MatmulTBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, mlir::tosa::BlockSizeAttr block_size);
13982 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_data, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, ::mlir::tosa::BlockSize block_size);
13983 static MatmulTBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_data, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, ::mlir::tosa::BlockSize block_size);
13984 static MatmulTBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_data, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, ::mlir::tosa::BlockSize block_size);
13985 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, ::mlir::tosa::BlockSize block_size);
13986 static MatmulTBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, ::mlir::tosa::BlockSize block_size);
13987 static MatmulTBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value a_data, ::mlir::Value a_scale, ::mlir::Value b_data, ::mlir::Value b_scale, ::mlir::tosa::BlockSize block_size);
13988 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
13989 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13990 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
13991 static MatmulTBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13992 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
13993 static MatmulTBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
13994 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13995 static MatmulTBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13996 static MatmulTBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
13997 ::llvm::LogicalResult verifyInvariantsImpl();
13998 ::llvm::LogicalResult verifyInvariants();
13999 ::llvm::LogicalResult verify();
14000 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
14001 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
14002 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
14003 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
14004private:
14005 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
14006 return getAttributeNameForIndex(name: (*this)->getName(), index);
14007 }
14008
14009 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
14010 assert(index < 1 && "invalid attribute index");
14011 assert(name.getStringRef() == getOperationName() && "invalid operation name");
14012 assert(name.isRegistered() && "Operation isn't registered, missing a "
14013 "dependent dialect loading?");
14014 return name.getAttributeNames()[index];
14015 }
14016
14017 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
14018public:
14019 static ::llvm::LogicalResult
14020 inferReturnTypeComponents(::mlir::MLIRContext *context,
14021 std::optional<::mlir::Location> location,
14022 Adaptor adaptor,
14023 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
14024
14025};
14026
14027} // namespace mlir::tosa
14028MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MatmulTBlockScaledOp)
14029MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::MatmulTBlockScaledOpGenericAdaptorBase::Properties)
14030
14031namespace mlir::tosa {
14032
14033
14034//===----------------------------------------------------------------------===//
14035// mlir::tosa::MaxPool2dAdaptiveOp declarations
14036//===----------------------------------------------------------------------===//
14037
14038namespace detail {
14039
14040class MaxPool2dAdaptiveOpGenericAdaptorBase {
14041public:
14042 struct Properties {
14043 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
14044 nan_modeTy nan_mode;
14045
14046 auto getNanMode() const {
14047 auto &propStorage = this->nan_mode;
14048 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
14049 }
14050 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
14051 this->nan_mode = propValue;
14052 }
14053 bool operator==(const Properties &rhs) const {
14054 return
14055 rhs.nan_mode == this->nan_mode &&
14056 true;
14057 }
14058 bool operator!=(const Properties &rhs) const {
14059 return !(*this == rhs);
14060 }
14061 };
14062protected:
14063 ::mlir::DictionaryAttr odsAttrs;
14064 ::std::optional<::mlir::OperationName> odsOpName;
14065 Properties properties;
14066 ::mlir::RegionRange odsRegions;
14067public:
14068 MaxPool2dAdaptiveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
14069 odsOpName.emplace(args: "tosa.max_pool2d_adaptive", args: odsAttrs.getContext());
14070 }
14071
14072 MaxPool2dAdaptiveOpGenericAdaptorBase(MaxPool2dAdaptiveOp op);
14073
14074 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
14075 return {index, 1};
14076 }
14077
14078 const Properties &getProperties() {
14079 return properties;
14080 }
14081
14082 ::mlir::DictionaryAttr getAttributes() {
14083 return odsAttrs;
14084 }
14085
14086 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
14087 ::mlir::tosa::NanPropagationMode getNanMode();
14088};
14089
14090} // namespace detail
14091template <typename RangeT>
14092class MaxPool2dAdaptiveOpGenericAdaptor : public detail::MaxPool2dAdaptiveOpGenericAdaptorBase {
14093 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
14094 using Base = detail::MaxPool2dAdaptiveOpGenericAdaptorBase;
14095 static constexpr int odsIndex_input = 0;
14096 static constexpr int odsIndex_kernel = 1;
14097 static constexpr int odsIndex_stride = 2;
14098 static constexpr int odsIndex_pad = 3;
14099public:
14100 MaxPool2dAdaptiveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
14101
14102 MaxPool2dAdaptiveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MaxPool2dAdaptiveOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
14103
14104 MaxPool2dAdaptiveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MaxPool2dAdaptiveOpGenericAdaptor(values, attrs, Properties{}, {}) {}
14105
14106 MaxPool2dAdaptiveOpGenericAdaptor(RangeT values, const MaxPool2dAdaptiveOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
14107
14108 template <typename LateInst = MaxPool2dAdaptiveOp, typename = std::enable_if_t<std::is_same_v<LateInst, MaxPool2dAdaptiveOp>>>
14109 MaxPool2dAdaptiveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
14110
14111 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
14112 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
14113 }
14114
14115 RangeT getODSOperands(unsigned index) {
14116 auto valueRange = getODSOperandIndexAndLength(index);
14117 return {std::next(odsOperands.begin(), valueRange.first),
14118 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
14119 }
14120
14121 ValueT getInput() {
14122 return (*getODSOperands(index: 0).begin());
14123 }
14124
14125 ValueT getKernel() {
14126 return (*getODSOperands(index: 1).begin());
14127 }
14128
14129 ValueT getStride() {
14130 return (*getODSOperands(index: 2).begin());
14131 }
14132
14133 ValueT getPad() {
14134 return (*getODSOperands(index: 3).begin());
14135 }
14136
14137 RangeT getOperands() {
14138 return odsOperands;
14139 }
14140
14141private:
14142 RangeT odsOperands;
14143};
14144class MaxPool2dAdaptiveOpAdaptor : public MaxPool2dAdaptiveOpGenericAdaptor<::mlir::ValueRange> {
14145public:
14146 using MaxPool2dAdaptiveOpGenericAdaptor::MaxPool2dAdaptiveOpGenericAdaptor;
14147 MaxPool2dAdaptiveOpAdaptor(MaxPool2dAdaptiveOp op);
14148
14149 ::llvm::LogicalResult verify(::mlir::Location loc);
14150};
14151class MaxPool2dAdaptiveOp : public ::mlir::Op<MaxPool2dAdaptiveOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
14152public:
14153 using Op::Op;
14154 using Op::print;
14155 using Adaptor = MaxPool2dAdaptiveOpAdaptor;
14156 template <typename RangeT>
14157 using GenericAdaptor = MaxPool2dAdaptiveOpGenericAdaptor<RangeT>;
14158 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
14159 static constexpr int odsIndex_input = 0;
14160 static constexpr int odsIndex_kernel = 1;
14161 static constexpr int odsIndex_stride = 2;
14162 static constexpr int odsIndex_pad = 3;
14163 static constexpr int odsIndex_output = 0;
14164 using Properties = FoldAdaptor::Properties;
14165 using ::mlir::InferShapedTypeOpInterface::Trait<MaxPool2dAdaptiveOp>::reifyReturnTypeShapes;
14166 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
14167 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nan_mode")};
14168 return ::llvm::ArrayRef(attrNames);
14169 }
14170
14171 ::mlir::StringAttr getNanModeAttrName() {
14172 return getAttributeNameForIndex(index: 0);
14173 }
14174
14175 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
14176 return getAttributeNameForIndex(name, index: 0);
14177 }
14178
14179 static constexpr ::llvm::StringLiteral getOperationName() {
14180 return ::llvm::StringLiteral("tosa.max_pool2d_adaptive");
14181 }
14182
14183 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
14184 return {index, 1};
14185 }
14186
14187 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
14188 auto [start, length] = getODSOperandIndexAndLength(index);
14189 return getOperation()->getOperands().slice(n: start, m: length);
14190 }
14191
14192 ::mlir::TypedValue<::mlir::TensorType> getInput() {
14193 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
14194 }
14195
14196 ::mlir::TypedValue<::mlir::Type> getKernel() {
14197 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 1).begin());
14198 }
14199
14200 ::mlir::TypedValue<::mlir::Type> getStride() {
14201 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 2).begin());
14202 }
14203
14204 ::mlir::TypedValue<::mlir::Type> getPad() {
14205 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 3).begin());
14206 }
14207
14208 ::mlir::OpOperand &getInputMutable() {
14209 auto range = getODSOperandIndexAndLength(index: 0);
14210 return getOperation()->getOpOperand(idx: range.first);
14211 }
14212
14213 ::mlir::OpOperand &getKernelMutable() {
14214 auto range = getODSOperandIndexAndLength(index: 1);
14215 return getOperation()->getOpOperand(idx: range.first);
14216 }
14217
14218 ::mlir::OpOperand &getStrideMutable() {
14219 auto range = getODSOperandIndexAndLength(index: 2);
14220 return getOperation()->getOpOperand(idx: range.first);
14221 }
14222
14223 ::mlir::OpOperand &getPadMutable() {
14224 auto range = getODSOperandIndexAndLength(index: 3);
14225 return getOperation()->getOpOperand(idx: range.first);
14226 }
14227
14228 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
14229 return {index, 1};
14230 }
14231
14232 ::mlir::Operation::result_range getODSResults(unsigned index) {
14233 auto valueRange = getODSResultIndexAndLength(index);
14234 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
14235 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
14236 }
14237
14238 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
14239 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
14240 }
14241
14242 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
14243 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
14244 static llvm::hash_code computePropertiesHash(const Properties &prop);
14245 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
14246 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
14247 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
14248 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
14249 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
14250 void writeProperties(::mlir::DialectBytecodeWriter &writer);
14251 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
14252 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
14253 }
14254
14255 ::mlir::tosa::NanPropagationMode getNanMode();
14256 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
14257 getProperties().nan_mode = attr;
14258 }
14259
14260 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
14261 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, mlir::tosa::NanPropagationModeAttr nan_mode);
14262 static MaxPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, mlir::tosa::NanPropagationModeAttr nan_mode);
14263 static MaxPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, mlir::tosa::NanPropagationModeAttr nan_mode);
14264 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, mlir::tosa::NanPropagationModeAttr nan_mode);
14265 static MaxPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, mlir::tosa::NanPropagationModeAttr nan_mode);
14266 static MaxPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, mlir::tosa::NanPropagationModeAttr nan_mode);
14267 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14268 static MaxPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14269 static MaxPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14270 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14271 static MaxPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14272 static MaxPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value stride, ::mlir::Value pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14273 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
14274 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14275 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
14276 static MaxPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14277 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
14278 static MaxPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14279 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14280 static MaxPool2dAdaptiveOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14281 static MaxPool2dAdaptiveOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14282 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
14283 ::llvm::LogicalResult verifyInvariantsImpl();
14284 ::llvm::LogicalResult verifyInvariants();
14285 ::llvm::LogicalResult verify();
14286 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
14287 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
14288 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
14289 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
14290 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
14291private:
14292 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
14293 return getAttributeNameForIndex(name: (*this)->getName(), index);
14294 }
14295
14296 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
14297 assert(index < 1 && "invalid attribute index");
14298 assert(name.getStringRef() == getOperationName() && "invalid operation name");
14299 assert(name.isRegistered() && "Operation isn't registered, missing a "
14300 "dependent dialect loading?");
14301 return name.getAttributeNames()[index];
14302 }
14303
14304 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
14305public:
14306 static ::llvm::LogicalResult
14307 inferReturnTypeComponents(::mlir::MLIRContext *context,
14308 std::optional<::mlir::Location> location,
14309 Adaptor adaptor,
14310 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
14311
14312};
14313
14314} // namespace mlir::tosa
14315MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MaxPool2dAdaptiveOp)
14316MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::MaxPool2dAdaptiveOpGenericAdaptorBase::Properties)
14317
14318namespace mlir::tosa {
14319
14320
14321//===----------------------------------------------------------------------===//
14322// mlir::tosa::MaxPool2dOp declarations
14323//===----------------------------------------------------------------------===//
14324
14325namespace detail {
14326
14327class MaxPool2dOpGenericAdaptorBase {
14328public:
14329 struct Properties {
14330 using kernelTy = ::mlir::DenseI64ArrayAttr;
14331 kernelTy kernel;
14332
14333 auto getKernel() const {
14334 auto &propStorage = this->kernel;
14335 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
14336 }
14337 void setKernel(const ::mlir::DenseI64ArrayAttr &propValue) {
14338 this->kernel = propValue;
14339 }
14340 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
14341 nan_modeTy nan_mode;
14342
14343 auto getNanMode() const {
14344 auto &propStorage = this->nan_mode;
14345 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
14346 }
14347 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
14348 this->nan_mode = propValue;
14349 }
14350 using padTy = ::mlir::DenseI64ArrayAttr;
14351 padTy pad;
14352
14353 auto getPad() const {
14354 auto &propStorage = this->pad;
14355 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
14356 }
14357 void setPad(const ::mlir::DenseI64ArrayAttr &propValue) {
14358 this->pad = propValue;
14359 }
14360 using strideTy = ::mlir::DenseI64ArrayAttr;
14361 strideTy stride;
14362
14363 auto getStride() const {
14364 auto &propStorage = this->stride;
14365 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
14366 }
14367 void setStride(const ::mlir::DenseI64ArrayAttr &propValue) {
14368 this->stride = propValue;
14369 }
14370 bool operator==(const Properties &rhs) const {
14371 return
14372 rhs.kernel == this->kernel &&
14373 rhs.nan_mode == this->nan_mode &&
14374 rhs.pad == this->pad &&
14375 rhs.stride == this->stride &&
14376 true;
14377 }
14378 bool operator!=(const Properties &rhs) const {
14379 return !(*this == rhs);
14380 }
14381 };
14382protected:
14383 ::mlir::DictionaryAttr odsAttrs;
14384 ::std::optional<::mlir::OperationName> odsOpName;
14385 Properties properties;
14386 ::mlir::RegionRange odsRegions;
14387public:
14388 MaxPool2dOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
14389 odsOpName.emplace(args: "tosa.max_pool2d", args: odsAttrs.getContext());
14390 }
14391
14392 MaxPool2dOpGenericAdaptorBase(MaxPool2dOp op);
14393
14394 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
14395 return {index, 1};
14396 }
14397
14398 const Properties &getProperties() {
14399 return properties;
14400 }
14401
14402 ::mlir::DictionaryAttr getAttributes() {
14403 return odsAttrs;
14404 }
14405
14406 ::mlir::DenseI64ArrayAttr getKernelAttr() {
14407 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().kernel);
14408 return attr;
14409 }
14410
14411 ::llvm::ArrayRef<int64_t> getKernel();
14412 ::mlir::DenseI64ArrayAttr getStrideAttr() {
14413 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().stride);
14414 return attr;
14415 }
14416
14417 ::llvm::ArrayRef<int64_t> getStride();
14418 ::mlir::DenseI64ArrayAttr getPadAttr() {
14419 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().pad);
14420 return attr;
14421 }
14422
14423 ::llvm::ArrayRef<int64_t> getPad();
14424 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
14425 ::mlir::tosa::NanPropagationMode getNanMode();
14426};
14427
14428} // namespace detail
14429template <typename RangeT>
14430class MaxPool2dOpGenericAdaptor : public detail::MaxPool2dOpGenericAdaptorBase {
14431 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
14432 using Base = detail::MaxPool2dOpGenericAdaptorBase;
14433 static constexpr int odsIndex_input = 0;
14434public:
14435 MaxPool2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
14436
14437 MaxPool2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MaxPool2dOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
14438
14439 MaxPool2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MaxPool2dOpGenericAdaptor(values, attrs, Properties{}, {}) {}
14440
14441 MaxPool2dOpGenericAdaptor(RangeT values, const MaxPool2dOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
14442
14443 template <typename LateInst = MaxPool2dOp, typename = std::enable_if_t<std::is_same_v<LateInst, MaxPool2dOp>>>
14444 MaxPool2dOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
14445
14446 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
14447 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
14448 }
14449
14450 RangeT getODSOperands(unsigned index) {
14451 auto valueRange = getODSOperandIndexAndLength(index);
14452 return {std::next(odsOperands.begin(), valueRange.first),
14453 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
14454 }
14455
14456 ValueT getInput() {
14457 return (*getODSOperands(index: 0).begin());
14458 }
14459
14460 RangeT getOperands() {
14461 return odsOperands;
14462 }
14463
14464private:
14465 RangeT odsOperands;
14466};
14467class MaxPool2dOpAdaptor : public MaxPool2dOpGenericAdaptor<::mlir::ValueRange> {
14468public:
14469 using MaxPool2dOpGenericAdaptor::MaxPool2dOpGenericAdaptor;
14470 MaxPool2dOpAdaptor(MaxPool2dOp op);
14471
14472 ::llvm::LogicalResult verify(::mlir::Location loc);
14473};
14474class MaxPool2dOp : public ::mlir::Op<MaxPool2dOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
14475public:
14476 using Op::Op;
14477 using Op::print;
14478 using Adaptor = MaxPool2dOpAdaptor;
14479 template <typename RangeT>
14480 using GenericAdaptor = MaxPool2dOpGenericAdaptor<RangeT>;
14481 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
14482 static constexpr int odsIndex_input = 0;
14483 static constexpr int odsIndex_output = 0;
14484 using Properties = FoldAdaptor::Properties;
14485 using ::mlir::InferShapedTypeOpInterface::Trait<MaxPool2dOp>::reifyReturnTypeShapes;
14486 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
14487 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("kernel"), ::llvm::StringRef("nan_mode"), ::llvm::StringRef("pad"), ::llvm::StringRef("stride")};
14488 return ::llvm::ArrayRef(attrNames);
14489 }
14490
14491 ::mlir::StringAttr getKernelAttrName() {
14492 return getAttributeNameForIndex(index: 0);
14493 }
14494
14495 static ::mlir::StringAttr getKernelAttrName(::mlir::OperationName name) {
14496 return getAttributeNameForIndex(name, index: 0);
14497 }
14498
14499 ::mlir::StringAttr getNanModeAttrName() {
14500 return getAttributeNameForIndex(index: 1);
14501 }
14502
14503 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
14504 return getAttributeNameForIndex(name, index: 1);
14505 }
14506
14507 ::mlir::StringAttr getPadAttrName() {
14508 return getAttributeNameForIndex(index: 2);
14509 }
14510
14511 static ::mlir::StringAttr getPadAttrName(::mlir::OperationName name) {
14512 return getAttributeNameForIndex(name, index: 2);
14513 }
14514
14515 ::mlir::StringAttr getStrideAttrName() {
14516 return getAttributeNameForIndex(index: 3);
14517 }
14518
14519 static ::mlir::StringAttr getStrideAttrName(::mlir::OperationName name) {
14520 return getAttributeNameForIndex(name, index: 3);
14521 }
14522
14523 static constexpr ::llvm::StringLiteral getOperationName() {
14524 return ::llvm::StringLiteral("tosa.max_pool2d");
14525 }
14526
14527 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
14528 return {index, 1};
14529 }
14530
14531 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
14532 auto [start, length] = getODSOperandIndexAndLength(index);
14533 return getOperation()->getOperands().slice(n: start, m: length);
14534 }
14535
14536 ::mlir::TypedValue<::mlir::TensorType> getInput() {
14537 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
14538 }
14539
14540 ::mlir::OpOperand &getInputMutable() {
14541 auto range = getODSOperandIndexAndLength(index: 0);
14542 return getOperation()->getOpOperand(idx: range.first);
14543 }
14544
14545 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
14546 return {index, 1};
14547 }
14548
14549 ::mlir::Operation::result_range getODSResults(unsigned index) {
14550 auto valueRange = getODSResultIndexAndLength(index);
14551 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
14552 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
14553 }
14554
14555 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
14556 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
14557 }
14558
14559 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
14560 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
14561 static llvm::hash_code computePropertiesHash(const Properties &prop);
14562 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
14563 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
14564 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
14565 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
14566 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
14567 void writeProperties(::mlir::DialectBytecodeWriter &writer);
14568 ::mlir::DenseI64ArrayAttr getKernelAttr() {
14569 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().kernel);
14570 }
14571
14572 ::llvm::ArrayRef<int64_t> getKernel();
14573 ::mlir::DenseI64ArrayAttr getStrideAttr() {
14574 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().stride);
14575 }
14576
14577 ::llvm::ArrayRef<int64_t> getStride();
14578 ::mlir::DenseI64ArrayAttr getPadAttr() {
14579 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().pad);
14580 }
14581
14582 ::llvm::ArrayRef<int64_t> getPad();
14583 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
14584 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
14585 }
14586
14587 ::mlir::tosa::NanPropagationMode getNanMode();
14588 void setKernelAttr(::mlir::DenseI64ArrayAttr attr) {
14589 getProperties().kernel = attr;
14590 }
14591
14592 void setKernel(::llvm::ArrayRef<int64_t> attrValue);
14593 void setStrideAttr(::mlir::DenseI64ArrayAttr attr) {
14594 getProperties().stride = attr;
14595 }
14596
14597 void setStride(::llvm::ArrayRef<int64_t> attrValue);
14598 void setPadAttr(::mlir::DenseI64ArrayAttr attr) {
14599 getProperties().pad = attr;
14600 }
14601
14602 void setPad(::llvm::ArrayRef<int64_t> attrValue);
14603 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
14604 getProperties().nan_mode = attr;
14605 }
14606
14607 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
14608 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
14609 static MaxPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
14610 static MaxPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
14611 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
14612 static MaxPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
14613 static MaxPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::DenseI64ArrayAttr kernel, ::mlir::DenseI64ArrayAttr stride, ::mlir::DenseI64ArrayAttr pad, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
14614 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14615 static MaxPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14616 static MaxPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14617 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14618 static MaxPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14619 static MaxPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::ArrayRef<int64_t> kernel, ::llvm::ArrayRef<int64_t> stride, ::llvm::ArrayRef<int64_t> pad, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
14620 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
14621 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14622 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
14623 static MaxPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14624 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
14625 static MaxPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14626 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14627 static MaxPool2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14628 static MaxPool2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14629 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
14630 ::llvm::LogicalResult verifyInvariantsImpl();
14631 ::llvm::LogicalResult verifyInvariants();
14632 ::llvm::LogicalResult verify();
14633 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
14634 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
14635 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
14636 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
14637 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
14638private:
14639 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
14640 return getAttributeNameForIndex(name: (*this)->getName(), index);
14641 }
14642
14643 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
14644 assert(index < 4 && "invalid attribute index");
14645 assert(name.getStringRef() == getOperationName() && "invalid operation name");
14646 assert(name.isRegistered() && "Operation isn't registered, missing a "
14647 "dependent dialect loading?");
14648 return name.getAttributeNames()[index];
14649 }
14650
14651 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
14652public:
14653 static ::llvm::LogicalResult
14654 inferReturnTypeComponents(::mlir::MLIRContext *context,
14655 std::optional<::mlir::Location> location,
14656 Adaptor adaptor,
14657 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
14658
14659};
14660
14661} // namespace mlir::tosa
14662MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MaxPool2dOp)
14663MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::MaxPool2dOpGenericAdaptorBase::Properties)
14664
14665namespace mlir::tosa {
14666
14667
14668//===----------------------------------------------------------------------===//
14669// mlir::tosa::MaxShapeOp declarations
14670//===----------------------------------------------------------------------===//
14671
14672namespace detail {
14673
14674class MaxShapeOpGenericAdaptorBase {
14675public:
14676 using Properties = ::mlir::EmptyProperties;
14677protected:
14678 ::mlir::DictionaryAttr odsAttrs;
14679 ::std::optional<::mlir::OperationName> odsOpName;
14680 Properties properties;
14681 ::mlir::RegionRange odsRegions;
14682public:
14683 MaxShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
14684 odsOpName.emplace(args: "tosa.max_shape", args: odsAttrs.getContext());
14685 }
14686
14687 MaxShapeOpGenericAdaptorBase(MaxShapeOp op);
14688
14689 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
14690 return {index, 1};
14691 }
14692
14693 const Properties &getProperties() {
14694 return properties;
14695 }
14696
14697 ::mlir::DictionaryAttr getAttributes() {
14698 return odsAttrs;
14699 }
14700
14701};
14702
14703} // namespace detail
14704template <typename RangeT>
14705class MaxShapeOpGenericAdaptor : public detail::MaxShapeOpGenericAdaptorBase {
14706 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
14707 using Base = detail::MaxShapeOpGenericAdaptorBase;
14708 static constexpr int odsIndex_input1 = 0;
14709 static constexpr int odsIndex_input2 = 1;
14710public:
14711 MaxShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
14712
14713 MaxShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MaxShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
14714
14715 MaxShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MaxShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
14716
14717 MaxShapeOpGenericAdaptor(RangeT values, const MaxShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
14718
14719 template <typename LateInst = MaxShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, MaxShapeOp>>>
14720 MaxShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
14721
14722 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
14723 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
14724 }
14725
14726 RangeT getODSOperands(unsigned index) {
14727 auto valueRange = getODSOperandIndexAndLength(index);
14728 return {std::next(odsOperands.begin(), valueRange.first),
14729 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
14730 }
14731
14732 ValueT getInput1() {
14733 return (*getODSOperands(index: 0).begin());
14734 }
14735
14736 ValueT getInput2() {
14737 return (*getODSOperands(index: 1).begin());
14738 }
14739
14740 RangeT getOperands() {
14741 return odsOperands;
14742 }
14743
14744private:
14745 RangeT odsOperands;
14746};
14747class MaxShapeOpAdaptor : public MaxShapeOpGenericAdaptor<::mlir::ValueRange> {
14748public:
14749 using MaxShapeOpGenericAdaptor::MaxShapeOpGenericAdaptor;
14750 MaxShapeOpAdaptor(MaxShapeOp op);
14751
14752 ::llvm::LogicalResult verify(::mlir::Location loc);
14753};
14754class MaxShapeOp : public ::mlir::Op<MaxShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
14755public:
14756 using Op::Op;
14757 using Op::print;
14758 using Adaptor = MaxShapeOpAdaptor;
14759 template <typename RangeT>
14760 using GenericAdaptor = MaxShapeOpGenericAdaptor<RangeT>;
14761 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
14762 static constexpr int odsIndex_input1 = 0;
14763 static constexpr int odsIndex_input2 = 1;
14764 static constexpr int odsIndex_output = 0;
14765 using Properties = FoldAdaptor::Properties;
14766 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
14767 return {};
14768 }
14769
14770 static constexpr ::llvm::StringLiteral getOperationName() {
14771 return ::llvm::StringLiteral("tosa.max_shape");
14772 }
14773
14774 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
14775 return {index, 1};
14776 }
14777
14778 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
14779 auto [start, length] = getODSOperandIndexAndLength(index);
14780 return getOperation()->getOperands().slice(n: start, m: length);
14781 }
14782
14783 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
14784 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
14785 }
14786
14787 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
14788 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
14789 }
14790
14791 ::mlir::OpOperand &getInput1Mutable() {
14792 auto range = getODSOperandIndexAndLength(index: 0);
14793 return getOperation()->getOpOperand(idx: range.first);
14794 }
14795
14796 ::mlir::OpOperand &getInput2Mutable() {
14797 auto range = getODSOperandIndexAndLength(index: 1);
14798 return getOperation()->getOpOperand(idx: range.first);
14799 }
14800
14801 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
14802 return {index, 1};
14803 }
14804
14805 ::mlir::Operation::result_range getODSResults(unsigned index) {
14806 auto valueRange = getODSResultIndexAndLength(index);
14807 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
14808 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
14809 }
14810
14811 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
14812 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
14813 }
14814
14815 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
14816 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
14817 static llvm::hash_code computePropertiesHash(const Properties &prop);
14818 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
14819 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
14820 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
14821 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
14822 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
14823 static MaxShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
14824 static MaxShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
14825 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
14826 static MaxShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
14827 static MaxShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
14828 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14829 static MaxShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14830 static MaxShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
14831 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14832 static MaxShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14833 static MaxShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
14834 ::llvm::LogicalResult verifyInvariantsImpl();
14835 ::llvm::LogicalResult verifyInvariants();
14836 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
14837 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
14838 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
14839 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
14840public:
14841};
14842
14843} // namespace mlir::tosa
14844MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MaxShapeOp)
14845
14846namespace mlir::tosa {
14847
14848
14849//===----------------------------------------------------------------------===//
14850// mlir::tosa::MaximumOp declarations
14851//===----------------------------------------------------------------------===//
14852
14853namespace detail {
14854
14855class MaximumOpGenericAdaptorBase {
14856public:
14857 struct Properties {
14858 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
14859 nan_modeTy nan_mode;
14860
14861 auto getNanMode() const {
14862 auto &propStorage = this->nan_mode;
14863 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
14864 }
14865 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
14866 this->nan_mode = propValue;
14867 }
14868 bool operator==(const Properties &rhs) const {
14869 return
14870 rhs.nan_mode == this->nan_mode &&
14871 true;
14872 }
14873 bool operator!=(const Properties &rhs) const {
14874 return !(*this == rhs);
14875 }
14876 };
14877protected:
14878 ::mlir::DictionaryAttr odsAttrs;
14879 ::std::optional<::mlir::OperationName> odsOpName;
14880 Properties properties;
14881 ::mlir::RegionRange odsRegions;
14882public:
14883 MaximumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
14884 odsOpName.emplace(args: "tosa.maximum", args: odsAttrs.getContext());
14885 }
14886
14887 MaximumOpGenericAdaptorBase(MaximumOp op);
14888
14889 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
14890 return {index, 1};
14891 }
14892
14893 const Properties &getProperties() {
14894 return properties;
14895 }
14896
14897 ::mlir::DictionaryAttr getAttributes() {
14898 return odsAttrs;
14899 }
14900
14901 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
14902 ::mlir::tosa::NanPropagationMode getNanMode();
14903};
14904
14905} // namespace detail
14906template <typename RangeT>
14907class MaximumOpGenericAdaptor : public detail::MaximumOpGenericAdaptorBase {
14908 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
14909 using Base = detail::MaximumOpGenericAdaptorBase;
14910 static constexpr int odsIndex_input1 = 0;
14911 static constexpr int odsIndex_input2 = 1;
14912public:
14913 MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
14914
14915 MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MaximumOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
14916
14917 MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MaximumOpGenericAdaptor(values, attrs, Properties{}, {}) {}
14918
14919 MaximumOpGenericAdaptor(RangeT values, const MaximumOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
14920
14921 template <typename LateInst = MaximumOp, typename = std::enable_if_t<std::is_same_v<LateInst, MaximumOp>>>
14922 MaximumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
14923
14924 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
14925 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
14926 }
14927
14928 RangeT getODSOperands(unsigned index) {
14929 auto valueRange = getODSOperandIndexAndLength(index);
14930 return {std::next(odsOperands.begin(), valueRange.first),
14931 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
14932 }
14933
14934 ValueT getInput1() {
14935 return (*getODSOperands(index: 0).begin());
14936 }
14937
14938 ValueT getInput2() {
14939 return (*getODSOperands(index: 1).begin());
14940 }
14941
14942 RangeT getOperands() {
14943 return odsOperands;
14944 }
14945
14946private:
14947 RangeT odsOperands;
14948};
14949class MaximumOpAdaptor : public MaximumOpGenericAdaptor<::mlir::ValueRange> {
14950public:
14951 using MaximumOpGenericAdaptor::MaximumOpGenericAdaptor;
14952 MaximumOpAdaptor(MaximumOp op);
14953
14954 ::llvm::LogicalResult verify(::mlir::Location loc);
14955};
14956class MaximumOp : public ::mlir::Op<MaximumOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
14957public:
14958 using Op::Op;
14959 using Op::print;
14960 using Adaptor = MaximumOpAdaptor;
14961 template <typename RangeT>
14962 using GenericAdaptor = MaximumOpGenericAdaptor<RangeT>;
14963 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
14964 static constexpr int odsIndex_input1 = 0;
14965 static constexpr int odsIndex_input2 = 1;
14966 static constexpr int odsIndex_output = 0;
14967 using Properties = FoldAdaptor::Properties;
14968 using ::mlir::InferShapedTypeOpInterface::Trait<MaximumOp>::reifyReturnTypeShapes;
14969 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
14970 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nan_mode")};
14971 return ::llvm::ArrayRef(attrNames);
14972 }
14973
14974 ::mlir::StringAttr getNanModeAttrName() {
14975 return getAttributeNameForIndex(index: 0);
14976 }
14977
14978 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
14979 return getAttributeNameForIndex(name, index: 0);
14980 }
14981
14982 static constexpr ::llvm::StringLiteral getOperationName() {
14983 return ::llvm::StringLiteral("tosa.maximum");
14984 }
14985
14986 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
14987 return {index, 1};
14988 }
14989
14990 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
14991 auto [start, length] = getODSOperandIndexAndLength(index);
14992 return getOperation()->getOperands().slice(n: start, m: length);
14993 }
14994
14995 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
14996 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
14997 }
14998
14999 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
15000 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
15001 }
15002
15003 ::mlir::OpOperand &getInput1Mutable() {
15004 auto range = getODSOperandIndexAndLength(index: 0);
15005 return getOperation()->getOpOperand(idx: range.first);
15006 }
15007
15008 ::mlir::OpOperand &getInput2Mutable() {
15009 auto range = getODSOperandIndexAndLength(index: 1);
15010 return getOperation()->getOpOperand(idx: range.first);
15011 }
15012
15013 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
15014 return {index, 1};
15015 }
15016
15017 ::mlir::Operation::result_range getODSResults(unsigned index) {
15018 auto valueRange = getODSResultIndexAndLength(index);
15019 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
15020 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
15021 }
15022
15023 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
15024 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
15025 }
15026
15027 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15028 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
15029 static llvm::hash_code computePropertiesHash(const Properties &prop);
15030 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
15031 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
15032 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
15033 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15034 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
15035 void writeProperties(::mlir::DialectBytecodeWriter &writer);
15036 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
15037 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
15038 }
15039
15040 ::mlir::tosa::NanPropagationMode getNanMode();
15041 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
15042 getProperties().nan_mode = attr;
15043 }
15044
15045 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
15046 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15047 static MaximumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15048 static MaximumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15049 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15050 static MaximumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15051 static MaximumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15052 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15053 static MaximumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15054 static MaximumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15055 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15056 static MaximumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15057 static MaximumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15058 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
15059 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15060 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
15061 static MaximumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15062 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
15063 static MaximumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15064 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15065 static MaximumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15066 static MaximumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15067 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
15068 ::llvm::LogicalResult verifyInvariantsImpl();
15069 ::llvm::LogicalResult verifyInvariants();
15070 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
15071 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
15072 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
15073 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
15074private:
15075 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
15076 return getAttributeNameForIndex(name: (*this)->getName(), index);
15077 }
15078
15079 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
15080 assert(index < 1 && "invalid attribute index");
15081 assert(name.getStringRef() == getOperationName() && "invalid operation name");
15082 assert(name.isRegistered() && "Operation isn't registered, missing a "
15083 "dependent dialect loading?");
15084 return name.getAttributeNames()[index];
15085 }
15086
15087 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
15088public:
15089};
15090
15091} // namespace mlir::tosa
15092MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MaximumOp)
15093MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::MaximumOpGenericAdaptorBase::Properties)
15094
15095namespace mlir::tosa {
15096
15097
15098//===----------------------------------------------------------------------===//
15099// mlir::tosa::MinShapeOp declarations
15100//===----------------------------------------------------------------------===//
15101
15102namespace detail {
15103
15104class MinShapeOpGenericAdaptorBase {
15105public:
15106 using Properties = ::mlir::EmptyProperties;
15107protected:
15108 ::mlir::DictionaryAttr odsAttrs;
15109 ::std::optional<::mlir::OperationName> odsOpName;
15110 Properties properties;
15111 ::mlir::RegionRange odsRegions;
15112public:
15113 MinShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
15114 odsOpName.emplace(args: "tosa.min_shape", args: odsAttrs.getContext());
15115 }
15116
15117 MinShapeOpGenericAdaptorBase(MinShapeOp op);
15118
15119 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
15120 return {index, 1};
15121 }
15122
15123 const Properties &getProperties() {
15124 return properties;
15125 }
15126
15127 ::mlir::DictionaryAttr getAttributes() {
15128 return odsAttrs;
15129 }
15130
15131};
15132
15133} // namespace detail
15134template <typename RangeT>
15135class MinShapeOpGenericAdaptor : public detail::MinShapeOpGenericAdaptorBase {
15136 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
15137 using Base = detail::MinShapeOpGenericAdaptorBase;
15138 static constexpr int odsIndex_input1 = 0;
15139 static constexpr int odsIndex_input2 = 1;
15140public:
15141 MinShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
15142
15143 MinShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MinShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
15144
15145 MinShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MinShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
15146
15147 MinShapeOpGenericAdaptor(RangeT values, const MinShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
15148
15149 template <typename LateInst = MinShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, MinShapeOp>>>
15150 MinShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
15151
15152 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15153 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
15154 }
15155
15156 RangeT getODSOperands(unsigned index) {
15157 auto valueRange = getODSOperandIndexAndLength(index);
15158 return {std::next(odsOperands.begin(), valueRange.first),
15159 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
15160 }
15161
15162 ValueT getInput1() {
15163 return (*getODSOperands(index: 0).begin());
15164 }
15165
15166 ValueT getInput2() {
15167 return (*getODSOperands(index: 1).begin());
15168 }
15169
15170 RangeT getOperands() {
15171 return odsOperands;
15172 }
15173
15174private:
15175 RangeT odsOperands;
15176};
15177class MinShapeOpAdaptor : public MinShapeOpGenericAdaptor<::mlir::ValueRange> {
15178public:
15179 using MinShapeOpGenericAdaptor::MinShapeOpGenericAdaptor;
15180 MinShapeOpAdaptor(MinShapeOp op);
15181
15182 ::llvm::LogicalResult verify(::mlir::Location loc);
15183};
15184class MinShapeOp : public ::mlir::Op<MinShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
15185public:
15186 using Op::Op;
15187 using Op::print;
15188 using Adaptor = MinShapeOpAdaptor;
15189 template <typename RangeT>
15190 using GenericAdaptor = MinShapeOpGenericAdaptor<RangeT>;
15191 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
15192 static constexpr int odsIndex_input1 = 0;
15193 static constexpr int odsIndex_input2 = 1;
15194 static constexpr int odsIndex_output = 0;
15195 using Properties = FoldAdaptor::Properties;
15196 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
15197 return {};
15198 }
15199
15200 static constexpr ::llvm::StringLiteral getOperationName() {
15201 return ::llvm::StringLiteral("tosa.min_shape");
15202 }
15203
15204 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15205 return {index, 1};
15206 }
15207
15208 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
15209 auto [start, length] = getODSOperandIndexAndLength(index);
15210 return getOperation()->getOperands().slice(n: start, m: length);
15211 }
15212
15213 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
15214 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
15215 }
15216
15217 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
15218 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
15219 }
15220
15221 ::mlir::OpOperand &getInput1Mutable() {
15222 auto range = getODSOperandIndexAndLength(index: 0);
15223 return getOperation()->getOpOperand(idx: range.first);
15224 }
15225
15226 ::mlir::OpOperand &getInput2Mutable() {
15227 auto range = getODSOperandIndexAndLength(index: 1);
15228 return getOperation()->getOpOperand(idx: range.first);
15229 }
15230
15231 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
15232 return {index, 1};
15233 }
15234
15235 ::mlir::Operation::result_range getODSResults(unsigned index) {
15236 auto valueRange = getODSResultIndexAndLength(index);
15237 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
15238 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
15239 }
15240
15241 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
15242 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
15243 }
15244
15245 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15246 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
15247 static llvm::hash_code computePropertiesHash(const Properties &prop);
15248 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
15249 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
15250 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
15251 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15252 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
15253 static MinShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
15254 static MinShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
15255 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
15256 static MinShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
15257 static MinShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
15258 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15259 static MinShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15260 static MinShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15261 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15262 static MinShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15263 static MinShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15264 ::llvm::LogicalResult verifyInvariantsImpl();
15265 ::llvm::LogicalResult verifyInvariants();
15266 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
15267 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
15268 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
15269 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
15270public:
15271};
15272
15273} // namespace mlir::tosa
15274MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MinShapeOp)
15275
15276namespace mlir::tosa {
15277
15278
15279//===----------------------------------------------------------------------===//
15280// mlir::tosa::MinimumOp declarations
15281//===----------------------------------------------------------------------===//
15282
15283namespace detail {
15284
15285class MinimumOpGenericAdaptorBase {
15286public:
15287 struct Properties {
15288 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
15289 nan_modeTy nan_mode;
15290
15291 auto getNanMode() const {
15292 auto &propStorage = this->nan_mode;
15293 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
15294 }
15295 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
15296 this->nan_mode = propValue;
15297 }
15298 bool operator==(const Properties &rhs) const {
15299 return
15300 rhs.nan_mode == this->nan_mode &&
15301 true;
15302 }
15303 bool operator!=(const Properties &rhs) const {
15304 return !(*this == rhs);
15305 }
15306 };
15307protected:
15308 ::mlir::DictionaryAttr odsAttrs;
15309 ::std::optional<::mlir::OperationName> odsOpName;
15310 Properties properties;
15311 ::mlir::RegionRange odsRegions;
15312public:
15313 MinimumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
15314 odsOpName.emplace(args: "tosa.minimum", args: odsAttrs.getContext());
15315 }
15316
15317 MinimumOpGenericAdaptorBase(MinimumOp op);
15318
15319 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
15320 return {index, 1};
15321 }
15322
15323 const Properties &getProperties() {
15324 return properties;
15325 }
15326
15327 ::mlir::DictionaryAttr getAttributes() {
15328 return odsAttrs;
15329 }
15330
15331 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
15332 ::mlir::tosa::NanPropagationMode getNanMode();
15333};
15334
15335} // namespace detail
15336template <typename RangeT>
15337class MinimumOpGenericAdaptor : public detail::MinimumOpGenericAdaptorBase {
15338 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
15339 using Base = detail::MinimumOpGenericAdaptorBase;
15340 static constexpr int odsIndex_input1 = 0;
15341 static constexpr int odsIndex_input2 = 1;
15342public:
15343 MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
15344
15345 MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MinimumOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
15346
15347 MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MinimumOpGenericAdaptor(values, attrs, Properties{}, {}) {}
15348
15349 MinimumOpGenericAdaptor(RangeT values, const MinimumOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
15350
15351 template <typename LateInst = MinimumOp, typename = std::enable_if_t<std::is_same_v<LateInst, MinimumOp>>>
15352 MinimumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
15353
15354 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15355 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
15356 }
15357
15358 RangeT getODSOperands(unsigned index) {
15359 auto valueRange = getODSOperandIndexAndLength(index);
15360 return {std::next(odsOperands.begin(), valueRange.first),
15361 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
15362 }
15363
15364 ValueT getInput1() {
15365 return (*getODSOperands(index: 0).begin());
15366 }
15367
15368 ValueT getInput2() {
15369 return (*getODSOperands(index: 1).begin());
15370 }
15371
15372 RangeT getOperands() {
15373 return odsOperands;
15374 }
15375
15376private:
15377 RangeT odsOperands;
15378};
15379class MinimumOpAdaptor : public MinimumOpGenericAdaptor<::mlir::ValueRange> {
15380public:
15381 using MinimumOpGenericAdaptor::MinimumOpGenericAdaptor;
15382 MinimumOpAdaptor(MinimumOp op);
15383
15384 ::llvm::LogicalResult verify(::mlir::Location loc);
15385};
15386class MinimumOp : public ::mlir::Op<MinimumOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsCommutative, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
15387public:
15388 using Op::Op;
15389 using Op::print;
15390 using Adaptor = MinimumOpAdaptor;
15391 template <typename RangeT>
15392 using GenericAdaptor = MinimumOpGenericAdaptor<RangeT>;
15393 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
15394 static constexpr int odsIndex_input1 = 0;
15395 static constexpr int odsIndex_input2 = 1;
15396 static constexpr int odsIndex_output = 0;
15397 using Properties = FoldAdaptor::Properties;
15398 using ::mlir::InferShapedTypeOpInterface::Trait<MinimumOp>::reifyReturnTypeShapes;
15399 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
15400 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("nan_mode")};
15401 return ::llvm::ArrayRef(attrNames);
15402 }
15403
15404 ::mlir::StringAttr getNanModeAttrName() {
15405 return getAttributeNameForIndex(index: 0);
15406 }
15407
15408 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
15409 return getAttributeNameForIndex(name, index: 0);
15410 }
15411
15412 static constexpr ::llvm::StringLiteral getOperationName() {
15413 return ::llvm::StringLiteral("tosa.minimum");
15414 }
15415
15416 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15417 return {index, 1};
15418 }
15419
15420 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
15421 auto [start, length] = getODSOperandIndexAndLength(index);
15422 return getOperation()->getOperands().slice(n: start, m: length);
15423 }
15424
15425 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
15426 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
15427 }
15428
15429 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
15430 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
15431 }
15432
15433 ::mlir::OpOperand &getInput1Mutable() {
15434 auto range = getODSOperandIndexAndLength(index: 0);
15435 return getOperation()->getOpOperand(idx: range.first);
15436 }
15437
15438 ::mlir::OpOperand &getInput2Mutable() {
15439 auto range = getODSOperandIndexAndLength(index: 1);
15440 return getOperation()->getOpOperand(idx: range.first);
15441 }
15442
15443 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
15444 return {index, 1};
15445 }
15446
15447 ::mlir::Operation::result_range getODSResults(unsigned index) {
15448 auto valueRange = getODSResultIndexAndLength(index);
15449 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
15450 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
15451 }
15452
15453 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
15454 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
15455 }
15456
15457 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15458 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
15459 static llvm::hash_code computePropertiesHash(const Properties &prop);
15460 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
15461 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
15462 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
15463 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15464 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
15465 void writeProperties(::mlir::DialectBytecodeWriter &writer);
15466 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
15467 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
15468 }
15469
15470 ::mlir::tosa::NanPropagationMode getNanMode();
15471 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
15472 getProperties().nan_mode = attr;
15473 }
15474
15475 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
15476 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15477 static MinimumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15478 static MinimumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15479 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15480 static MinimumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15481 static MinimumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, mlir::tosa::NanPropagationModeAttr nan_mode);
15482 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15483 static MinimumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15484 static MinimumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15485 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15486 static MinimumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15487 static MinimumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
15488 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
15489 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15490 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
15491 static MinimumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15492 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
15493 static MinimumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15494 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15495 static MinimumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15496 static MinimumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15497 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
15498 ::llvm::LogicalResult verifyInvariantsImpl();
15499 ::llvm::LogicalResult verifyInvariants();
15500 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
15501 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
15502 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
15503 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
15504private:
15505 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
15506 return getAttributeNameForIndex(name: (*this)->getName(), index);
15507 }
15508
15509 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
15510 assert(index < 1 && "invalid attribute index");
15511 assert(name.getStringRef() == getOperationName() && "invalid operation name");
15512 assert(name.isRegistered() && "Operation isn't registered, missing a "
15513 "dependent dialect loading?");
15514 return name.getAttributeNames()[index];
15515 }
15516
15517 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
15518public:
15519};
15520
15521} // namespace mlir::tosa
15522MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MinimumOp)
15523MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::MinimumOpGenericAdaptorBase::Properties)
15524
15525namespace mlir::tosa {
15526
15527
15528//===----------------------------------------------------------------------===//
15529// mlir::tosa::ModShapeOp declarations
15530//===----------------------------------------------------------------------===//
15531
15532namespace detail {
15533
15534class ModShapeOpGenericAdaptorBase {
15535public:
15536 using Properties = ::mlir::EmptyProperties;
15537protected:
15538 ::mlir::DictionaryAttr odsAttrs;
15539 ::std::optional<::mlir::OperationName> odsOpName;
15540 Properties properties;
15541 ::mlir::RegionRange odsRegions;
15542public:
15543 ModShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
15544 odsOpName.emplace(args: "tosa.mod_shape", args: odsAttrs.getContext());
15545 }
15546
15547 ModShapeOpGenericAdaptorBase(ModShapeOp op);
15548
15549 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
15550 return {index, 1};
15551 }
15552
15553 const Properties &getProperties() {
15554 return properties;
15555 }
15556
15557 ::mlir::DictionaryAttr getAttributes() {
15558 return odsAttrs;
15559 }
15560
15561};
15562
15563} // namespace detail
15564template <typename RangeT>
15565class ModShapeOpGenericAdaptor : public detail::ModShapeOpGenericAdaptorBase {
15566 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
15567 using Base = detail::ModShapeOpGenericAdaptorBase;
15568 static constexpr int odsIndex_input1 = 0;
15569 static constexpr int odsIndex_input2 = 1;
15570public:
15571 ModShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
15572
15573 ModShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ModShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
15574
15575 ModShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ModShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
15576
15577 ModShapeOpGenericAdaptor(RangeT values, const ModShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
15578
15579 template <typename LateInst = ModShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, ModShapeOp>>>
15580 ModShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
15581
15582 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15583 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
15584 }
15585
15586 RangeT getODSOperands(unsigned index) {
15587 auto valueRange = getODSOperandIndexAndLength(index);
15588 return {std::next(odsOperands.begin(), valueRange.first),
15589 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
15590 }
15591
15592 ValueT getInput1() {
15593 return (*getODSOperands(index: 0).begin());
15594 }
15595
15596 ValueT getInput2() {
15597 return (*getODSOperands(index: 1).begin());
15598 }
15599
15600 RangeT getOperands() {
15601 return odsOperands;
15602 }
15603
15604private:
15605 RangeT odsOperands;
15606};
15607class ModShapeOpAdaptor : public ModShapeOpGenericAdaptor<::mlir::ValueRange> {
15608public:
15609 using ModShapeOpGenericAdaptor::ModShapeOpGenericAdaptor;
15610 ModShapeOpAdaptor(ModShapeOp op);
15611
15612 ::llvm::LogicalResult verify(::mlir::Location loc);
15613};
15614class ModShapeOp : public ::mlir::Op<ModShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
15615public:
15616 using Op::Op;
15617 using Op::print;
15618 using Adaptor = ModShapeOpAdaptor;
15619 template <typename RangeT>
15620 using GenericAdaptor = ModShapeOpGenericAdaptor<RangeT>;
15621 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
15622 static constexpr int odsIndex_input1 = 0;
15623 static constexpr int odsIndex_input2 = 1;
15624 static constexpr int odsIndex_output = 0;
15625 using Properties = FoldAdaptor::Properties;
15626 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
15627 return {};
15628 }
15629
15630 static constexpr ::llvm::StringLiteral getOperationName() {
15631 return ::llvm::StringLiteral("tosa.mod_shape");
15632 }
15633
15634 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15635 return {index, 1};
15636 }
15637
15638 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
15639 auto [start, length] = getODSOperandIndexAndLength(index);
15640 return getOperation()->getOperands().slice(n: start, m: length);
15641 }
15642
15643 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
15644 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
15645 }
15646
15647 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
15648 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
15649 }
15650
15651 ::mlir::OpOperand &getInput1Mutable() {
15652 auto range = getODSOperandIndexAndLength(index: 0);
15653 return getOperation()->getOpOperand(idx: range.first);
15654 }
15655
15656 ::mlir::OpOperand &getInput2Mutable() {
15657 auto range = getODSOperandIndexAndLength(index: 1);
15658 return getOperation()->getOpOperand(idx: range.first);
15659 }
15660
15661 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
15662 return {index, 1};
15663 }
15664
15665 ::mlir::Operation::result_range getODSResults(unsigned index) {
15666 auto valueRange = getODSResultIndexAndLength(index);
15667 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
15668 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
15669 }
15670
15671 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
15672 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
15673 }
15674
15675 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15676 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
15677 static llvm::hash_code computePropertiesHash(const Properties &prop);
15678 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
15679 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
15680 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
15681 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15682 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
15683 static ModShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
15684 static ModShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
15685 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
15686 static ModShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
15687 static ModShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
15688 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15689 static ModShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15690 static ModShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15691 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15692 static ModShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15693 static ModShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15694 ::llvm::LogicalResult verifyInvariantsImpl();
15695 ::llvm::LogicalResult verifyInvariants();
15696 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
15697 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
15698 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
15699 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
15700public:
15701};
15702
15703} // namespace mlir::tosa
15704MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ModShapeOp)
15705
15706namespace mlir::tosa {
15707
15708
15709//===----------------------------------------------------------------------===//
15710// mlir::tosa::MulOp declarations
15711//===----------------------------------------------------------------------===//
15712
15713namespace detail {
15714
15715class MulOpGenericAdaptorBase {
15716public:
15717 using Properties = ::mlir::EmptyProperties;
15718protected:
15719 ::mlir::DictionaryAttr odsAttrs;
15720 ::std::optional<::mlir::OperationName> odsOpName;
15721 Properties properties;
15722 ::mlir::RegionRange odsRegions;
15723public:
15724 MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
15725 odsOpName.emplace(args: "tosa.mul", args: odsAttrs.getContext());
15726 }
15727
15728 MulOpGenericAdaptorBase(MulOp op);
15729
15730 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
15731 return {index, 1};
15732 }
15733
15734 const Properties &getProperties() {
15735 return properties;
15736 }
15737
15738 ::mlir::DictionaryAttr getAttributes() {
15739 return odsAttrs;
15740 }
15741
15742};
15743
15744} // namespace detail
15745template <typename RangeT>
15746class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase {
15747 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
15748 using Base = detail::MulOpGenericAdaptorBase;
15749 static constexpr int odsIndex_input1 = 0;
15750 static constexpr int odsIndex_input2 = 1;
15751 static constexpr int odsIndex_shift = 2;
15752public:
15753 MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
15754
15755 MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
15756
15757 MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MulOpGenericAdaptor(values, attrs, Properties{}, {}) {}
15758
15759 MulOpGenericAdaptor(RangeT values, const MulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
15760
15761 template <typename LateInst = MulOp, typename = std::enable_if_t<std::is_same_v<LateInst, MulOp>>>
15762 MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
15763
15764 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15765 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
15766 }
15767
15768 RangeT getODSOperands(unsigned index) {
15769 auto valueRange = getODSOperandIndexAndLength(index);
15770 return {std::next(odsOperands.begin(), valueRange.first),
15771 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
15772 }
15773
15774 ValueT getInput1() {
15775 return (*getODSOperands(index: 0).begin());
15776 }
15777
15778 ValueT getInput2() {
15779 return (*getODSOperands(index: 1).begin());
15780 }
15781
15782 ValueT getShift() {
15783 return (*getODSOperands(index: 2).begin());
15784 }
15785
15786 RangeT getOperands() {
15787 return odsOperands;
15788 }
15789
15790private:
15791 RangeT odsOperands;
15792};
15793class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> {
15794public:
15795 using MulOpGenericAdaptor::MulOpGenericAdaptor;
15796 MulOpAdaptor(MulOp op);
15797
15798 ::llvm::LogicalResult verify(::mlir::Location loc);
15799};
15800class MulOp : public ::mlir::Op<MulOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
15801public:
15802 using Op::Op;
15803 using Op::print;
15804 using Adaptor = MulOpAdaptor;
15805 template <typename RangeT>
15806 using GenericAdaptor = MulOpGenericAdaptor<RangeT>;
15807 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
15808 static constexpr int odsIndex_input1 = 0;
15809 static constexpr int odsIndex_input2 = 1;
15810 static constexpr int odsIndex_shift = 2;
15811 static constexpr int odsIndex_output = 0;
15812 using Properties = FoldAdaptor::Properties;
15813 using ::mlir::InferShapedTypeOpInterface::Trait<MulOp>::reifyReturnTypeShapes;
15814 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
15815 return {};
15816 }
15817
15818 static constexpr ::llvm::StringLiteral getOperationName() {
15819 return ::llvm::StringLiteral("tosa.mul");
15820 }
15821
15822 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15823 return {index, 1};
15824 }
15825
15826 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
15827 auto [start, length] = getODSOperandIndexAndLength(index);
15828 return getOperation()->getOperands().slice(n: start, m: length);
15829 }
15830
15831 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
15832 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
15833 }
15834
15835 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
15836 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
15837 }
15838
15839 ::mlir::TypedValue<::mlir::TensorType> getShift() {
15840 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
15841 }
15842
15843 ::mlir::OpOperand &getInput1Mutable() {
15844 auto range = getODSOperandIndexAndLength(index: 0);
15845 return getOperation()->getOpOperand(idx: range.first);
15846 }
15847
15848 ::mlir::OpOperand &getInput2Mutable() {
15849 auto range = getODSOperandIndexAndLength(index: 1);
15850 return getOperation()->getOpOperand(idx: range.first);
15851 }
15852
15853 ::mlir::OpOperand &getShiftMutable() {
15854 auto range = getODSOperandIndexAndLength(index: 2);
15855 return getOperation()->getOpOperand(idx: range.first);
15856 }
15857
15858 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
15859 return {index, 1};
15860 }
15861
15862 ::mlir::Operation::result_range getODSResults(unsigned index) {
15863 auto valueRange = getODSResultIndexAndLength(index);
15864 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
15865 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
15866 }
15867
15868 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
15869 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
15870 }
15871
15872 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15873 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
15874 static llvm::hash_code computePropertiesHash(const Properties &prop);
15875 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
15876 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
15877 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
15878 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
15879 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift);
15880 static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift);
15881 static MulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift);
15882 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift);
15883 static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift);
15884 static MulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value shift);
15885 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15886 static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15887 static MulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
15888 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15889 static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15890 static MulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
15891 ::llvm::LogicalResult verifyInvariantsImpl();
15892 ::llvm::LogicalResult verifyInvariants();
15893 ::llvm::LogicalResult verify();
15894 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
15895 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
15896 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
15897 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
15898 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
15899public:
15900};
15901
15902} // namespace mlir::tosa
15903MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MulOp)
15904
15905namespace mlir::tosa {
15906
15907
15908//===----------------------------------------------------------------------===//
15909// mlir::tosa::MulShapeOp declarations
15910//===----------------------------------------------------------------------===//
15911
15912namespace detail {
15913
15914class MulShapeOpGenericAdaptorBase {
15915public:
15916 using Properties = ::mlir::EmptyProperties;
15917protected:
15918 ::mlir::DictionaryAttr odsAttrs;
15919 ::std::optional<::mlir::OperationName> odsOpName;
15920 Properties properties;
15921 ::mlir::RegionRange odsRegions;
15922public:
15923 MulShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
15924 odsOpName.emplace(args: "tosa.mul_shape", args: odsAttrs.getContext());
15925 }
15926
15927 MulShapeOpGenericAdaptorBase(MulShapeOp op);
15928
15929 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
15930 return {index, 1};
15931 }
15932
15933 const Properties &getProperties() {
15934 return properties;
15935 }
15936
15937 ::mlir::DictionaryAttr getAttributes() {
15938 return odsAttrs;
15939 }
15940
15941};
15942
15943} // namespace detail
15944template <typename RangeT>
15945class MulShapeOpGenericAdaptor : public detail::MulShapeOpGenericAdaptorBase {
15946 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
15947 using Base = detail::MulShapeOpGenericAdaptorBase;
15948 static constexpr int odsIndex_input1 = 0;
15949 static constexpr int odsIndex_input2 = 1;
15950public:
15951 MulShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
15952
15953 MulShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MulShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
15954
15955 MulShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MulShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
15956
15957 MulShapeOpGenericAdaptor(RangeT values, const MulShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
15958
15959 template <typename LateInst = MulShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, MulShapeOp>>>
15960 MulShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
15961
15962 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
15963 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
15964 }
15965
15966 RangeT getODSOperands(unsigned index) {
15967 auto valueRange = getODSOperandIndexAndLength(index);
15968 return {std::next(odsOperands.begin(), valueRange.first),
15969 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
15970 }
15971
15972 ValueT getInput1() {
15973 return (*getODSOperands(index: 0).begin());
15974 }
15975
15976 ValueT getInput2() {
15977 return (*getODSOperands(index: 1).begin());
15978 }
15979
15980 RangeT getOperands() {
15981 return odsOperands;
15982 }
15983
15984private:
15985 RangeT odsOperands;
15986};
15987class MulShapeOpAdaptor : public MulShapeOpGenericAdaptor<::mlir::ValueRange> {
15988public:
15989 using MulShapeOpGenericAdaptor::MulShapeOpGenericAdaptor;
15990 MulShapeOpAdaptor(MulShapeOp op);
15991
15992 ::llvm::LogicalResult verify(::mlir::Location loc);
15993};
15994class MulShapeOp : public ::mlir::Op<MulShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
15995public:
15996 using Op::Op;
15997 using Op::print;
15998 using Adaptor = MulShapeOpAdaptor;
15999 template <typename RangeT>
16000 using GenericAdaptor = MulShapeOpGenericAdaptor<RangeT>;
16001 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
16002 static constexpr int odsIndex_input1 = 0;
16003 static constexpr int odsIndex_input2 = 1;
16004 static constexpr int odsIndex_output = 0;
16005 using Properties = FoldAdaptor::Properties;
16006 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
16007 return {};
16008 }
16009
16010 static constexpr ::llvm::StringLiteral getOperationName() {
16011 return ::llvm::StringLiteral("tosa.mul_shape");
16012 }
16013
16014 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16015 return {index, 1};
16016 }
16017
16018 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
16019 auto [start, length] = getODSOperandIndexAndLength(index);
16020 return getOperation()->getOperands().slice(n: start, m: length);
16021 }
16022
16023 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
16024 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
16025 }
16026
16027 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
16028 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
16029 }
16030
16031 ::mlir::OpOperand &getInput1Mutable() {
16032 auto range = getODSOperandIndexAndLength(index: 0);
16033 return getOperation()->getOpOperand(idx: range.first);
16034 }
16035
16036 ::mlir::OpOperand &getInput2Mutable() {
16037 auto range = getODSOperandIndexAndLength(index: 1);
16038 return getOperation()->getOpOperand(idx: range.first);
16039 }
16040
16041 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
16042 return {index, 1};
16043 }
16044
16045 ::mlir::Operation::result_range getODSResults(unsigned index) {
16046 auto valueRange = getODSResultIndexAndLength(index);
16047 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
16048 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
16049 }
16050
16051 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
16052 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
16053 }
16054
16055 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16056 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
16057 static llvm::hash_code computePropertiesHash(const Properties &prop);
16058 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
16059 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
16060 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
16061 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16062 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
16063 static MulShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
16064 static MulShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
16065 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
16066 static MulShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
16067 static MulShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
16068 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16069 static MulShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16070 static MulShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16071 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16072 static MulShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16073 static MulShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16074 ::llvm::LogicalResult verifyInvariantsImpl();
16075 ::llvm::LogicalResult verifyInvariants();
16076 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
16077 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
16078 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
16079 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
16080public:
16081};
16082
16083} // namespace mlir::tosa
16084MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::MulShapeOp)
16085
16086namespace mlir::tosa {
16087
16088
16089//===----------------------------------------------------------------------===//
16090// mlir::tosa::NegateOp declarations
16091//===----------------------------------------------------------------------===//
16092
16093namespace detail {
16094
16095class NegateOpGenericAdaptorBase {
16096public:
16097 using Properties = ::mlir::EmptyProperties;
16098protected:
16099 ::mlir::DictionaryAttr odsAttrs;
16100 ::std::optional<::mlir::OperationName> odsOpName;
16101 Properties properties;
16102 ::mlir::RegionRange odsRegions;
16103public:
16104 NegateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
16105 odsOpName.emplace(args: "tosa.negate", args: odsAttrs.getContext());
16106 }
16107
16108 NegateOpGenericAdaptorBase(NegateOp op);
16109
16110 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
16111 return {index, 1};
16112 }
16113
16114 const Properties &getProperties() {
16115 return properties;
16116 }
16117
16118 ::mlir::DictionaryAttr getAttributes() {
16119 return odsAttrs;
16120 }
16121
16122};
16123
16124} // namespace detail
16125template <typename RangeT>
16126class NegateOpGenericAdaptor : public detail::NegateOpGenericAdaptorBase {
16127 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
16128 using Base = detail::NegateOpGenericAdaptorBase;
16129 static constexpr int odsIndex_input1 = 0;
16130 static constexpr int odsIndex_input1_zp = 1;
16131 static constexpr int odsIndex_output_zp = 2;
16132public:
16133 NegateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
16134
16135 NegateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : NegateOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
16136
16137 NegateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : NegateOpGenericAdaptor(values, attrs, Properties{}, {}) {}
16138
16139 NegateOpGenericAdaptor(RangeT values, const NegateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
16140
16141 template <typename LateInst = NegateOp, typename = std::enable_if_t<std::is_same_v<LateInst, NegateOp>>>
16142 NegateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
16143
16144 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16145 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
16146 }
16147
16148 RangeT getODSOperands(unsigned index) {
16149 auto valueRange = getODSOperandIndexAndLength(index);
16150 return {std::next(odsOperands.begin(), valueRange.first),
16151 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
16152 }
16153
16154 ValueT getInput1() {
16155 return (*getODSOperands(index: 0).begin());
16156 }
16157
16158 ValueT getInput1Zp() {
16159 return (*getODSOperands(index: 1).begin());
16160 }
16161
16162 ValueT getOutputZp() {
16163 return (*getODSOperands(index: 2).begin());
16164 }
16165
16166 RangeT getOperands() {
16167 return odsOperands;
16168 }
16169
16170private:
16171 RangeT odsOperands;
16172};
16173class NegateOpAdaptor : public NegateOpGenericAdaptor<::mlir::ValueRange> {
16174public:
16175 using NegateOpGenericAdaptor::NegateOpGenericAdaptor;
16176 NegateOpAdaptor(NegateOp op);
16177
16178 ::llvm::LogicalResult verify(::mlir::Location loc);
16179};
16180class NegateOp : public ::mlir::Op<NegateOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
16181public:
16182 using Op::Op;
16183 using Op::print;
16184 using Adaptor = NegateOpAdaptor;
16185 template <typename RangeT>
16186 using GenericAdaptor = NegateOpGenericAdaptor<RangeT>;
16187 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
16188 static constexpr int odsIndex_input1 = 0;
16189 static constexpr int odsIndex_input1_zp = 1;
16190 static constexpr int odsIndex_output_zp = 2;
16191 static constexpr int odsIndex_output = 0;
16192 using Properties = FoldAdaptor::Properties;
16193 using ::mlir::InferShapedTypeOpInterface::Trait<NegateOp>::reifyReturnTypeShapes;
16194 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
16195 return {};
16196 }
16197
16198 static constexpr ::llvm::StringLiteral getOperationName() {
16199 return ::llvm::StringLiteral("tosa.negate");
16200 }
16201
16202 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16203 return {index, 1};
16204 }
16205
16206 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
16207 auto [start, length] = getODSOperandIndexAndLength(index);
16208 return getOperation()->getOperands().slice(n: start, m: length);
16209 }
16210
16211 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
16212 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
16213 }
16214
16215 ::mlir::TypedValue<::mlir::TensorType> getInput1Zp() {
16216 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
16217 }
16218
16219 ::mlir::TypedValue<::mlir::TensorType> getOutputZp() {
16220 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
16221 }
16222
16223 ::mlir::OpOperand &getInput1Mutable() {
16224 auto range = getODSOperandIndexAndLength(index: 0);
16225 return getOperation()->getOpOperand(idx: range.first);
16226 }
16227
16228 ::mlir::OpOperand &getInput1ZpMutable() {
16229 auto range = getODSOperandIndexAndLength(index: 1);
16230 return getOperation()->getOpOperand(idx: range.first);
16231 }
16232
16233 ::mlir::OpOperand &getOutputZpMutable() {
16234 auto range = getODSOperandIndexAndLength(index: 2);
16235 return getOperation()->getOpOperand(idx: range.first);
16236 }
16237
16238 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
16239 return {index, 1};
16240 }
16241
16242 ::mlir::Operation::result_range getODSResults(unsigned index) {
16243 auto valueRange = getODSResultIndexAndLength(index);
16244 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
16245 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
16246 }
16247
16248 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
16249 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
16250 }
16251
16252 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16253 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
16254 static llvm::hash_code computePropertiesHash(const Properties &prop);
16255 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
16256 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
16257 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
16258 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16259 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type outputType, Value input);
16260 static NegateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Type outputType, Value input);
16261 static NegateOp create(::mlir::ImplicitLocOpBuilder &builder, Type outputType, Value input);
16262 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp);
16263 static NegateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp);
16264 static NegateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp);
16265 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp);
16266 static NegateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp);
16267 static NegateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input1_zp, ::mlir::Value output_zp);
16268 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16269 static NegateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16270 static NegateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16271 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16272 static NegateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16273 static NegateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16274 ::llvm::LogicalResult verifyInvariantsImpl();
16275 ::llvm::LogicalResult verifyInvariants();
16276 ::llvm::LogicalResult verify();
16277 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
16278 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
16279 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
16280 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
16281 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
16282public:
16283 static ::llvm::LogicalResult
16284 inferReturnTypeComponents(::mlir::MLIRContext *context,
16285 std::optional<::mlir::Location> location,
16286 Adaptor adaptor,
16287 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
16288
16289
16290 FailureOr<int64_t> getInput1ZeroPoint();
16291 FailureOr<int64_t> getOutputZeroPoint();
16292 LogicalResult verifyInput1ZeroPoint(int64_t zp);
16293 LogicalResult verifyOutputZeroPoint(int64_t zp);
16294};
16295
16296} // namespace mlir::tosa
16297MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::NegateOp)
16298
16299namespace mlir::tosa {
16300
16301
16302//===----------------------------------------------------------------------===//
16303// mlir::tosa::PadOp declarations
16304//===----------------------------------------------------------------------===//
16305
16306namespace detail {
16307
16308class PadOpGenericAdaptorBase {
16309public:
16310 using Properties = ::mlir::EmptyProperties;
16311protected:
16312 ::mlir::DictionaryAttr odsAttrs;
16313 ::std::optional<::mlir::OperationName> odsOpName;
16314 Properties properties;
16315 ::mlir::RegionRange odsRegions;
16316public:
16317 PadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
16318 odsOpName.emplace(args: "tosa.pad", args: odsAttrs.getContext());
16319 }
16320
16321 PadOpGenericAdaptorBase(PadOp op);
16322
16323 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
16324 return {index, 1};
16325 }
16326
16327 const Properties &getProperties() {
16328 return properties;
16329 }
16330
16331 ::mlir::DictionaryAttr getAttributes() {
16332 return odsAttrs;
16333 }
16334
16335};
16336
16337} // namespace detail
16338template <typename RangeT>
16339class PadOpGenericAdaptor : public detail::PadOpGenericAdaptorBase {
16340 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
16341 using Base = detail::PadOpGenericAdaptorBase;
16342 static constexpr int odsIndex_input1 = 0;
16343 static constexpr int odsIndex_padding = 1;
16344 static constexpr int odsIndex_pad_const = 2;
16345public:
16346 PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
16347
16348 PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PadOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
16349
16350 PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : PadOpGenericAdaptor(values, attrs, Properties{}, {}) {}
16351
16352 PadOpGenericAdaptor(RangeT values, const PadOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
16353
16354 template <typename LateInst = PadOp, typename = std::enable_if_t<std::is_same_v<LateInst, PadOp>>>
16355 PadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
16356
16357 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16358 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
16359 }
16360
16361 RangeT getODSOperands(unsigned index) {
16362 auto valueRange = getODSOperandIndexAndLength(index);
16363 return {std::next(odsOperands.begin(), valueRange.first),
16364 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
16365 }
16366
16367 ValueT getInput1() {
16368 return (*getODSOperands(index: 0).begin());
16369 }
16370
16371 ValueT getPadding() {
16372 return (*getODSOperands(index: 1).begin());
16373 }
16374
16375 ValueT getPadConst() {
16376 return (*getODSOperands(index: 2).begin());
16377 }
16378
16379 RangeT getOperands() {
16380 return odsOperands;
16381 }
16382
16383private:
16384 RangeT odsOperands;
16385};
16386class PadOpAdaptor : public PadOpGenericAdaptor<::mlir::ValueRange> {
16387public:
16388 using PadOpGenericAdaptor::PadOpGenericAdaptor;
16389 PadOpAdaptor(PadOp op);
16390
16391 ::llvm::LogicalResult verify(::mlir::Location loc);
16392};
16393class PadOp : public ::mlir::Op<PadOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
16394public:
16395 using Op::Op;
16396 using Op::print;
16397 using Adaptor = PadOpAdaptor;
16398 template <typename RangeT>
16399 using GenericAdaptor = PadOpGenericAdaptor<RangeT>;
16400 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
16401 static constexpr int odsIndex_input1 = 0;
16402 static constexpr int odsIndex_padding = 1;
16403 static constexpr int odsIndex_pad_const = 2;
16404 static constexpr int odsIndex_output = 0;
16405 using Properties = FoldAdaptor::Properties;
16406 using ::mlir::InferShapedTypeOpInterface::Trait<PadOp>::reifyReturnTypeShapes;
16407 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
16408 return {};
16409 }
16410
16411 static constexpr ::llvm::StringLiteral getOperationName() {
16412 return ::llvm::StringLiteral("tosa.pad");
16413 }
16414
16415 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16416 return {index, 1};
16417 }
16418
16419 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
16420 auto [start, length] = getODSOperandIndexAndLength(index);
16421 return getOperation()->getOperands().slice(n: start, m: length);
16422 }
16423
16424 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
16425 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
16426 }
16427
16428 ::mlir::TypedValue<mlir::tosa::shapeType> getPadding() {
16429 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
16430 }
16431
16432 ::mlir::TypedValue<::mlir::TensorType> getPadConst() {
16433 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
16434 }
16435
16436 ::mlir::OpOperand &getInput1Mutable() {
16437 auto range = getODSOperandIndexAndLength(index: 0);
16438 return getOperation()->getOpOperand(idx: range.first);
16439 }
16440
16441 ::mlir::OpOperand &getPaddingMutable() {
16442 auto range = getODSOperandIndexAndLength(index: 1);
16443 return getOperation()->getOpOperand(idx: range.first);
16444 }
16445
16446 ::mlir::OpOperand &getPadConstMutable() {
16447 auto range = getODSOperandIndexAndLength(index: 2);
16448 return getOperation()->getOpOperand(idx: range.first);
16449 }
16450
16451 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
16452 return {index, 1};
16453 }
16454
16455 ::mlir::Operation::result_range getODSResults(unsigned index) {
16456 auto valueRange = getODSResultIndexAndLength(index);
16457 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
16458 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
16459 }
16460
16461 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
16462 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
16463 }
16464
16465 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16466 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
16467 static llvm::hash_code computePropertiesHash(const Properties &prop);
16468 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
16469 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
16470 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
16471 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16472 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type outputType, Value input, Value paddings);
16473 static PadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Type outputType, Value input, Value paddings);
16474 static PadOp create(::mlir::ImplicitLocOpBuilder &builder, Type outputType, Value input, Value paddings);
16475 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const);
16476 static PadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const);
16477 static PadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const);
16478 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const);
16479 static PadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const);
16480 static PadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value padding, ::mlir::Value pad_const);
16481 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16482 static PadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16483 static PadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16484 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16485 static PadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16486 static PadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16487 ::llvm::LogicalResult verifyInvariantsImpl();
16488 ::llvm::LogicalResult verifyInvariants();
16489 ::llvm::LogicalResult verify();
16490 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
16491 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
16492 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
16493 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
16494 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
16495public:
16496 static ::llvm::LogicalResult
16497 inferReturnTypeComponents(::mlir::MLIRContext *context,
16498 std::optional<::mlir::Location> location,
16499 Adaptor adaptor,
16500 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
16501
16502};
16503
16504} // namespace mlir::tosa
16505MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::PadOp)
16506
16507namespace mlir::tosa {
16508
16509
16510//===----------------------------------------------------------------------===//
16511// mlir::tosa::PowOp declarations
16512//===----------------------------------------------------------------------===//
16513
16514namespace detail {
16515
16516class PowOpGenericAdaptorBase {
16517public:
16518 using Properties = ::mlir::EmptyProperties;
16519protected:
16520 ::mlir::DictionaryAttr odsAttrs;
16521 ::std::optional<::mlir::OperationName> odsOpName;
16522 Properties properties;
16523 ::mlir::RegionRange odsRegions;
16524public:
16525 PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
16526 odsOpName.emplace(args: "tosa.pow", args: odsAttrs.getContext());
16527 }
16528
16529 PowOpGenericAdaptorBase(PowOp op);
16530
16531 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
16532 return {index, 1};
16533 }
16534
16535 const Properties &getProperties() {
16536 return properties;
16537 }
16538
16539 ::mlir::DictionaryAttr getAttributes() {
16540 return odsAttrs;
16541 }
16542
16543};
16544
16545} // namespace detail
16546template <typename RangeT>
16547class PowOpGenericAdaptor : public detail::PowOpGenericAdaptorBase {
16548 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
16549 using Base = detail::PowOpGenericAdaptorBase;
16550 static constexpr int odsIndex_input1 = 0;
16551 static constexpr int odsIndex_input2 = 1;
16552public:
16553 PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
16554
16555 PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PowOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
16556
16557 PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : PowOpGenericAdaptor(values, attrs, Properties{}, {}) {}
16558
16559 PowOpGenericAdaptor(RangeT values, const PowOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
16560
16561 template <typename LateInst = PowOp, typename = std::enable_if_t<std::is_same_v<LateInst, PowOp>>>
16562 PowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
16563
16564 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16565 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
16566 }
16567
16568 RangeT getODSOperands(unsigned index) {
16569 auto valueRange = getODSOperandIndexAndLength(index);
16570 return {std::next(odsOperands.begin(), valueRange.first),
16571 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
16572 }
16573
16574 ValueT getInput1() {
16575 return (*getODSOperands(index: 0).begin());
16576 }
16577
16578 ValueT getInput2() {
16579 return (*getODSOperands(index: 1).begin());
16580 }
16581
16582 RangeT getOperands() {
16583 return odsOperands;
16584 }
16585
16586private:
16587 RangeT odsOperands;
16588};
16589class PowOpAdaptor : public PowOpGenericAdaptor<::mlir::ValueRange> {
16590public:
16591 using PowOpGenericAdaptor::PowOpGenericAdaptor;
16592 PowOpAdaptor(PowOp op);
16593
16594 ::llvm::LogicalResult verify(::mlir::Location loc);
16595};
16596class PowOp : public ::mlir::Op<PowOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
16597public:
16598 using Op::Op;
16599 using Op::print;
16600 using Adaptor = PowOpAdaptor;
16601 template <typename RangeT>
16602 using GenericAdaptor = PowOpGenericAdaptor<RangeT>;
16603 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
16604 static constexpr int odsIndex_input1 = 0;
16605 static constexpr int odsIndex_input2 = 1;
16606 static constexpr int odsIndex_output = 0;
16607 using Properties = FoldAdaptor::Properties;
16608 using ::mlir::InferShapedTypeOpInterface::Trait<PowOp>::reifyReturnTypeShapes;
16609 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
16610 return {};
16611 }
16612
16613 static constexpr ::llvm::StringLiteral getOperationName() {
16614 return ::llvm::StringLiteral("tosa.pow");
16615 }
16616
16617 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16618 return {index, 1};
16619 }
16620
16621 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
16622 auto [start, length] = getODSOperandIndexAndLength(index);
16623 return getOperation()->getOperands().slice(n: start, m: length);
16624 }
16625
16626 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
16627 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
16628 }
16629
16630 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
16631 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
16632 }
16633
16634 ::mlir::OpOperand &getInput1Mutable() {
16635 auto range = getODSOperandIndexAndLength(index: 0);
16636 return getOperation()->getOpOperand(idx: range.first);
16637 }
16638
16639 ::mlir::OpOperand &getInput2Mutable() {
16640 auto range = getODSOperandIndexAndLength(index: 1);
16641 return getOperation()->getOpOperand(idx: range.first);
16642 }
16643
16644 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
16645 return {index, 1};
16646 }
16647
16648 ::mlir::Operation::result_range getODSResults(unsigned index) {
16649 auto valueRange = getODSResultIndexAndLength(index);
16650 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
16651 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
16652 }
16653
16654 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
16655 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
16656 }
16657
16658 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16659 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
16660 static llvm::hash_code computePropertiesHash(const Properties &prop);
16661 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
16662 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
16663 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
16664 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16665 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
16666 static PowOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
16667 static PowOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
16668 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
16669 static PowOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
16670 static PowOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
16671 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16672 static PowOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16673 static PowOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16674 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16675 static PowOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16676 static PowOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16677 ::llvm::LogicalResult verifyInvariantsImpl();
16678 ::llvm::LogicalResult verifyInvariants();
16679 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
16680 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
16681 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
16682 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
16683public:
16684};
16685
16686} // namespace mlir::tosa
16687MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::PowOp)
16688
16689namespace mlir::tosa {
16690
16691
16692//===----------------------------------------------------------------------===//
16693// mlir::tosa::RFFT2dOp declarations
16694//===----------------------------------------------------------------------===//
16695
16696namespace detail {
16697
16698class RFFT2dOpGenericAdaptorBase {
16699public:
16700 struct Properties {
16701 using local_boundTy = ::mlir::BoolAttr;
16702 local_boundTy local_bound;
16703
16704 auto getLocalBound() const {
16705 auto &propStorage = this->local_bound;
16706 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val: propStorage);
16707 }
16708 void setLocalBound(const ::mlir::BoolAttr &propValue) {
16709 this->local_bound = propValue;
16710 }
16711 bool operator==(const Properties &rhs) const {
16712 return
16713 rhs.local_bound == this->local_bound &&
16714 true;
16715 }
16716 bool operator!=(const Properties &rhs) const {
16717 return !(*this == rhs);
16718 }
16719 };
16720protected:
16721 ::mlir::DictionaryAttr odsAttrs;
16722 ::std::optional<::mlir::OperationName> odsOpName;
16723 Properties properties;
16724 ::mlir::RegionRange odsRegions;
16725public:
16726 RFFT2dOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
16727 odsOpName.emplace(args: "tosa.rfft2d", args: odsAttrs.getContext());
16728 }
16729
16730 RFFT2dOpGenericAdaptorBase(RFFT2dOp op);
16731
16732 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
16733 return {index, 1};
16734 }
16735
16736 const Properties &getProperties() {
16737 return properties;
16738 }
16739
16740 ::mlir::DictionaryAttr getAttributes() {
16741 return odsAttrs;
16742 }
16743
16744 ::mlir::BoolAttr getLocalBoundAttr();
16745 bool getLocalBound();
16746};
16747
16748} // namespace detail
16749template <typename RangeT>
16750class RFFT2dOpGenericAdaptor : public detail::RFFT2dOpGenericAdaptorBase {
16751 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
16752 using Base = detail::RFFT2dOpGenericAdaptorBase;
16753 static constexpr int odsIndex_input_real = 0;
16754public:
16755 RFFT2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
16756
16757 RFFT2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RFFT2dOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
16758
16759 RFFT2dOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RFFT2dOpGenericAdaptor(values, attrs, Properties{}, {}) {}
16760
16761 RFFT2dOpGenericAdaptor(RangeT values, const RFFT2dOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
16762
16763 template <typename LateInst = RFFT2dOp, typename = std::enable_if_t<std::is_same_v<LateInst, RFFT2dOp>>>
16764 RFFT2dOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
16765
16766 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16767 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
16768 }
16769
16770 RangeT getODSOperands(unsigned index) {
16771 auto valueRange = getODSOperandIndexAndLength(index);
16772 return {std::next(odsOperands.begin(), valueRange.first),
16773 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
16774 }
16775
16776 ValueT getInputReal() {
16777 return (*getODSOperands(index: 0).begin());
16778 }
16779
16780 RangeT getOperands() {
16781 return odsOperands;
16782 }
16783
16784private:
16785 RangeT odsOperands;
16786};
16787class RFFT2dOpAdaptor : public RFFT2dOpGenericAdaptor<::mlir::ValueRange> {
16788public:
16789 using RFFT2dOpGenericAdaptor::RFFT2dOpGenericAdaptor;
16790 RFFT2dOpAdaptor(RFFT2dOp op);
16791
16792 ::llvm::LogicalResult verify(::mlir::Location loc);
16793};
16794class RFFT2dOp : public ::mlir::Op<RFFT2dOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::NResults<2>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::OpTrait::ResultsAreFloatLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands, ::mlir::OpAsmOpInterface::Trait> {
16795public:
16796 using Op::Op;
16797 using Op::print;
16798 using Adaptor = RFFT2dOpAdaptor;
16799 template <typename RangeT>
16800 using GenericAdaptor = RFFT2dOpGenericAdaptor<RangeT>;
16801 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
16802 static constexpr int odsIndex_input_real = 0;
16803 static constexpr int odsIndex_output_real = 0;
16804 static constexpr int odsIndex_output_imag = 1;
16805 using Properties = FoldAdaptor::Properties;
16806 using ::mlir::InferShapedTypeOpInterface::Trait<RFFT2dOp>::reifyReturnTypeShapes;
16807 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
16808 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("local_bound")};
16809 return ::llvm::ArrayRef(attrNames);
16810 }
16811
16812 ::mlir::StringAttr getLocalBoundAttrName() {
16813 return getAttributeNameForIndex(index: 0);
16814 }
16815
16816 static ::mlir::StringAttr getLocalBoundAttrName(::mlir::OperationName name) {
16817 return getAttributeNameForIndex(name, index: 0);
16818 }
16819
16820 void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn);
16821 static constexpr ::llvm::StringLiteral getOperationName() {
16822 return ::llvm::StringLiteral("tosa.rfft2d");
16823 }
16824
16825 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16826 return {index, 1};
16827 }
16828
16829 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
16830 auto [start, length] = getODSOperandIndexAndLength(index);
16831 return getOperation()->getOperands().slice(n: start, m: length);
16832 }
16833
16834 ::mlir::TypedValue<::mlir::TensorType> getInputReal() {
16835 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
16836 }
16837
16838 ::mlir::OpOperand &getInputRealMutable() {
16839 auto range = getODSOperandIndexAndLength(index: 0);
16840 return getOperation()->getOpOperand(idx: range.first);
16841 }
16842
16843 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
16844 return {index, 1};
16845 }
16846
16847 ::mlir::Operation::result_range getODSResults(unsigned index) {
16848 auto valueRange = getODSResultIndexAndLength(index);
16849 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
16850 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
16851 }
16852
16853 ::mlir::TypedValue<::mlir::TensorType> getOutputReal() {
16854 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
16855 }
16856
16857 ::mlir::TypedValue<::mlir::TensorType> getOutputImag() {
16858 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 1).begin());
16859 }
16860
16861 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16862 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
16863 static llvm::hash_code computePropertiesHash(const Properties &prop);
16864 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
16865 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
16866 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
16867 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
16868 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
16869 void writeProperties(::mlir::DialectBytecodeWriter &writer);
16870 ::mlir::BoolAttr getLocalBoundAttr() {
16871 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val&: getProperties().local_bound);
16872 }
16873
16874 bool getLocalBound();
16875 void setLocalBoundAttr(::mlir::BoolAttr attr) {
16876 getProperties().local_bound = attr;
16877 }
16878
16879 void setLocalBound(::std::optional<bool> attrValue);
16880 ::mlir::Attribute removeLocalBoundAttr() {
16881 auto attr = getProperties().local_bound;
16882 getProperties().local_bound = {};
16883 return attr;
16884 }
16885
16886 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, /*optional*/::mlir::BoolAttr local_bound);
16887 static RFFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, /*optional*/::mlir::BoolAttr local_bound);
16888 static RFFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, /*optional*/::mlir::BoolAttr local_bound);
16889 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, /*optional*/::mlir::BoolAttr local_bound);
16890 static RFFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, /*optional*/::mlir::BoolAttr local_bound);
16891 static RFFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, /*optional*/::mlir::BoolAttr local_bound);
16892 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, /*optional*/bool local_bound = false);
16893 static RFFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, /*optional*/bool local_bound = false);
16894 static RFFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output_real, ::mlir::Type output_imag, ::mlir::Value input_real, /*optional*/bool local_bound = false);
16895 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, /*optional*/bool local_bound = false);
16896 static RFFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, /*optional*/bool local_bound = false);
16897 static RFFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input_real, /*optional*/bool local_bound = false);
16898 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
16899 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16900 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
16901 static RFFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16902 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
16903 static RFFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
16904 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16905 static RFFT2dOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16906 static RFFT2dOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
16907 ::llvm::LogicalResult verifyInvariantsImpl();
16908 ::llvm::LogicalResult verifyInvariants();
16909 ::llvm::LogicalResult verify();
16910 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
16911 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
16912 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
16913 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
16914private:
16915 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
16916 return getAttributeNameForIndex(name: (*this)->getName(), index);
16917 }
16918
16919 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
16920 assert(index < 1 && "invalid attribute index");
16921 assert(name.getStringRef() == getOperationName() && "invalid operation name");
16922 assert(name.isRegistered() && "Operation isn't registered, missing a "
16923 "dependent dialect loading?");
16924 return name.getAttributeNames()[index];
16925 }
16926
16927 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
16928public:
16929 static ::llvm::LogicalResult
16930 inferReturnTypeComponents(::mlir::MLIRContext *context,
16931 std::optional<::mlir::Location> location,
16932 Adaptor adaptor,
16933 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
16934
16935};
16936
16937} // namespace mlir::tosa
16938MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::RFFT2dOp)
16939MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::RFFT2dOpGenericAdaptorBase::Properties)
16940
16941namespace mlir::tosa {
16942
16943
16944//===----------------------------------------------------------------------===//
16945// mlir::tosa::ReciprocalOp declarations
16946//===----------------------------------------------------------------------===//
16947
16948namespace detail {
16949
16950class ReciprocalOpGenericAdaptorBase {
16951public:
16952 using Properties = ::mlir::EmptyProperties;
16953protected:
16954 ::mlir::DictionaryAttr odsAttrs;
16955 ::std::optional<::mlir::OperationName> odsOpName;
16956 Properties properties;
16957 ::mlir::RegionRange odsRegions;
16958public:
16959 ReciprocalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
16960 odsOpName.emplace(args: "tosa.reciprocal", args: odsAttrs.getContext());
16961 }
16962
16963 ReciprocalOpGenericAdaptorBase(ReciprocalOp op);
16964
16965 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
16966 return {index, 1};
16967 }
16968
16969 const Properties &getProperties() {
16970 return properties;
16971 }
16972
16973 ::mlir::DictionaryAttr getAttributes() {
16974 return odsAttrs;
16975 }
16976
16977};
16978
16979} // namespace detail
16980template <typename RangeT>
16981class ReciprocalOpGenericAdaptor : public detail::ReciprocalOpGenericAdaptorBase {
16982 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
16983 using Base = detail::ReciprocalOpGenericAdaptorBase;
16984 static constexpr int odsIndex_input1 = 0;
16985public:
16986 ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
16987
16988 ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReciprocalOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
16989
16990 ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReciprocalOpGenericAdaptor(values, attrs, Properties{}, {}) {}
16991
16992 ReciprocalOpGenericAdaptor(RangeT values, const ReciprocalOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
16993
16994 template <typename LateInst = ReciprocalOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReciprocalOp>>>
16995 ReciprocalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
16996
16997 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
16998 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
16999 }
17000
17001 RangeT getODSOperands(unsigned index) {
17002 auto valueRange = getODSOperandIndexAndLength(index);
17003 return {std::next(odsOperands.begin(), valueRange.first),
17004 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
17005 }
17006
17007 ValueT getInput1() {
17008 return (*getODSOperands(index: 0).begin());
17009 }
17010
17011 RangeT getOperands() {
17012 return odsOperands;
17013 }
17014
17015private:
17016 RangeT odsOperands;
17017};
17018class ReciprocalOpAdaptor : public ReciprocalOpGenericAdaptor<::mlir::ValueRange> {
17019public:
17020 using ReciprocalOpGenericAdaptor::ReciprocalOpGenericAdaptor;
17021 ReciprocalOpAdaptor(ReciprocalOp op);
17022
17023 ::llvm::LogicalResult verify(::mlir::Location loc);
17024};
17025class ReciprocalOp : public ::mlir::Op<ReciprocalOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
17026public:
17027 using Op::Op;
17028 using Op::print;
17029 using Adaptor = ReciprocalOpAdaptor;
17030 template <typename RangeT>
17031 using GenericAdaptor = ReciprocalOpGenericAdaptor<RangeT>;
17032 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
17033 static constexpr int odsIndex_input1 = 0;
17034 static constexpr int odsIndex_output = 0;
17035 using Properties = FoldAdaptor::Properties;
17036 using ::mlir::InferShapedTypeOpInterface::Trait<ReciprocalOp>::reifyReturnTypeShapes;
17037 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
17038 return {};
17039 }
17040
17041 static constexpr ::llvm::StringLiteral getOperationName() {
17042 return ::llvm::StringLiteral("tosa.reciprocal");
17043 }
17044
17045 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
17046 return {index, 1};
17047 }
17048
17049 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
17050 auto [start, length] = getODSOperandIndexAndLength(index);
17051 return getOperation()->getOperands().slice(n: start, m: length);
17052 }
17053
17054 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
17055 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
17056 }
17057
17058 ::mlir::OpOperand &getInput1Mutable() {
17059 auto range = getODSOperandIndexAndLength(index: 0);
17060 return getOperation()->getOpOperand(idx: range.first);
17061 }
17062
17063 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
17064 return {index, 1};
17065 }
17066
17067 ::mlir::Operation::result_range getODSResults(unsigned index) {
17068 auto valueRange = getODSResultIndexAndLength(index);
17069 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
17070 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
17071 }
17072
17073 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
17074 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
17075 }
17076
17077 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
17078 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
17079 static llvm::hash_code computePropertiesHash(const Properties &prop);
17080 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
17081 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
17082 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
17083 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
17084 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
17085 static ReciprocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
17086 static ReciprocalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
17087 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
17088 static ReciprocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
17089 static ReciprocalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
17090 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17091 static ReciprocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17092 static ReciprocalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17093 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17094 static ReciprocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17095 static ReciprocalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17096 ::llvm::LogicalResult verifyInvariantsImpl();
17097 ::llvm::LogicalResult verifyInvariants();
17098 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
17099 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
17100 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
17101 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
17102 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
17103public:
17104 /// Return the reciprocal result on the operand.
17105 static inline APFloat calcOneElement(const APFloat &operand) {
17106 APFloat recip = APFloat(operand.getSemantics(), 1);
17107 recip.divide(RHS: operand, RM: APFloat::rmNearestTiesToEven);
17108 return recip;
17109 }
17110};
17111
17112} // namespace mlir::tosa
17113MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReciprocalOp)
17114
17115namespace mlir::tosa {
17116
17117
17118//===----------------------------------------------------------------------===//
17119// mlir::tosa::ReduceAllOp declarations
17120//===----------------------------------------------------------------------===//
17121
17122namespace detail {
17123
17124class ReduceAllOpGenericAdaptorBase {
17125public:
17126 struct Properties {
17127 using axisTy = ::mlir::IntegerAttr;
17128 axisTy axis;
17129
17130 auto getAxis() const {
17131 auto &propStorage = this->axis;
17132 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
17133 }
17134 void setAxis(const ::mlir::IntegerAttr &propValue) {
17135 this->axis = propValue;
17136 }
17137 bool operator==(const Properties &rhs) const {
17138 return
17139 rhs.axis == this->axis &&
17140 true;
17141 }
17142 bool operator!=(const Properties &rhs) const {
17143 return !(*this == rhs);
17144 }
17145 };
17146protected:
17147 ::mlir::DictionaryAttr odsAttrs;
17148 ::std::optional<::mlir::OperationName> odsOpName;
17149 Properties properties;
17150 ::mlir::RegionRange odsRegions;
17151public:
17152 ReduceAllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
17153 odsOpName.emplace(args: "tosa.reduce_all", args: odsAttrs.getContext());
17154 }
17155
17156 ReduceAllOpGenericAdaptorBase(ReduceAllOp op);
17157
17158 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
17159 return {index, 1};
17160 }
17161
17162 const Properties &getProperties() {
17163 return properties;
17164 }
17165
17166 ::mlir::DictionaryAttr getAttributes() {
17167 return odsAttrs;
17168 }
17169
17170 ::mlir::IntegerAttr getAxisAttr() {
17171 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
17172 return attr;
17173 }
17174
17175 uint32_t getAxis();
17176};
17177
17178} // namespace detail
17179template <typename RangeT>
17180class ReduceAllOpGenericAdaptor : public detail::ReduceAllOpGenericAdaptorBase {
17181 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
17182 using Base = detail::ReduceAllOpGenericAdaptorBase;
17183 static constexpr int odsIndex_input = 0;
17184public:
17185 ReduceAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
17186
17187 ReduceAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReduceAllOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
17188
17189 ReduceAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReduceAllOpGenericAdaptor(values, attrs, Properties{}, {}) {}
17190
17191 ReduceAllOpGenericAdaptor(RangeT values, const ReduceAllOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
17192
17193 template <typename LateInst = ReduceAllOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReduceAllOp>>>
17194 ReduceAllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
17195
17196 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
17197 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
17198 }
17199
17200 RangeT getODSOperands(unsigned index) {
17201 auto valueRange = getODSOperandIndexAndLength(index);
17202 return {std::next(odsOperands.begin(), valueRange.first),
17203 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
17204 }
17205
17206 ValueT getInput() {
17207 return (*getODSOperands(index: 0).begin());
17208 }
17209
17210 RangeT getOperands() {
17211 return odsOperands;
17212 }
17213
17214private:
17215 RangeT odsOperands;
17216};
17217class ReduceAllOpAdaptor : public ReduceAllOpGenericAdaptor<::mlir::ValueRange> {
17218public:
17219 using ReduceAllOpGenericAdaptor::ReduceAllOpGenericAdaptor;
17220 ReduceAllOpAdaptor(ReduceAllOp op);
17221
17222 ::llvm::LogicalResult verify(::mlir::Location loc);
17223};
17224class ReduceAllOp : public ::mlir::Op<ReduceAllOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
17225public:
17226 using Op::Op;
17227 using Op::print;
17228 using Adaptor = ReduceAllOpAdaptor;
17229 template <typename RangeT>
17230 using GenericAdaptor = ReduceAllOpGenericAdaptor<RangeT>;
17231 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
17232 static constexpr int odsIndex_input = 0;
17233 static constexpr int odsIndex_output = 0;
17234 using Properties = FoldAdaptor::Properties;
17235 using ::mlir::InferTypeOpInterface::Trait<ReduceAllOp>::refineReturnTypes;
17236 using ::mlir::InferShapedTypeOpInterface::Trait<ReduceAllOp>::reifyReturnTypeShapes;
17237 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
17238 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis")};
17239 return ::llvm::ArrayRef(attrNames);
17240 }
17241
17242 ::mlir::StringAttr getAxisAttrName() {
17243 return getAttributeNameForIndex(index: 0);
17244 }
17245
17246 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
17247 return getAttributeNameForIndex(name, index: 0);
17248 }
17249
17250 static constexpr ::llvm::StringLiteral getOperationName() {
17251 return ::llvm::StringLiteral("tosa.reduce_all");
17252 }
17253
17254 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
17255 return {index, 1};
17256 }
17257
17258 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
17259 auto [start, length] = getODSOperandIndexAndLength(index);
17260 return getOperation()->getOperands().slice(n: start, m: length);
17261 }
17262
17263 ::mlir::TypedValue<::mlir::TensorType> getInput() {
17264 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
17265 }
17266
17267 ::mlir::OpOperand &getInputMutable() {
17268 auto range = getODSOperandIndexAndLength(index: 0);
17269 return getOperation()->getOpOperand(idx: range.first);
17270 }
17271
17272 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
17273 return {index, 1};
17274 }
17275
17276 ::mlir::Operation::result_range getODSResults(unsigned index) {
17277 auto valueRange = getODSResultIndexAndLength(index);
17278 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
17279 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
17280 }
17281
17282 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
17283 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
17284 }
17285
17286 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
17287 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
17288 static llvm::hash_code computePropertiesHash(const Properties &prop);
17289 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
17290 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
17291 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
17292 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
17293 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
17294 void writeProperties(::mlir::DialectBytecodeWriter &writer);
17295 ::mlir::IntegerAttr getAxisAttr() {
17296 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
17297 }
17298
17299 uint32_t getAxis();
17300 void setAxisAttr(::mlir::IntegerAttr attr) {
17301 getProperties().axis = attr;
17302 }
17303
17304 void setAxis(uint32_t attrValue);
17305 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
17306 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
17307 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
17308 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::IntegerAttr axis);
17309 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, ::mlir::IntegerAttr axis);
17310 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, ::mlir::IntegerAttr axis);
17311 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
17312 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
17313 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
17314 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
17315 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
17316 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
17317 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, uint32_t axis);
17318 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, uint32_t axis);
17319 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, uint32_t axis);
17320 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
17321 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
17322 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
17323 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17324 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17325 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17326 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17327 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17328 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17329 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17330 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17331 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17332 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17333 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17334 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17335 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17336 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17337 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17338 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17339 static ReduceAllOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17340 static ReduceAllOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17341 ::llvm::LogicalResult verifyInvariantsImpl();
17342 ::llvm::LogicalResult verifyInvariants();
17343 ::llvm::LogicalResult verify();
17344 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
17345 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
17346 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
17347 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
17348 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
17349 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
17350private:
17351 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
17352 return getAttributeNameForIndex(name: (*this)->getName(), index);
17353 }
17354
17355 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
17356 assert(index < 1 && "invalid attribute index");
17357 assert(name.getStringRef() == getOperationName() && "invalid operation name");
17358 assert(name.isRegistered() && "Operation isn't registered, missing a "
17359 "dependent dialect loading?");
17360 return name.getAttributeNames()[index];
17361 }
17362
17363 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
17364public:
17365 static ::llvm::LogicalResult
17366 inferReturnTypeComponents(::mlir::MLIRContext *context,
17367 std::optional<::mlir::Location> location,
17368 Adaptor adaptor,
17369 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
17370
17371
17372 /// Returns true when two result types are compatible for this op;
17373 /// Method used by InferTypeOpInterface.
17374 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
17375
17376 /// Return the AND result between two integer operands
17377 static inline APInt calcOneElement(APInt leftOperand, APInt rightOperand) {
17378 return leftOperand & rightOperand;
17379 }
17380};
17381
17382} // namespace mlir::tosa
17383MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReduceAllOp)
17384MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ReduceAllOpGenericAdaptorBase::Properties)
17385
17386namespace mlir::tosa {
17387
17388
17389//===----------------------------------------------------------------------===//
17390// mlir::tosa::ReduceAnyOp declarations
17391//===----------------------------------------------------------------------===//
17392
17393namespace detail {
17394
17395class ReduceAnyOpGenericAdaptorBase {
17396public:
17397 struct Properties {
17398 using axisTy = ::mlir::IntegerAttr;
17399 axisTy axis;
17400
17401 auto getAxis() const {
17402 auto &propStorage = this->axis;
17403 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
17404 }
17405 void setAxis(const ::mlir::IntegerAttr &propValue) {
17406 this->axis = propValue;
17407 }
17408 bool operator==(const Properties &rhs) const {
17409 return
17410 rhs.axis == this->axis &&
17411 true;
17412 }
17413 bool operator!=(const Properties &rhs) const {
17414 return !(*this == rhs);
17415 }
17416 };
17417protected:
17418 ::mlir::DictionaryAttr odsAttrs;
17419 ::std::optional<::mlir::OperationName> odsOpName;
17420 Properties properties;
17421 ::mlir::RegionRange odsRegions;
17422public:
17423 ReduceAnyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
17424 odsOpName.emplace(args: "tosa.reduce_any", args: odsAttrs.getContext());
17425 }
17426
17427 ReduceAnyOpGenericAdaptorBase(ReduceAnyOp op);
17428
17429 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
17430 return {index, 1};
17431 }
17432
17433 const Properties &getProperties() {
17434 return properties;
17435 }
17436
17437 ::mlir::DictionaryAttr getAttributes() {
17438 return odsAttrs;
17439 }
17440
17441 ::mlir::IntegerAttr getAxisAttr() {
17442 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
17443 return attr;
17444 }
17445
17446 uint32_t getAxis();
17447};
17448
17449} // namespace detail
17450template <typename RangeT>
17451class ReduceAnyOpGenericAdaptor : public detail::ReduceAnyOpGenericAdaptorBase {
17452 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
17453 using Base = detail::ReduceAnyOpGenericAdaptorBase;
17454 static constexpr int odsIndex_input = 0;
17455public:
17456 ReduceAnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
17457
17458 ReduceAnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReduceAnyOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
17459
17460 ReduceAnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReduceAnyOpGenericAdaptor(values, attrs, Properties{}, {}) {}
17461
17462 ReduceAnyOpGenericAdaptor(RangeT values, const ReduceAnyOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
17463
17464 template <typename LateInst = ReduceAnyOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReduceAnyOp>>>
17465 ReduceAnyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
17466
17467 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
17468 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
17469 }
17470
17471 RangeT getODSOperands(unsigned index) {
17472 auto valueRange = getODSOperandIndexAndLength(index);
17473 return {std::next(odsOperands.begin(), valueRange.first),
17474 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
17475 }
17476
17477 ValueT getInput() {
17478 return (*getODSOperands(index: 0).begin());
17479 }
17480
17481 RangeT getOperands() {
17482 return odsOperands;
17483 }
17484
17485private:
17486 RangeT odsOperands;
17487};
17488class ReduceAnyOpAdaptor : public ReduceAnyOpGenericAdaptor<::mlir::ValueRange> {
17489public:
17490 using ReduceAnyOpGenericAdaptor::ReduceAnyOpGenericAdaptor;
17491 ReduceAnyOpAdaptor(ReduceAnyOp op);
17492
17493 ::llvm::LogicalResult verify(::mlir::Location loc);
17494};
17495class ReduceAnyOp : public ::mlir::Op<ReduceAnyOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
17496public:
17497 using Op::Op;
17498 using Op::print;
17499 using Adaptor = ReduceAnyOpAdaptor;
17500 template <typename RangeT>
17501 using GenericAdaptor = ReduceAnyOpGenericAdaptor<RangeT>;
17502 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
17503 static constexpr int odsIndex_input = 0;
17504 static constexpr int odsIndex_output = 0;
17505 using Properties = FoldAdaptor::Properties;
17506 using ::mlir::InferTypeOpInterface::Trait<ReduceAnyOp>::refineReturnTypes;
17507 using ::mlir::InferShapedTypeOpInterface::Trait<ReduceAnyOp>::reifyReturnTypeShapes;
17508 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
17509 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis")};
17510 return ::llvm::ArrayRef(attrNames);
17511 }
17512
17513 ::mlir::StringAttr getAxisAttrName() {
17514 return getAttributeNameForIndex(index: 0);
17515 }
17516
17517 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
17518 return getAttributeNameForIndex(name, index: 0);
17519 }
17520
17521 static constexpr ::llvm::StringLiteral getOperationName() {
17522 return ::llvm::StringLiteral("tosa.reduce_any");
17523 }
17524
17525 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
17526 return {index, 1};
17527 }
17528
17529 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
17530 auto [start, length] = getODSOperandIndexAndLength(index);
17531 return getOperation()->getOperands().slice(n: start, m: length);
17532 }
17533
17534 ::mlir::TypedValue<::mlir::TensorType> getInput() {
17535 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
17536 }
17537
17538 ::mlir::OpOperand &getInputMutable() {
17539 auto range = getODSOperandIndexAndLength(index: 0);
17540 return getOperation()->getOpOperand(idx: range.first);
17541 }
17542
17543 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
17544 return {index, 1};
17545 }
17546
17547 ::mlir::Operation::result_range getODSResults(unsigned index) {
17548 auto valueRange = getODSResultIndexAndLength(index);
17549 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
17550 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
17551 }
17552
17553 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
17554 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
17555 }
17556
17557 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
17558 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
17559 static llvm::hash_code computePropertiesHash(const Properties &prop);
17560 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
17561 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
17562 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
17563 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
17564 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
17565 void writeProperties(::mlir::DialectBytecodeWriter &writer);
17566 ::mlir::IntegerAttr getAxisAttr() {
17567 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
17568 }
17569
17570 uint32_t getAxis();
17571 void setAxisAttr(::mlir::IntegerAttr attr) {
17572 getProperties().axis = attr;
17573 }
17574
17575 void setAxis(uint32_t attrValue);
17576 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
17577 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
17578 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
17579 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::IntegerAttr axis);
17580 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, ::mlir::IntegerAttr axis);
17581 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, ::mlir::IntegerAttr axis);
17582 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
17583 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
17584 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
17585 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
17586 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
17587 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
17588 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, uint32_t axis);
17589 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, uint32_t axis);
17590 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, uint32_t axis);
17591 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
17592 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
17593 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
17594 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17595 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17596 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17597 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17598 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17599 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17600 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17601 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17602 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17603 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17604 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17605 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17606 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17607 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17608 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17609 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17610 static ReduceAnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17611 static ReduceAnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17612 ::llvm::LogicalResult verifyInvariantsImpl();
17613 ::llvm::LogicalResult verifyInvariants();
17614 ::llvm::LogicalResult verify();
17615 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
17616 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
17617 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
17618 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
17619 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
17620 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
17621private:
17622 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
17623 return getAttributeNameForIndex(name: (*this)->getName(), index);
17624 }
17625
17626 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
17627 assert(index < 1 && "invalid attribute index");
17628 assert(name.getStringRef() == getOperationName() && "invalid operation name");
17629 assert(name.isRegistered() && "Operation isn't registered, missing a "
17630 "dependent dialect loading?");
17631 return name.getAttributeNames()[index];
17632 }
17633
17634 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
17635public:
17636 static ::llvm::LogicalResult
17637 inferReturnTypeComponents(::mlir::MLIRContext *context,
17638 std::optional<::mlir::Location> location,
17639 Adaptor adaptor,
17640 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
17641
17642
17643 /// Returns true when two result types are compatible for this op;
17644 /// Method used by InferTypeOpInterface.
17645 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
17646
17647 /// Return the OR result between two integer operands
17648 static inline APInt calcOneElement(APInt leftOperand, APInt rightOperand) {
17649 return leftOperand | rightOperand;
17650 }
17651};
17652
17653} // namespace mlir::tosa
17654MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReduceAnyOp)
17655MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ReduceAnyOpGenericAdaptorBase::Properties)
17656
17657namespace mlir::tosa {
17658
17659
17660//===----------------------------------------------------------------------===//
17661// mlir::tosa::ReduceMaxOp declarations
17662//===----------------------------------------------------------------------===//
17663
17664namespace detail {
17665
17666class ReduceMaxOpGenericAdaptorBase {
17667public:
17668 struct Properties {
17669 using axisTy = ::mlir::IntegerAttr;
17670 axisTy axis;
17671
17672 auto getAxis() const {
17673 auto &propStorage = this->axis;
17674 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
17675 }
17676 void setAxis(const ::mlir::IntegerAttr &propValue) {
17677 this->axis = propValue;
17678 }
17679 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
17680 nan_modeTy nan_mode;
17681
17682 auto getNanMode() const {
17683 auto &propStorage = this->nan_mode;
17684 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
17685 }
17686 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
17687 this->nan_mode = propValue;
17688 }
17689 bool operator==(const Properties &rhs) const {
17690 return
17691 rhs.axis == this->axis &&
17692 rhs.nan_mode == this->nan_mode &&
17693 true;
17694 }
17695 bool operator!=(const Properties &rhs) const {
17696 return !(*this == rhs);
17697 }
17698 };
17699protected:
17700 ::mlir::DictionaryAttr odsAttrs;
17701 ::std::optional<::mlir::OperationName> odsOpName;
17702 Properties properties;
17703 ::mlir::RegionRange odsRegions;
17704public:
17705 ReduceMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
17706 odsOpName.emplace(args: "tosa.reduce_max", args: odsAttrs.getContext());
17707 }
17708
17709 ReduceMaxOpGenericAdaptorBase(ReduceMaxOp op);
17710
17711 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
17712 return {index, 1};
17713 }
17714
17715 const Properties &getProperties() {
17716 return properties;
17717 }
17718
17719 ::mlir::DictionaryAttr getAttributes() {
17720 return odsAttrs;
17721 }
17722
17723 ::mlir::IntegerAttr getAxisAttr() {
17724 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
17725 return attr;
17726 }
17727
17728 uint32_t getAxis();
17729 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
17730 ::mlir::tosa::NanPropagationMode getNanMode();
17731};
17732
17733} // namespace detail
17734template <typename RangeT>
17735class ReduceMaxOpGenericAdaptor : public detail::ReduceMaxOpGenericAdaptorBase {
17736 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
17737 using Base = detail::ReduceMaxOpGenericAdaptorBase;
17738 static constexpr int odsIndex_input = 0;
17739public:
17740 ReduceMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
17741
17742 ReduceMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReduceMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
17743
17744 ReduceMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReduceMaxOpGenericAdaptor(values, attrs, Properties{}, {}) {}
17745
17746 ReduceMaxOpGenericAdaptor(RangeT values, const ReduceMaxOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
17747
17748 template <typename LateInst = ReduceMaxOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReduceMaxOp>>>
17749 ReduceMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
17750
17751 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
17752 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
17753 }
17754
17755 RangeT getODSOperands(unsigned index) {
17756 auto valueRange = getODSOperandIndexAndLength(index);
17757 return {std::next(odsOperands.begin(), valueRange.first),
17758 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
17759 }
17760
17761 ValueT getInput() {
17762 return (*getODSOperands(index: 0).begin());
17763 }
17764
17765 RangeT getOperands() {
17766 return odsOperands;
17767 }
17768
17769private:
17770 RangeT odsOperands;
17771};
17772class ReduceMaxOpAdaptor : public ReduceMaxOpGenericAdaptor<::mlir::ValueRange> {
17773public:
17774 using ReduceMaxOpGenericAdaptor::ReduceMaxOpGenericAdaptor;
17775 ReduceMaxOpAdaptor(ReduceMaxOp op);
17776
17777 ::llvm::LogicalResult verify(::mlir::Location loc);
17778};
17779class ReduceMaxOp : public ::mlir::Op<ReduceMaxOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
17780public:
17781 using Op::Op;
17782 using Op::print;
17783 using Adaptor = ReduceMaxOpAdaptor;
17784 template <typename RangeT>
17785 using GenericAdaptor = ReduceMaxOpGenericAdaptor<RangeT>;
17786 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
17787 static constexpr int odsIndex_input = 0;
17788 static constexpr int odsIndex_output = 0;
17789 using Properties = FoldAdaptor::Properties;
17790 using ::mlir::InferTypeOpInterface::Trait<ReduceMaxOp>::refineReturnTypes;
17791 using ::mlir::InferShapedTypeOpInterface::Trait<ReduceMaxOp>::reifyReturnTypeShapes;
17792 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
17793 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis"), ::llvm::StringRef("nan_mode")};
17794 return ::llvm::ArrayRef(attrNames);
17795 }
17796
17797 ::mlir::StringAttr getAxisAttrName() {
17798 return getAttributeNameForIndex(index: 0);
17799 }
17800
17801 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
17802 return getAttributeNameForIndex(name, index: 0);
17803 }
17804
17805 ::mlir::StringAttr getNanModeAttrName() {
17806 return getAttributeNameForIndex(index: 1);
17807 }
17808
17809 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
17810 return getAttributeNameForIndex(name, index: 1);
17811 }
17812
17813 static constexpr ::llvm::StringLiteral getOperationName() {
17814 return ::llvm::StringLiteral("tosa.reduce_max");
17815 }
17816
17817 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
17818 return {index, 1};
17819 }
17820
17821 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
17822 auto [start, length] = getODSOperandIndexAndLength(index);
17823 return getOperation()->getOperands().slice(n: start, m: length);
17824 }
17825
17826 ::mlir::TypedValue<::mlir::TensorType> getInput() {
17827 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
17828 }
17829
17830 ::mlir::OpOperand &getInputMutable() {
17831 auto range = getODSOperandIndexAndLength(index: 0);
17832 return getOperation()->getOpOperand(idx: range.first);
17833 }
17834
17835 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
17836 return {index, 1};
17837 }
17838
17839 ::mlir::Operation::result_range getODSResults(unsigned index) {
17840 auto valueRange = getODSResultIndexAndLength(index);
17841 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
17842 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
17843 }
17844
17845 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
17846 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
17847 }
17848
17849 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
17850 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
17851 static llvm::hash_code computePropertiesHash(const Properties &prop);
17852 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
17853 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
17854 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
17855 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
17856 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
17857 void writeProperties(::mlir::DialectBytecodeWriter &writer);
17858 ::mlir::IntegerAttr getAxisAttr() {
17859 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
17860 }
17861
17862 uint32_t getAxis();
17863 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
17864 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
17865 }
17866
17867 ::mlir::tosa::NanPropagationMode getNanMode();
17868 void setAxisAttr(::mlir::IntegerAttr attr) {
17869 getProperties().axis = attr;
17870 }
17871
17872 void setAxis(uint32_t attrValue);
17873 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
17874 getProperties().nan_mode = attr;
17875 }
17876
17877 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
17878 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17879 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17880 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17881 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17882 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17883 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17884 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17885 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17886 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
17887 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17888 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17889 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17890 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17891 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17892 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17893 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17894 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17895 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
17896 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17897 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17898 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17899 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17900 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17901 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17902 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17903 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17904 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17905 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17906 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
17907 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
17908 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17909 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17910 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17911 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17912 static ReduceMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17913 static ReduceMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
17914 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
17915 ::llvm::LogicalResult verifyInvariantsImpl();
17916 ::llvm::LogicalResult verifyInvariants();
17917 ::llvm::LogicalResult verify();
17918 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
17919 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
17920 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
17921 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
17922 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
17923 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
17924private:
17925 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
17926 return getAttributeNameForIndex(name: (*this)->getName(), index);
17927 }
17928
17929 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
17930 assert(index < 2 && "invalid attribute index");
17931 assert(name.getStringRef() == getOperationName() && "invalid operation name");
17932 assert(name.isRegistered() && "Operation isn't registered, missing a "
17933 "dependent dialect loading?");
17934 return name.getAttributeNames()[index];
17935 }
17936
17937 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
17938public:
17939 static ::llvm::LogicalResult
17940 inferReturnTypeComponents(::mlir::MLIRContext *context,
17941 std::optional<::mlir::Location> location,
17942 Adaptor adaptor,
17943 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
17944
17945
17946 /// Returns true when two result types are compatible for this op;
17947 /// Method used by InferTypeOpInterface.
17948 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
17949
17950 /// Return the max of the two integer operands
17951 static inline APInt calcOneElement(APInt leftOperand, APInt rightOperand) {
17952 return (leftOperand.sge(RHS: rightOperand)) ? leftOperand : rightOperand;
17953 }
17954};
17955
17956} // namespace mlir::tosa
17957MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReduceMaxOp)
17958MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ReduceMaxOpGenericAdaptorBase::Properties)
17959
17960namespace mlir::tosa {
17961
17962
17963//===----------------------------------------------------------------------===//
17964// mlir::tosa::ReduceMinOp declarations
17965//===----------------------------------------------------------------------===//
17966
17967namespace detail {
17968
17969class ReduceMinOpGenericAdaptorBase {
17970public:
17971 struct Properties {
17972 using axisTy = ::mlir::IntegerAttr;
17973 axisTy axis;
17974
17975 auto getAxis() const {
17976 auto &propStorage = this->axis;
17977 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
17978 }
17979 void setAxis(const ::mlir::IntegerAttr &propValue) {
17980 this->axis = propValue;
17981 }
17982 using nan_modeTy = mlir::tosa::NanPropagationModeAttr;
17983 nan_modeTy nan_mode;
17984
17985 auto getNanMode() const {
17986 auto &propStorage = this->nan_mode;
17987 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val: propStorage);
17988 }
17989 void setNanMode(const mlir::tosa::NanPropagationModeAttr &propValue) {
17990 this->nan_mode = propValue;
17991 }
17992 bool operator==(const Properties &rhs) const {
17993 return
17994 rhs.axis == this->axis &&
17995 rhs.nan_mode == this->nan_mode &&
17996 true;
17997 }
17998 bool operator!=(const Properties &rhs) const {
17999 return !(*this == rhs);
18000 }
18001 };
18002protected:
18003 ::mlir::DictionaryAttr odsAttrs;
18004 ::std::optional<::mlir::OperationName> odsOpName;
18005 Properties properties;
18006 ::mlir::RegionRange odsRegions;
18007public:
18008 ReduceMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
18009 odsOpName.emplace(args: "tosa.reduce_min", args: odsAttrs.getContext());
18010 }
18011
18012 ReduceMinOpGenericAdaptorBase(ReduceMinOp op);
18013
18014 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
18015 return {index, 1};
18016 }
18017
18018 const Properties &getProperties() {
18019 return properties;
18020 }
18021
18022 ::mlir::DictionaryAttr getAttributes() {
18023 return odsAttrs;
18024 }
18025
18026 ::mlir::IntegerAttr getAxisAttr() {
18027 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
18028 return attr;
18029 }
18030
18031 uint32_t getAxis();
18032 mlir::tosa::NanPropagationModeAttr getNanModeAttr();
18033 ::mlir::tosa::NanPropagationMode getNanMode();
18034};
18035
18036} // namespace detail
18037template <typename RangeT>
18038class ReduceMinOpGenericAdaptor : public detail::ReduceMinOpGenericAdaptorBase {
18039 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
18040 using Base = detail::ReduceMinOpGenericAdaptorBase;
18041 static constexpr int odsIndex_input = 0;
18042public:
18043 ReduceMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
18044
18045 ReduceMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReduceMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
18046
18047 ReduceMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReduceMinOpGenericAdaptor(values, attrs, Properties{}, {}) {}
18048
18049 ReduceMinOpGenericAdaptor(RangeT values, const ReduceMinOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
18050
18051 template <typename LateInst = ReduceMinOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReduceMinOp>>>
18052 ReduceMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
18053
18054 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
18055 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
18056 }
18057
18058 RangeT getODSOperands(unsigned index) {
18059 auto valueRange = getODSOperandIndexAndLength(index);
18060 return {std::next(odsOperands.begin(), valueRange.first),
18061 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
18062 }
18063
18064 ValueT getInput() {
18065 return (*getODSOperands(index: 0).begin());
18066 }
18067
18068 RangeT getOperands() {
18069 return odsOperands;
18070 }
18071
18072private:
18073 RangeT odsOperands;
18074};
18075class ReduceMinOpAdaptor : public ReduceMinOpGenericAdaptor<::mlir::ValueRange> {
18076public:
18077 using ReduceMinOpGenericAdaptor::ReduceMinOpGenericAdaptor;
18078 ReduceMinOpAdaptor(ReduceMinOp op);
18079
18080 ::llvm::LogicalResult verify(::mlir::Location loc);
18081};
18082class ReduceMinOp : public ::mlir::Op<ReduceMinOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
18083public:
18084 using Op::Op;
18085 using Op::print;
18086 using Adaptor = ReduceMinOpAdaptor;
18087 template <typename RangeT>
18088 using GenericAdaptor = ReduceMinOpGenericAdaptor<RangeT>;
18089 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
18090 static constexpr int odsIndex_input = 0;
18091 static constexpr int odsIndex_output = 0;
18092 using Properties = FoldAdaptor::Properties;
18093 using ::mlir::InferTypeOpInterface::Trait<ReduceMinOp>::refineReturnTypes;
18094 using ::mlir::InferShapedTypeOpInterface::Trait<ReduceMinOp>::reifyReturnTypeShapes;
18095 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
18096 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis"), ::llvm::StringRef("nan_mode")};
18097 return ::llvm::ArrayRef(attrNames);
18098 }
18099
18100 ::mlir::StringAttr getAxisAttrName() {
18101 return getAttributeNameForIndex(index: 0);
18102 }
18103
18104 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
18105 return getAttributeNameForIndex(name, index: 0);
18106 }
18107
18108 ::mlir::StringAttr getNanModeAttrName() {
18109 return getAttributeNameForIndex(index: 1);
18110 }
18111
18112 static ::mlir::StringAttr getNanModeAttrName(::mlir::OperationName name) {
18113 return getAttributeNameForIndex(name, index: 1);
18114 }
18115
18116 static constexpr ::llvm::StringLiteral getOperationName() {
18117 return ::llvm::StringLiteral("tosa.reduce_min");
18118 }
18119
18120 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
18121 return {index, 1};
18122 }
18123
18124 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
18125 auto [start, length] = getODSOperandIndexAndLength(index);
18126 return getOperation()->getOperands().slice(n: start, m: length);
18127 }
18128
18129 ::mlir::TypedValue<::mlir::TensorType> getInput() {
18130 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
18131 }
18132
18133 ::mlir::OpOperand &getInputMutable() {
18134 auto range = getODSOperandIndexAndLength(index: 0);
18135 return getOperation()->getOpOperand(idx: range.first);
18136 }
18137
18138 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
18139 return {index, 1};
18140 }
18141
18142 ::mlir::Operation::result_range getODSResults(unsigned index) {
18143 auto valueRange = getODSResultIndexAndLength(index);
18144 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
18145 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
18146 }
18147
18148 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
18149 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
18150 }
18151
18152 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
18153 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
18154 static llvm::hash_code computePropertiesHash(const Properties &prop);
18155 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
18156 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
18157 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
18158 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
18159 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
18160 void writeProperties(::mlir::DialectBytecodeWriter &writer);
18161 ::mlir::IntegerAttr getAxisAttr() {
18162 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
18163 }
18164
18165 uint32_t getAxis();
18166 mlir::tosa::NanPropagationModeAttr getNanModeAttr() {
18167 return ::llvm::dyn_cast_or_null<mlir::tosa::NanPropagationModeAttr>(Val&: getProperties().nan_mode);
18168 }
18169
18170 ::mlir::tosa::NanPropagationMode getNanMode();
18171 void setAxisAttr(::mlir::IntegerAttr attr) {
18172 getProperties().axis = attr;
18173 }
18174
18175 void setAxis(uint32_t attrValue);
18176 void setNanModeAttr(mlir::tosa::NanPropagationModeAttr attr) {
18177 getProperties().nan_mode = attr;
18178 }
18179
18180 void setNanMode(::mlir::tosa::NanPropagationMode attrValue);
18181 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18182 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18183 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18184 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18185 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18186 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18187 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18188 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18189 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis, mlir::tosa::NanPropagationModeAttr nan_mode = nullptr);
18190 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18191 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18192 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18193 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18194 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18195 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18196 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18197 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18198 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis, ::mlir::tosa::NanPropagationMode nan_mode = ::mlir::tosa::NanPropagationMode::PROPAGATE);
18199 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18200 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18201 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18202 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18203 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18204 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18205 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18206 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18207 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18208 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18209 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18210 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18211 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18212 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18213 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18214 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18215 static ReduceMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18216 static ReduceMinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18217 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
18218 ::llvm::LogicalResult verifyInvariantsImpl();
18219 ::llvm::LogicalResult verifyInvariants();
18220 ::llvm::LogicalResult verify();
18221 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
18222 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
18223 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
18224 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
18225 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
18226 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
18227private:
18228 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
18229 return getAttributeNameForIndex(name: (*this)->getName(), index);
18230 }
18231
18232 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
18233 assert(index < 2 && "invalid attribute index");
18234 assert(name.getStringRef() == getOperationName() && "invalid operation name");
18235 assert(name.isRegistered() && "Operation isn't registered, missing a "
18236 "dependent dialect loading?");
18237 return name.getAttributeNames()[index];
18238 }
18239
18240 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
18241public:
18242 static ::llvm::LogicalResult
18243 inferReturnTypeComponents(::mlir::MLIRContext *context,
18244 std::optional<::mlir::Location> location,
18245 Adaptor adaptor,
18246 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
18247
18248
18249 /// Returns true when two result types are compatible for this op;
18250 /// Method used by InferTypeOpInterface.
18251 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
18252
18253 /// Return the min of the two integer operands
18254 static inline APInt calcOneElement(APInt leftOperand, APInt rightOperand) {
18255 return (leftOperand.sle(RHS: rightOperand)) ? leftOperand : rightOperand;
18256 }
18257};
18258
18259} // namespace mlir::tosa
18260MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReduceMinOp)
18261MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ReduceMinOpGenericAdaptorBase::Properties)
18262
18263namespace mlir::tosa {
18264
18265
18266//===----------------------------------------------------------------------===//
18267// mlir::tosa::ReduceProductOp declarations
18268//===----------------------------------------------------------------------===//
18269
18270namespace detail {
18271
18272class ReduceProductOpGenericAdaptorBase {
18273public:
18274 struct Properties {
18275 using axisTy = ::mlir::IntegerAttr;
18276 axisTy axis;
18277
18278 auto getAxis() const {
18279 auto &propStorage = this->axis;
18280 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
18281 }
18282 void setAxis(const ::mlir::IntegerAttr &propValue) {
18283 this->axis = propValue;
18284 }
18285 bool operator==(const Properties &rhs) const {
18286 return
18287 rhs.axis == this->axis &&
18288 true;
18289 }
18290 bool operator!=(const Properties &rhs) const {
18291 return !(*this == rhs);
18292 }
18293 };
18294protected:
18295 ::mlir::DictionaryAttr odsAttrs;
18296 ::std::optional<::mlir::OperationName> odsOpName;
18297 Properties properties;
18298 ::mlir::RegionRange odsRegions;
18299public:
18300 ReduceProductOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
18301 odsOpName.emplace(args: "tosa.reduce_product", args: odsAttrs.getContext());
18302 }
18303
18304 ReduceProductOpGenericAdaptorBase(ReduceProductOp op);
18305
18306 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
18307 return {index, 1};
18308 }
18309
18310 const Properties &getProperties() {
18311 return properties;
18312 }
18313
18314 ::mlir::DictionaryAttr getAttributes() {
18315 return odsAttrs;
18316 }
18317
18318 ::mlir::IntegerAttr getAxisAttr() {
18319 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
18320 return attr;
18321 }
18322
18323 uint32_t getAxis();
18324};
18325
18326} // namespace detail
18327template <typename RangeT>
18328class ReduceProductOpGenericAdaptor : public detail::ReduceProductOpGenericAdaptorBase {
18329 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
18330 using Base = detail::ReduceProductOpGenericAdaptorBase;
18331 static constexpr int odsIndex_input = 0;
18332public:
18333 ReduceProductOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
18334
18335 ReduceProductOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReduceProductOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
18336
18337 ReduceProductOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReduceProductOpGenericAdaptor(values, attrs, Properties{}, {}) {}
18338
18339 ReduceProductOpGenericAdaptor(RangeT values, const ReduceProductOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
18340
18341 template <typename LateInst = ReduceProductOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReduceProductOp>>>
18342 ReduceProductOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
18343
18344 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
18345 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
18346 }
18347
18348 RangeT getODSOperands(unsigned index) {
18349 auto valueRange = getODSOperandIndexAndLength(index);
18350 return {std::next(odsOperands.begin(), valueRange.first),
18351 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
18352 }
18353
18354 ValueT getInput() {
18355 return (*getODSOperands(index: 0).begin());
18356 }
18357
18358 RangeT getOperands() {
18359 return odsOperands;
18360 }
18361
18362private:
18363 RangeT odsOperands;
18364};
18365class ReduceProductOpAdaptor : public ReduceProductOpGenericAdaptor<::mlir::ValueRange> {
18366public:
18367 using ReduceProductOpGenericAdaptor::ReduceProductOpGenericAdaptor;
18368 ReduceProductOpAdaptor(ReduceProductOp op);
18369
18370 ::llvm::LogicalResult verify(::mlir::Location loc);
18371};
18372class ReduceProductOp : public ::mlir::Op<ReduceProductOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
18373public:
18374 using Op::Op;
18375 using Op::print;
18376 using Adaptor = ReduceProductOpAdaptor;
18377 template <typename RangeT>
18378 using GenericAdaptor = ReduceProductOpGenericAdaptor<RangeT>;
18379 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
18380 static constexpr int odsIndex_input = 0;
18381 static constexpr int odsIndex_output = 0;
18382 using Properties = FoldAdaptor::Properties;
18383 using ::mlir::InferTypeOpInterface::Trait<ReduceProductOp>::refineReturnTypes;
18384 using ::mlir::InferShapedTypeOpInterface::Trait<ReduceProductOp>::reifyReturnTypeShapes;
18385 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
18386 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis")};
18387 return ::llvm::ArrayRef(attrNames);
18388 }
18389
18390 ::mlir::StringAttr getAxisAttrName() {
18391 return getAttributeNameForIndex(index: 0);
18392 }
18393
18394 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
18395 return getAttributeNameForIndex(name, index: 0);
18396 }
18397
18398 static constexpr ::llvm::StringLiteral getOperationName() {
18399 return ::llvm::StringLiteral("tosa.reduce_product");
18400 }
18401
18402 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
18403 return {index, 1};
18404 }
18405
18406 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
18407 auto [start, length] = getODSOperandIndexAndLength(index);
18408 return getOperation()->getOperands().slice(n: start, m: length);
18409 }
18410
18411 ::mlir::TypedValue<::mlir::TensorType> getInput() {
18412 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
18413 }
18414
18415 ::mlir::OpOperand &getInputMutable() {
18416 auto range = getODSOperandIndexAndLength(index: 0);
18417 return getOperation()->getOpOperand(idx: range.first);
18418 }
18419
18420 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
18421 return {index, 1};
18422 }
18423
18424 ::mlir::Operation::result_range getODSResults(unsigned index) {
18425 auto valueRange = getODSResultIndexAndLength(index);
18426 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
18427 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
18428 }
18429
18430 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
18431 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
18432 }
18433
18434 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
18435 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
18436 static llvm::hash_code computePropertiesHash(const Properties &prop);
18437 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
18438 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
18439 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
18440 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
18441 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
18442 void writeProperties(::mlir::DialectBytecodeWriter &writer);
18443 ::mlir::IntegerAttr getAxisAttr() {
18444 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
18445 }
18446
18447 uint32_t getAxis();
18448 void setAxisAttr(::mlir::IntegerAttr attr) {
18449 getProperties().axis = attr;
18450 }
18451
18452 void setAxis(uint32_t attrValue);
18453 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
18454 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
18455 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
18456 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::IntegerAttr axis);
18457 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, ::mlir::IntegerAttr axis);
18458 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, ::mlir::IntegerAttr axis);
18459 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
18460 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
18461 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
18462 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
18463 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
18464 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
18465 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, uint32_t axis);
18466 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, uint32_t axis);
18467 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, uint32_t axis);
18468 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
18469 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
18470 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
18471 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18472 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18473 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18474 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18475 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18476 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18477 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18478 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18479 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18480 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18481 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18482 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18483 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18484 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18485 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18486 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18487 static ReduceProductOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18488 static ReduceProductOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18489 ::llvm::LogicalResult verifyInvariantsImpl();
18490 ::llvm::LogicalResult verifyInvariants();
18491 ::llvm::LogicalResult verify();
18492 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
18493 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
18494 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
18495 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
18496 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
18497 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
18498private:
18499 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
18500 return getAttributeNameForIndex(name: (*this)->getName(), index);
18501 }
18502
18503 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
18504 assert(index < 1 && "invalid attribute index");
18505 assert(name.getStringRef() == getOperationName() && "invalid operation name");
18506 assert(name.isRegistered() && "Operation isn't registered, missing a "
18507 "dependent dialect loading?");
18508 return name.getAttributeNames()[index];
18509 }
18510
18511 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
18512public:
18513 static ::llvm::LogicalResult
18514 inferReturnTypeComponents(::mlir::MLIRContext *context,
18515 std::optional<::mlir::Location> location,
18516 Adaptor adaptor,
18517 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
18518
18519
18520 /// Returns true when two result types are compatible for this op;
18521 /// Method used by InferTypeOpInterface.
18522 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
18523
18524 /// Return the prod of the two integer operands
18525 static inline APInt calcOneElement(APInt leftOperand, APInt rightOperand) {
18526 return leftOperand * rightOperand;
18527 }
18528};
18529
18530} // namespace mlir::tosa
18531MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReduceProductOp)
18532MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ReduceProductOpGenericAdaptorBase::Properties)
18533
18534namespace mlir::tosa {
18535
18536
18537//===----------------------------------------------------------------------===//
18538// mlir::tosa::ReduceSumOp declarations
18539//===----------------------------------------------------------------------===//
18540
18541namespace detail {
18542
18543class ReduceSumOpGenericAdaptorBase {
18544public:
18545 struct Properties {
18546 using axisTy = ::mlir::IntegerAttr;
18547 axisTy axis;
18548
18549 auto getAxis() const {
18550 auto &propStorage = this->axis;
18551 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
18552 }
18553 void setAxis(const ::mlir::IntegerAttr &propValue) {
18554 this->axis = propValue;
18555 }
18556 bool operator==(const Properties &rhs) const {
18557 return
18558 rhs.axis == this->axis &&
18559 true;
18560 }
18561 bool operator!=(const Properties &rhs) const {
18562 return !(*this == rhs);
18563 }
18564 };
18565protected:
18566 ::mlir::DictionaryAttr odsAttrs;
18567 ::std::optional<::mlir::OperationName> odsOpName;
18568 Properties properties;
18569 ::mlir::RegionRange odsRegions;
18570public:
18571 ReduceSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
18572 odsOpName.emplace(args: "tosa.reduce_sum", args: odsAttrs.getContext());
18573 }
18574
18575 ReduceSumOpGenericAdaptorBase(ReduceSumOp op);
18576
18577 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
18578 return {index, 1};
18579 }
18580
18581 const Properties &getProperties() {
18582 return properties;
18583 }
18584
18585 ::mlir::DictionaryAttr getAttributes() {
18586 return odsAttrs;
18587 }
18588
18589 ::mlir::IntegerAttr getAxisAttr() {
18590 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
18591 return attr;
18592 }
18593
18594 uint32_t getAxis();
18595};
18596
18597} // namespace detail
18598template <typename RangeT>
18599class ReduceSumOpGenericAdaptor : public detail::ReduceSumOpGenericAdaptorBase {
18600 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
18601 using Base = detail::ReduceSumOpGenericAdaptorBase;
18602 static constexpr int odsIndex_input = 0;
18603public:
18604 ReduceSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
18605
18606 ReduceSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReduceSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
18607
18608 ReduceSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReduceSumOpGenericAdaptor(values, attrs, Properties{}, {}) {}
18609
18610 ReduceSumOpGenericAdaptor(RangeT values, const ReduceSumOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
18611
18612 template <typename LateInst = ReduceSumOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReduceSumOp>>>
18613 ReduceSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
18614
18615 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
18616 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
18617 }
18618
18619 RangeT getODSOperands(unsigned index) {
18620 auto valueRange = getODSOperandIndexAndLength(index);
18621 return {std::next(odsOperands.begin(), valueRange.first),
18622 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
18623 }
18624
18625 ValueT getInput() {
18626 return (*getODSOperands(index: 0).begin());
18627 }
18628
18629 RangeT getOperands() {
18630 return odsOperands;
18631 }
18632
18633private:
18634 RangeT odsOperands;
18635};
18636class ReduceSumOpAdaptor : public ReduceSumOpGenericAdaptor<::mlir::ValueRange> {
18637public:
18638 using ReduceSumOpGenericAdaptor::ReduceSumOpGenericAdaptor;
18639 ReduceSumOpAdaptor(ReduceSumOp op);
18640
18641 ::llvm::LogicalResult verify(::mlir::Location loc);
18642};
18643class ReduceSumOp : public ::mlir::Op<ReduceSumOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
18644public:
18645 using Op::Op;
18646 using Op::print;
18647 using Adaptor = ReduceSumOpAdaptor;
18648 template <typename RangeT>
18649 using GenericAdaptor = ReduceSumOpGenericAdaptor<RangeT>;
18650 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
18651 static constexpr int odsIndex_input = 0;
18652 static constexpr int odsIndex_output = 0;
18653 using Properties = FoldAdaptor::Properties;
18654 using ::mlir::InferTypeOpInterface::Trait<ReduceSumOp>::refineReturnTypes;
18655 using ::mlir::InferShapedTypeOpInterface::Trait<ReduceSumOp>::reifyReturnTypeShapes;
18656 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
18657 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis")};
18658 return ::llvm::ArrayRef(attrNames);
18659 }
18660
18661 ::mlir::StringAttr getAxisAttrName() {
18662 return getAttributeNameForIndex(index: 0);
18663 }
18664
18665 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
18666 return getAttributeNameForIndex(name, index: 0);
18667 }
18668
18669 static constexpr ::llvm::StringLiteral getOperationName() {
18670 return ::llvm::StringLiteral("tosa.reduce_sum");
18671 }
18672
18673 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
18674 return {index, 1};
18675 }
18676
18677 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
18678 auto [start, length] = getODSOperandIndexAndLength(index);
18679 return getOperation()->getOperands().slice(n: start, m: length);
18680 }
18681
18682 ::mlir::TypedValue<::mlir::TensorType> getInput() {
18683 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
18684 }
18685
18686 ::mlir::OpOperand &getInputMutable() {
18687 auto range = getODSOperandIndexAndLength(index: 0);
18688 return getOperation()->getOpOperand(idx: range.first);
18689 }
18690
18691 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
18692 return {index, 1};
18693 }
18694
18695 ::mlir::Operation::result_range getODSResults(unsigned index) {
18696 auto valueRange = getODSResultIndexAndLength(index);
18697 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
18698 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
18699 }
18700
18701 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
18702 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
18703 }
18704
18705 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
18706 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
18707 static llvm::hash_code computePropertiesHash(const Properties &prop);
18708 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
18709 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
18710 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
18711 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
18712 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
18713 void writeProperties(::mlir::DialectBytecodeWriter &writer);
18714 ::mlir::IntegerAttr getAxisAttr() {
18715 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
18716 }
18717
18718 uint32_t getAxis();
18719 void setAxisAttr(::mlir::IntegerAttr attr) {
18720 getProperties().axis = attr;
18721 }
18722
18723 void setAxis(uint32_t attrValue);
18724 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
18725 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
18726 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr axis);
18727 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::IntegerAttr axis);
18728 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, ::mlir::IntegerAttr axis);
18729 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, ::mlir::IntegerAttr axis);
18730 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
18731 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
18732 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr axis);
18733 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
18734 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
18735 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, uint32_t axis);
18736 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, uint32_t axis);
18737 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input, uint32_t axis);
18738 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input, uint32_t axis);
18739 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
18740 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
18741 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint32_t axis);
18742 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18743 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18744 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18745 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18746 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18747 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18748 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18749 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18750 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18751 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18752 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
18753 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
18754 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18755 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18756 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18757 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18758 static ReduceSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18759 static ReduceSumOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
18760 ::llvm::LogicalResult verifyInvariantsImpl();
18761 ::llvm::LogicalResult verifyInvariants();
18762 ::llvm::LogicalResult verify();
18763 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
18764 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
18765 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
18766 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
18767 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
18768 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
18769private:
18770 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
18771 return getAttributeNameForIndex(name: (*this)->getName(), index);
18772 }
18773
18774 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
18775 assert(index < 1 && "invalid attribute index");
18776 assert(name.getStringRef() == getOperationName() && "invalid operation name");
18777 assert(name.isRegistered() && "Operation isn't registered, missing a "
18778 "dependent dialect loading?");
18779 return name.getAttributeNames()[index];
18780 }
18781
18782 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
18783public:
18784 static ::llvm::LogicalResult
18785 inferReturnTypeComponents(::mlir::MLIRContext *context,
18786 std::optional<::mlir::Location> location,
18787 Adaptor adaptor,
18788 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
18789
18790
18791 /// Returns true when two result types are compatible for this op;
18792 /// Method used by InferTypeOpInterface.
18793 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
18794
18795 /// Return the sum of the two integer operands
18796 static inline APInt calcOneElement(APInt leftOperand, APInt rightOperand) {
18797 return leftOperand + rightOperand;
18798 }
18799};
18800
18801} // namespace mlir::tosa
18802MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReduceSumOp)
18803MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ReduceSumOpGenericAdaptorBase::Properties)
18804
18805namespace mlir::tosa {
18806
18807
18808//===----------------------------------------------------------------------===//
18809// mlir::tosa::RescaleOp declarations
18810//===----------------------------------------------------------------------===//
18811
18812namespace detail {
18813
18814class RescaleOpGenericAdaptorBase {
18815public:
18816 struct Properties {
18817 using input_unsignedTy = ::mlir::BoolAttr;
18818 input_unsignedTy input_unsigned;
18819
18820 auto getInputUnsigned() const {
18821 auto &propStorage = this->input_unsigned;
18822 return ::llvm::cast<::mlir::BoolAttr>(Val: propStorage);
18823 }
18824 void setInputUnsigned(const ::mlir::BoolAttr &propValue) {
18825 this->input_unsigned = propValue;
18826 }
18827 using output_unsignedTy = ::mlir::BoolAttr;
18828 output_unsignedTy output_unsigned;
18829
18830 auto getOutputUnsigned() const {
18831 auto &propStorage = this->output_unsigned;
18832 return ::llvm::cast<::mlir::BoolAttr>(Val: propStorage);
18833 }
18834 void setOutputUnsigned(const ::mlir::BoolAttr &propValue) {
18835 this->output_unsigned = propValue;
18836 }
18837 using per_channelTy = ::mlir::BoolAttr;
18838 per_channelTy per_channel;
18839
18840 auto getPerChannel() const {
18841 auto &propStorage = this->per_channel;
18842 return ::llvm::cast<::mlir::BoolAttr>(Val: propStorage);
18843 }
18844 void setPerChannel(const ::mlir::BoolAttr &propValue) {
18845 this->per_channel = propValue;
18846 }
18847 using rounding_modeTy = mlir::tosa::RoundingModeAttr;
18848 rounding_modeTy rounding_mode;
18849
18850 auto getRoundingMode() const {
18851 auto &propStorage = this->rounding_mode;
18852 return ::llvm::cast<mlir::tosa::RoundingModeAttr>(Val: propStorage);
18853 }
18854 void setRoundingMode(const mlir::tosa::RoundingModeAttr &propValue) {
18855 this->rounding_mode = propValue;
18856 }
18857 using scale32Ty = ::mlir::BoolAttr;
18858 scale32Ty scale32;
18859
18860 auto getScale32() const {
18861 auto &propStorage = this->scale32;
18862 return ::llvm::cast<::mlir::BoolAttr>(Val: propStorage);
18863 }
18864 void setScale32(const ::mlir::BoolAttr &propValue) {
18865 this->scale32 = propValue;
18866 }
18867 bool operator==(const Properties &rhs) const {
18868 return
18869 rhs.input_unsigned == this->input_unsigned &&
18870 rhs.output_unsigned == this->output_unsigned &&
18871 rhs.per_channel == this->per_channel &&
18872 rhs.rounding_mode == this->rounding_mode &&
18873 rhs.scale32 == this->scale32 &&
18874 true;
18875 }
18876 bool operator!=(const Properties &rhs) const {
18877 return !(*this == rhs);
18878 }
18879 };
18880protected:
18881 ::mlir::DictionaryAttr odsAttrs;
18882 ::std::optional<::mlir::OperationName> odsOpName;
18883 Properties properties;
18884 ::mlir::RegionRange odsRegions;
18885public:
18886 RescaleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
18887 odsOpName.emplace(args: "tosa.rescale", args: odsAttrs.getContext());
18888 }
18889
18890 RescaleOpGenericAdaptorBase(RescaleOp op);
18891
18892 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
18893 return {index, 1};
18894 }
18895
18896 const Properties &getProperties() {
18897 return properties;
18898 }
18899
18900 ::mlir::DictionaryAttr getAttributes() {
18901 return odsAttrs;
18902 }
18903
18904 ::mlir::BoolAttr getScale32Attr() {
18905 auto attr = ::llvm::cast<::mlir::BoolAttr>(Val: getProperties().scale32);
18906 return attr;
18907 }
18908
18909 bool getScale32();
18910 mlir::tosa::RoundingModeAttr getRoundingModeAttr() {
18911 auto attr = ::llvm::cast<mlir::tosa::RoundingModeAttr>(Val: getProperties().rounding_mode);
18912 return attr;
18913 }
18914
18915 ::mlir::tosa::RoundingMode getRoundingMode();
18916 ::mlir::BoolAttr getPerChannelAttr() {
18917 auto attr = ::llvm::cast<::mlir::BoolAttr>(Val: getProperties().per_channel);
18918 return attr;
18919 }
18920
18921 bool getPerChannel();
18922 ::mlir::BoolAttr getInputUnsignedAttr() {
18923 auto attr = ::llvm::cast<::mlir::BoolAttr>(Val: getProperties().input_unsigned);
18924 return attr;
18925 }
18926
18927 bool getInputUnsigned();
18928 ::mlir::BoolAttr getOutputUnsignedAttr() {
18929 auto attr = ::llvm::cast<::mlir::BoolAttr>(Val: getProperties().output_unsigned);
18930 return attr;
18931 }
18932
18933 bool getOutputUnsigned();
18934};
18935
18936} // namespace detail
18937template <typename RangeT>
18938class RescaleOpGenericAdaptor : public detail::RescaleOpGenericAdaptorBase {
18939 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
18940 using Base = detail::RescaleOpGenericAdaptorBase;
18941 static constexpr int odsIndex_input = 0;
18942 static constexpr int odsIndex_multiplier = 1;
18943 static constexpr int odsIndex_shift = 2;
18944 static constexpr int odsIndex_input_zp = 3;
18945 static constexpr int odsIndex_output_zp = 4;
18946public:
18947 RescaleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
18948
18949 RescaleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RescaleOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
18950
18951 RescaleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RescaleOpGenericAdaptor(values, attrs, Properties{}, {}) {}
18952
18953 RescaleOpGenericAdaptor(RangeT values, const RescaleOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
18954
18955 template <typename LateInst = RescaleOp, typename = std::enable_if_t<std::is_same_v<LateInst, RescaleOp>>>
18956 RescaleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
18957
18958 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
18959 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
18960 }
18961
18962 RangeT getODSOperands(unsigned index) {
18963 auto valueRange = getODSOperandIndexAndLength(index);
18964 return {std::next(odsOperands.begin(), valueRange.first),
18965 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
18966 }
18967
18968 ValueT getInput() {
18969 return (*getODSOperands(index: 0).begin());
18970 }
18971
18972 ValueT getMultiplier() {
18973 return (*getODSOperands(index: 1).begin());
18974 }
18975
18976 ValueT getShift() {
18977 return (*getODSOperands(index: 2).begin());
18978 }
18979
18980 ValueT getInputZp() {
18981 return (*getODSOperands(index: 3).begin());
18982 }
18983
18984 ValueT getOutputZp() {
18985 return (*getODSOperands(index: 4).begin());
18986 }
18987
18988 RangeT getOperands() {
18989 return odsOperands;
18990 }
18991
18992private:
18993 RangeT odsOperands;
18994};
18995class RescaleOpAdaptor : public RescaleOpGenericAdaptor<::mlir::ValueRange> {
18996public:
18997 using RescaleOpGenericAdaptor::RescaleOpGenericAdaptor;
18998 RescaleOpAdaptor(RescaleOp op);
18999
19000 ::llvm::LogicalResult verify(::mlir::Location loc);
19001};
19002class RescaleOp : public ::mlir::Op<RescaleOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
19003public:
19004 using Op::Op;
19005 using Op::print;
19006 using Adaptor = RescaleOpAdaptor;
19007 template <typename RangeT>
19008 using GenericAdaptor = RescaleOpGenericAdaptor<RangeT>;
19009 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
19010 static constexpr int odsIndex_input = 0;
19011 static constexpr int odsIndex_multiplier = 1;
19012 static constexpr int odsIndex_shift = 2;
19013 static constexpr int odsIndex_input_zp = 3;
19014 static constexpr int odsIndex_output_zp = 4;
19015 static constexpr int odsIndex_output = 0;
19016 using Properties = FoldAdaptor::Properties;
19017 using ::mlir::InferShapedTypeOpInterface::Trait<RescaleOp>::reifyReturnTypeShapes;
19018 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
19019 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("input_unsigned"), ::llvm::StringRef("output_unsigned"), ::llvm::StringRef("per_channel"), ::llvm::StringRef("rounding_mode"), ::llvm::StringRef("scale32")};
19020 return ::llvm::ArrayRef(attrNames);
19021 }
19022
19023 ::mlir::StringAttr getInputUnsignedAttrName() {
19024 return getAttributeNameForIndex(index: 0);
19025 }
19026
19027 static ::mlir::StringAttr getInputUnsignedAttrName(::mlir::OperationName name) {
19028 return getAttributeNameForIndex(name, index: 0);
19029 }
19030
19031 ::mlir::StringAttr getOutputUnsignedAttrName() {
19032 return getAttributeNameForIndex(index: 1);
19033 }
19034
19035 static ::mlir::StringAttr getOutputUnsignedAttrName(::mlir::OperationName name) {
19036 return getAttributeNameForIndex(name, index: 1);
19037 }
19038
19039 ::mlir::StringAttr getPerChannelAttrName() {
19040 return getAttributeNameForIndex(index: 2);
19041 }
19042
19043 static ::mlir::StringAttr getPerChannelAttrName(::mlir::OperationName name) {
19044 return getAttributeNameForIndex(name, index: 2);
19045 }
19046
19047 ::mlir::StringAttr getRoundingModeAttrName() {
19048 return getAttributeNameForIndex(index: 3);
19049 }
19050
19051 static ::mlir::StringAttr getRoundingModeAttrName(::mlir::OperationName name) {
19052 return getAttributeNameForIndex(name, index: 3);
19053 }
19054
19055 ::mlir::StringAttr getScale32AttrName() {
19056 return getAttributeNameForIndex(index: 4);
19057 }
19058
19059 static ::mlir::StringAttr getScale32AttrName(::mlir::OperationName name) {
19060 return getAttributeNameForIndex(name, index: 4);
19061 }
19062
19063 static constexpr ::llvm::StringLiteral getOperationName() {
19064 return ::llvm::StringLiteral("tosa.rescale");
19065 }
19066
19067 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
19068 return {index, 1};
19069 }
19070
19071 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
19072 auto [start, length] = getODSOperandIndexAndLength(index);
19073 return getOperation()->getOperands().slice(n: start, m: length);
19074 }
19075
19076 ::mlir::TypedValue<::mlir::TensorType> getInput() {
19077 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
19078 }
19079
19080 ::mlir::TypedValue<::mlir::TensorType> getMultiplier() {
19081 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
19082 }
19083
19084 ::mlir::TypedValue<::mlir::TensorType> getShift() {
19085 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
19086 }
19087
19088 ::mlir::TypedValue<::mlir::TensorType> getInputZp() {
19089 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
19090 }
19091
19092 ::mlir::TypedValue<::mlir::TensorType> getOutputZp() {
19093 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 4).begin());
19094 }
19095
19096 ::mlir::OpOperand &getInputMutable() {
19097 auto range = getODSOperandIndexAndLength(index: 0);
19098 return getOperation()->getOpOperand(idx: range.first);
19099 }
19100
19101 ::mlir::OpOperand &getMultiplierMutable() {
19102 auto range = getODSOperandIndexAndLength(index: 1);
19103 return getOperation()->getOpOperand(idx: range.first);
19104 }
19105
19106 ::mlir::OpOperand &getShiftMutable() {
19107 auto range = getODSOperandIndexAndLength(index: 2);
19108 return getOperation()->getOpOperand(idx: range.first);
19109 }
19110
19111 ::mlir::OpOperand &getInputZpMutable() {
19112 auto range = getODSOperandIndexAndLength(index: 3);
19113 return getOperation()->getOpOperand(idx: range.first);
19114 }
19115
19116 ::mlir::OpOperand &getOutputZpMutable() {
19117 auto range = getODSOperandIndexAndLength(index: 4);
19118 return getOperation()->getOpOperand(idx: range.first);
19119 }
19120
19121 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
19122 return {index, 1};
19123 }
19124
19125 ::mlir::Operation::result_range getODSResults(unsigned index) {
19126 auto valueRange = getODSResultIndexAndLength(index);
19127 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
19128 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
19129 }
19130
19131 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
19132 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
19133 }
19134
19135 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
19136 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
19137 static llvm::hash_code computePropertiesHash(const Properties &prop);
19138 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
19139 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
19140 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
19141 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
19142 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
19143 void writeProperties(::mlir::DialectBytecodeWriter &writer);
19144 ::mlir::BoolAttr getScale32Attr() {
19145 return ::llvm::cast<::mlir::BoolAttr>(Val&: getProperties().scale32);
19146 }
19147
19148 bool getScale32();
19149 mlir::tosa::RoundingModeAttr getRoundingModeAttr() {
19150 return ::llvm::cast<mlir::tosa::RoundingModeAttr>(Val&: getProperties().rounding_mode);
19151 }
19152
19153 ::mlir::tosa::RoundingMode getRoundingMode();
19154 ::mlir::BoolAttr getPerChannelAttr() {
19155 return ::llvm::cast<::mlir::BoolAttr>(Val&: getProperties().per_channel);
19156 }
19157
19158 bool getPerChannel();
19159 ::mlir::BoolAttr getInputUnsignedAttr() {
19160 return ::llvm::cast<::mlir::BoolAttr>(Val&: getProperties().input_unsigned);
19161 }
19162
19163 bool getInputUnsigned();
19164 ::mlir::BoolAttr getOutputUnsignedAttr() {
19165 return ::llvm::cast<::mlir::BoolAttr>(Val&: getProperties().output_unsigned);
19166 }
19167
19168 bool getOutputUnsigned();
19169 void setScale32Attr(::mlir::BoolAttr attr) {
19170 getProperties().scale32 = attr;
19171 }
19172
19173 void setScale32(bool attrValue);
19174 void setRoundingModeAttr(mlir::tosa::RoundingModeAttr attr) {
19175 getProperties().rounding_mode = attr;
19176 }
19177
19178 void setRoundingMode(::mlir::tosa::RoundingMode attrValue);
19179 void setPerChannelAttr(::mlir::BoolAttr attr) {
19180 getProperties().per_channel = attr;
19181 }
19182
19183 void setPerChannel(bool attrValue);
19184 void setInputUnsignedAttr(::mlir::BoolAttr attr) {
19185 getProperties().input_unsigned = attr;
19186 }
19187
19188 void setInputUnsigned(bool attrValue);
19189 void setOutputUnsignedAttr(::mlir::BoolAttr attr) {
19190 getProperties().output_unsigned = attr;
19191 }
19192
19193 void setOutputUnsigned(bool attrValue);
19194 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::BoolAttr scale32, mlir::tosa::RoundingModeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned);
19195 static RescaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::BoolAttr scale32, mlir::tosa::RoundingModeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned);
19196 static RescaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::BoolAttr scale32, mlir::tosa::RoundingModeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned);
19197 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::BoolAttr scale32, mlir::tosa::RoundingModeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned);
19198 static RescaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::BoolAttr scale32, mlir::tosa::RoundingModeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned);
19199 static RescaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, ::mlir::BoolAttr scale32, mlir::tosa::RoundingModeAttr rounding_mode, ::mlir::BoolAttr per_channel, ::mlir::BoolAttr input_unsigned, ::mlir::BoolAttr output_unsigned);
19200 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, bool scale32, ::mlir::tosa::RoundingMode rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned);
19201 static RescaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, bool scale32, ::mlir::tosa::RoundingMode rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned);
19202 static RescaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, bool scale32, ::mlir::tosa::RoundingMode rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned);
19203 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, bool scale32, ::mlir::tosa::RoundingMode rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned);
19204 static RescaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, bool scale32, ::mlir::tosa::RoundingMode rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned);
19205 static RescaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value multiplier, ::mlir::Value shift, ::mlir::Value input_zp, ::mlir::Value output_zp, bool scale32, ::mlir::tosa::RoundingMode rounding_mode, bool per_channel, bool input_unsigned, bool output_unsigned);
19206 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19207 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19208 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19209 static RescaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19210 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19211 static RescaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19212 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19213 static RescaleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19214 static RescaleOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19215 ::llvm::LogicalResult verifyInvariantsImpl();
19216 ::llvm::LogicalResult verifyInvariants();
19217 ::llvm::LogicalResult verify();
19218 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
19219 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
19220 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
19221 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
19222private:
19223 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
19224 return getAttributeNameForIndex(name: (*this)->getName(), index);
19225 }
19226
19227 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
19228 assert(index < 5 && "invalid attribute index");
19229 assert(name.getStringRef() == getOperationName() && "invalid operation name");
19230 assert(name.isRegistered() && "Operation isn't registered, missing a "
19231 "dependent dialect loading?");
19232 return name.getAttributeNames()[index];
19233 }
19234
19235 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
19236public:
19237 static ::llvm::LogicalResult
19238 inferReturnTypeComponents(::mlir::MLIRContext *context,
19239 std::optional<::mlir::Location> location,
19240 Adaptor adaptor,
19241 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
19242
19243
19244 FailureOr<int64_t> getInputZeroPoint();
19245 FailureOr<int64_t> getOutputZeroPoint();
19246 LogicalResult verifyInputZeroPoint(int64_t zp);
19247 LogicalResult verifyOutputZeroPoint(int64_t zp);
19248};
19249
19250} // namespace mlir::tosa
19251MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::RescaleOp)
19252MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::RescaleOpGenericAdaptorBase::Properties)
19253
19254namespace mlir::tosa {
19255
19256
19257//===----------------------------------------------------------------------===//
19258// mlir::tosa::ReshapeBlockScaledOp declarations
19259//===----------------------------------------------------------------------===//
19260
19261namespace detail {
19262
19263class ReshapeBlockScaledOpGenericAdaptorBase {
19264public:
19265 struct Properties {
19266 using block_sizeTy = mlir::tosa::BlockSizeAttr;
19267 block_sizeTy block_size;
19268
19269 auto getBlockSize() const {
19270 auto &propStorage = this->block_size;
19271 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: propStorage);
19272 }
19273 void setBlockSize(const mlir::tosa::BlockSizeAttr &propValue) {
19274 this->block_size = propValue;
19275 }
19276 bool operator==(const Properties &rhs) const {
19277 return
19278 rhs.block_size == this->block_size &&
19279 true;
19280 }
19281 bool operator!=(const Properties &rhs) const {
19282 return !(*this == rhs);
19283 }
19284 };
19285protected:
19286 ::mlir::DictionaryAttr odsAttrs;
19287 ::std::optional<::mlir::OperationName> odsOpName;
19288 Properties properties;
19289 ::mlir::RegionRange odsRegions;
19290public:
19291 ReshapeBlockScaledOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
19292 odsOpName.emplace(args: "tosa.reshape_block_scaled", args: odsAttrs.getContext());
19293 }
19294
19295 ReshapeBlockScaledOpGenericAdaptorBase(ReshapeBlockScaledOp op);
19296
19297 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
19298 const Properties &getProperties() {
19299 return properties;
19300 }
19301
19302 ::mlir::DictionaryAttr getAttributes() {
19303 return odsAttrs;
19304 }
19305
19306 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
19307 auto attr = ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: getProperties().block_size);
19308 return attr;
19309 }
19310
19311 ::mlir::tosa::BlockSize getBlockSize();
19312};
19313
19314} // namespace detail
19315template <typename RangeT>
19316class ReshapeBlockScaledOpGenericAdaptor : public detail::ReshapeBlockScaledOpGenericAdaptorBase {
19317 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
19318 using Base = detail::ReshapeBlockScaledOpGenericAdaptorBase;
19319 static constexpr int odsIndex_input = 0;
19320 static constexpr int odsIndex_new_value_shape = 1;
19321public:
19322 ReshapeBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
19323
19324 ReshapeBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReshapeBlockScaledOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
19325
19326 ReshapeBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReshapeBlockScaledOpGenericAdaptor(values, attrs, Properties{}, {}) {}
19327
19328 ReshapeBlockScaledOpGenericAdaptor(RangeT values, const ReshapeBlockScaledOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
19329
19330 template <typename LateInst = ReshapeBlockScaledOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReshapeBlockScaledOp>>>
19331 ReshapeBlockScaledOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
19332
19333 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
19334 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
19335 }
19336
19337 RangeT getODSOperands(unsigned index) {
19338 auto valueRange = getODSOperandIndexAndLength(index);
19339 return {std::next(odsOperands.begin(), valueRange.first),
19340 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
19341 }
19342
19343 RangeT getInput() {
19344 return getODSOperands(index: 0);
19345 }
19346
19347 ValueT getNewValueShape() {
19348 return (*getODSOperands(index: 1).begin());
19349 }
19350
19351 RangeT getOperands() {
19352 return odsOperands;
19353 }
19354
19355private:
19356 RangeT odsOperands;
19357};
19358class ReshapeBlockScaledOpAdaptor : public ReshapeBlockScaledOpGenericAdaptor<::mlir::ValueRange> {
19359public:
19360 using ReshapeBlockScaledOpGenericAdaptor::ReshapeBlockScaledOpGenericAdaptor;
19361 ReshapeBlockScaledOpAdaptor(ReshapeBlockScaledOp op);
19362
19363 ::llvm::LogicalResult verify(::mlir::Location loc);
19364};
19365class ReshapeBlockScaledOp : public ::mlir::Op<ReshapeBlockScaledOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
19366public:
19367 using Op::Op;
19368 using Op::print;
19369 using Adaptor = ReshapeBlockScaledOpAdaptor;
19370 template <typename RangeT>
19371 using GenericAdaptor = ReshapeBlockScaledOpGenericAdaptor<RangeT>;
19372 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
19373 static constexpr int odsIndex_input = 0;
19374 static constexpr int odsIndex_new_value_shape = 1;
19375 static constexpr int odsIndex_output = 0;
19376 using Properties = FoldAdaptor::Properties;
19377 using ::mlir::InferTypeOpInterface::Trait<ReshapeBlockScaledOp>::refineReturnTypes;
19378 using ::mlir::InferShapedTypeOpInterface::Trait<ReshapeBlockScaledOp>::reifyReturnTypeShapes;
19379 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
19380 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("block_size")};
19381 return ::llvm::ArrayRef(attrNames);
19382 }
19383
19384 ::mlir::StringAttr getBlockSizeAttrName() {
19385 return getAttributeNameForIndex(index: 0);
19386 }
19387
19388 static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) {
19389 return getAttributeNameForIndex(name, index: 0);
19390 }
19391
19392 static constexpr ::llvm::StringLiteral getOperationName() {
19393 return ::llvm::StringLiteral("tosa.reshape_block_scaled");
19394 }
19395
19396 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
19397 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
19398 auto [start, length] = getODSOperandIndexAndLength(index);
19399 return getOperation()->getOperands().slice(n: start, m: length);
19400 }
19401
19402 ::mlir::Operation::operand_range getInput() {
19403 return getODSOperands(index: 0);
19404 }
19405
19406 ::mlir::TypedValue<mlir::tosa::shapeType> getNewValueShape() {
19407 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
19408 }
19409
19410 ::mlir::MutableOperandRange getInputMutable();
19411 ::mlir::OpOperand &getNewValueShapeMutable() {
19412 auto range = getODSOperandIndexAndLength(index: 1);
19413 return getOperation()->getOpOperand(idx: range.first);
19414 }
19415
19416 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
19417 ::mlir::Operation::result_range getODSResults(unsigned index) {
19418 auto valueRange = getODSResultIndexAndLength(index);
19419 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
19420 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
19421 }
19422
19423 ::mlir::Operation::result_range getOutput() {
19424 return getODSResults(index: 0);
19425 }
19426
19427 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
19428 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
19429 static llvm::hash_code computePropertiesHash(const Properties &prop);
19430 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
19431 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
19432 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
19433 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
19434 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
19435 void writeProperties(::mlir::DialectBytecodeWriter &writer);
19436 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
19437 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val&: getProperties().block_size);
19438 }
19439
19440 ::mlir::tosa::BlockSize getBlockSize();
19441 void setBlockSizeAttr(mlir::tosa::BlockSizeAttr attr) {
19442 getProperties().block_size = attr;
19443 }
19444
19445 void setBlockSize(::mlir::tosa::BlockSize attrValue);
19446 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::Value new_value_shape, mlir::tosa::BlockSizeAttr block_size);
19447 static ReshapeBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::Value new_value_shape, mlir::tosa::BlockSizeAttr block_size);
19448 static ReshapeBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::Value new_value_shape, mlir::tosa::BlockSizeAttr block_size);
19449 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange input, ::mlir::Value new_value_shape, mlir::tosa::BlockSizeAttr block_size);
19450 static ReshapeBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange input, ::mlir::Value new_value_shape, mlir::tosa::BlockSizeAttr block_size);
19451 static ReshapeBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange input, ::mlir::Value new_value_shape, mlir::tosa::BlockSizeAttr block_size);
19452 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::Value new_value_shape, ::mlir::tosa::BlockSize block_size);
19453 static ReshapeBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::Value new_value_shape, ::mlir::tosa::BlockSize block_size);
19454 static ReshapeBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::Value new_value_shape, ::mlir::tosa::BlockSize block_size);
19455 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange input, ::mlir::Value new_value_shape, ::mlir::tosa::BlockSize block_size);
19456 static ReshapeBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange input, ::mlir::Value new_value_shape, ::mlir::tosa::BlockSize block_size);
19457 static ReshapeBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange input, ::mlir::Value new_value_shape, ::mlir::tosa::BlockSize block_size);
19458 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19459 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19460 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19461 static ReshapeBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19462 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19463 static ReshapeBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19464 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19465 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19466 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19467 static ReshapeBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19468 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19469 static ReshapeBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19470 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19471 static ReshapeBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19472 static ReshapeBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19473 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19474 static ReshapeBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19475 static ReshapeBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19476 ::llvm::LogicalResult verifyInvariantsImpl();
19477 ::llvm::LogicalResult verifyInvariants();
19478 ::llvm::LogicalResult verify();
19479 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
19480 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
19481 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
19482 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
19483 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
19484private:
19485 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
19486 return getAttributeNameForIndex(name: (*this)->getName(), index);
19487 }
19488
19489 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
19490 assert(index < 1 && "invalid attribute index");
19491 assert(name.getStringRef() == getOperationName() && "invalid operation name");
19492 assert(name.isRegistered() && "Operation isn't registered, missing a "
19493 "dependent dialect loading?");
19494 return name.getAttributeNames()[index];
19495 }
19496
19497 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
19498public:
19499 static ::llvm::LogicalResult
19500 inferReturnTypeComponents(::mlir::MLIRContext *context,
19501 std::optional<::mlir::Location> location,
19502 Adaptor adaptor,
19503 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
19504
19505
19506 /// Returns true when two result types are compatible for this op;
19507 /// Method used by InferTypeOpInterface.
19508 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
19509};
19510
19511} // namespace mlir::tosa
19512MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReshapeBlockScaledOp)
19513MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ReshapeBlockScaledOpGenericAdaptorBase::Properties)
19514
19515namespace mlir::tosa {
19516
19517
19518//===----------------------------------------------------------------------===//
19519// mlir::tosa::ReshapeOp declarations
19520//===----------------------------------------------------------------------===//
19521
19522namespace detail {
19523
19524class ReshapeOpGenericAdaptorBase {
19525public:
19526 using Properties = ::mlir::EmptyProperties;
19527protected:
19528 ::mlir::DictionaryAttr odsAttrs;
19529 ::std::optional<::mlir::OperationName> odsOpName;
19530 Properties properties;
19531 ::mlir::RegionRange odsRegions;
19532public:
19533 ReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
19534 odsOpName.emplace(args: "tosa.reshape", args: odsAttrs.getContext());
19535 }
19536
19537 ReshapeOpGenericAdaptorBase(ReshapeOp op);
19538
19539 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
19540 return {index, 1};
19541 }
19542
19543 const Properties &getProperties() {
19544 return properties;
19545 }
19546
19547 ::mlir::DictionaryAttr getAttributes() {
19548 return odsAttrs;
19549 }
19550
19551};
19552
19553} // namespace detail
19554template <typename RangeT>
19555class ReshapeOpGenericAdaptor : public detail::ReshapeOpGenericAdaptorBase {
19556 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
19557 using Base = detail::ReshapeOpGenericAdaptorBase;
19558 static constexpr int odsIndex_input1 = 0;
19559 static constexpr int odsIndex_shape = 1;
19560public:
19561 ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
19562
19563 ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
19564
19565 ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReshapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
19566
19567 ReshapeOpGenericAdaptor(RangeT values, const ReshapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
19568
19569 template <typename LateInst = ReshapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReshapeOp>>>
19570 ReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
19571
19572 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
19573 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
19574 }
19575
19576 RangeT getODSOperands(unsigned index) {
19577 auto valueRange = getODSOperandIndexAndLength(index);
19578 return {std::next(odsOperands.begin(), valueRange.first),
19579 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
19580 }
19581
19582 ValueT getInput1() {
19583 return (*getODSOperands(index: 0).begin());
19584 }
19585
19586 ValueT getShape() {
19587 return (*getODSOperands(index: 1).begin());
19588 }
19589
19590 RangeT getOperands() {
19591 return odsOperands;
19592 }
19593
19594private:
19595 RangeT odsOperands;
19596};
19597class ReshapeOpAdaptor : public ReshapeOpGenericAdaptor<::mlir::ValueRange> {
19598public:
19599 using ReshapeOpGenericAdaptor::ReshapeOpGenericAdaptor;
19600 ReshapeOpAdaptor(ReshapeOp op);
19601
19602 ::llvm::LogicalResult verify(::mlir::Location loc);
19603};
19604class ReshapeOp : public ::mlir::Op<ReshapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::InferTensorType, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
19605public:
19606 using Op::Op;
19607 using Op::print;
19608 using Adaptor = ReshapeOpAdaptor;
19609 template <typename RangeT>
19610 using GenericAdaptor = ReshapeOpGenericAdaptor<RangeT>;
19611 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
19612 static constexpr int odsIndex_input1 = 0;
19613 static constexpr int odsIndex_shape = 1;
19614 static constexpr int odsIndex_output = 0;
19615 using Properties = FoldAdaptor::Properties;
19616 using ::mlir::InferTypeOpInterface::Trait<ReshapeOp>::refineReturnTypes;
19617 using ::mlir::InferShapedTypeOpInterface::Trait<ReshapeOp>::reifyReturnTypeShapes;
19618 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
19619 return {};
19620 }
19621
19622 static constexpr ::llvm::StringLiteral getOperationName() {
19623 return ::llvm::StringLiteral("tosa.reshape");
19624 }
19625
19626 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
19627 return {index, 1};
19628 }
19629
19630 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
19631 auto [start, length] = getODSOperandIndexAndLength(index);
19632 return getOperation()->getOperands().slice(n: start, m: length);
19633 }
19634
19635 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
19636 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
19637 }
19638
19639 ::mlir::TypedValue<mlir::tosa::shapeType> getShape() {
19640 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
19641 }
19642
19643 ::mlir::OpOperand &getInput1Mutable() {
19644 auto range = getODSOperandIndexAndLength(index: 0);
19645 return getOperation()->getOpOperand(idx: range.first);
19646 }
19647
19648 ::mlir::OpOperand &getShapeMutable() {
19649 auto range = getODSOperandIndexAndLength(index: 1);
19650 return getOperation()->getOpOperand(idx: range.first);
19651 }
19652
19653 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
19654 return {index, 1};
19655 }
19656
19657 ::mlir::Operation::result_range getODSResults(unsigned index) {
19658 auto valueRange = getODSResultIndexAndLength(index);
19659 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
19660 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
19661 }
19662
19663 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
19664 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
19665 }
19666
19667 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
19668 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
19669 static llvm::hash_code computePropertiesHash(const Properties &prop);
19670 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
19671 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
19672 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
19673 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
19674 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value shape);
19675 static ReshapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value shape);
19676 static ReshapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value shape);
19677 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input1, ::mlir::Value shape);
19678 static ReshapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input1, ::mlir::Value shape);
19679 static ReshapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input1, ::mlir::Value shape);
19680 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value shape);
19681 static ReshapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value shape);
19682 static ReshapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value shape);
19683 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19684 static ReshapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19685 static ReshapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19686 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19687 static ReshapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19688 static ReshapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19689 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19690 static ReshapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19691 static ReshapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19692 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19693 static ReshapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19694 static ReshapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19695 ::llvm::LogicalResult verifyInvariantsImpl();
19696 ::llvm::LogicalResult verifyInvariants();
19697 ::llvm::LogicalResult verify();
19698 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
19699 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
19700 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
19701 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
19702 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
19703 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
19704public:
19705 static ::llvm::LogicalResult
19706 inferReturnTypeComponents(::mlir::MLIRContext *context,
19707 std::optional<::mlir::Location> location,
19708 Adaptor adaptor,
19709 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
19710
19711
19712 /// Returns true when two result types are compatible for this op;
19713 /// Method used by InferTypeOpInterface.
19714 static bool isCompatibleReturnTypes(TypeRange l, TypeRange r);
19715};
19716
19717} // namespace mlir::tosa
19718MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReshapeOp)
19719
19720namespace mlir::tosa {
19721
19722
19723//===----------------------------------------------------------------------===//
19724// mlir::tosa::ResizeOp declarations
19725//===----------------------------------------------------------------------===//
19726
19727namespace detail {
19728
19729class ResizeOpGenericAdaptorBase {
19730public:
19731 struct Properties {
19732 using modeTy = mlir::tosa::ResizeModeAttr;
19733 modeTy mode;
19734
19735 auto getMode() const {
19736 auto &propStorage = this->mode;
19737 return ::llvm::cast<mlir::tosa::ResizeModeAttr>(Val: propStorage);
19738 }
19739 void setMode(const mlir::tosa::ResizeModeAttr &propValue) {
19740 this->mode = propValue;
19741 }
19742 bool operator==(const Properties &rhs) const {
19743 return
19744 rhs.mode == this->mode &&
19745 true;
19746 }
19747 bool operator!=(const Properties &rhs) const {
19748 return !(*this == rhs);
19749 }
19750 };
19751protected:
19752 ::mlir::DictionaryAttr odsAttrs;
19753 ::std::optional<::mlir::OperationName> odsOpName;
19754 Properties properties;
19755 ::mlir::RegionRange odsRegions;
19756public:
19757 ResizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
19758 odsOpName.emplace(args: "tosa.resize", args: odsAttrs.getContext());
19759 }
19760
19761 ResizeOpGenericAdaptorBase(ResizeOp op);
19762
19763 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
19764 return {index, 1};
19765 }
19766
19767 const Properties &getProperties() {
19768 return properties;
19769 }
19770
19771 ::mlir::DictionaryAttr getAttributes() {
19772 return odsAttrs;
19773 }
19774
19775 mlir::tosa::ResizeModeAttr getModeAttr() {
19776 auto attr = ::llvm::cast<mlir::tosa::ResizeModeAttr>(Val: getProperties().mode);
19777 return attr;
19778 }
19779
19780 ::mlir::tosa::ResizeMode getMode();
19781};
19782
19783} // namespace detail
19784template <typename RangeT>
19785class ResizeOpGenericAdaptor : public detail::ResizeOpGenericAdaptorBase {
19786 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
19787 using Base = detail::ResizeOpGenericAdaptorBase;
19788 static constexpr int odsIndex_input = 0;
19789 static constexpr int odsIndex_scale = 1;
19790 static constexpr int odsIndex_offset = 2;
19791 static constexpr int odsIndex_border = 3;
19792public:
19793 ResizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
19794
19795 ResizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ResizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
19796
19797 ResizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ResizeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
19798
19799 ResizeOpGenericAdaptor(RangeT values, const ResizeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
19800
19801 template <typename LateInst = ResizeOp, typename = std::enable_if_t<std::is_same_v<LateInst, ResizeOp>>>
19802 ResizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
19803
19804 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
19805 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
19806 }
19807
19808 RangeT getODSOperands(unsigned index) {
19809 auto valueRange = getODSOperandIndexAndLength(index);
19810 return {std::next(odsOperands.begin(), valueRange.first),
19811 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
19812 }
19813
19814 ValueT getInput() {
19815 return (*getODSOperands(index: 0).begin());
19816 }
19817
19818 ValueT getScale() {
19819 return (*getODSOperands(index: 1).begin());
19820 }
19821
19822 ValueT getOffset() {
19823 return (*getODSOperands(index: 2).begin());
19824 }
19825
19826 ValueT getBorder() {
19827 return (*getODSOperands(index: 3).begin());
19828 }
19829
19830 RangeT getOperands() {
19831 return odsOperands;
19832 }
19833
19834private:
19835 RangeT odsOperands;
19836};
19837class ResizeOpAdaptor : public ResizeOpGenericAdaptor<::mlir::ValueRange> {
19838public:
19839 using ResizeOpGenericAdaptor::ResizeOpGenericAdaptor;
19840 ResizeOpAdaptor(ResizeOp op);
19841
19842 ::llvm::LogicalResult verify(::mlir::Location loc);
19843};
19844class ResizeOp : public ::mlir::Op<ResizeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
19845public:
19846 using Op::Op;
19847 using Op::print;
19848 using Adaptor = ResizeOpAdaptor;
19849 template <typename RangeT>
19850 using GenericAdaptor = ResizeOpGenericAdaptor<RangeT>;
19851 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
19852 static constexpr int odsIndex_input = 0;
19853 static constexpr int odsIndex_scale = 1;
19854 static constexpr int odsIndex_offset = 2;
19855 static constexpr int odsIndex_border = 3;
19856 static constexpr int odsIndex_output = 0;
19857 using Properties = FoldAdaptor::Properties;
19858 using ::mlir::InferShapedTypeOpInterface::Trait<ResizeOp>::reifyReturnTypeShapes;
19859 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
19860 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("mode")};
19861 return ::llvm::ArrayRef(attrNames);
19862 }
19863
19864 ::mlir::StringAttr getModeAttrName() {
19865 return getAttributeNameForIndex(index: 0);
19866 }
19867
19868 static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) {
19869 return getAttributeNameForIndex(name, index: 0);
19870 }
19871
19872 static constexpr ::llvm::StringLiteral getOperationName() {
19873 return ::llvm::StringLiteral("tosa.resize");
19874 }
19875
19876 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
19877 return {index, 1};
19878 }
19879
19880 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
19881 auto [start, length] = getODSOperandIndexAndLength(index);
19882 return getOperation()->getOperands().slice(n: start, m: length);
19883 }
19884
19885 ::mlir::TypedValue<::mlir::TensorType> getInput() {
19886 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
19887 }
19888
19889 ::mlir::TypedValue<::mlir::Type> getScale() {
19890 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 1).begin());
19891 }
19892
19893 ::mlir::TypedValue<::mlir::Type> getOffset() {
19894 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 2).begin());
19895 }
19896
19897 ::mlir::TypedValue<::mlir::Type> getBorder() {
19898 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(Val: *getODSOperands(index: 3).begin());
19899 }
19900
19901 ::mlir::OpOperand &getInputMutable() {
19902 auto range = getODSOperandIndexAndLength(index: 0);
19903 return getOperation()->getOpOperand(idx: range.first);
19904 }
19905
19906 ::mlir::OpOperand &getScaleMutable() {
19907 auto range = getODSOperandIndexAndLength(index: 1);
19908 return getOperation()->getOpOperand(idx: range.first);
19909 }
19910
19911 ::mlir::OpOperand &getOffsetMutable() {
19912 auto range = getODSOperandIndexAndLength(index: 2);
19913 return getOperation()->getOpOperand(idx: range.first);
19914 }
19915
19916 ::mlir::OpOperand &getBorderMutable() {
19917 auto range = getODSOperandIndexAndLength(index: 3);
19918 return getOperation()->getOpOperand(idx: range.first);
19919 }
19920
19921 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
19922 return {index, 1};
19923 }
19924
19925 ::mlir::Operation::result_range getODSResults(unsigned index) {
19926 auto valueRange = getODSResultIndexAndLength(index);
19927 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
19928 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
19929 }
19930
19931 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
19932 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
19933 }
19934
19935 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
19936 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
19937 static llvm::hash_code computePropertiesHash(const Properties &prop);
19938 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
19939 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
19940 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
19941 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
19942 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
19943 void writeProperties(::mlir::DialectBytecodeWriter &writer);
19944 mlir::tosa::ResizeModeAttr getModeAttr() {
19945 return ::llvm::cast<mlir::tosa::ResizeModeAttr>(Val&: getProperties().mode);
19946 }
19947
19948 ::mlir::tosa::ResizeMode getMode();
19949 void setModeAttr(mlir::tosa::ResizeModeAttr attr) {
19950 getProperties().mode = attr;
19951 }
19952
19953 void setMode(::mlir::tosa::ResizeMode attrValue);
19954 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, mlir::tosa::ResizeModeAttr mode);
19955 static ResizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, mlir::tosa::ResizeModeAttr mode);
19956 static ResizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, mlir::tosa::ResizeModeAttr mode);
19957 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, mlir::tosa::ResizeModeAttr mode);
19958 static ResizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, mlir::tosa::ResizeModeAttr mode);
19959 static ResizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, mlir::tosa::ResizeModeAttr mode);
19960 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, ::mlir::tosa::ResizeMode mode);
19961 static ResizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, ::mlir::tosa::ResizeMode mode);
19962 static ResizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, ::mlir::tosa::ResizeMode mode);
19963 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, ::mlir::tosa::ResizeMode mode);
19964 static ResizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, ::mlir::tosa::ResizeMode mode);
19965 static ResizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value border, ::mlir::tosa::ResizeMode mode);
19966 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19967 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19968 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19969 static ResizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19970 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
19971 static ResizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
19972 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19973 static ResizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19974 static ResizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
19975 ::llvm::LogicalResult verifyInvariantsImpl();
19976 ::llvm::LogicalResult verifyInvariants();
19977 ::llvm::LogicalResult verify();
19978 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
19979 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
19980 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
19981 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
19982 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
19983private:
19984 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
19985 return getAttributeNameForIndex(name: (*this)->getName(), index);
19986 }
19987
19988 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
19989 assert(index < 1 && "invalid attribute index");
19990 assert(name.getStringRef() == getOperationName() && "invalid operation name");
19991 assert(name.isRegistered() && "Operation isn't registered, missing a "
19992 "dependent dialect loading?");
19993 return name.getAttributeNames()[index];
19994 }
19995
19996 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
19997public:
19998 static ::llvm::LogicalResult
19999 inferReturnTypeComponents(::mlir::MLIRContext *context,
20000 std::optional<::mlir::Location> location,
20001 Adaptor adaptor,
20002 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
20003
20004};
20005
20006} // namespace mlir::tosa
20007MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ResizeOp)
20008MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ResizeOpGenericAdaptorBase::Properties)
20009
20010namespace mlir::tosa {
20011
20012
20013//===----------------------------------------------------------------------===//
20014// mlir::tosa::ReverseOp declarations
20015//===----------------------------------------------------------------------===//
20016
20017namespace detail {
20018
20019class ReverseOpGenericAdaptorBase {
20020public:
20021 struct Properties {
20022 using axisTy = ::mlir::IntegerAttr;
20023 axisTy axis;
20024
20025 auto getAxis() const {
20026 auto &propStorage = this->axis;
20027 return ::llvm::cast<::mlir::IntegerAttr>(Val: propStorage);
20028 }
20029 void setAxis(const ::mlir::IntegerAttr &propValue) {
20030 this->axis = propValue;
20031 }
20032 bool operator==(const Properties &rhs) const {
20033 return
20034 rhs.axis == this->axis &&
20035 true;
20036 }
20037 bool operator!=(const Properties &rhs) const {
20038 return !(*this == rhs);
20039 }
20040 };
20041protected:
20042 ::mlir::DictionaryAttr odsAttrs;
20043 ::std::optional<::mlir::OperationName> odsOpName;
20044 Properties properties;
20045 ::mlir::RegionRange odsRegions;
20046public:
20047 ReverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
20048 odsOpName.emplace(args: "tosa.reverse", args: odsAttrs.getContext());
20049 }
20050
20051 ReverseOpGenericAdaptorBase(ReverseOp op);
20052
20053 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
20054 return {index, 1};
20055 }
20056
20057 const Properties &getProperties() {
20058 return properties;
20059 }
20060
20061 ::mlir::DictionaryAttr getAttributes() {
20062 return odsAttrs;
20063 }
20064
20065 ::mlir::IntegerAttr getAxisAttr() {
20066 auto attr = ::llvm::cast<::mlir::IntegerAttr>(Val: getProperties().axis);
20067 return attr;
20068 }
20069
20070 uint32_t getAxis();
20071};
20072
20073} // namespace detail
20074template <typename RangeT>
20075class ReverseOpGenericAdaptor : public detail::ReverseOpGenericAdaptorBase {
20076 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
20077 using Base = detail::ReverseOpGenericAdaptorBase;
20078 static constexpr int odsIndex_input1 = 0;
20079public:
20080 ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
20081
20082 ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReverseOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
20083
20084 ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReverseOpGenericAdaptor(values, attrs, Properties{}, {}) {}
20085
20086 ReverseOpGenericAdaptor(RangeT values, const ReverseOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
20087
20088 template <typename LateInst = ReverseOp, typename = std::enable_if_t<std::is_same_v<LateInst, ReverseOp>>>
20089 ReverseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
20090
20091 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20092 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
20093 }
20094
20095 RangeT getODSOperands(unsigned index) {
20096 auto valueRange = getODSOperandIndexAndLength(index);
20097 return {std::next(odsOperands.begin(), valueRange.first),
20098 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
20099 }
20100
20101 ValueT getInput1() {
20102 return (*getODSOperands(index: 0).begin());
20103 }
20104
20105 RangeT getOperands() {
20106 return odsOperands;
20107 }
20108
20109private:
20110 RangeT odsOperands;
20111};
20112class ReverseOpAdaptor : public ReverseOpGenericAdaptor<::mlir::ValueRange> {
20113public:
20114 using ReverseOpGenericAdaptor::ReverseOpGenericAdaptor;
20115 ReverseOpAdaptor(ReverseOp op);
20116
20117 ::llvm::LogicalResult verify(::mlir::Location loc);
20118};
20119class ReverseOp : public ::mlir::Op<ReverseOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
20120public:
20121 using Op::Op;
20122 using Op::print;
20123 using Adaptor = ReverseOpAdaptor;
20124 template <typename RangeT>
20125 using GenericAdaptor = ReverseOpGenericAdaptor<RangeT>;
20126 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
20127 static constexpr int odsIndex_input1 = 0;
20128 static constexpr int odsIndex_output = 0;
20129 using Properties = FoldAdaptor::Properties;
20130 using ::mlir::InferShapedTypeOpInterface::Trait<ReverseOp>::reifyReturnTypeShapes;
20131 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
20132 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis")};
20133 return ::llvm::ArrayRef(attrNames);
20134 }
20135
20136 ::mlir::StringAttr getAxisAttrName() {
20137 return getAttributeNameForIndex(index: 0);
20138 }
20139
20140 static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) {
20141 return getAttributeNameForIndex(name, index: 0);
20142 }
20143
20144 static constexpr ::llvm::StringLiteral getOperationName() {
20145 return ::llvm::StringLiteral("tosa.reverse");
20146 }
20147
20148 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20149 return {index, 1};
20150 }
20151
20152 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
20153 auto [start, length] = getODSOperandIndexAndLength(index);
20154 return getOperation()->getOperands().slice(n: start, m: length);
20155 }
20156
20157 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
20158 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
20159 }
20160
20161 ::mlir::OpOperand &getInput1Mutable() {
20162 auto range = getODSOperandIndexAndLength(index: 0);
20163 return getOperation()->getOpOperand(idx: range.first);
20164 }
20165
20166 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
20167 return {index, 1};
20168 }
20169
20170 ::mlir::Operation::result_range getODSResults(unsigned index) {
20171 auto valueRange = getODSResultIndexAndLength(index);
20172 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
20173 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
20174 }
20175
20176 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
20177 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
20178 }
20179
20180 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
20181 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
20182 static llvm::hash_code computePropertiesHash(const Properties &prop);
20183 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
20184 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
20185 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
20186 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
20187 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
20188 void writeProperties(::mlir::DialectBytecodeWriter &writer);
20189 ::mlir::IntegerAttr getAxisAttr() {
20190 return ::llvm::cast<::mlir::IntegerAttr>(Val&: getProperties().axis);
20191 }
20192
20193 uint32_t getAxis();
20194 void setAxisAttr(::mlir::IntegerAttr attr) {
20195 getProperties().axis = attr;
20196 }
20197
20198 void setAxis(uint32_t attrValue);
20199 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::IntegerAttr axis);
20200 static ReverseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::IntegerAttr axis);
20201 static ReverseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::IntegerAttr axis);
20202 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::IntegerAttr axis);
20203 static ReverseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::IntegerAttr axis);
20204 static ReverseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::IntegerAttr axis);
20205 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, uint32_t axis);
20206 static ReverseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, uint32_t axis);
20207 static ReverseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, uint32_t axis);
20208 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, uint32_t axis);
20209 static ReverseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, uint32_t axis);
20210 static ReverseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, uint32_t axis);
20211 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
20212 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20213 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
20214 static ReverseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20215 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
20216 static ReverseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20217 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20218 static ReverseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20219 static ReverseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20220 ::llvm::LogicalResult verifyInvariantsImpl();
20221 ::llvm::LogicalResult verifyInvariants();
20222 ::llvm::LogicalResult verify();
20223 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
20224 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
20225 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
20226 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
20227 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
20228private:
20229 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
20230 return getAttributeNameForIndex(name: (*this)->getName(), index);
20231 }
20232
20233 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
20234 assert(index < 1 && "invalid attribute index");
20235 assert(name.getStringRef() == getOperationName() && "invalid operation name");
20236 assert(name.isRegistered() && "Operation isn't registered, missing a "
20237 "dependent dialect loading?");
20238 return name.getAttributeNames()[index];
20239 }
20240
20241 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
20242public:
20243};
20244
20245} // namespace mlir::tosa
20246MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ReverseOp)
20247MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::ReverseOpGenericAdaptorBase::Properties)
20248
20249namespace mlir::tosa {
20250
20251
20252//===----------------------------------------------------------------------===//
20253// mlir::tosa::RowGatherBlockScaledOp declarations
20254//===----------------------------------------------------------------------===//
20255
20256namespace detail {
20257
20258class RowGatherBlockScaledOpGenericAdaptorBase {
20259public:
20260 struct Properties {
20261 using block_sizeTy = mlir::tosa::BlockSizeAttr;
20262 block_sizeTy block_size;
20263
20264 auto getBlockSize() const {
20265 auto &propStorage = this->block_size;
20266 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: propStorage);
20267 }
20268 void setBlockSize(const mlir::tosa::BlockSizeAttr &propValue) {
20269 this->block_size = propValue;
20270 }
20271 bool operator==(const Properties &rhs) const {
20272 return
20273 rhs.block_size == this->block_size &&
20274 true;
20275 }
20276 bool operator!=(const Properties &rhs) const {
20277 return !(*this == rhs);
20278 }
20279 };
20280protected:
20281 ::mlir::DictionaryAttr odsAttrs;
20282 ::std::optional<::mlir::OperationName> odsOpName;
20283 Properties properties;
20284 ::mlir::RegionRange odsRegions;
20285public:
20286 RowGatherBlockScaledOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
20287 odsOpName.emplace(args: "tosa.row_gather_block_scaled", args: odsAttrs.getContext());
20288 }
20289
20290 RowGatherBlockScaledOpGenericAdaptorBase(RowGatherBlockScaledOp op);
20291
20292 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
20293 const Properties &getProperties() {
20294 return properties;
20295 }
20296
20297 ::mlir::DictionaryAttr getAttributes() {
20298 return odsAttrs;
20299 }
20300
20301 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
20302 auto attr = ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val: getProperties().block_size);
20303 return attr;
20304 }
20305
20306 ::mlir::tosa::BlockSize getBlockSize();
20307};
20308
20309} // namespace detail
20310template <typename RangeT>
20311class RowGatherBlockScaledOpGenericAdaptor : public detail::RowGatherBlockScaledOpGenericAdaptorBase {
20312 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
20313 using Base = detail::RowGatherBlockScaledOpGenericAdaptorBase;
20314 static constexpr int odsIndex_values = 0;
20315 static constexpr int odsIndex_indices = 1;
20316 static constexpr int odsIndex_row_count = 2;
20317public:
20318 RowGatherBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
20319
20320 RowGatherBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RowGatherBlockScaledOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
20321
20322 RowGatherBlockScaledOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RowGatherBlockScaledOpGenericAdaptor(values, attrs, Properties{}, {}) {}
20323
20324 RowGatherBlockScaledOpGenericAdaptor(RangeT values, const RowGatherBlockScaledOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
20325
20326 template <typename LateInst = RowGatherBlockScaledOp, typename = std::enable_if_t<std::is_same_v<LateInst, RowGatherBlockScaledOp>>>
20327 RowGatherBlockScaledOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
20328
20329 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20330 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
20331 }
20332
20333 RangeT getODSOperands(unsigned index) {
20334 auto valueRange = getODSOperandIndexAndLength(index);
20335 return {std::next(odsOperands.begin(), valueRange.first),
20336 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
20337 }
20338
20339 RangeT getValues() {
20340 return getODSOperands(index: 0);
20341 }
20342
20343 ValueT getIndices() {
20344 return (*getODSOperands(index: 1).begin());
20345 }
20346
20347 ValueT getRowCount() {
20348 return (*getODSOperands(index: 2).begin());
20349 }
20350
20351 RangeT getOperands() {
20352 return odsOperands;
20353 }
20354
20355private:
20356 RangeT odsOperands;
20357};
20358class RowGatherBlockScaledOpAdaptor : public RowGatherBlockScaledOpGenericAdaptor<::mlir::ValueRange> {
20359public:
20360 using RowGatherBlockScaledOpGenericAdaptor::RowGatherBlockScaledOpGenericAdaptor;
20361 RowGatherBlockScaledOpAdaptor(RowGatherBlockScaledOp op);
20362
20363 ::llvm::LogicalResult verify(::mlir::Location loc);
20364};
20365class RowGatherBlockScaledOp : public ::mlir::Op<RowGatherBlockScaledOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
20366public:
20367 using Op::Op;
20368 using Op::print;
20369 using Adaptor = RowGatherBlockScaledOpAdaptor;
20370 template <typename RangeT>
20371 using GenericAdaptor = RowGatherBlockScaledOpGenericAdaptor<RangeT>;
20372 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
20373 static constexpr int odsIndex_values = 0;
20374 static constexpr int odsIndex_indices = 1;
20375 static constexpr int odsIndex_row_count = 2;
20376 static constexpr int odsIndex_output = 0;
20377 using Properties = FoldAdaptor::Properties;
20378 using ::mlir::InferShapedTypeOpInterface::Trait<RowGatherBlockScaledOp>::reifyReturnTypeShapes;
20379 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
20380 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("block_size")};
20381 return ::llvm::ArrayRef(attrNames);
20382 }
20383
20384 ::mlir::StringAttr getBlockSizeAttrName() {
20385 return getAttributeNameForIndex(index: 0);
20386 }
20387
20388 static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) {
20389 return getAttributeNameForIndex(name, index: 0);
20390 }
20391
20392 static constexpr ::llvm::StringLiteral getOperationName() {
20393 return ::llvm::StringLiteral("tosa.row_gather_block_scaled");
20394 }
20395
20396 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
20397 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
20398 auto [start, length] = getODSOperandIndexAndLength(index);
20399 return getOperation()->getOperands().slice(n: start, m: length);
20400 }
20401
20402 ::mlir::Operation::operand_range getValues() {
20403 return getODSOperands(index: 0);
20404 }
20405
20406 ::mlir::TypedValue<::mlir::TensorType> getIndices() {
20407 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
20408 }
20409
20410 ::mlir::TypedValue<::mlir::TensorType> getRowCount() {
20411 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
20412 }
20413
20414 ::mlir::MutableOperandRange getValuesMutable();
20415 ::mlir::OpOperand &getIndicesMutable() {
20416 auto range = getODSOperandIndexAndLength(index: 1);
20417 return getOperation()->getOpOperand(idx: range.first);
20418 }
20419
20420 ::mlir::OpOperand &getRowCountMutable() {
20421 auto range = getODSOperandIndexAndLength(index: 2);
20422 return getOperation()->getOpOperand(idx: range.first);
20423 }
20424
20425 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
20426 ::mlir::Operation::result_range getODSResults(unsigned index) {
20427 auto valueRange = getODSResultIndexAndLength(index);
20428 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
20429 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
20430 }
20431
20432 ::mlir::Operation::result_range getOutput() {
20433 return getODSResults(index: 0);
20434 }
20435
20436 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
20437 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
20438 static llvm::hash_code computePropertiesHash(const Properties &prop);
20439 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
20440 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
20441 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
20442 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
20443 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
20444 void writeProperties(::mlir::DialectBytecodeWriter &writer);
20445 mlir::tosa::BlockSizeAttr getBlockSizeAttr() {
20446 return ::llvm::cast<mlir::tosa::BlockSizeAttr>(Val&: getProperties().block_size);
20447 }
20448
20449 ::mlir::tosa::BlockSize getBlockSize();
20450 void setBlockSizeAttr(mlir::tosa::BlockSizeAttr attr) {
20451 getProperties().block_size = attr;
20452 }
20453
20454 void setBlockSize(::mlir::tosa::BlockSize attrValue);
20455 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange values, ::mlir::Value indices, ::mlir::Value row_count, mlir::tosa::BlockSizeAttr block_size);
20456 static RowGatherBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange output, ::mlir::ValueRange values, ::mlir::Value indices, ::mlir::Value row_count, mlir::tosa::BlockSizeAttr block_size);
20457 static RowGatherBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange output, ::mlir::ValueRange values, ::mlir::Value indices, ::mlir::Value row_count, mlir::tosa::BlockSizeAttr block_size);
20458 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange values, ::mlir::Value indices, ::mlir::Value row_count, ::mlir::tosa::BlockSize block_size);
20459 static RowGatherBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange output, ::mlir::ValueRange values, ::mlir::Value indices, ::mlir::Value row_count, ::mlir::tosa::BlockSize block_size);
20460 static RowGatherBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange output, ::mlir::ValueRange values, ::mlir::Value indices, ::mlir::Value row_count, ::mlir::tosa::BlockSize block_size);
20461 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
20462 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20463 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
20464 static RowGatherBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20465 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
20466 static RowGatherBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20467 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20468 static RowGatherBlockScaledOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20469 static RowGatherBlockScaledOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20470 ::llvm::LogicalResult verifyInvariantsImpl();
20471 ::llvm::LogicalResult verifyInvariants();
20472 ::llvm::LogicalResult verify();
20473 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
20474 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
20475 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
20476 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
20477private:
20478 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
20479 return getAttributeNameForIndex(name: (*this)->getName(), index);
20480 }
20481
20482 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
20483 assert(index < 1 && "invalid attribute index");
20484 assert(name.getStringRef() == getOperationName() && "invalid operation name");
20485 assert(name.isRegistered() && "Operation isn't registered, missing a "
20486 "dependent dialect loading?");
20487 return name.getAttributeNames()[index];
20488 }
20489
20490 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
20491public:
20492 static ::llvm::LogicalResult
20493 inferReturnTypeComponents(::mlir::MLIRContext *context,
20494 std::optional<::mlir::Location> location,
20495 Adaptor adaptor,
20496 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
20497
20498};
20499
20500} // namespace mlir::tosa
20501MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::RowGatherBlockScaledOp)
20502MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::RowGatherBlockScaledOpGenericAdaptorBase::Properties)
20503
20504namespace mlir::tosa {
20505
20506
20507//===----------------------------------------------------------------------===//
20508// mlir::tosa::RowGatherOp declarations
20509//===----------------------------------------------------------------------===//
20510
20511namespace detail {
20512
20513class RowGatherOpGenericAdaptorBase {
20514public:
20515 using Properties = ::mlir::EmptyProperties;
20516protected:
20517 ::mlir::DictionaryAttr odsAttrs;
20518 ::std::optional<::mlir::OperationName> odsOpName;
20519 Properties properties;
20520 ::mlir::RegionRange odsRegions;
20521public:
20522 RowGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
20523 odsOpName.emplace(args: "tosa.row_gather", args: odsAttrs.getContext());
20524 }
20525
20526 RowGatherOpGenericAdaptorBase(RowGatherOp op);
20527
20528 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
20529 return {index, 1};
20530 }
20531
20532 const Properties &getProperties() {
20533 return properties;
20534 }
20535
20536 ::mlir::DictionaryAttr getAttributes() {
20537 return odsAttrs;
20538 }
20539
20540};
20541
20542} // namespace detail
20543template <typename RangeT>
20544class RowGatherOpGenericAdaptor : public detail::RowGatherOpGenericAdaptorBase {
20545 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
20546 using Base = detail::RowGatherOpGenericAdaptorBase;
20547 static constexpr int odsIndex_values = 0;
20548 static constexpr int odsIndex_indices = 1;
20549 static constexpr int odsIndex_row_count = 2;
20550public:
20551 RowGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
20552
20553 RowGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RowGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
20554
20555 RowGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RowGatherOpGenericAdaptor(values, attrs, Properties{}, {}) {}
20556
20557 RowGatherOpGenericAdaptor(RangeT values, const RowGatherOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
20558
20559 template <typename LateInst = RowGatherOp, typename = std::enable_if_t<std::is_same_v<LateInst, RowGatherOp>>>
20560 RowGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
20561
20562 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20563 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
20564 }
20565
20566 RangeT getODSOperands(unsigned index) {
20567 auto valueRange = getODSOperandIndexAndLength(index);
20568 return {std::next(odsOperands.begin(), valueRange.first),
20569 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
20570 }
20571
20572 ValueT getValues() {
20573 return (*getODSOperands(index: 0).begin());
20574 }
20575
20576 ValueT getIndices() {
20577 return (*getODSOperands(index: 1).begin());
20578 }
20579
20580 ValueT getRowCount() {
20581 return (*getODSOperands(index: 2).begin());
20582 }
20583
20584 RangeT getOperands() {
20585 return odsOperands;
20586 }
20587
20588private:
20589 RangeT odsOperands;
20590};
20591class RowGatherOpAdaptor : public RowGatherOpGenericAdaptor<::mlir::ValueRange> {
20592public:
20593 using RowGatherOpGenericAdaptor::RowGatherOpGenericAdaptor;
20594 RowGatherOpAdaptor(RowGatherOp op);
20595
20596 ::llvm::LogicalResult verify(::mlir::Location loc);
20597};
20598class RowGatherOp : public ::mlir::Op<RowGatherOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
20599public:
20600 using Op::Op;
20601 using Op::print;
20602 using Adaptor = RowGatherOpAdaptor;
20603 template <typename RangeT>
20604 using GenericAdaptor = RowGatherOpGenericAdaptor<RangeT>;
20605 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
20606 static constexpr int odsIndex_values = 0;
20607 static constexpr int odsIndex_indices = 1;
20608 static constexpr int odsIndex_row_count = 2;
20609 static constexpr int odsIndex_output = 0;
20610 using Properties = FoldAdaptor::Properties;
20611 using ::mlir::InferShapedTypeOpInterface::Trait<RowGatherOp>::reifyReturnTypeShapes;
20612 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
20613 return {};
20614 }
20615
20616 static constexpr ::llvm::StringLiteral getOperationName() {
20617 return ::llvm::StringLiteral("tosa.row_gather");
20618 }
20619
20620 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20621 return {index, 1};
20622 }
20623
20624 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
20625 auto [start, length] = getODSOperandIndexAndLength(index);
20626 return getOperation()->getOperands().slice(n: start, m: length);
20627 }
20628
20629 ::mlir::TypedValue<::mlir::TensorType> getValues() {
20630 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
20631 }
20632
20633 ::mlir::TypedValue<::mlir::TensorType> getIndices() {
20634 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
20635 }
20636
20637 ::mlir::TypedValue<::mlir::TensorType> getRowCount() {
20638 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
20639 }
20640
20641 ::mlir::OpOperand &getValuesMutable() {
20642 auto range = getODSOperandIndexAndLength(index: 0);
20643 return getOperation()->getOpOperand(idx: range.first);
20644 }
20645
20646 ::mlir::OpOperand &getIndicesMutable() {
20647 auto range = getODSOperandIndexAndLength(index: 1);
20648 return getOperation()->getOpOperand(idx: range.first);
20649 }
20650
20651 ::mlir::OpOperand &getRowCountMutable() {
20652 auto range = getODSOperandIndexAndLength(index: 2);
20653 return getOperation()->getOpOperand(idx: range.first);
20654 }
20655
20656 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
20657 return {index, 1};
20658 }
20659
20660 ::mlir::Operation::result_range getODSResults(unsigned index) {
20661 auto valueRange = getODSResultIndexAndLength(index);
20662 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
20663 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
20664 }
20665
20666 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
20667 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
20668 }
20669
20670 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
20671 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
20672 static llvm::hash_code computePropertiesHash(const Properties &prop);
20673 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
20674 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
20675 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
20676 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
20677 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices, ::mlir::Value row_count);
20678 static RowGatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices, ::mlir::Value row_count);
20679 static RowGatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value values, ::mlir::Value indices, ::mlir::Value row_count);
20680 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices, ::mlir::Value row_count);
20681 static RowGatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices, ::mlir::Value row_count);
20682 static RowGatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value values, ::mlir::Value indices, ::mlir::Value row_count);
20683 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20684 static RowGatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20685 static RowGatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20686 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20687 static RowGatherOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20688 static RowGatherOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20689 ::llvm::LogicalResult verifyInvariantsImpl();
20690 ::llvm::LogicalResult verifyInvariants();
20691 ::llvm::LogicalResult verify();
20692 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
20693 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
20694 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
20695 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
20696 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
20697public:
20698 static ::llvm::LogicalResult
20699 inferReturnTypeComponents(::mlir::MLIRContext *context,
20700 std::optional<::mlir::Location> location,
20701 Adaptor adaptor,
20702 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
20703
20704};
20705
20706} // namespace mlir::tosa
20707MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::RowGatherOp)
20708
20709namespace mlir::tosa {
20710
20711
20712//===----------------------------------------------------------------------===//
20713// mlir::tosa::RsqrtOp declarations
20714//===----------------------------------------------------------------------===//
20715
20716namespace detail {
20717
20718class RsqrtOpGenericAdaptorBase {
20719public:
20720 using Properties = ::mlir::EmptyProperties;
20721protected:
20722 ::mlir::DictionaryAttr odsAttrs;
20723 ::std::optional<::mlir::OperationName> odsOpName;
20724 Properties properties;
20725 ::mlir::RegionRange odsRegions;
20726public:
20727 RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
20728 odsOpName.emplace(args: "tosa.rsqrt", args: odsAttrs.getContext());
20729 }
20730
20731 RsqrtOpGenericAdaptorBase(RsqrtOp op);
20732
20733 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
20734 return {index, 1};
20735 }
20736
20737 const Properties &getProperties() {
20738 return properties;
20739 }
20740
20741 ::mlir::DictionaryAttr getAttributes() {
20742 return odsAttrs;
20743 }
20744
20745};
20746
20747} // namespace detail
20748template <typename RangeT>
20749class RsqrtOpGenericAdaptor : public detail::RsqrtOpGenericAdaptorBase {
20750 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
20751 using Base = detail::RsqrtOpGenericAdaptorBase;
20752 static constexpr int odsIndex_input1 = 0;
20753public:
20754 RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
20755
20756 RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RsqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
20757
20758 RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RsqrtOpGenericAdaptor(values, attrs, Properties{}, {}) {}
20759
20760 RsqrtOpGenericAdaptor(RangeT values, const RsqrtOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
20761
20762 template <typename LateInst = RsqrtOp, typename = std::enable_if_t<std::is_same_v<LateInst, RsqrtOp>>>
20763 RsqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
20764
20765 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20766 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
20767 }
20768
20769 RangeT getODSOperands(unsigned index) {
20770 auto valueRange = getODSOperandIndexAndLength(index);
20771 return {std::next(odsOperands.begin(), valueRange.first),
20772 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
20773 }
20774
20775 ValueT getInput1() {
20776 return (*getODSOperands(index: 0).begin());
20777 }
20778
20779 RangeT getOperands() {
20780 return odsOperands;
20781 }
20782
20783private:
20784 RangeT odsOperands;
20785};
20786class RsqrtOpAdaptor : public RsqrtOpGenericAdaptor<::mlir::ValueRange> {
20787public:
20788 using RsqrtOpGenericAdaptor::RsqrtOpGenericAdaptor;
20789 RsqrtOpAdaptor(RsqrtOp op);
20790
20791 ::llvm::LogicalResult verify(::mlir::Location loc);
20792};
20793class RsqrtOp : public ::mlir::Op<RsqrtOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
20794public:
20795 using Op::Op;
20796 using Op::print;
20797 using Adaptor = RsqrtOpAdaptor;
20798 template <typename RangeT>
20799 using GenericAdaptor = RsqrtOpGenericAdaptor<RangeT>;
20800 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
20801 static constexpr int odsIndex_input1 = 0;
20802 static constexpr int odsIndex_output = 0;
20803 using Properties = FoldAdaptor::Properties;
20804 using ::mlir::InferShapedTypeOpInterface::Trait<RsqrtOp>::reifyReturnTypeShapes;
20805 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
20806 return {};
20807 }
20808
20809 static constexpr ::llvm::StringLiteral getOperationName() {
20810 return ::llvm::StringLiteral("tosa.rsqrt");
20811 }
20812
20813 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20814 return {index, 1};
20815 }
20816
20817 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
20818 auto [start, length] = getODSOperandIndexAndLength(index);
20819 return getOperation()->getOperands().slice(n: start, m: length);
20820 }
20821
20822 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
20823 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
20824 }
20825
20826 ::mlir::OpOperand &getInput1Mutable() {
20827 auto range = getODSOperandIndexAndLength(index: 0);
20828 return getOperation()->getOpOperand(idx: range.first);
20829 }
20830
20831 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
20832 return {index, 1};
20833 }
20834
20835 ::mlir::Operation::result_range getODSResults(unsigned index) {
20836 auto valueRange = getODSResultIndexAndLength(index);
20837 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
20838 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
20839 }
20840
20841 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
20842 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
20843 }
20844
20845 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
20846 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
20847 static llvm::hash_code computePropertiesHash(const Properties &prop);
20848 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
20849 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
20850 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
20851 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
20852 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
20853 static RsqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
20854 static RsqrtOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
20855 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
20856 static RsqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
20857 static RsqrtOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
20858 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20859 static RsqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20860 static RsqrtOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
20861 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20862 static RsqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20863 static RsqrtOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
20864 ::llvm::LogicalResult verifyInvariantsImpl();
20865 ::llvm::LogicalResult verifyInvariants();
20866 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
20867 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
20868 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
20869 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
20870public:
20871};
20872
20873} // namespace mlir::tosa
20874MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::RsqrtOp)
20875
20876namespace mlir::tosa {
20877
20878
20879//===----------------------------------------------------------------------===//
20880// mlir::tosa::ScatterOp declarations
20881//===----------------------------------------------------------------------===//
20882
20883namespace detail {
20884
20885class ScatterOpGenericAdaptorBase {
20886public:
20887 using Properties = ::mlir::EmptyProperties;
20888protected:
20889 ::mlir::DictionaryAttr odsAttrs;
20890 ::std::optional<::mlir::OperationName> odsOpName;
20891 Properties properties;
20892 ::mlir::RegionRange odsRegions;
20893public:
20894 ScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
20895 odsOpName.emplace(args: "tosa.scatter", args: odsAttrs.getContext());
20896 }
20897
20898 ScatterOpGenericAdaptorBase(ScatterOp op);
20899
20900 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
20901 return {index, 1};
20902 }
20903
20904 const Properties &getProperties() {
20905 return properties;
20906 }
20907
20908 ::mlir::DictionaryAttr getAttributes() {
20909 return odsAttrs;
20910 }
20911
20912};
20913
20914} // namespace detail
20915template <typename RangeT>
20916class ScatterOpGenericAdaptor : public detail::ScatterOpGenericAdaptorBase {
20917 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
20918 using Base = detail::ScatterOpGenericAdaptorBase;
20919 static constexpr int odsIndex_values_in = 0;
20920 static constexpr int odsIndex_indices = 1;
20921 static constexpr int odsIndex_input = 2;
20922public:
20923 ScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
20924
20925 ScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
20926
20927 ScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ScatterOpGenericAdaptor(values, attrs, Properties{}, {}) {}
20928
20929 ScatterOpGenericAdaptor(RangeT values, const ScatterOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
20930
20931 template <typename LateInst = ScatterOp, typename = std::enable_if_t<std::is_same_v<LateInst, ScatterOp>>>
20932 ScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
20933
20934 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20935 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
20936 }
20937
20938 RangeT getODSOperands(unsigned index) {
20939 auto valueRange = getODSOperandIndexAndLength(index);
20940 return {std::next(odsOperands.begin(), valueRange.first),
20941 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
20942 }
20943
20944 ValueT getValuesIn() {
20945 return (*getODSOperands(index: 0).begin());
20946 }
20947
20948 ValueT getIndices() {
20949 return (*getODSOperands(index: 1).begin());
20950 }
20951
20952 ValueT getInput() {
20953 return (*getODSOperands(index: 2).begin());
20954 }
20955
20956 RangeT getOperands() {
20957 return odsOperands;
20958 }
20959
20960private:
20961 RangeT odsOperands;
20962};
20963class ScatterOpAdaptor : public ScatterOpGenericAdaptor<::mlir::ValueRange> {
20964public:
20965 using ScatterOpGenericAdaptor::ScatterOpGenericAdaptor;
20966 ScatterOpAdaptor(ScatterOp op);
20967
20968 ::llvm::LogicalResult verify(::mlir::Location loc);
20969};
20970class ScatterOp : public ::mlir::Op<ScatterOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
20971public:
20972 using Op::Op;
20973 using Op::print;
20974 using Adaptor = ScatterOpAdaptor;
20975 template <typename RangeT>
20976 using GenericAdaptor = ScatterOpGenericAdaptor<RangeT>;
20977 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
20978 static constexpr int odsIndex_values_in = 0;
20979 static constexpr int odsIndex_indices = 1;
20980 static constexpr int odsIndex_input = 2;
20981 static constexpr int odsIndex_values_out = 0;
20982 using Properties = FoldAdaptor::Properties;
20983 using ::mlir::InferShapedTypeOpInterface::Trait<ScatterOp>::reifyReturnTypeShapes;
20984 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
20985 return {};
20986 }
20987
20988 static constexpr ::llvm::StringLiteral getOperationName() {
20989 return ::llvm::StringLiteral("tosa.scatter");
20990 }
20991
20992 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
20993 return {index, 1};
20994 }
20995
20996 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
20997 auto [start, length] = getODSOperandIndexAndLength(index);
20998 return getOperation()->getOperands().slice(n: start, m: length);
20999 }
21000
21001 ::mlir::TypedValue<::mlir::TensorType> getValuesIn() {
21002 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
21003 }
21004
21005 ::mlir::TypedValue<::mlir::TensorType> getIndices() {
21006 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
21007 }
21008
21009 ::mlir::TypedValue<::mlir::TensorType> getInput() {
21010 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
21011 }
21012
21013 ::mlir::OpOperand &getValuesInMutable() {
21014 auto range = getODSOperandIndexAndLength(index: 0);
21015 return getOperation()->getOpOperand(idx: range.first);
21016 }
21017
21018 ::mlir::OpOperand &getIndicesMutable() {
21019 auto range = getODSOperandIndexAndLength(index: 1);
21020 return getOperation()->getOpOperand(idx: range.first);
21021 }
21022
21023 ::mlir::OpOperand &getInputMutable() {
21024 auto range = getODSOperandIndexAndLength(index: 2);
21025 return getOperation()->getOpOperand(idx: range.first);
21026 }
21027
21028 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
21029 return {index, 1};
21030 }
21031
21032 ::mlir::Operation::result_range getODSResults(unsigned index) {
21033 auto valueRange = getODSResultIndexAndLength(index);
21034 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
21035 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
21036 }
21037
21038 ::mlir::TypedValue<::mlir::TensorType> getValuesOut() {
21039 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
21040 }
21041
21042 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21043 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
21044 static llvm::hash_code computePropertiesHash(const Properties &prop);
21045 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
21046 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
21047 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
21048 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21049 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values_out, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input);
21050 static ScatterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type values_out, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input);
21051 static ScatterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type values_out, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input);
21052 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input);
21053 static ScatterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input);
21054 static ScatterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value values_in, ::mlir::Value indices, ::mlir::Value input);
21055 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21056 static ScatterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21057 static ScatterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21058 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21059 static ScatterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21060 static ScatterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21061 ::llvm::LogicalResult verifyInvariantsImpl();
21062 ::llvm::LogicalResult verifyInvariants();
21063 ::llvm::LogicalResult verify();
21064 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
21065 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
21066 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
21067 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
21068public:
21069 static ::llvm::LogicalResult
21070 inferReturnTypeComponents(::mlir::MLIRContext *context,
21071 std::optional<::mlir::Location> location,
21072 Adaptor adaptor,
21073 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
21074
21075};
21076
21077} // namespace mlir::tosa
21078MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::ScatterOp)
21079
21080namespace mlir::tosa {
21081
21082
21083//===----------------------------------------------------------------------===//
21084// mlir::tosa::SelectOp declarations
21085//===----------------------------------------------------------------------===//
21086
21087namespace detail {
21088
21089class SelectOpGenericAdaptorBase {
21090public:
21091 using Properties = ::mlir::EmptyProperties;
21092protected:
21093 ::mlir::DictionaryAttr odsAttrs;
21094 ::std::optional<::mlir::OperationName> odsOpName;
21095 Properties properties;
21096 ::mlir::RegionRange odsRegions;
21097public:
21098 SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
21099 odsOpName.emplace(args: "tosa.select", args: odsAttrs.getContext());
21100 }
21101
21102 SelectOpGenericAdaptorBase(SelectOp op);
21103
21104 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
21105 return {index, 1};
21106 }
21107
21108 const Properties &getProperties() {
21109 return properties;
21110 }
21111
21112 ::mlir::DictionaryAttr getAttributes() {
21113 return odsAttrs;
21114 }
21115
21116};
21117
21118} // namespace detail
21119template <typename RangeT>
21120class SelectOpGenericAdaptor : public detail::SelectOpGenericAdaptorBase {
21121 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
21122 using Base = detail::SelectOpGenericAdaptorBase;
21123 static constexpr int odsIndex_input1 = 0;
21124 static constexpr int odsIndex_input2 = 1;
21125 static constexpr int odsIndex_input3 = 2;
21126public:
21127 SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
21128
21129 SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SelectOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
21130
21131 SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SelectOpGenericAdaptor(values, attrs, Properties{}, {}) {}
21132
21133 SelectOpGenericAdaptor(RangeT values, const SelectOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
21134
21135 template <typename LateInst = SelectOp, typename = std::enable_if_t<std::is_same_v<LateInst, SelectOp>>>
21136 SelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
21137
21138 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21139 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
21140 }
21141
21142 RangeT getODSOperands(unsigned index) {
21143 auto valueRange = getODSOperandIndexAndLength(index);
21144 return {std::next(odsOperands.begin(), valueRange.first),
21145 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
21146 }
21147
21148 ValueT getInput1() {
21149 return (*getODSOperands(index: 0).begin());
21150 }
21151
21152 ValueT getInput2() {
21153 return (*getODSOperands(index: 1).begin());
21154 }
21155
21156 ValueT getInput3() {
21157 return (*getODSOperands(index: 2).begin());
21158 }
21159
21160 RangeT getOperands() {
21161 return odsOperands;
21162 }
21163
21164private:
21165 RangeT odsOperands;
21166};
21167class SelectOpAdaptor : public SelectOpGenericAdaptor<::mlir::ValueRange> {
21168public:
21169 using SelectOpGenericAdaptor::SelectOpGenericAdaptor;
21170 SelectOpAdaptor(SelectOp op);
21171
21172 ::llvm::LogicalResult verify(::mlir::Location loc);
21173};
21174class SelectOp : public ::mlir::Op<SelectOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
21175public:
21176 using Op::Op;
21177 using Op::print;
21178 using Adaptor = SelectOpAdaptor;
21179 template <typename RangeT>
21180 using GenericAdaptor = SelectOpGenericAdaptor<RangeT>;
21181 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
21182 static constexpr int odsIndex_input1 = 0;
21183 static constexpr int odsIndex_input2 = 1;
21184 static constexpr int odsIndex_input3 = 2;
21185 static constexpr int odsIndex_output = 0;
21186 using Properties = FoldAdaptor::Properties;
21187 using ::mlir::InferShapedTypeOpInterface::Trait<SelectOp>::reifyReturnTypeShapes;
21188 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
21189 return {};
21190 }
21191
21192 static constexpr ::llvm::StringLiteral getOperationName() {
21193 return ::llvm::StringLiteral("tosa.select");
21194 }
21195
21196 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21197 return {index, 1};
21198 }
21199
21200 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
21201 auto [start, length] = getODSOperandIndexAndLength(index);
21202 return getOperation()->getOperands().slice(n: start, m: length);
21203 }
21204
21205 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
21206 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
21207 }
21208
21209 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
21210 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
21211 }
21212
21213 ::mlir::TypedValue<::mlir::TensorType> getInput3() {
21214 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
21215 }
21216
21217 ::mlir::OpOperand &getInput1Mutable() {
21218 auto range = getODSOperandIndexAndLength(index: 0);
21219 return getOperation()->getOpOperand(idx: range.first);
21220 }
21221
21222 ::mlir::OpOperand &getInput2Mutable() {
21223 auto range = getODSOperandIndexAndLength(index: 1);
21224 return getOperation()->getOpOperand(idx: range.first);
21225 }
21226
21227 ::mlir::OpOperand &getInput3Mutable() {
21228 auto range = getODSOperandIndexAndLength(index: 2);
21229 return getOperation()->getOpOperand(idx: range.first);
21230 }
21231
21232 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
21233 return {index, 1};
21234 }
21235
21236 ::mlir::Operation::result_range getODSResults(unsigned index) {
21237 auto valueRange = getODSResultIndexAndLength(index);
21238 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
21239 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
21240 }
21241
21242 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
21243 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
21244 }
21245
21246 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21247 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
21248 static llvm::hash_code computePropertiesHash(const Properties &prop);
21249 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
21250 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
21251 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
21252 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21253 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value input3);
21254 static SelectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value input3);
21255 static SelectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value input3);
21256 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value input3);
21257 static SelectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value input3);
21258 static SelectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2, ::mlir::Value input3);
21259 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21260 static SelectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21261 static SelectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21262 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21263 static SelectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21264 static SelectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21265 ::llvm::LogicalResult verifyInvariantsImpl();
21266 ::llvm::LogicalResult verifyInvariants();
21267 ::llvm::LogicalResult verify();
21268 static ::llvm::LogicalResult canonicalize(SelectOp op, ::mlir::PatternRewriter &rewriter);
21269 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
21270 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
21271 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
21272 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
21273 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
21274 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
21275public:
21276 // Custom getters for readability
21277 ::mlir::TypedValue<::mlir::TensorType> getPred() { return getInput1(); }
21278 ::mlir::TypedValue<::mlir::TensorType> getOnTrue() { return getInput2(); }
21279 ::mlir::TypedValue<::mlir::TensorType> getOnFalse() { return getInput3(); }
21280};
21281
21282} // namespace mlir::tosa
21283MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::SelectOp)
21284
21285namespace mlir::tosa {
21286
21287
21288//===----------------------------------------------------------------------===//
21289// mlir::tosa::SigmoidOp declarations
21290//===----------------------------------------------------------------------===//
21291
21292namespace detail {
21293
21294class SigmoidOpGenericAdaptorBase {
21295public:
21296 using Properties = ::mlir::EmptyProperties;
21297protected:
21298 ::mlir::DictionaryAttr odsAttrs;
21299 ::std::optional<::mlir::OperationName> odsOpName;
21300 Properties properties;
21301 ::mlir::RegionRange odsRegions;
21302public:
21303 SigmoidOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
21304 odsOpName.emplace(args: "tosa.sigmoid", args: odsAttrs.getContext());
21305 }
21306
21307 SigmoidOpGenericAdaptorBase(SigmoidOp op);
21308
21309 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
21310 return {index, 1};
21311 }
21312
21313 const Properties &getProperties() {
21314 return properties;
21315 }
21316
21317 ::mlir::DictionaryAttr getAttributes() {
21318 return odsAttrs;
21319 }
21320
21321};
21322
21323} // namespace detail
21324template <typename RangeT>
21325class SigmoidOpGenericAdaptor : public detail::SigmoidOpGenericAdaptorBase {
21326 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
21327 using Base = detail::SigmoidOpGenericAdaptorBase;
21328 static constexpr int odsIndex_input = 0;
21329public:
21330 SigmoidOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
21331
21332 SigmoidOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SigmoidOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
21333
21334 SigmoidOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SigmoidOpGenericAdaptor(values, attrs, Properties{}, {}) {}
21335
21336 SigmoidOpGenericAdaptor(RangeT values, const SigmoidOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
21337
21338 template <typename LateInst = SigmoidOp, typename = std::enable_if_t<std::is_same_v<LateInst, SigmoidOp>>>
21339 SigmoidOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
21340
21341 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21342 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
21343 }
21344
21345 RangeT getODSOperands(unsigned index) {
21346 auto valueRange = getODSOperandIndexAndLength(index);
21347 return {std::next(odsOperands.begin(), valueRange.first),
21348 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
21349 }
21350
21351 ValueT getInput() {
21352 return (*getODSOperands(index: 0).begin());
21353 }
21354
21355 RangeT getOperands() {
21356 return odsOperands;
21357 }
21358
21359private:
21360 RangeT odsOperands;
21361};
21362class SigmoidOpAdaptor : public SigmoidOpGenericAdaptor<::mlir::ValueRange> {
21363public:
21364 using SigmoidOpGenericAdaptor::SigmoidOpGenericAdaptor;
21365 SigmoidOpAdaptor(SigmoidOp op);
21366
21367 ::llvm::LogicalResult verify(::mlir::Location loc);
21368};
21369class SigmoidOp : public ::mlir::Op<SigmoidOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
21370public:
21371 using Op::Op;
21372 using Op::print;
21373 using Adaptor = SigmoidOpAdaptor;
21374 template <typename RangeT>
21375 using GenericAdaptor = SigmoidOpGenericAdaptor<RangeT>;
21376 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
21377 static constexpr int odsIndex_input = 0;
21378 static constexpr int odsIndex_output = 0;
21379 using Properties = FoldAdaptor::Properties;
21380 using ::mlir::InferShapedTypeOpInterface::Trait<SigmoidOp>::reifyReturnTypeShapes;
21381 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
21382 return {};
21383 }
21384
21385 static constexpr ::llvm::StringLiteral getOperationName() {
21386 return ::llvm::StringLiteral("tosa.sigmoid");
21387 }
21388
21389 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21390 return {index, 1};
21391 }
21392
21393 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
21394 auto [start, length] = getODSOperandIndexAndLength(index);
21395 return getOperation()->getOperands().slice(n: start, m: length);
21396 }
21397
21398 ::mlir::TypedValue<::mlir::TensorType> getInput() {
21399 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
21400 }
21401
21402 ::mlir::OpOperand &getInputMutable() {
21403 auto range = getODSOperandIndexAndLength(index: 0);
21404 return getOperation()->getOpOperand(idx: range.first);
21405 }
21406
21407 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
21408 return {index, 1};
21409 }
21410
21411 ::mlir::Operation::result_range getODSResults(unsigned index) {
21412 auto valueRange = getODSResultIndexAndLength(index);
21413 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
21414 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
21415 }
21416
21417 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
21418 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
21419 }
21420
21421 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21422 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
21423 static llvm::hash_code computePropertiesHash(const Properties &prop);
21424 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
21425 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
21426 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
21427 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21428 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input);
21429 static SigmoidOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input);
21430 static SigmoidOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input);
21431 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input);
21432 static SigmoidOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input);
21433 static SigmoidOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input);
21434 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21435 static SigmoidOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21436 static SigmoidOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21437 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21438 static SigmoidOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21439 static SigmoidOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21440 ::llvm::LogicalResult verifyInvariantsImpl();
21441 ::llvm::LogicalResult verifyInvariants();
21442 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
21443 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
21444 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
21445 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
21446public:
21447};
21448
21449} // namespace mlir::tosa
21450MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::SigmoidOp)
21451
21452namespace mlir::tosa {
21453
21454
21455//===----------------------------------------------------------------------===//
21456// mlir::tosa::SinOp declarations
21457//===----------------------------------------------------------------------===//
21458
21459namespace detail {
21460
21461class SinOpGenericAdaptorBase {
21462public:
21463 using Properties = ::mlir::EmptyProperties;
21464protected:
21465 ::mlir::DictionaryAttr odsAttrs;
21466 ::std::optional<::mlir::OperationName> odsOpName;
21467 Properties properties;
21468 ::mlir::RegionRange odsRegions;
21469public:
21470 SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
21471 odsOpName.emplace(args: "tosa.sin", args: odsAttrs.getContext());
21472 }
21473
21474 SinOpGenericAdaptorBase(SinOp op);
21475
21476 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
21477 return {index, 1};
21478 }
21479
21480 const Properties &getProperties() {
21481 return properties;
21482 }
21483
21484 ::mlir::DictionaryAttr getAttributes() {
21485 return odsAttrs;
21486 }
21487
21488};
21489
21490} // namespace detail
21491template <typename RangeT>
21492class SinOpGenericAdaptor : public detail::SinOpGenericAdaptorBase {
21493 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
21494 using Base = detail::SinOpGenericAdaptorBase;
21495 static constexpr int odsIndex_input1 = 0;
21496public:
21497 SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
21498
21499 SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SinOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
21500
21501 SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SinOpGenericAdaptor(values, attrs, Properties{}, {}) {}
21502
21503 SinOpGenericAdaptor(RangeT values, const SinOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
21504
21505 template <typename LateInst = SinOp, typename = std::enable_if_t<std::is_same_v<LateInst, SinOp>>>
21506 SinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
21507
21508 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21509 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
21510 }
21511
21512 RangeT getODSOperands(unsigned index) {
21513 auto valueRange = getODSOperandIndexAndLength(index);
21514 return {std::next(odsOperands.begin(), valueRange.first),
21515 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
21516 }
21517
21518 ValueT getInput1() {
21519 return (*getODSOperands(index: 0).begin());
21520 }
21521
21522 RangeT getOperands() {
21523 return odsOperands;
21524 }
21525
21526private:
21527 RangeT odsOperands;
21528};
21529class SinOpAdaptor : public SinOpGenericAdaptor<::mlir::ValueRange> {
21530public:
21531 using SinOpGenericAdaptor::SinOpGenericAdaptor;
21532 SinOpAdaptor(SinOp op);
21533
21534 ::llvm::LogicalResult verify(::mlir::Location loc);
21535};
21536class SinOp : public ::mlir::Op<SinOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
21537public:
21538 using Op::Op;
21539 using Op::print;
21540 using Adaptor = SinOpAdaptor;
21541 template <typename RangeT>
21542 using GenericAdaptor = SinOpGenericAdaptor<RangeT>;
21543 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
21544 static constexpr int odsIndex_input1 = 0;
21545 static constexpr int odsIndex_output = 0;
21546 using Properties = FoldAdaptor::Properties;
21547 using ::mlir::InferShapedTypeOpInterface::Trait<SinOp>::reifyReturnTypeShapes;
21548 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
21549 return {};
21550 }
21551
21552 static constexpr ::llvm::StringLiteral getOperationName() {
21553 return ::llvm::StringLiteral("tosa.sin");
21554 }
21555
21556 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21557 return {index, 1};
21558 }
21559
21560 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
21561 auto [start, length] = getODSOperandIndexAndLength(index);
21562 return getOperation()->getOperands().slice(n: start, m: length);
21563 }
21564
21565 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
21566 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
21567 }
21568
21569 ::mlir::OpOperand &getInput1Mutable() {
21570 auto range = getODSOperandIndexAndLength(index: 0);
21571 return getOperation()->getOpOperand(idx: range.first);
21572 }
21573
21574 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
21575 return {index, 1};
21576 }
21577
21578 ::mlir::Operation::result_range getODSResults(unsigned index) {
21579 auto valueRange = getODSResultIndexAndLength(index);
21580 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
21581 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
21582 }
21583
21584 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
21585 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
21586 }
21587
21588 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21589 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
21590 static llvm::hash_code computePropertiesHash(const Properties &prop);
21591 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
21592 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
21593 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
21594 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21595 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1);
21596 static SinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1);
21597 static SinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1);
21598 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
21599 static SinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
21600 static SinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1);
21601 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21602 static SinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21603 static SinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21604 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21605 static SinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21606 static SinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21607 ::llvm::LogicalResult verifyInvariantsImpl();
21608 ::llvm::LogicalResult verifyInvariants();
21609 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
21610 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
21611 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
21612 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
21613public:
21614};
21615
21616} // namespace mlir::tosa
21617MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::SinOp)
21618
21619namespace mlir::tosa {
21620
21621
21622//===----------------------------------------------------------------------===//
21623// mlir::tosa::SliceOp declarations
21624//===----------------------------------------------------------------------===//
21625
21626namespace detail {
21627
21628class SliceOpGenericAdaptorBase {
21629public:
21630 using Properties = ::mlir::EmptyProperties;
21631protected:
21632 ::mlir::DictionaryAttr odsAttrs;
21633 ::std::optional<::mlir::OperationName> odsOpName;
21634 Properties properties;
21635 ::mlir::RegionRange odsRegions;
21636public:
21637 SliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
21638 odsOpName.emplace(args: "tosa.slice", args: odsAttrs.getContext());
21639 }
21640
21641 SliceOpGenericAdaptorBase(SliceOp op);
21642
21643 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
21644 return {index, 1};
21645 }
21646
21647 const Properties &getProperties() {
21648 return properties;
21649 }
21650
21651 ::mlir::DictionaryAttr getAttributes() {
21652 return odsAttrs;
21653 }
21654
21655};
21656
21657} // namespace detail
21658template <typename RangeT>
21659class SliceOpGenericAdaptor : public detail::SliceOpGenericAdaptorBase {
21660 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
21661 using Base = detail::SliceOpGenericAdaptorBase;
21662 static constexpr int odsIndex_input1 = 0;
21663 static constexpr int odsIndex_start = 1;
21664 static constexpr int odsIndex_size = 2;
21665public:
21666 SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
21667
21668 SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
21669
21670 SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SliceOpGenericAdaptor(values, attrs, Properties{}, {}) {}
21671
21672 SliceOpGenericAdaptor(RangeT values, const SliceOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
21673
21674 template <typename LateInst = SliceOp, typename = std::enable_if_t<std::is_same_v<LateInst, SliceOp>>>
21675 SliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
21676
21677 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21678 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
21679 }
21680
21681 RangeT getODSOperands(unsigned index) {
21682 auto valueRange = getODSOperandIndexAndLength(index);
21683 return {std::next(odsOperands.begin(), valueRange.first),
21684 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
21685 }
21686
21687 ValueT getInput1() {
21688 return (*getODSOperands(index: 0).begin());
21689 }
21690
21691 ValueT getStart() {
21692 return (*getODSOperands(index: 1).begin());
21693 }
21694
21695 ValueT getSize() {
21696 return (*getODSOperands(index: 2).begin());
21697 }
21698
21699 RangeT getOperands() {
21700 return odsOperands;
21701 }
21702
21703private:
21704 RangeT odsOperands;
21705};
21706class SliceOpAdaptor : public SliceOpGenericAdaptor<::mlir::ValueRange> {
21707public:
21708 using SliceOpGenericAdaptor::SliceOpGenericAdaptor;
21709 SliceOpAdaptor(SliceOp op);
21710
21711 ::llvm::LogicalResult verify(::mlir::Location loc);
21712};
21713class SliceOp : public ::mlir::Op<SliceOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
21714public:
21715 using Op::Op;
21716 using Op::print;
21717 using Adaptor = SliceOpAdaptor;
21718 template <typename RangeT>
21719 using GenericAdaptor = SliceOpGenericAdaptor<RangeT>;
21720 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
21721 static constexpr int odsIndex_input1 = 0;
21722 static constexpr int odsIndex_start = 1;
21723 static constexpr int odsIndex_size = 2;
21724 static constexpr int odsIndex_output = 0;
21725 using Properties = FoldAdaptor::Properties;
21726 using ::mlir::InferShapedTypeOpInterface::Trait<SliceOp>::reifyReturnTypeShapes;
21727 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
21728 return {};
21729 }
21730
21731 static constexpr ::llvm::StringLiteral getOperationName() {
21732 return ::llvm::StringLiteral("tosa.slice");
21733 }
21734
21735 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21736 return {index, 1};
21737 }
21738
21739 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
21740 auto [start, length] = getODSOperandIndexAndLength(index);
21741 return getOperation()->getOperands().slice(n: start, m: length);
21742 }
21743
21744 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
21745 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
21746 }
21747
21748 ::mlir::TypedValue<mlir::tosa::shapeType> getStart() {
21749 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
21750 }
21751
21752 ::mlir::TypedValue<mlir::tosa::shapeType> getSize() {
21753 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 2).begin());
21754 }
21755
21756 ::mlir::OpOperand &getInput1Mutable() {
21757 auto range = getODSOperandIndexAndLength(index: 0);
21758 return getOperation()->getOpOperand(idx: range.first);
21759 }
21760
21761 ::mlir::OpOperand &getStartMutable() {
21762 auto range = getODSOperandIndexAndLength(index: 1);
21763 return getOperation()->getOpOperand(idx: range.first);
21764 }
21765
21766 ::mlir::OpOperand &getSizeMutable() {
21767 auto range = getODSOperandIndexAndLength(index: 2);
21768 return getOperation()->getOpOperand(idx: range.first);
21769 }
21770
21771 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
21772 return {index, 1};
21773 }
21774
21775 ::mlir::Operation::result_range getODSResults(unsigned index) {
21776 auto valueRange = getODSResultIndexAndLength(index);
21777 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
21778 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
21779 }
21780
21781 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
21782 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
21783 }
21784
21785 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21786 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
21787 static llvm::hash_code computePropertiesHash(const Properties &prop);
21788 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
21789 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
21790 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
21791 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21792 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size);
21793 static SliceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size);
21794 static SliceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size);
21795 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size);
21796 static SliceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size);
21797 static SliceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value start, ::mlir::Value size);
21798 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21799 static SliceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21800 static SliceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
21801 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21802 static SliceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21803 static SliceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
21804 ::llvm::LogicalResult verifyInvariantsImpl();
21805 ::llvm::LogicalResult verifyInvariants();
21806 ::llvm::LogicalResult verify();
21807 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
21808 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
21809 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
21810 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
21811 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
21812 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
21813public:
21814 static ::llvm::LogicalResult
21815 inferReturnTypeComponents(::mlir::MLIRContext *context,
21816 std::optional<::mlir::Location> location,
21817 Adaptor adaptor,
21818 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
21819
21820};
21821
21822} // namespace mlir::tosa
21823MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::SliceOp)
21824
21825namespace mlir::tosa {
21826
21827
21828//===----------------------------------------------------------------------===//
21829// mlir::tosa::SliceShapeOp declarations
21830//===----------------------------------------------------------------------===//
21831
21832namespace detail {
21833
21834class SliceShapeOpGenericAdaptorBase {
21835public:
21836 using Properties = ::mlir::EmptyProperties;
21837protected:
21838 ::mlir::DictionaryAttr odsAttrs;
21839 ::std::optional<::mlir::OperationName> odsOpName;
21840 Properties properties;
21841 ::mlir::RegionRange odsRegions;
21842public:
21843 SliceShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
21844 odsOpName.emplace(args: "tosa.slice_shape", args: odsAttrs.getContext());
21845 }
21846
21847 SliceShapeOpGenericAdaptorBase(SliceShapeOp op);
21848
21849 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
21850 return {index, 1};
21851 }
21852
21853 const Properties &getProperties() {
21854 return properties;
21855 }
21856
21857 ::mlir::DictionaryAttr getAttributes() {
21858 return odsAttrs;
21859 }
21860
21861};
21862
21863} // namespace detail
21864template <typename RangeT>
21865class SliceShapeOpGenericAdaptor : public detail::SliceShapeOpGenericAdaptorBase {
21866 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
21867 using Base = detail::SliceShapeOpGenericAdaptorBase;
21868 static constexpr int odsIndex_input = 0;
21869 static constexpr int odsIndex_start = 1;
21870 static constexpr int odsIndex_size = 2;
21871public:
21872 SliceShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
21873
21874 SliceShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SliceShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
21875
21876 SliceShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SliceShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
21877
21878 SliceShapeOpGenericAdaptor(RangeT values, const SliceShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
21879
21880 template <typename LateInst = SliceShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, SliceShapeOp>>>
21881 SliceShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
21882
21883 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21884 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
21885 }
21886
21887 RangeT getODSOperands(unsigned index) {
21888 auto valueRange = getODSOperandIndexAndLength(index);
21889 return {std::next(odsOperands.begin(), valueRange.first),
21890 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
21891 }
21892
21893 ValueT getInput() {
21894 return (*getODSOperands(index: 0).begin());
21895 }
21896
21897 ValueT getStart() {
21898 return (*getODSOperands(index: 1).begin());
21899 }
21900
21901 ValueT getSize() {
21902 return (*getODSOperands(index: 2).begin());
21903 }
21904
21905 RangeT getOperands() {
21906 return odsOperands;
21907 }
21908
21909private:
21910 RangeT odsOperands;
21911};
21912class SliceShapeOpAdaptor : public SliceShapeOpGenericAdaptor<::mlir::ValueRange> {
21913public:
21914 using SliceShapeOpGenericAdaptor::SliceShapeOpGenericAdaptor;
21915 SliceShapeOpAdaptor(SliceShapeOp op);
21916
21917 ::llvm::LogicalResult verify(::mlir::Location loc);
21918};
21919class SliceShapeOp : public ::mlir::Op<SliceShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
21920public:
21921 using Op::Op;
21922 using Op::print;
21923 using Adaptor = SliceShapeOpAdaptor;
21924 template <typename RangeT>
21925 using GenericAdaptor = SliceShapeOpGenericAdaptor<RangeT>;
21926 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
21927 static constexpr int odsIndex_input = 0;
21928 static constexpr int odsIndex_start = 1;
21929 static constexpr int odsIndex_size = 2;
21930 static constexpr int odsIndex_output = 0;
21931 using Properties = FoldAdaptor::Properties;
21932 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
21933 return {};
21934 }
21935
21936 static constexpr ::llvm::StringLiteral getOperationName() {
21937 return ::llvm::StringLiteral("tosa.slice_shape");
21938 }
21939
21940 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
21941 return {index, 1};
21942 }
21943
21944 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
21945 auto [start, length] = getODSOperandIndexAndLength(index);
21946 return getOperation()->getOperands().slice(n: start, m: length);
21947 }
21948
21949 ::mlir::TypedValue<mlir::tosa::shapeType> getInput() {
21950 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
21951 }
21952
21953 ::mlir::TypedValue<::mlir::TensorType> getStart() {
21954 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
21955 }
21956
21957 ::mlir::TypedValue<::mlir::TensorType> getSize() {
21958 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
21959 }
21960
21961 ::mlir::OpOperand &getInputMutable() {
21962 auto range = getODSOperandIndexAndLength(index: 0);
21963 return getOperation()->getOpOperand(idx: range.first);
21964 }
21965
21966 ::mlir::OpOperand &getStartMutable() {
21967 auto range = getODSOperandIndexAndLength(index: 1);
21968 return getOperation()->getOpOperand(idx: range.first);
21969 }
21970
21971 ::mlir::OpOperand &getSizeMutable() {
21972 auto range = getODSOperandIndexAndLength(index: 2);
21973 return getOperation()->getOpOperand(idx: range.first);
21974 }
21975
21976 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
21977 return {index, 1};
21978 }
21979
21980 ::mlir::Operation::result_range getODSResults(unsigned index) {
21981 auto valueRange = getODSResultIndexAndLength(index);
21982 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
21983 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
21984 }
21985
21986 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
21987 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
21988 }
21989
21990 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21991 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
21992 static llvm::hash_code computePropertiesHash(const Properties &prop);
21993 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
21994 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
21995 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
21996 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
21997 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value start, ::mlir::Value size);
21998 static SliceShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value start, ::mlir::Value size);
21999 static SliceShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value start, ::mlir::Value size);
22000 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value start, ::mlir::Value size);
22001 static SliceShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value start, ::mlir::Value size);
22002 static SliceShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value start, ::mlir::Value size);
22003 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22004 static SliceShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22005 static SliceShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22006 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22007 static SliceShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22008 static SliceShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22009 ::llvm::LogicalResult verifyInvariantsImpl();
22010 ::llvm::LogicalResult verifyInvariants();
22011 ::llvm::LogicalResult verify();
22012 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
22013 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
22014 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
22015 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
22016public:
22017};
22018
22019} // namespace mlir::tosa
22020MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::SliceShapeOp)
22021
22022namespace mlir::tosa {
22023
22024
22025//===----------------------------------------------------------------------===//
22026// mlir::tosa::SubOp declarations
22027//===----------------------------------------------------------------------===//
22028
22029namespace detail {
22030
22031class SubOpGenericAdaptorBase {
22032public:
22033 using Properties = ::mlir::EmptyProperties;
22034protected:
22035 ::mlir::DictionaryAttr odsAttrs;
22036 ::std::optional<::mlir::OperationName> odsOpName;
22037 Properties properties;
22038 ::mlir::RegionRange odsRegions;
22039public:
22040 SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
22041 odsOpName.emplace(args: "tosa.sub", args: odsAttrs.getContext());
22042 }
22043
22044 SubOpGenericAdaptorBase(SubOp op);
22045
22046 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
22047 return {index, 1};
22048 }
22049
22050 const Properties &getProperties() {
22051 return properties;
22052 }
22053
22054 ::mlir::DictionaryAttr getAttributes() {
22055 return odsAttrs;
22056 }
22057
22058};
22059
22060} // namespace detail
22061template <typename RangeT>
22062class SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase {
22063 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
22064 using Base = detail::SubOpGenericAdaptorBase;
22065 static constexpr int odsIndex_input1 = 0;
22066 static constexpr int odsIndex_input2 = 1;
22067public:
22068 SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
22069
22070 SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
22071
22072 SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SubOpGenericAdaptor(values, attrs, Properties{}, {}) {}
22073
22074 SubOpGenericAdaptor(RangeT values, const SubOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
22075
22076 template <typename LateInst = SubOp, typename = std::enable_if_t<std::is_same_v<LateInst, SubOp>>>
22077 SubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
22078
22079 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22080 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
22081 }
22082
22083 RangeT getODSOperands(unsigned index) {
22084 auto valueRange = getODSOperandIndexAndLength(index);
22085 return {std::next(odsOperands.begin(), valueRange.first),
22086 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
22087 }
22088
22089 ValueT getInput1() {
22090 return (*getODSOperands(index: 0).begin());
22091 }
22092
22093 ValueT getInput2() {
22094 return (*getODSOperands(index: 1).begin());
22095 }
22096
22097 RangeT getOperands() {
22098 return odsOperands;
22099 }
22100
22101private:
22102 RangeT odsOperands;
22103};
22104class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> {
22105public:
22106 using SubOpGenericAdaptor::SubOpGenericAdaptor;
22107 SubOpAdaptor(SubOp op);
22108
22109 ::llvm::LogicalResult verify(::mlir::Location loc);
22110};
22111class SubOp : public ::mlir::Op<SubOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
22112public:
22113 using Op::Op;
22114 using Op::print;
22115 using Adaptor = SubOpAdaptor;
22116 template <typename RangeT>
22117 using GenericAdaptor = SubOpGenericAdaptor<RangeT>;
22118 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
22119 static constexpr int odsIndex_input1 = 0;
22120 static constexpr int odsIndex_input2 = 1;
22121 static constexpr int odsIndex_output = 0;
22122 using Properties = FoldAdaptor::Properties;
22123 using ::mlir::InferShapedTypeOpInterface::Trait<SubOp>::reifyReturnTypeShapes;
22124 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
22125 return {};
22126 }
22127
22128 static constexpr ::llvm::StringLiteral getOperationName() {
22129 return ::llvm::StringLiteral("tosa.sub");
22130 }
22131
22132 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22133 return {index, 1};
22134 }
22135
22136 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
22137 auto [start, length] = getODSOperandIndexAndLength(index);
22138 return getOperation()->getOperands().slice(n: start, m: length);
22139 }
22140
22141 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
22142 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
22143 }
22144
22145 ::mlir::TypedValue<::mlir::TensorType> getInput2() {
22146 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
22147 }
22148
22149 ::mlir::OpOperand &getInput1Mutable() {
22150 auto range = getODSOperandIndexAndLength(index: 0);
22151 return getOperation()->getOpOperand(idx: range.first);
22152 }
22153
22154 ::mlir::OpOperand &getInput2Mutable() {
22155 auto range = getODSOperandIndexAndLength(index: 1);
22156 return getOperation()->getOpOperand(idx: range.first);
22157 }
22158
22159 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
22160 return {index, 1};
22161 }
22162
22163 ::mlir::Operation::result_range getODSResults(unsigned index) {
22164 auto valueRange = getODSResultIndexAndLength(index);
22165 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
22166 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
22167 }
22168
22169 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
22170 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
22171 }
22172
22173 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22174 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
22175 static llvm::hash_code computePropertiesHash(const Properties &prop);
22176 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
22177 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
22178 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
22179 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22180 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
22181 static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
22182 static SubOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
22183 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
22184 static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
22185 static SubOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
22186 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22187 static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22188 static SubOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22189 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22190 static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22191 static SubOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22192 ::llvm::LogicalResult verifyInvariantsImpl();
22193 ::llvm::LogicalResult verifyInvariants();
22194 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
22195 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
22196 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
22197 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
22198 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
22199public:
22200};
22201
22202} // namespace mlir::tosa
22203MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::SubOp)
22204
22205namespace mlir::tosa {
22206
22207
22208//===----------------------------------------------------------------------===//
22209// mlir::tosa::SubShapeOp declarations
22210//===----------------------------------------------------------------------===//
22211
22212namespace detail {
22213
22214class SubShapeOpGenericAdaptorBase {
22215public:
22216 using Properties = ::mlir::EmptyProperties;
22217protected:
22218 ::mlir::DictionaryAttr odsAttrs;
22219 ::std::optional<::mlir::OperationName> odsOpName;
22220 Properties properties;
22221 ::mlir::RegionRange odsRegions;
22222public:
22223 SubShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
22224 odsOpName.emplace(args: "tosa.sub_shape", args: odsAttrs.getContext());
22225 }
22226
22227 SubShapeOpGenericAdaptorBase(SubShapeOp op);
22228
22229 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
22230 return {index, 1};
22231 }
22232
22233 const Properties &getProperties() {
22234 return properties;
22235 }
22236
22237 ::mlir::DictionaryAttr getAttributes() {
22238 return odsAttrs;
22239 }
22240
22241};
22242
22243} // namespace detail
22244template <typename RangeT>
22245class SubShapeOpGenericAdaptor : public detail::SubShapeOpGenericAdaptorBase {
22246 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
22247 using Base = detail::SubShapeOpGenericAdaptorBase;
22248 static constexpr int odsIndex_input1 = 0;
22249 static constexpr int odsIndex_input2 = 1;
22250public:
22251 SubShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
22252
22253 SubShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SubShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
22254
22255 SubShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SubShapeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
22256
22257 SubShapeOpGenericAdaptor(RangeT values, const SubShapeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
22258
22259 template <typename LateInst = SubShapeOp, typename = std::enable_if_t<std::is_same_v<LateInst, SubShapeOp>>>
22260 SubShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
22261
22262 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22263 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
22264 }
22265
22266 RangeT getODSOperands(unsigned index) {
22267 auto valueRange = getODSOperandIndexAndLength(index);
22268 return {std::next(odsOperands.begin(), valueRange.first),
22269 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
22270 }
22271
22272 ValueT getInput1() {
22273 return (*getODSOperands(index: 0).begin());
22274 }
22275
22276 ValueT getInput2() {
22277 return (*getODSOperands(index: 1).begin());
22278 }
22279
22280 RangeT getOperands() {
22281 return odsOperands;
22282 }
22283
22284private:
22285 RangeT odsOperands;
22286};
22287class SubShapeOpAdaptor : public SubShapeOpGenericAdaptor<::mlir::ValueRange> {
22288public:
22289 using SubShapeOpGenericAdaptor::SubShapeOpGenericAdaptor;
22290 SubShapeOpAdaptor(SubShapeOp op);
22291
22292 ::llvm::LogicalResult verify(::mlir::Location loc);
22293};
22294class SubShapeOp : public ::mlir::Op<SubShapeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<mlir::tosa::shapeType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, mlir::OpTrait::tosa::TosaShapeOperatorWithSameRanks, mlir::OpTrait::tosa::TosaShapeOperator, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
22295public:
22296 using Op::Op;
22297 using Op::print;
22298 using Adaptor = SubShapeOpAdaptor;
22299 template <typename RangeT>
22300 using GenericAdaptor = SubShapeOpGenericAdaptor<RangeT>;
22301 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
22302 static constexpr int odsIndex_input1 = 0;
22303 static constexpr int odsIndex_input2 = 1;
22304 static constexpr int odsIndex_output = 0;
22305 using Properties = FoldAdaptor::Properties;
22306 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
22307 return {};
22308 }
22309
22310 static constexpr ::llvm::StringLiteral getOperationName() {
22311 return ::llvm::StringLiteral("tosa.sub_shape");
22312 }
22313
22314 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22315 return {index, 1};
22316 }
22317
22318 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
22319 auto [start, length] = getODSOperandIndexAndLength(index);
22320 return getOperation()->getOperands().slice(n: start, m: length);
22321 }
22322
22323 ::mlir::TypedValue<mlir::tosa::shapeType> getInput1() {
22324 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 0).begin());
22325 }
22326
22327 ::mlir::TypedValue<mlir::tosa::shapeType> getInput2() {
22328 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
22329 }
22330
22331 ::mlir::OpOperand &getInput1Mutable() {
22332 auto range = getODSOperandIndexAndLength(index: 0);
22333 return getOperation()->getOpOperand(idx: range.first);
22334 }
22335
22336 ::mlir::OpOperand &getInput2Mutable() {
22337 auto range = getODSOperandIndexAndLength(index: 1);
22338 return getOperation()->getOpOperand(idx: range.first);
22339 }
22340
22341 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
22342 return {index, 1};
22343 }
22344
22345 ::mlir::Operation::result_range getODSResults(unsigned index) {
22346 auto valueRange = getODSResultIndexAndLength(index);
22347 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
22348 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
22349 }
22350
22351 ::mlir::TypedValue<mlir::tosa::shapeType> getOutput() {
22352 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSResults(index: 0).begin());
22353 }
22354
22355 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22356 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
22357 static llvm::hash_code computePropertiesHash(const Properties &prop);
22358 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
22359 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
22360 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
22361 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22362 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
22363 static SubShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
22364 static SubShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value input2);
22365 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
22366 static SubShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
22367 static SubShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value input2);
22368 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22369 static SubShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22370 static SubShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22371 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22372 static SubShapeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22373 static SubShapeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22374 ::llvm::LogicalResult verifyInvariantsImpl();
22375 ::llvm::LogicalResult verifyInvariants();
22376 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
22377 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
22378 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
22379 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
22380public:
22381};
22382
22383} // namespace mlir::tosa
22384MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::SubShapeOp)
22385
22386namespace mlir::tosa {
22387
22388
22389//===----------------------------------------------------------------------===//
22390// mlir::tosa::TableOp declarations
22391//===----------------------------------------------------------------------===//
22392
22393namespace detail {
22394
22395class TableOpGenericAdaptorBase {
22396public:
22397 using Properties = ::mlir::EmptyProperties;
22398protected:
22399 ::mlir::DictionaryAttr odsAttrs;
22400 ::std::optional<::mlir::OperationName> odsOpName;
22401 Properties properties;
22402 ::mlir::RegionRange odsRegions;
22403public:
22404 TableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
22405 odsOpName.emplace(args: "tosa.table", args: odsAttrs.getContext());
22406 }
22407
22408 TableOpGenericAdaptorBase(TableOp op);
22409
22410 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
22411 return {index, 1};
22412 }
22413
22414 const Properties &getProperties() {
22415 return properties;
22416 }
22417
22418 ::mlir::DictionaryAttr getAttributes() {
22419 return odsAttrs;
22420 }
22421
22422};
22423
22424} // namespace detail
22425template <typename RangeT>
22426class TableOpGenericAdaptor : public detail::TableOpGenericAdaptorBase {
22427 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
22428 using Base = detail::TableOpGenericAdaptorBase;
22429 static constexpr int odsIndex_input1 = 0;
22430 static constexpr int odsIndex_table = 1;
22431public:
22432 TableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
22433
22434 TableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TableOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
22435
22436 TableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : TableOpGenericAdaptor(values, attrs, Properties{}, {}) {}
22437
22438 TableOpGenericAdaptor(RangeT values, const TableOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
22439
22440 template <typename LateInst = TableOp, typename = std::enable_if_t<std::is_same_v<LateInst, TableOp>>>
22441 TableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
22442
22443 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22444 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
22445 }
22446
22447 RangeT getODSOperands(unsigned index) {
22448 auto valueRange = getODSOperandIndexAndLength(index);
22449 return {std::next(odsOperands.begin(), valueRange.first),
22450 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
22451 }
22452
22453 ValueT getInput1() {
22454 return (*getODSOperands(index: 0).begin());
22455 }
22456
22457 ValueT getTable() {
22458 return (*getODSOperands(index: 1).begin());
22459 }
22460
22461 RangeT getOperands() {
22462 return odsOperands;
22463 }
22464
22465private:
22466 RangeT odsOperands;
22467};
22468class TableOpAdaptor : public TableOpGenericAdaptor<::mlir::ValueRange> {
22469public:
22470 using TableOpGenericAdaptor::TableOpGenericAdaptor;
22471 TableOpAdaptor(TableOp op);
22472
22473 ::llvm::LogicalResult verify(::mlir::Location loc);
22474};
22475class TableOp : public ::mlir::Op<TableOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
22476public:
22477 using Op::Op;
22478 using Op::print;
22479 using Adaptor = TableOpAdaptor;
22480 template <typename RangeT>
22481 using GenericAdaptor = TableOpGenericAdaptor<RangeT>;
22482 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
22483 static constexpr int odsIndex_input1 = 0;
22484 static constexpr int odsIndex_table = 1;
22485 static constexpr int odsIndex_output = 0;
22486 using Properties = FoldAdaptor::Properties;
22487 using ::mlir::InferShapedTypeOpInterface::Trait<TableOp>::reifyReturnTypeShapes;
22488 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
22489 return {};
22490 }
22491
22492 static constexpr ::llvm::StringLiteral getOperationName() {
22493 return ::llvm::StringLiteral("tosa.table");
22494 }
22495
22496 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22497 return {index, 1};
22498 }
22499
22500 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
22501 auto [start, length] = getODSOperandIndexAndLength(index);
22502 return getOperation()->getOperands().slice(n: start, m: length);
22503 }
22504
22505 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
22506 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
22507 }
22508
22509 ::mlir::TypedValue<::mlir::TensorType> getTable() {
22510 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
22511 }
22512
22513 ::mlir::OpOperand &getInput1Mutable() {
22514 auto range = getODSOperandIndexAndLength(index: 0);
22515 return getOperation()->getOpOperand(idx: range.first);
22516 }
22517
22518 ::mlir::OpOperand &getTableMutable() {
22519 auto range = getODSOperandIndexAndLength(index: 1);
22520 return getOperation()->getOpOperand(idx: range.first);
22521 }
22522
22523 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
22524 return {index, 1};
22525 }
22526
22527 ::mlir::Operation::result_range getODSResults(unsigned index) {
22528 auto valueRange = getODSResultIndexAndLength(index);
22529 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
22530 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
22531 }
22532
22533 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
22534 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
22535 }
22536
22537 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22538 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
22539 static llvm::hash_code computePropertiesHash(const Properties &prop);
22540 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
22541 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
22542 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
22543 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22544 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value table);
22545 static TableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value table);
22546 static TableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value table);
22547 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value table);
22548 static TableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value table);
22549 static TableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value table);
22550 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22551 static TableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22552 static TableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22553 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22554 static TableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22555 static TableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22556 ::llvm::LogicalResult verifyInvariantsImpl();
22557 ::llvm::LogicalResult verifyInvariants();
22558 ::llvm::LogicalResult verify();
22559 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
22560 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
22561 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
22562 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
22563public:
22564 static ::llvm::LogicalResult
22565 inferReturnTypeComponents(::mlir::MLIRContext *context,
22566 std::optional<::mlir::Location> location,
22567 Adaptor adaptor,
22568 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
22569
22570};
22571
22572} // namespace mlir::tosa
22573MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::TableOp)
22574
22575namespace mlir::tosa {
22576
22577
22578//===----------------------------------------------------------------------===//
22579// mlir::tosa::TanhOp declarations
22580//===----------------------------------------------------------------------===//
22581
22582namespace detail {
22583
22584class TanhOpGenericAdaptorBase {
22585public:
22586 using Properties = ::mlir::EmptyProperties;
22587protected:
22588 ::mlir::DictionaryAttr odsAttrs;
22589 ::std::optional<::mlir::OperationName> odsOpName;
22590 Properties properties;
22591 ::mlir::RegionRange odsRegions;
22592public:
22593 TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
22594 odsOpName.emplace(args: "tosa.tanh", args: odsAttrs.getContext());
22595 }
22596
22597 TanhOpGenericAdaptorBase(TanhOp op);
22598
22599 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
22600 return {index, 1};
22601 }
22602
22603 const Properties &getProperties() {
22604 return properties;
22605 }
22606
22607 ::mlir::DictionaryAttr getAttributes() {
22608 return odsAttrs;
22609 }
22610
22611};
22612
22613} // namespace detail
22614template <typename RangeT>
22615class TanhOpGenericAdaptor : public detail::TanhOpGenericAdaptorBase {
22616 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
22617 using Base = detail::TanhOpGenericAdaptorBase;
22618 static constexpr int odsIndex_input = 0;
22619public:
22620 TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
22621
22622 TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TanhOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
22623
22624 TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : TanhOpGenericAdaptor(values, attrs, Properties{}, {}) {}
22625
22626 TanhOpGenericAdaptor(RangeT values, const TanhOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
22627
22628 template <typename LateInst = TanhOp, typename = std::enable_if_t<std::is_same_v<LateInst, TanhOp>>>
22629 TanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
22630
22631 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22632 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
22633 }
22634
22635 RangeT getODSOperands(unsigned index) {
22636 auto valueRange = getODSOperandIndexAndLength(index);
22637 return {std::next(odsOperands.begin(), valueRange.first),
22638 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
22639 }
22640
22641 ValueT getInput() {
22642 return (*getODSOperands(index: 0).begin());
22643 }
22644
22645 RangeT getOperands() {
22646 return odsOperands;
22647 }
22648
22649private:
22650 RangeT odsOperands;
22651};
22652class TanhOpAdaptor : public TanhOpGenericAdaptor<::mlir::ValueRange> {
22653public:
22654 using TanhOpGenericAdaptor::TanhOpGenericAdaptor;
22655 TanhOpAdaptor(TanhOp op);
22656
22657 ::llvm::LogicalResult verify(::mlir::Location loc);
22658};
22659class TanhOp : public ::mlir::Op<TanhOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, mlir::OpTrait::tosa::TosaElementwiseOperator, ::mlir::OpTrait::SameOperandsAndResultRank, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
22660public:
22661 using Op::Op;
22662 using Op::print;
22663 using Adaptor = TanhOpAdaptor;
22664 template <typename RangeT>
22665 using GenericAdaptor = TanhOpGenericAdaptor<RangeT>;
22666 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
22667 static constexpr int odsIndex_input = 0;
22668 static constexpr int odsIndex_output = 0;
22669 using Properties = FoldAdaptor::Properties;
22670 using ::mlir::InferShapedTypeOpInterface::Trait<TanhOp>::reifyReturnTypeShapes;
22671 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
22672 return {};
22673 }
22674
22675 static constexpr ::llvm::StringLiteral getOperationName() {
22676 return ::llvm::StringLiteral("tosa.tanh");
22677 }
22678
22679 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22680 return {index, 1};
22681 }
22682
22683 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
22684 auto [start, length] = getODSOperandIndexAndLength(index);
22685 return getOperation()->getOperands().slice(n: start, m: length);
22686 }
22687
22688 ::mlir::TypedValue<::mlir::TensorType> getInput() {
22689 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
22690 }
22691
22692 ::mlir::OpOperand &getInputMutable() {
22693 auto range = getODSOperandIndexAndLength(index: 0);
22694 return getOperation()->getOpOperand(idx: range.first);
22695 }
22696
22697 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
22698 return {index, 1};
22699 }
22700
22701 ::mlir::Operation::result_range getODSResults(unsigned index) {
22702 auto valueRange = getODSResultIndexAndLength(index);
22703 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
22704 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
22705 }
22706
22707 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
22708 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
22709 }
22710
22711 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22712 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
22713 static llvm::hash_code computePropertiesHash(const Properties &prop);
22714 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
22715 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
22716 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
22717 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22718 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input);
22719 static TanhOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input);
22720 static TanhOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input);
22721 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input);
22722 static TanhOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input);
22723 static TanhOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input);
22724 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22725 static TanhOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22726 static TanhOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22727 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22728 static TanhOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22729 static TanhOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22730 ::llvm::LogicalResult verifyInvariantsImpl();
22731 ::llvm::LogicalResult verifyInvariants();
22732 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
22733 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
22734 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
22735 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
22736public:
22737};
22738
22739} // namespace mlir::tosa
22740MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::TanhOp)
22741
22742namespace mlir::tosa {
22743
22744
22745//===----------------------------------------------------------------------===//
22746// mlir::tosa::TileOp declarations
22747//===----------------------------------------------------------------------===//
22748
22749namespace detail {
22750
22751class TileOpGenericAdaptorBase {
22752public:
22753 using Properties = ::mlir::EmptyProperties;
22754protected:
22755 ::mlir::DictionaryAttr odsAttrs;
22756 ::std::optional<::mlir::OperationName> odsOpName;
22757 Properties properties;
22758 ::mlir::RegionRange odsRegions;
22759public:
22760 TileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
22761 odsOpName.emplace(args: "tosa.tile", args: odsAttrs.getContext());
22762 }
22763
22764 TileOpGenericAdaptorBase(TileOp op);
22765
22766 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
22767 return {index, 1};
22768 }
22769
22770 const Properties &getProperties() {
22771 return properties;
22772 }
22773
22774 ::mlir::DictionaryAttr getAttributes() {
22775 return odsAttrs;
22776 }
22777
22778};
22779
22780} // namespace detail
22781template <typename RangeT>
22782class TileOpGenericAdaptor : public detail::TileOpGenericAdaptorBase {
22783 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
22784 using Base = detail::TileOpGenericAdaptorBase;
22785 static constexpr int odsIndex_input1 = 0;
22786 static constexpr int odsIndex_multiples = 1;
22787public:
22788 TileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
22789
22790 TileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TileOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
22791
22792 TileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : TileOpGenericAdaptor(values, attrs, Properties{}, {}) {}
22793
22794 TileOpGenericAdaptor(RangeT values, const TileOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
22795
22796 template <typename LateInst = TileOp, typename = std::enable_if_t<std::is_same_v<LateInst, TileOp>>>
22797 TileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
22798
22799 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22800 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
22801 }
22802
22803 RangeT getODSOperands(unsigned index) {
22804 auto valueRange = getODSOperandIndexAndLength(index);
22805 return {std::next(odsOperands.begin(), valueRange.first),
22806 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
22807 }
22808
22809 ValueT getInput1() {
22810 return (*getODSOperands(index: 0).begin());
22811 }
22812
22813 ValueT getMultiples() {
22814 return (*getODSOperands(index: 1).begin());
22815 }
22816
22817 RangeT getOperands() {
22818 return odsOperands;
22819 }
22820
22821private:
22822 RangeT odsOperands;
22823};
22824class TileOpAdaptor : public TileOpGenericAdaptor<::mlir::ValueRange> {
22825public:
22826 using TileOpGenericAdaptor::TileOpGenericAdaptor;
22827 TileOpAdaptor(TileOp op);
22828
22829 ::llvm::LogicalResult verify(::mlir::Location loc);
22830};
22831class TileOp : public ::mlir::Op<TileOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
22832public:
22833 using Op::Op;
22834 using Op::print;
22835 using Adaptor = TileOpAdaptor;
22836 template <typename RangeT>
22837 using GenericAdaptor = TileOpGenericAdaptor<RangeT>;
22838 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
22839 static constexpr int odsIndex_input1 = 0;
22840 static constexpr int odsIndex_multiples = 1;
22841 static constexpr int odsIndex_output = 0;
22842 using Properties = FoldAdaptor::Properties;
22843 using ::mlir::InferShapedTypeOpInterface::Trait<TileOp>::reifyReturnTypeShapes;
22844 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
22845 return {};
22846 }
22847
22848 static constexpr ::llvm::StringLiteral getOperationName() {
22849 return ::llvm::StringLiteral("tosa.tile");
22850 }
22851
22852 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
22853 return {index, 1};
22854 }
22855
22856 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
22857 auto [start, length] = getODSOperandIndexAndLength(index);
22858 return getOperation()->getOperands().slice(n: start, m: length);
22859 }
22860
22861 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
22862 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
22863 }
22864
22865 ::mlir::TypedValue<mlir::tosa::shapeType> getMultiples() {
22866 return ::llvm::cast<::mlir::TypedValue<mlir::tosa::shapeType>>(Val: *getODSOperands(index: 1).begin());
22867 }
22868
22869 ::mlir::OpOperand &getInput1Mutable() {
22870 auto range = getODSOperandIndexAndLength(index: 0);
22871 return getOperation()->getOpOperand(idx: range.first);
22872 }
22873
22874 ::mlir::OpOperand &getMultiplesMutable() {
22875 auto range = getODSOperandIndexAndLength(index: 1);
22876 return getOperation()->getOpOperand(idx: range.first);
22877 }
22878
22879 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
22880 return {index, 1};
22881 }
22882
22883 ::mlir::Operation::result_range getODSResults(unsigned index) {
22884 auto valueRange = getODSResultIndexAndLength(index);
22885 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
22886 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
22887 }
22888
22889 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
22890 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
22891 }
22892
22893 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22894 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
22895 static llvm::hash_code computePropertiesHash(const Properties &prop);
22896 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
22897 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
22898 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
22899 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
22900 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value multiples);
22901 static TileOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value multiples);
22902 static TileOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::Value multiples);
22903 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value multiples);
22904 static TileOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value multiples);
22905 static TileOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::Value multiples);
22906 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22907 static TileOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22908 static TileOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
22909 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22910 static TileOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22911 static TileOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
22912 ::llvm::LogicalResult verifyInvariantsImpl();
22913 ::llvm::LogicalResult verifyInvariants();
22914 ::llvm::LogicalResult verify();
22915 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
22916 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
22917 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
22918 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
22919 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
22920 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
22921public:
22922 static ::llvm::LogicalResult
22923 inferReturnTypeComponents(::mlir::MLIRContext *context,
22924 std::optional<::mlir::Location> location,
22925 Adaptor adaptor,
22926 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
22927
22928
22929 LogicalResult getConstantMultiples(llvm::SmallVector<int64_t> &multiples);
22930};
22931
22932} // namespace mlir::tosa
22933MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::TileOp)
22934
22935namespace mlir::tosa {
22936
22937
22938//===----------------------------------------------------------------------===//
22939// mlir::tosa::TransposeConv2DOp declarations
22940//===----------------------------------------------------------------------===//
22941
22942namespace detail {
22943
22944class TransposeConv2DOpGenericAdaptorBase {
22945public:
22946 struct Properties {
22947 using acc_typeTy = ::mlir::TypeAttr;
22948 acc_typeTy acc_type;
22949
22950 auto getAccType() const {
22951 auto &propStorage = this->acc_type;
22952 return ::llvm::cast<::mlir::TypeAttr>(Val: propStorage);
22953 }
22954 void setAccType(const ::mlir::TypeAttr &propValue) {
22955 this->acc_type = propValue;
22956 }
22957 using local_boundTy = ::mlir::BoolAttr;
22958 local_boundTy local_bound;
22959
22960 auto getLocalBound() const {
22961 auto &propStorage = this->local_bound;
22962 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val: propStorage);
22963 }
22964 void setLocalBound(const ::mlir::BoolAttr &propValue) {
22965 this->local_bound = propValue;
22966 }
22967 using out_padTy = ::mlir::DenseI64ArrayAttr;
22968 out_padTy out_pad;
22969
22970 auto getOutPad() const {
22971 auto &propStorage = this->out_pad;
22972 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
22973 }
22974 void setOutPad(const ::mlir::DenseI64ArrayAttr &propValue) {
22975 this->out_pad = propValue;
22976 }
22977 using strideTy = ::mlir::DenseI64ArrayAttr;
22978 strideTy stride;
22979
22980 auto getStride() const {
22981 auto &propStorage = this->stride;
22982 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: propStorage);
22983 }
22984 void setStride(const ::mlir::DenseI64ArrayAttr &propValue) {
22985 this->stride = propValue;
22986 }
22987 bool operator==(const Properties &rhs) const {
22988 return
22989 rhs.acc_type == this->acc_type &&
22990 rhs.local_bound == this->local_bound &&
22991 rhs.out_pad == this->out_pad &&
22992 rhs.stride == this->stride &&
22993 true;
22994 }
22995 bool operator!=(const Properties &rhs) const {
22996 return !(*this == rhs);
22997 }
22998 };
22999protected:
23000 ::mlir::DictionaryAttr odsAttrs;
23001 ::std::optional<::mlir::OperationName> odsOpName;
23002 Properties properties;
23003 ::mlir::RegionRange odsRegions;
23004public:
23005 TransposeConv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
23006 odsOpName.emplace(args: "tosa.transpose_conv2d", args: odsAttrs.getContext());
23007 }
23008
23009 TransposeConv2DOpGenericAdaptorBase(TransposeConv2DOp op);
23010
23011 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
23012 return {index, 1};
23013 }
23014
23015 const Properties &getProperties() {
23016 return properties;
23017 }
23018
23019 ::mlir::DictionaryAttr getAttributes() {
23020 return odsAttrs;
23021 }
23022
23023 ::mlir::DenseI64ArrayAttr getOutPadAttr() {
23024 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().out_pad);
23025 return attr;
23026 }
23027
23028 ::llvm::ArrayRef<int64_t> getOutPad();
23029 ::mlir::DenseI64ArrayAttr getStrideAttr() {
23030 auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val: getProperties().stride);
23031 return attr;
23032 }
23033
23034 ::llvm::ArrayRef<int64_t> getStride();
23035 ::mlir::TypeAttr getAccTypeAttr() {
23036 auto attr = ::llvm::cast<::mlir::TypeAttr>(Val: getProperties().acc_type);
23037 return attr;
23038 }
23039
23040 ::mlir::Type getAccType();
23041 ::mlir::BoolAttr getLocalBoundAttr();
23042 bool getLocalBound();
23043};
23044
23045} // namespace detail
23046template <typename RangeT>
23047class TransposeConv2DOpGenericAdaptor : public detail::TransposeConv2DOpGenericAdaptorBase {
23048 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
23049 using Base = detail::TransposeConv2DOpGenericAdaptorBase;
23050 static constexpr int odsIndex_input = 0;
23051 static constexpr int odsIndex_weight = 1;
23052 static constexpr int odsIndex_bias = 2;
23053 static constexpr int odsIndex_input_zp = 3;
23054 static constexpr int odsIndex_weight_zp = 4;
23055public:
23056 TransposeConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
23057
23058 TransposeConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TransposeConv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
23059
23060 TransposeConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : TransposeConv2DOpGenericAdaptor(values, attrs, Properties{}, {}) {}
23061
23062 TransposeConv2DOpGenericAdaptor(RangeT values, const TransposeConv2DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
23063
23064 template <typename LateInst = TransposeConv2DOp, typename = std::enable_if_t<std::is_same_v<LateInst, TransposeConv2DOp>>>
23065 TransposeConv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
23066
23067 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
23068 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
23069 }
23070
23071 RangeT getODSOperands(unsigned index) {
23072 auto valueRange = getODSOperandIndexAndLength(index);
23073 return {std::next(odsOperands.begin(), valueRange.first),
23074 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
23075 }
23076
23077 ValueT getInput() {
23078 return (*getODSOperands(index: 0).begin());
23079 }
23080
23081 ValueT getWeight() {
23082 return (*getODSOperands(index: 1).begin());
23083 }
23084
23085 ValueT getBias() {
23086 return (*getODSOperands(index: 2).begin());
23087 }
23088
23089 ValueT getInputZp() {
23090 return (*getODSOperands(index: 3).begin());
23091 }
23092
23093 ValueT getWeightZp() {
23094 return (*getODSOperands(index: 4).begin());
23095 }
23096
23097 RangeT getOperands() {
23098 return odsOperands;
23099 }
23100
23101private:
23102 RangeT odsOperands;
23103};
23104class TransposeConv2DOpAdaptor : public TransposeConv2DOpGenericAdaptor<::mlir::ValueRange> {
23105public:
23106 using TransposeConv2DOpGenericAdaptor::TransposeConv2DOpGenericAdaptor;
23107 TransposeConv2DOpAdaptor(TransposeConv2DOp op);
23108
23109 ::llvm::LogicalResult verify(::mlir::Location loc);
23110};
23111class TransposeConv2DOp : public ::mlir::Op<TransposeConv2DOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
23112public:
23113 using Op::Op;
23114 using Op::print;
23115 using Adaptor = TransposeConv2DOpAdaptor;
23116 template <typename RangeT>
23117 using GenericAdaptor = TransposeConv2DOpGenericAdaptor<RangeT>;
23118 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
23119 static constexpr int odsIndex_input = 0;
23120 static constexpr int odsIndex_weight = 1;
23121 static constexpr int odsIndex_bias = 2;
23122 static constexpr int odsIndex_input_zp = 3;
23123 static constexpr int odsIndex_weight_zp = 4;
23124 static constexpr int odsIndex_output = 0;
23125 using Properties = FoldAdaptor::Properties;
23126 using ::mlir::InferShapedTypeOpInterface::Trait<TransposeConv2DOp>::reifyReturnTypeShapes;
23127 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
23128 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acc_type"), ::llvm::StringRef("local_bound"), ::llvm::StringRef("out_pad"), ::llvm::StringRef("stride")};
23129 return ::llvm::ArrayRef(attrNames);
23130 }
23131
23132 ::mlir::StringAttr getAccTypeAttrName() {
23133 return getAttributeNameForIndex(index: 0);
23134 }
23135
23136 static ::mlir::StringAttr getAccTypeAttrName(::mlir::OperationName name) {
23137 return getAttributeNameForIndex(name, index: 0);
23138 }
23139
23140 ::mlir::StringAttr getLocalBoundAttrName() {
23141 return getAttributeNameForIndex(index: 1);
23142 }
23143
23144 static ::mlir::StringAttr getLocalBoundAttrName(::mlir::OperationName name) {
23145 return getAttributeNameForIndex(name, index: 1);
23146 }
23147
23148 ::mlir::StringAttr getOutPadAttrName() {
23149 return getAttributeNameForIndex(index: 2);
23150 }
23151
23152 static ::mlir::StringAttr getOutPadAttrName(::mlir::OperationName name) {
23153 return getAttributeNameForIndex(name, index: 2);
23154 }
23155
23156 ::mlir::StringAttr getStrideAttrName() {
23157 return getAttributeNameForIndex(index: 3);
23158 }
23159
23160 static ::mlir::StringAttr getStrideAttrName(::mlir::OperationName name) {
23161 return getAttributeNameForIndex(name, index: 3);
23162 }
23163
23164 static constexpr ::llvm::StringLiteral getOperationName() {
23165 return ::llvm::StringLiteral("tosa.transpose_conv2d");
23166 }
23167
23168 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
23169 return {index, 1};
23170 }
23171
23172 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
23173 auto [start, length] = getODSOperandIndexAndLength(index);
23174 return getOperation()->getOperands().slice(n: start, m: length);
23175 }
23176
23177 ::mlir::TypedValue<::mlir::TensorType> getInput() {
23178 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
23179 }
23180
23181 ::mlir::TypedValue<::mlir::TensorType> getWeight() {
23182 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 1).begin());
23183 }
23184
23185 ::mlir::TypedValue<::mlir::TensorType> getBias() {
23186 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 2).begin());
23187 }
23188
23189 ::mlir::TypedValue<::mlir::TensorType> getInputZp() {
23190 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 3).begin());
23191 }
23192
23193 ::mlir::TypedValue<::mlir::TensorType> getWeightZp() {
23194 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 4).begin());
23195 }
23196
23197 ::mlir::OpOperand &getInputMutable() {
23198 auto range = getODSOperandIndexAndLength(index: 0);
23199 return getOperation()->getOpOperand(idx: range.first);
23200 }
23201
23202 ::mlir::OpOperand &getWeightMutable() {
23203 auto range = getODSOperandIndexAndLength(index: 1);
23204 return getOperation()->getOpOperand(idx: range.first);
23205 }
23206
23207 ::mlir::OpOperand &getBiasMutable() {
23208 auto range = getODSOperandIndexAndLength(index: 2);
23209 return getOperation()->getOpOperand(idx: range.first);
23210 }
23211
23212 ::mlir::OpOperand &getInputZpMutable() {
23213 auto range = getODSOperandIndexAndLength(index: 3);
23214 return getOperation()->getOpOperand(idx: range.first);
23215 }
23216
23217 ::mlir::OpOperand &getWeightZpMutable() {
23218 auto range = getODSOperandIndexAndLength(index: 4);
23219 return getOperation()->getOpOperand(idx: range.first);
23220 }
23221
23222 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
23223 return {index, 1};
23224 }
23225
23226 ::mlir::Operation::result_range getODSResults(unsigned index) {
23227 auto valueRange = getODSResultIndexAndLength(index);
23228 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
23229 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
23230 }
23231
23232 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
23233 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
23234 }
23235
23236 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
23237 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
23238 static llvm::hash_code computePropertiesHash(const Properties &prop);
23239 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
23240 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
23241 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
23242 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
23243 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
23244 void writeProperties(::mlir::DialectBytecodeWriter &writer);
23245 ::mlir::DenseI64ArrayAttr getOutPadAttr() {
23246 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().out_pad);
23247 }
23248
23249 ::llvm::ArrayRef<int64_t> getOutPad();
23250 ::mlir::DenseI64ArrayAttr getStrideAttr() {
23251 return ::llvm::cast<::mlir::DenseI64ArrayAttr>(Val&: getProperties().stride);
23252 }
23253
23254 ::llvm::ArrayRef<int64_t> getStride();
23255 ::mlir::TypeAttr getAccTypeAttr() {
23256 return ::llvm::cast<::mlir::TypeAttr>(Val&: getProperties().acc_type);
23257 }
23258
23259 ::mlir::Type getAccType();
23260 ::mlir::BoolAttr getLocalBoundAttr() {
23261 return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(Val&: getProperties().local_bound);
23262 }
23263
23264 bool getLocalBound();
23265 void setOutPadAttr(::mlir::DenseI64ArrayAttr attr) {
23266 getProperties().out_pad = attr;
23267 }
23268
23269 void setOutPad(::llvm::ArrayRef<int64_t> attrValue);
23270 void setStrideAttr(::mlir::DenseI64ArrayAttr attr) {
23271 getProperties().stride = attr;
23272 }
23273
23274 void setStride(::llvm::ArrayRef<int64_t> attrValue);
23275 void setAccTypeAttr(::mlir::TypeAttr attr) {
23276 getProperties().acc_type = attr;
23277 }
23278
23279 void setAccType(::mlir::Type attrValue);
23280 void setLocalBoundAttr(::mlir::BoolAttr attr) {
23281 getProperties().local_bound = attr;
23282 }
23283
23284 void setLocalBound(::std::optional<bool> attrValue);
23285 ::mlir::Attribute removeLocalBoundAttr() {
23286 auto attr = getProperties().local_bound;
23287 getProperties().local_bound = {};
23288 return attr;
23289 }
23290
23291 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, mlir::Value bias, ::mlir::DenseI64ArrayAttr outpad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type);
23292 static TransposeConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, mlir::Value bias, ::mlir::DenseI64ArrayAttr outpad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type);
23293 static TransposeConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type outputType, ::mlir::Value input, ::mlir::Value weight, mlir::Value bias, ::mlir::DenseI64ArrayAttr outpad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type);
23294 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr out_pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
23295 static TransposeConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr out_pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
23296 static TransposeConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr out_pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
23297 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr out_pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
23298 static TransposeConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr out_pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
23299 static TransposeConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::mlir::DenseI64ArrayAttr out_pad, ::mlir::DenseI64ArrayAttr stride, ::mlir::TypeAttr acc_type, /*optional*/::mlir::BoolAttr local_bound = nullptr);
23300 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> out_pad, ::llvm::ArrayRef<int64_t> stride, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
23301 static TransposeConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> out_pad, ::llvm::ArrayRef<int64_t> stride, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
23302 static TransposeConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> out_pad, ::llvm::ArrayRef<int64_t> stride, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
23303 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> out_pad, ::llvm::ArrayRef<int64_t> stride, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
23304 static TransposeConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> out_pad, ::llvm::ArrayRef<int64_t> stride, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
23305 static TransposeConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value weight, ::mlir::Value bias, ::mlir::Value input_zp, ::mlir::Value weight_zp, ::llvm::ArrayRef<int64_t> out_pad, ::llvm::ArrayRef<int64_t> stride, ::mlir::Type acc_type, /*optional*/bool local_bound = false);
23306 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23307 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23308 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23309 static TransposeConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23310 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23311 static TransposeConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23312 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23313 static TransposeConv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23314 static TransposeConv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23315 ::llvm::LogicalResult verifyInvariantsImpl();
23316 ::llvm::LogicalResult verifyInvariants();
23317 ::llvm::LogicalResult verify();
23318 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
23319 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
23320 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
23321 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
23322private:
23323 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
23324 return getAttributeNameForIndex(name: (*this)->getName(), index);
23325 }
23326
23327 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
23328 assert(index < 4 && "invalid attribute index");
23329 assert(name.getStringRef() == getOperationName() && "invalid operation name");
23330 assert(name.isRegistered() && "Operation isn't registered, missing a "
23331 "dependent dialect loading?");
23332 return name.getAttributeNames()[index];
23333 }
23334
23335 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
23336public:
23337 static ::llvm::LogicalResult
23338 inferReturnTypeComponents(::mlir::MLIRContext *context,
23339 std::optional<::mlir::Location> location,
23340 Adaptor adaptor,
23341 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
23342
23343
23344 FailureOr<int64_t> getInputZeroPoint();
23345 FailureOr<int64_t> getWeightZeroPoint();
23346 LogicalResult verifyInputZeroPoint(int64_t zp);
23347 LogicalResult verifyWeightZeroPoint(int64_t zp);
23348};
23349
23350} // namespace mlir::tosa
23351MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::TransposeConv2DOp)
23352MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::TransposeConv2DOpGenericAdaptorBase::Properties)
23353
23354namespace mlir::tosa {
23355
23356
23357//===----------------------------------------------------------------------===//
23358// mlir::tosa::TransposeOp declarations
23359//===----------------------------------------------------------------------===//
23360
23361namespace detail {
23362
23363class TransposeOpGenericAdaptorBase {
23364public:
23365 struct Properties {
23366 using permsTy = ::mlir::DenseI32ArrayAttr;
23367 permsTy perms;
23368
23369 auto getPerms() const {
23370 auto &propStorage = this->perms;
23371 return ::llvm::cast<::mlir::DenseI32ArrayAttr>(Val: propStorage);
23372 }
23373 void setPerms(const ::mlir::DenseI32ArrayAttr &propValue) {
23374 this->perms = propValue;
23375 }
23376 bool operator==(const Properties &rhs) const {
23377 return
23378 rhs.perms == this->perms &&
23379 true;
23380 }
23381 bool operator!=(const Properties &rhs) const {
23382 return !(*this == rhs);
23383 }
23384 };
23385protected:
23386 ::mlir::DictionaryAttr odsAttrs;
23387 ::std::optional<::mlir::OperationName> odsOpName;
23388 Properties properties;
23389 ::mlir::RegionRange odsRegions;
23390public:
23391 TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
23392 odsOpName.emplace(args: "tosa.transpose", args: odsAttrs.getContext());
23393 }
23394
23395 TransposeOpGenericAdaptorBase(TransposeOp op);
23396
23397 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
23398 return {index, 1};
23399 }
23400
23401 const Properties &getProperties() {
23402 return properties;
23403 }
23404
23405 ::mlir::DictionaryAttr getAttributes() {
23406 return odsAttrs;
23407 }
23408
23409 ::mlir::DenseI32ArrayAttr getPermsAttr() {
23410 auto attr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(Val: getProperties().perms);
23411 return attr;
23412 }
23413
23414 ::llvm::ArrayRef<int32_t> getPerms();
23415};
23416
23417} // namespace detail
23418template <typename RangeT>
23419class TransposeOpGenericAdaptor : public detail::TransposeOpGenericAdaptorBase {
23420 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
23421 using Base = detail::TransposeOpGenericAdaptorBase;
23422 static constexpr int odsIndex_input1 = 0;
23423public:
23424 TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
23425
23426 TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
23427
23428 TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : TransposeOpGenericAdaptor(values, attrs, Properties{}, {}) {}
23429
23430 TransposeOpGenericAdaptor(RangeT values, const TransposeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
23431
23432 template <typename LateInst = TransposeOp, typename = std::enable_if_t<std::is_same_v<LateInst, TransposeOp>>>
23433 TransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
23434
23435 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
23436 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
23437 }
23438
23439 RangeT getODSOperands(unsigned index) {
23440 auto valueRange = getODSOperandIndexAndLength(index);
23441 return {std::next(odsOperands.begin(), valueRange.first),
23442 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
23443 }
23444
23445 ValueT getInput1() {
23446 return (*getODSOperands(index: 0).begin());
23447 }
23448
23449 RangeT getOperands() {
23450 return odsOperands;
23451 }
23452
23453private:
23454 RangeT odsOperands;
23455};
23456class TransposeOpAdaptor : public TransposeOpGenericAdaptor<::mlir::ValueRange> {
23457public:
23458 using TransposeOpGenericAdaptor::TransposeOpGenericAdaptor;
23459 TransposeOpAdaptor(TransposeOp op);
23460
23461 ::llvm::LogicalResult verify(::mlir::Location loc);
23462};
23463class TransposeOp : public ::mlir::Op<TransposeOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
23464public:
23465 using Op::Op;
23466 using Op::print;
23467 using Adaptor = TransposeOpAdaptor;
23468 template <typename RangeT>
23469 using GenericAdaptor = TransposeOpGenericAdaptor<RangeT>;
23470 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
23471 static constexpr int odsIndex_input1 = 0;
23472 static constexpr int odsIndex_output = 0;
23473 using Properties = FoldAdaptor::Properties;
23474 using ::mlir::ReifyRankedShapedTypeOpInterface::Trait<TransposeOp>::reifyShapeOfResult;
23475 using ::mlir::ReifyRankedShapedTypeOpInterface::Trait<TransposeOp>::reifyDimOfResult;
23476 using ::mlir::InferShapedTypeOpInterface::Trait<TransposeOp>::reifyReturnTypeShapes;
23477 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
23478 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("perms")};
23479 return ::llvm::ArrayRef(attrNames);
23480 }
23481
23482 ::mlir::StringAttr getPermsAttrName() {
23483 return getAttributeNameForIndex(index: 0);
23484 }
23485
23486 static ::mlir::StringAttr getPermsAttrName(::mlir::OperationName name) {
23487 return getAttributeNameForIndex(name, index: 0);
23488 }
23489
23490 static constexpr ::llvm::StringLiteral getOperationName() {
23491 return ::llvm::StringLiteral("tosa.transpose");
23492 }
23493
23494 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
23495 return {index, 1};
23496 }
23497
23498 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
23499 auto [start, length] = getODSOperandIndexAndLength(index);
23500 return getOperation()->getOperands().slice(n: start, m: length);
23501 }
23502
23503 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
23504 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
23505 }
23506
23507 ::mlir::OpOperand &getInput1Mutable() {
23508 auto range = getODSOperandIndexAndLength(index: 0);
23509 return getOperation()->getOpOperand(idx: range.first);
23510 }
23511
23512 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
23513 return {index, 1};
23514 }
23515
23516 ::mlir::Operation::result_range getODSResults(unsigned index) {
23517 auto valueRange = getODSResultIndexAndLength(index);
23518 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
23519 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
23520 }
23521
23522 ::mlir::TypedValue<::mlir::TensorType> getOutput() {
23523 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
23524 }
23525
23526 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
23527 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
23528 static llvm::hash_code computePropertiesHash(const Properties &prop);
23529 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
23530 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
23531 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
23532 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
23533 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
23534 void writeProperties(::mlir::DialectBytecodeWriter &writer);
23535 ::mlir::DenseI32ArrayAttr getPermsAttr() {
23536 return ::llvm::cast<::mlir::DenseI32ArrayAttr>(Val&: getProperties().perms);
23537 }
23538
23539 ::llvm::ArrayRef<int32_t> getPerms();
23540 void setPermsAttr(::mlir::DenseI32ArrayAttr attr) {
23541 getProperties().perms = attr;
23542 }
23543
23544 void setPerms(::llvm::ArrayRef<int32_t> attrValue);
23545 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::mlir::DenseI32ArrayAttr perms);
23546 static TransposeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::mlir::DenseI32ArrayAttr perms);
23547 static TransposeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::mlir::DenseI32ArrayAttr perms);
23548 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::DenseI32ArrayAttr perms);
23549 static TransposeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::DenseI32ArrayAttr perms);
23550 static TransposeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::mlir::DenseI32ArrayAttr perms);
23551 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input1, ::llvm::ArrayRef<int32_t> perms);
23552 static TransposeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Value input1, ::llvm::ArrayRef<int32_t> perms);
23553 static TransposeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Value input1, ::llvm::ArrayRef<int32_t> perms);
23554 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::llvm::ArrayRef<int32_t> perms);
23555 static TransposeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::llvm::ArrayRef<int32_t> perms);
23556 static TransposeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input1, ::llvm::ArrayRef<int32_t> perms);
23557 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23558 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23559 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23560 static TransposeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23561 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23562 static TransposeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23563 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23564 static TransposeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23565 static TransposeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23566 ::llvm::LogicalResult verifyInvariantsImpl();
23567 ::llvm::LogicalResult verifyInvariants();
23568 ::llvm::LogicalResult verify();
23569 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
23570 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
23571 ::llvm::LogicalResult reifyResultShapes(::mlir::OpBuilder &builder, ::mlir::ReifiedRankedShapedTypeDims &reifiedReturnShapes);
23572 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
23573 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
23574 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
23575 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
23576private:
23577 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
23578 return getAttributeNameForIndex(name: (*this)->getName(), index);
23579 }
23580
23581 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
23582 assert(index < 1 && "invalid attribute index");
23583 assert(name.getStringRef() == getOperationName() && "invalid operation name");
23584 assert(name.isRegistered() && "Operation isn't registered, missing a "
23585 "dependent dialect loading?");
23586 return name.getAttributeNames()[index];
23587 }
23588
23589 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
23590public:
23591 static ::llvm::LogicalResult
23592 inferReturnTypeComponents(::mlir::MLIRContext *context,
23593 std::optional<::mlir::Location> location,
23594 Adaptor adaptor,
23595 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
23596
23597};
23598
23599} // namespace mlir::tosa
23600MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::TransposeOp)
23601MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::TransposeOpGenericAdaptorBase::Properties)
23602
23603namespace mlir::tosa {
23604
23605
23606//===----------------------------------------------------------------------===//
23607// mlir::tosa::VariableOp declarations
23608//===----------------------------------------------------------------------===//
23609
23610namespace detail {
23611
23612class VariableOpGenericAdaptorBase {
23613public:
23614 struct Properties {
23615 using initial_valueTy = ::mlir::Attribute;
23616 initial_valueTy initial_value;
23617
23618 auto getInitialValue() const {
23619 auto &propStorage = this->initial_value;
23620 return ::llvm::dyn_cast_or_null<::mlir::Attribute>(Val: propStorage);
23621 }
23622 void setInitialValue(const ::mlir::Attribute &propValue) {
23623 this->initial_value = propValue;
23624 }
23625 using sym_nameTy = ::mlir::StringAttr;
23626 sym_nameTy sym_name;
23627
23628 auto getSymName() const {
23629 auto &propStorage = this->sym_name;
23630 return ::llvm::cast<::mlir::StringAttr>(Val: propStorage);
23631 }
23632 void setSymName(const ::mlir::StringAttr &propValue) {
23633 this->sym_name = propValue;
23634 }
23635 using sym_visibilityTy = ::mlir::StringAttr;
23636 sym_visibilityTy sym_visibility;
23637
23638 auto getSymVisibility() const {
23639 auto &propStorage = this->sym_visibility;
23640 return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val: propStorage);
23641 }
23642 void setSymVisibility(const ::mlir::StringAttr &propValue) {
23643 this->sym_visibility = propValue;
23644 }
23645 using typeTy = ::mlir::TypeAttr;
23646 typeTy type;
23647
23648 auto getType() const {
23649 auto &propStorage = this->type;
23650 return ::llvm::cast<::mlir::TypeAttr>(Val: propStorage);
23651 }
23652 void setType(const ::mlir::TypeAttr &propValue) {
23653 this->type = propValue;
23654 }
23655 using var_shapeTy = ::mlir::DenseIntElementsAttr;
23656 var_shapeTy var_shape;
23657
23658 auto getVarShape() const {
23659 auto &propStorage = this->var_shape;
23660 return ::llvm::cast<::mlir::DenseIntElementsAttr>(Val: propStorage);
23661 }
23662 void setVarShape(const ::mlir::DenseIntElementsAttr &propValue) {
23663 this->var_shape = propValue;
23664 }
23665 bool operator==(const Properties &rhs) const {
23666 return
23667 rhs.initial_value == this->initial_value &&
23668 rhs.sym_name == this->sym_name &&
23669 rhs.sym_visibility == this->sym_visibility &&
23670 rhs.type == this->type &&
23671 rhs.var_shape == this->var_shape &&
23672 true;
23673 }
23674 bool operator!=(const Properties &rhs) const {
23675 return !(*this == rhs);
23676 }
23677 };
23678protected:
23679 ::mlir::DictionaryAttr odsAttrs;
23680 ::std::optional<::mlir::OperationName> odsOpName;
23681 Properties properties;
23682 ::mlir::RegionRange odsRegions;
23683public:
23684 VariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
23685 odsOpName.emplace(args: "tosa.variable", args: odsAttrs.getContext());
23686 }
23687
23688 VariableOpGenericAdaptorBase(VariableOp op);
23689
23690 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
23691 return {index, 1};
23692 }
23693
23694 const Properties &getProperties() {
23695 return properties;
23696 }
23697
23698 ::mlir::DictionaryAttr getAttributes() {
23699 return odsAttrs;
23700 }
23701
23702 ::mlir::StringAttr getSymNameAttr() {
23703 auto attr = ::llvm::cast<::mlir::StringAttr>(Val: getProperties().sym_name);
23704 return attr;
23705 }
23706
23707 ::llvm::StringRef getSymName();
23708 ::mlir::StringAttr getSymVisibilityAttr() {
23709 auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val: getProperties().sym_visibility);
23710 return attr;
23711 }
23712
23713 ::std::optional< ::llvm::StringRef > getSymVisibility();
23714 ::mlir::DenseIntElementsAttr getVarShapeAttr() {
23715 auto attr = ::llvm::cast<::mlir::DenseIntElementsAttr>(Val: getProperties().var_shape);
23716 return attr;
23717 }
23718
23719 ::mlir::DenseIntElementsAttr getVarShape();
23720 ::mlir::TypeAttr getTypeAttr() {
23721 auto attr = ::llvm::cast<::mlir::TypeAttr>(Val: getProperties().type);
23722 return attr;
23723 }
23724
23725 ::mlir::Type getType();
23726 ::mlir::Attribute getInitialValueAttr() {
23727 auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(Val: getProperties().initial_value);
23728 return attr;
23729 }
23730
23731 ::std::optional<::mlir::Attribute> getInitialValue();
23732};
23733
23734} // namespace detail
23735template <typename RangeT>
23736class VariableOpGenericAdaptor : public detail::VariableOpGenericAdaptorBase {
23737 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
23738 using Base = detail::VariableOpGenericAdaptorBase;
23739public:
23740 VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
23741
23742 VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : VariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
23743
23744 VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : VariableOpGenericAdaptor(values, attrs, Properties{}, {}) {}
23745
23746 VariableOpGenericAdaptor(RangeT values, const VariableOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
23747
23748 template <typename LateInst = VariableOp, typename = std::enable_if_t<std::is_same_v<LateInst, VariableOp>>>
23749 VariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
23750
23751 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
23752 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
23753 }
23754
23755 RangeT getODSOperands(unsigned index) {
23756 auto valueRange = getODSOperandIndexAndLength(index);
23757 return {std::next(odsOperands.begin(), valueRange.first),
23758 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
23759 }
23760
23761 RangeT getOperands() {
23762 return odsOperands;
23763 }
23764
23765private:
23766 RangeT odsOperands;
23767};
23768class VariableOpAdaptor : public VariableOpGenericAdaptor<::mlir::ValueRange> {
23769public:
23770 using VariableOpGenericAdaptor::VariableOpGenericAdaptor;
23771 VariableOpAdaptor(VariableOp op);
23772
23773 ::llvm::LogicalResult verify(::mlir::Location loc);
23774};
23775class VariableOp : public ::mlir::Op<VariableOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SymbolName, ::mlir::OpTrait::SymbolVisibility, ::mlir::SymbolOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
23776public:
23777 using Op::Op;
23778 using Op::print;
23779 using Adaptor = VariableOpAdaptor;
23780 template <typename RangeT>
23781 using GenericAdaptor = VariableOpGenericAdaptor<RangeT>;
23782 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
23783 using Properties = FoldAdaptor::Properties;
23784 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
23785 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("initial_value"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("sym_visibility"), ::llvm::StringRef("type"), ::llvm::StringRef("var_shape")};
23786 return ::llvm::ArrayRef(attrNames);
23787 }
23788
23789 ::mlir::StringAttr getInitialValueAttrName() {
23790 return getAttributeNameForIndex(index: 0);
23791 }
23792
23793 static ::mlir::StringAttr getInitialValueAttrName(::mlir::OperationName name) {
23794 return getAttributeNameForIndex(name, index: 0);
23795 }
23796
23797 ::mlir::StringAttr getSymNameAttrName() {
23798 return getAttributeNameForIndex(index: 1);
23799 }
23800
23801 static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) {
23802 return getAttributeNameForIndex(name, index: 1);
23803 }
23804
23805 ::mlir::StringAttr getSymVisibilityAttrName() {
23806 return getAttributeNameForIndex(index: 2);
23807 }
23808
23809 static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) {
23810 return getAttributeNameForIndex(name, index: 2);
23811 }
23812
23813 ::mlir::StringAttr getTypeAttrName() {
23814 return getAttributeNameForIndex(index: 3);
23815 }
23816
23817 static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) {
23818 return getAttributeNameForIndex(name, index: 3);
23819 }
23820
23821 ::mlir::StringAttr getVarShapeAttrName() {
23822 return getAttributeNameForIndex(index: 4);
23823 }
23824
23825 static ::mlir::StringAttr getVarShapeAttrName(::mlir::OperationName name) {
23826 return getAttributeNameForIndex(name, index: 4);
23827 }
23828
23829 static constexpr ::llvm::StringLiteral getOperationName() {
23830 return ::llvm::StringLiteral("tosa.variable");
23831 }
23832
23833 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
23834 return {index, 1};
23835 }
23836
23837 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
23838 auto [start, length] = getODSOperandIndexAndLength(index);
23839 return getOperation()->getOperands().slice(n: start, m: length);
23840 }
23841
23842 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
23843 return {index, 1};
23844 }
23845
23846 ::mlir::Operation::result_range getODSResults(unsigned index) {
23847 auto valueRange = getODSResultIndexAndLength(index);
23848 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
23849 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
23850 }
23851
23852 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
23853 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
23854 static llvm::hash_code computePropertiesHash(const Properties &prop);
23855 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
23856 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
23857 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
23858 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
23859 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
23860 void writeProperties(::mlir::DialectBytecodeWriter &writer);
23861 ::mlir::StringAttr getSymNameAttr() {
23862 return ::llvm::cast<::mlir::StringAttr>(Val&: getProperties().sym_name);
23863 }
23864
23865 ::llvm::StringRef getSymName();
23866 ::mlir::StringAttr getSymVisibilityAttr() {
23867 return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val&: getProperties().sym_visibility);
23868 }
23869
23870 ::std::optional< ::llvm::StringRef > getSymVisibility();
23871 ::mlir::DenseIntElementsAttr getVarShapeAttr() {
23872 return ::llvm::cast<::mlir::DenseIntElementsAttr>(Val&: getProperties().var_shape);
23873 }
23874
23875 ::mlir::DenseIntElementsAttr getVarShape();
23876 ::mlir::TypeAttr getTypeAttr() {
23877 return ::llvm::cast<::mlir::TypeAttr>(Val&: getProperties().type);
23878 }
23879
23880 ::mlir::Type getType();
23881 ::mlir::Attribute getInitialValueAttr() {
23882 return ::llvm::dyn_cast_or_null<::mlir::Attribute>(Val&: getProperties().initial_value);
23883 }
23884
23885 ::std::optional<::mlir::Attribute> getInitialValue();
23886 void setSymNameAttr(::mlir::StringAttr attr) {
23887 getProperties().sym_name = attr;
23888 }
23889
23890 void setSymName(::llvm::StringRef attrValue);
23891 void setSymVisibilityAttr(::mlir::StringAttr attr) {
23892 getProperties().sym_visibility = attr;
23893 }
23894
23895 void setSymVisibility(::std::optional<::llvm::StringRef> attrValue);
23896 void setVarShapeAttr(::mlir::DenseIntElementsAttr attr) {
23897 getProperties().var_shape = attr;
23898 }
23899
23900 void setTypeAttr(::mlir::TypeAttr attr) {
23901 getProperties().type = attr;
23902 }
23903
23904 void setType(::mlir::Type attrValue);
23905 void setInitialValueAttr(::mlir::Attribute attr) {
23906 getProperties().initial_value = attr;
23907 }
23908
23909 ::mlir::Attribute removeSymVisibilityAttr() {
23910 auto attr = getProperties().sym_visibility;
23911 getProperties().sym_visibility = {};
23912 return attr;
23913 }
23914
23915 ::mlir::Attribute removeInitialValueAttr() {
23916 auto attr = getProperties().initial_value;
23917 getProperties().initial_value = {};
23918 return attr;
23919 }
23920
23921 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef sym_name, Type variable_type, Attribute initial_value);
23922 static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef sym_name, Type variable_type, Attribute initial_value);
23923 static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, StringRef sym_name, Type variable_type, Attribute initial_value);
23924 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value);
23925 static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value);
23926 static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value);
23927 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value);
23928 static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value);
23929 static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value);
23930 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value);
23931 static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value);
23932 static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value);
23933 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value);
23934 static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value);
23935 static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/::mlir::StringAttr sym_visibility, ::mlir::DenseIntElementsAttr var_shape, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value);
23936 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23937 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23938 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23939 static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23940 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
23941 static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
23942 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23943 static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23944 static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
23945 ::llvm::LogicalResult verifyInvariantsImpl();
23946 ::llvm::LogicalResult verifyInvariants();
23947 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
23948 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
23949private:
23950 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
23951 return getAttributeNameForIndex(name: (*this)->getName(), index);
23952 }
23953
23954 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
23955 assert(index < 5 && "invalid attribute index");
23956 assert(name.getStringRef() == getOperationName() && "invalid operation name");
23957 assert(name.isRegistered() && "Operation isn't registered, missing a "
23958 "dependent dialect loading?");
23959 return name.getAttributeNames()[index];
23960 }
23961
23962 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
23963public:
23964 ::llvm::StringRef getName() {
23965 return getSymName();
23966 }
23967};
23968
23969} // namespace mlir::tosa
23970MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::VariableOp)
23971MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::VariableOpGenericAdaptorBase::Properties)
23972
23973namespace mlir::tosa {
23974
23975
23976//===----------------------------------------------------------------------===//
23977// mlir::tosa::VariableReadOp declarations
23978//===----------------------------------------------------------------------===//
23979
23980namespace detail {
23981
23982class VariableReadOpGenericAdaptorBase {
23983public:
23984 struct Properties {
23985 using nameTy = ::mlir::StringAttr;
23986 nameTy name;
23987
23988 auto getName() const {
23989 auto &propStorage = this->name;
23990 return ::llvm::cast<::mlir::StringAttr>(Val: propStorage);
23991 }
23992 void setName(const ::mlir::StringAttr &propValue) {
23993 this->name = propValue;
23994 }
23995 bool operator==(const Properties &rhs) const {
23996 return
23997 rhs.name == this->name &&
23998 true;
23999 }
24000 bool operator!=(const Properties &rhs) const {
24001 return !(*this == rhs);
24002 }
24003 };
24004protected:
24005 ::mlir::DictionaryAttr odsAttrs;
24006 ::std::optional<::mlir::OperationName> odsOpName;
24007 Properties properties;
24008 ::mlir::RegionRange odsRegions;
24009public:
24010 VariableReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
24011 odsOpName.emplace(args: "tosa.variable_read", args: odsAttrs.getContext());
24012 }
24013
24014 VariableReadOpGenericAdaptorBase(VariableReadOp op);
24015
24016 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
24017 return {index, 1};
24018 }
24019
24020 const Properties &getProperties() {
24021 return properties;
24022 }
24023
24024 ::mlir::DictionaryAttr getAttributes() {
24025 return odsAttrs;
24026 }
24027
24028 ::mlir::StringAttr getNameAttr() {
24029 auto attr = ::llvm::cast<::mlir::StringAttr>(Val: getProperties().name);
24030 return attr;
24031 }
24032
24033 ::llvm::StringRef getName();
24034};
24035
24036} // namespace detail
24037template <typename RangeT>
24038class VariableReadOpGenericAdaptor : public detail::VariableReadOpGenericAdaptorBase {
24039 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
24040 using Base = detail::VariableReadOpGenericAdaptorBase;
24041public:
24042 VariableReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
24043
24044 VariableReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : VariableReadOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
24045
24046 VariableReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : VariableReadOpGenericAdaptor(values, attrs, Properties{}, {}) {}
24047
24048 VariableReadOpGenericAdaptor(RangeT values, const VariableReadOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
24049
24050 template <typename LateInst = VariableReadOp, typename = std::enable_if_t<std::is_same_v<LateInst, VariableReadOp>>>
24051 VariableReadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
24052
24053 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
24054 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
24055 }
24056
24057 RangeT getODSOperands(unsigned index) {
24058 auto valueRange = getODSOperandIndexAndLength(index);
24059 return {std::next(odsOperands.begin(), valueRange.first),
24060 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
24061 }
24062
24063 RangeT getOperands() {
24064 return odsOperands;
24065 }
24066
24067private:
24068 RangeT odsOperands;
24069};
24070class VariableReadOpAdaptor : public VariableReadOpGenericAdaptor<::mlir::ValueRange> {
24071public:
24072 using VariableReadOpGenericAdaptor::VariableReadOpGenericAdaptor;
24073 VariableReadOpAdaptor(VariableReadOp op);
24074
24075 ::llvm::LogicalResult verify(::mlir::Location loc);
24076};
24077class VariableReadOp : public ::mlir::Op<VariableReadOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
24078public:
24079 using Op::Op;
24080 using Op::print;
24081 using Adaptor = VariableReadOpAdaptor;
24082 template <typename RangeT>
24083 using GenericAdaptor = VariableReadOpGenericAdaptor<RangeT>;
24084 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
24085 static constexpr int odsIndex_output1 = 0;
24086 using Properties = FoldAdaptor::Properties;
24087 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
24088 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")};
24089 return ::llvm::ArrayRef(attrNames);
24090 }
24091
24092 ::mlir::StringAttr getNameAttrName() {
24093 return getAttributeNameForIndex(index: 0);
24094 }
24095
24096 static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) {
24097 return getAttributeNameForIndex(name, index: 0);
24098 }
24099
24100 static constexpr ::llvm::StringLiteral getOperationName() {
24101 return ::llvm::StringLiteral("tosa.variable_read");
24102 }
24103
24104 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
24105 return {index, 1};
24106 }
24107
24108 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
24109 auto [start, length] = getODSOperandIndexAndLength(index);
24110 return getOperation()->getOperands().slice(n: start, m: length);
24111 }
24112
24113 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
24114 return {index, 1};
24115 }
24116
24117 ::mlir::Operation::result_range getODSResults(unsigned index) {
24118 auto valueRange = getODSResultIndexAndLength(index);
24119 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
24120 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
24121 }
24122
24123 ::mlir::TypedValue<::mlir::TensorType> getOutput1() {
24124 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSResults(index: 0).begin());
24125 }
24126
24127 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24128 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
24129 static llvm::hash_code computePropertiesHash(const Properties &prop);
24130 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
24131 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
24132 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
24133 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24134 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
24135 void writeProperties(::mlir::DialectBytecodeWriter &writer);
24136 ::mlir::StringAttr getNameAttr() {
24137 return ::llvm::cast<::mlir::StringAttr>(Val&: getProperties().name);
24138 }
24139
24140 ::llvm::StringRef getName();
24141 void setNameAttr(::mlir::StringAttr attr) {
24142 getProperties().name = attr;
24143 }
24144
24145 void setName(::llvm::StringRef attrValue);
24146 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output1, ::mlir::StringAttr name);
24147 static VariableReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output1, ::mlir::StringAttr name);
24148 static VariableReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output1, ::mlir::StringAttr name);
24149 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name);
24150 static VariableReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name);
24151 static VariableReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name);
24152 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output1, ::llvm::StringRef name);
24153 static VariableReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output1, ::llvm::StringRef name);
24154 static VariableReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output1, ::llvm::StringRef name);
24155 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name);
24156 static VariableReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef name);
24157 static VariableReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef name);
24158 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
24159 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24160 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
24161 static VariableReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24162 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
24163 static VariableReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24164 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24165 static VariableReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24166 static VariableReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24167 ::llvm::LogicalResult verifyInvariantsImpl();
24168 ::llvm::LogicalResult verifyInvariants();
24169 ::llvm::LogicalResult verify();
24170 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
24171 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
24172private:
24173 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
24174 return getAttributeNameForIndex(name: (*this)->getName(), index);
24175 }
24176
24177 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
24178 assert(index < 1 && "invalid attribute index");
24179 assert(name.getStringRef() == getOperationName() && "invalid operation name");
24180 assert(name.isRegistered() && "Operation isn't registered, missing a "
24181 "dependent dialect loading?");
24182 return name.getAttributeNames()[index];
24183 }
24184
24185 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
24186public:
24187};
24188
24189} // namespace mlir::tosa
24190MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::VariableReadOp)
24191MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::VariableReadOpGenericAdaptorBase::Properties)
24192
24193namespace mlir::tosa {
24194
24195
24196//===----------------------------------------------------------------------===//
24197// mlir::tosa::VariableWriteOp declarations
24198//===----------------------------------------------------------------------===//
24199
24200namespace detail {
24201
24202class VariableWriteOpGenericAdaptorBase {
24203public:
24204 struct Properties {
24205 using nameTy = ::mlir::StringAttr;
24206 nameTy name;
24207
24208 auto getName() const {
24209 auto &propStorage = this->name;
24210 return ::llvm::cast<::mlir::StringAttr>(Val: propStorage);
24211 }
24212 void setName(const ::mlir::StringAttr &propValue) {
24213 this->name = propValue;
24214 }
24215 bool operator==(const Properties &rhs) const {
24216 return
24217 rhs.name == this->name &&
24218 true;
24219 }
24220 bool operator!=(const Properties &rhs) const {
24221 return !(*this == rhs);
24222 }
24223 };
24224protected:
24225 ::mlir::DictionaryAttr odsAttrs;
24226 ::std::optional<::mlir::OperationName> odsOpName;
24227 Properties properties;
24228 ::mlir::RegionRange odsRegions;
24229public:
24230 VariableWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
24231 odsOpName.emplace(args: "tosa.variable_write", args: odsAttrs.getContext());
24232 }
24233
24234 VariableWriteOpGenericAdaptorBase(VariableWriteOp op);
24235
24236 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
24237 return {index, 1};
24238 }
24239
24240 const Properties &getProperties() {
24241 return properties;
24242 }
24243
24244 ::mlir::DictionaryAttr getAttributes() {
24245 return odsAttrs;
24246 }
24247
24248 ::mlir::StringAttr getNameAttr() {
24249 auto attr = ::llvm::cast<::mlir::StringAttr>(Val: getProperties().name);
24250 return attr;
24251 }
24252
24253 ::llvm::StringRef getName();
24254};
24255
24256} // namespace detail
24257template <typename RangeT>
24258class VariableWriteOpGenericAdaptor : public detail::VariableWriteOpGenericAdaptorBase {
24259 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
24260 using Base = detail::VariableWriteOpGenericAdaptorBase;
24261 static constexpr int odsIndex_input1 = 0;
24262public:
24263 VariableWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
24264
24265 VariableWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : VariableWriteOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
24266
24267 VariableWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : VariableWriteOpGenericAdaptor(values, attrs, Properties{}, {}) {}
24268
24269 VariableWriteOpGenericAdaptor(RangeT values, const VariableWriteOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
24270
24271 template <typename LateInst = VariableWriteOp, typename = std::enable_if_t<std::is_same_v<LateInst, VariableWriteOp>>>
24272 VariableWriteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
24273
24274 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
24275 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
24276 }
24277
24278 RangeT getODSOperands(unsigned index) {
24279 auto valueRange = getODSOperandIndexAndLength(index);
24280 return {std::next(odsOperands.begin(), valueRange.first),
24281 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
24282 }
24283
24284 ValueT getInput1() {
24285 return (*getODSOperands(index: 0).begin());
24286 }
24287
24288 RangeT getOperands() {
24289 return odsOperands;
24290 }
24291
24292private:
24293 RangeT odsOperands;
24294};
24295class VariableWriteOpAdaptor : public VariableWriteOpGenericAdaptor<::mlir::ValueRange> {
24296public:
24297 using VariableWriteOpGenericAdaptor::VariableWriteOpGenericAdaptor;
24298 VariableWriteOpAdaptor(VariableWriteOp op);
24299
24300 ::llvm::LogicalResult verify(::mlir::Location loc);
24301};
24302class VariableWriteOp : public ::mlir::Op<VariableWriteOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
24303public:
24304 using Op::Op;
24305 using Op::print;
24306 using Adaptor = VariableWriteOpAdaptor;
24307 template <typename RangeT>
24308 using GenericAdaptor = VariableWriteOpGenericAdaptor<RangeT>;
24309 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
24310 static constexpr int odsIndex_input1 = 0;
24311 using Properties = FoldAdaptor::Properties;
24312 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
24313 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")};
24314 return ::llvm::ArrayRef(attrNames);
24315 }
24316
24317 ::mlir::StringAttr getNameAttrName() {
24318 return getAttributeNameForIndex(index: 0);
24319 }
24320
24321 static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) {
24322 return getAttributeNameForIndex(name, index: 0);
24323 }
24324
24325 static constexpr ::llvm::StringLiteral getOperationName() {
24326 return ::llvm::StringLiteral("tosa.variable_write");
24327 }
24328
24329 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
24330 return {index, 1};
24331 }
24332
24333 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
24334 auto [start, length] = getODSOperandIndexAndLength(index);
24335 return getOperation()->getOperands().slice(n: start, m: length);
24336 }
24337
24338 ::mlir::TypedValue<::mlir::TensorType> getInput1() {
24339 return ::llvm::cast<::mlir::TypedValue<::mlir::TensorType>>(Val: *getODSOperands(index: 0).begin());
24340 }
24341
24342 ::mlir::OpOperand &getInput1Mutable() {
24343 auto range = getODSOperandIndexAndLength(index: 0);
24344 return getOperation()->getOpOperand(idx: range.first);
24345 }
24346
24347 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
24348 return {index, 1};
24349 }
24350
24351 ::mlir::Operation::result_range getODSResults(unsigned index) {
24352 auto valueRange = getODSResultIndexAndLength(index);
24353 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
24354 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
24355 }
24356
24357 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24358 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
24359 static llvm::hash_code computePropertiesHash(const Properties &prop);
24360 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
24361 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
24362 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
24363 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24364 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
24365 void writeProperties(::mlir::DialectBytecodeWriter &writer);
24366 ::mlir::StringAttr getNameAttr() {
24367 return ::llvm::cast<::mlir::StringAttr>(Val&: getProperties().name);
24368 }
24369
24370 ::llvm::StringRef getName();
24371 void setNameAttr(::mlir::StringAttr attr) {
24372 getProperties().name = attr;
24373 }
24374
24375 void setName(::llvm::StringRef attrValue);
24376 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr name, ::mlir::Value input1);
24377 static VariableWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr name, ::mlir::Value input1);
24378 static VariableWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr name, ::mlir::Value input1);
24379 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::Value input1);
24380 static VariableWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::Value input1);
24381 static VariableWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::Value input1);
24382 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef name, ::mlir::Value input1);
24383 static VariableWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef name, ::mlir::Value input1);
24384 static VariableWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef name, ::mlir::Value input1);
24385 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::Value input1);
24386 static VariableWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::Value input1);
24387 static VariableWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::Value input1);
24388 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
24389 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24390 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
24391 static VariableWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24392 [[deprecated("use the overload taking Properties and discardableAttributes instead")]]
24393 static VariableWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24394 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24395 static VariableWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24396 static VariableWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24397 ::llvm::LogicalResult verifyInvariantsImpl();
24398 ::llvm::LogicalResult verifyInvariants();
24399 ::llvm::LogicalResult verify();
24400 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
24401 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
24402private:
24403 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
24404 return getAttributeNameForIndex(name: (*this)->getName(), index);
24405 }
24406
24407 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
24408 assert(index < 1 && "invalid attribute index");
24409 assert(name.getStringRef() == getOperationName() && "invalid operation name");
24410 assert(name.isRegistered() && "Operation isn't registered, missing a "
24411 "dependent dialect loading?");
24412 return name.getAttributeNames()[index];
24413 }
24414
24415 static void buildPropertiesAndDiscardableAttributes(::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes);
24416public:
24417};
24418
24419} // namespace mlir::tosa
24420MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::VariableWriteOp)
24421MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::detail::VariableWriteOpGenericAdaptorBase::Properties)
24422
24423namespace mlir::tosa {
24424
24425
24426//===----------------------------------------------------------------------===//
24427// mlir::tosa::WhileOp declarations
24428//===----------------------------------------------------------------------===//
24429
24430namespace detail {
24431
24432class WhileOpGenericAdaptorBase {
24433public:
24434 using Properties = ::mlir::EmptyProperties;
24435protected:
24436 ::mlir::DictionaryAttr odsAttrs;
24437 ::std::optional<::mlir::OperationName> odsOpName;
24438 Properties properties;
24439 ::mlir::RegionRange odsRegions;
24440public:
24441 WhileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
24442 odsOpName.emplace(args: "tosa.while_loop", args: odsAttrs.getContext());
24443 }
24444
24445 WhileOpGenericAdaptorBase(WhileOp op);
24446
24447 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
24448 const Properties &getProperties() {
24449 return properties;
24450 }
24451
24452 ::mlir::DictionaryAttr getAttributes() {
24453 return odsAttrs;
24454 }
24455
24456 ::mlir::Region &getCondGraph() {
24457 return *odsRegions[0];
24458 }
24459
24460 ::mlir::Region &getBodyGraph() {
24461 return *odsRegions[1];
24462 }
24463
24464 ::mlir::RegionRange getRegions() {
24465 return odsRegions;
24466 }
24467
24468};
24469
24470} // namespace detail
24471template <typename RangeT>
24472class WhileOpGenericAdaptor : public detail::WhileOpGenericAdaptorBase {
24473 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
24474 using Base = detail::WhileOpGenericAdaptorBase;
24475 static constexpr int odsIndex_input_list = 0;
24476public:
24477 WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
24478
24479 WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : WhileOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
24480
24481 WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : WhileOpGenericAdaptor(values, attrs, Properties{}, {}) {}
24482
24483 WhileOpGenericAdaptor(RangeT values, const WhileOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
24484
24485 template <typename LateInst = WhileOp, typename = std::enable_if_t<std::is_same_v<LateInst, WhileOp>>>
24486 WhileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
24487
24488 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
24489 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
24490 }
24491
24492 RangeT getODSOperands(unsigned index) {
24493 auto valueRange = getODSOperandIndexAndLength(index);
24494 return {std::next(odsOperands.begin(), valueRange.first),
24495 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
24496 }
24497
24498 RangeT getInputList() {
24499 return getODSOperands(index: 0);
24500 }
24501
24502 RangeT getOperands() {
24503 return odsOperands;
24504 }
24505
24506private:
24507 RangeT odsOperands;
24508};
24509class WhileOpAdaptor : public WhileOpGenericAdaptor<::mlir::ValueRange> {
24510public:
24511 using WhileOpGenericAdaptor::WhileOpGenericAdaptor;
24512 WhileOpAdaptor(WhileOp op);
24513
24514 ::llvm::LogicalResult verify(::mlir::Location loc);
24515};
24516class WhileOp : public ::mlir::Op<WhileOp, ::mlir::OpTrait::NRegions<2>::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator<YieldOp>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::LoopLikeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferShapedTypeOpAdaptor, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
24517public:
24518 using Op::Op;
24519 using Op::print;
24520 using Adaptor = WhileOpAdaptor;
24521 template <typename RangeT>
24522 using GenericAdaptor = WhileOpGenericAdaptor<RangeT>;
24523 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
24524 static constexpr int odsIndex_input_list = 0;
24525 static constexpr int odsIndex_output_list = 0;
24526 using Properties = FoldAdaptor::Properties;
24527 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::isDefinedOutsideOfLoop;
24528 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::moveOutOfLoop;
24529 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::promoteIfSingleIteration;
24530 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getLoopInductionVars;
24531 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getLoopLowerBounds;
24532 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getLoopSteps;
24533 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getLoopUpperBounds;
24534 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getInitsMutable;
24535 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getRegionIterArgs;
24536 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getYieldedValuesMutable;
24537 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getLoopResults;
24538 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::replaceWithAdditionalYields;
24539 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::getStaticTripCount;
24540 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::isValidInductionVarType;
24541 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::setLoopLowerBounds;
24542 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::setLoopUpperBounds;
24543 using ::mlir::LoopLikeOpInterface::Trait<WhileOp>::setLoopSteps;
24544 using ::mlir::InferShapedTypeOpInterface::Trait<WhileOp>::reifyReturnTypeShapes;
24545 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
24546 return {};
24547 }
24548
24549 static constexpr ::llvm::StringLiteral getOperationName() {
24550 return ::llvm::StringLiteral("tosa.while_loop");
24551 }
24552
24553 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
24554 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
24555 auto [start, length] = getODSOperandIndexAndLength(index);
24556 return getOperation()->getOperands().slice(n: start, m: length);
24557 }
24558
24559 ::mlir::Operation::operand_range getInputList() {
24560 return getODSOperands(index: 0);
24561 }
24562
24563 ::mlir::MutableOperandRange getInputListMutable();
24564 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
24565 ::mlir::Operation::result_range getODSResults(unsigned index) {
24566 auto valueRange = getODSResultIndexAndLength(index);
24567 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
24568 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
24569 }
24570
24571 ::mlir::Operation::result_range getOutputList() {
24572 return getODSResults(index: 0);
24573 }
24574
24575 ::mlir::Region &getCondGraph() {
24576 return (*this)->getRegion(index: 0);
24577 }
24578
24579 ::mlir::Region &getBodyGraph() {
24580 return (*this)->getRegion(index: 1);
24581 }
24582
24583 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24584 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
24585 static llvm::hash_code computePropertiesHash(const Properties &prop);
24586 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
24587 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
24588 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
24589 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24590 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24591 static WhileOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24592 static WhileOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24593 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24594 static WhileOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24595 static WhileOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24596 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
24597 void print(::mlir::OpAsmPrinter &p);
24598 ::llvm::LogicalResult verifyInvariantsImpl();
24599 ::llvm::LogicalResult verifyInvariants();
24600 ::llvm::LogicalResult verify();
24601 ::llvm::SmallVector<::mlir::Region *> getLoopRegions();
24602 static ::llvm::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes);
24603 static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24604public:
24605 static ::llvm::LogicalResult
24606 inferReturnTypeComponents(::mlir::MLIRContext *context,
24607 std::optional<::mlir::Location> location,
24608 Adaptor adaptor,
24609 ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
24610
24611};
24612
24613} // namespace mlir::tosa
24614MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::WhileOp)
24615
24616namespace mlir::tosa {
24617
24618
24619//===----------------------------------------------------------------------===//
24620// mlir::tosa::YieldOp declarations
24621//===----------------------------------------------------------------------===//
24622
24623namespace detail {
24624
24625class YieldOpGenericAdaptorBase {
24626public:
24627 using Properties = ::mlir::EmptyProperties;
24628protected:
24629 ::mlir::DictionaryAttr odsAttrs;
24630 ::std::optional<::mlir::OperationName> odsOpName;
24631 Properties properties;
24632 ::mlir::RegionRange odsRegions;
24633public:
24634 YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
24635 odsOpName.emplace(args: "tosa.yield", args: odsAttrs.getContext());
24636 }
24637
24638 YieldOpGenericAdaptorBase(YieldOp op);
24639
24640 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize);
24641 const Properties &getProperties() {
24642 return properties;
24643 }
24644
24645 ::mlir::DictionaryAttr getAttributes() {
24646 return odsAttrs;
24647 }
24648
24649};
24650
24651} // namespace detail
24652template <typename RangeT>
24653class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase {
24654 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
24655 using Base = detail::YieldOpGenericAdaptorBase;
24656 static constexpr int odsIndex_inputs = 0;
24657public:
24658 YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
24659
24660 YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
24661
24662 YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : YieldOpGenericAdaptor(values, attrs, Properties{}, {}) {}
24663
24664 YieldOpGenericAdaptor(RangeT values, const YieldOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
24665
24666 template <typename LateInst = YieldOp, typename = std::enable_if_t<std::is_same_v<LateInst, YieldOp>>>
24667 YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
24668
24669 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
24670 return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size());
24671 }
24672
24673 RangeT getODSOperands(unsigned index) {
24674 auto valueRange = getODSOperandIndexAndLength(index);
24675 return {std::next(odsOperands.begin(), valueRange.first),
24676 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
24677 }
24678
24679 RangeT getInputs() {
24680 return getODSOperands(index: 0);
24681 }
24682
24683 RangeT getOperands() {
24684 return odsOperands;
24685 }
24686
24687private:
24688 RangeT odsOperands;
24689};
24690class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> {
24691public:
24692 using YieldOpGenericAdaptor::YieldOpGenericAdaptor;
24693 YieldOpAdaptor(YieldOp op);
24694
24695 ::llvm::LogicalResult verify(::mlir::Location loc);
24696};
24697class YieldOp : public ::mlir::Op<YieldOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::tosa::TosaOp::Trait, mlir::OpTrait::tosa::TosaResolvableShapeOperands> {
24698public:
24699 using Op::Op;
24700 using Op::print;
24701 using Adaptor = YieldOpAdaptor;
24702 template <typename RangeT>
24703 using GenericAdaptor = YieldOpGenericAdaptor<RangeT>;
24704 using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>;
24705 static constexpr int odsIndex_inputs = 0;
24706 using Properties = FoldAdaptor::Properties;
24707 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
24708 return {};
24709 }
24710
24711 static constexpr ::llvm::StringLiteral getOperationName() {
24712 return ::llvm::StringLiteral("tosa.yield");
24713 }
24714
24715 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
24716 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
24717 auto [start, length] = getODSOperandIndexAndLength(index);
24718 return getOperation()->getOperands().slice(n: start, m: length);
24719 }
24720
24721 ::mlir::Operation::operand_range getInputs() {
24722 return getODSOperands(index: 0);
24723 }
24724
24725 ::mlir::MutableOperandRange getInputsMutable();
24726 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
24727 return {index, 1};
24728 }
24729
24730 ::mlir::Operation::result_range getODSResults(unsigned index) {
24731 auto valueRange = getODSResultIndexAndLength(index);
24732 return {std::next(x: getOperation()->result_begin(), n: valueRange.first),
24733 std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)};
24734 }
24735
24736 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24737 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
24738 static llvm::hash_code computePropertiesHash(const Properties &prop);
24739 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
24740 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
24741 static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor);
24742 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
24743 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs);
24744 static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange inputs);
24745 static YieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange inputs);
24746 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24747 static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24748 static YieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
24749 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24750 static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24751 static YieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
24752 ::llvm::LogicalResult verifyInvariantsImpl();
24753 ::llvm::LogicalResult verifyInvariants();
24754 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
24755 LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter);
24756 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
24757public:
24758};
24759
24760} // namespace mlir::tosa
24761MLIR_DECLARE_EXPLICIT_TYPE_ID(mlir::tosa::YieldOp)
24762
24763
24764#endif // GET_OP_CLASSES
24765
24766