/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Op Declarations *| |* *| |* Automatically generated file, do not edit! *| |* From: LinalgStructuredOps.td *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::linalg { /// Applies abs(x) elementwise. /// No numeric casting is performed on the input operand. class AbsOp; } // namespace mlir::linalg namespace mlir::linalg { /// Adds two tensors elementwise. /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.add` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class AddOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a batched matrix multiplication of two 3D inputs. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. /// /// Broadcast and Transpose semantics can be appiled by specifying the explicit attribute /// 'indexing_maps' as shown below. This is a list attribute, so must include maps for all /// arguments if specified. /// /// Example Transpose: /// ```mlir /// linalg.batch_matmul /// indexing_maps = [affine_map<(batch, m, n, k) -> (batch, k, m)>, // transpose /// affine_map<(batch, m, n, k) -> (batch, k, n)>, /// affine_map<(batch, m, n, k) -> (batch, m, n)>] /// ins(%arg0, %arg1 : memref<2x5x3xf32>,memref<2x5x7xf32>) /// outs(%arg2: memref<2x3x7xf32>) /// ``` /// /// Example Broadcast: /// ```mlir /// linalg.batch_matmul /// indexing_maps = [affine_map<(batch, m, n, k) -> (k)>, // broadcast /// affine_map<(batch, m, n, k) -> (batch, k, n)>, /// affine_map<(batch, m, n, k) -> (batch, m, n)>] /// ins(%arg0, %arg1 : memref<5xf32>, memref<2x5x7xf32>) /// outs(%arg2: memref<2x3x7xf32>) /// ``` /// /// Example Broadcast and Transpose: /// ```mlir /// linalg.batch_matmul /// indexing_maps = [affine_map<(batch, m, n, k) -> (m, k)>, // broadcast /// affine_map<(batch, m, n, k) -> (batch, n, k)>, // transpose /// affine_map<(batch, m, n, k) -> (batch, m, n)>] /// ins(%arg0, %arg1 : memref<3x5xf32>, memref<2x7x5xf32>) /// outs(%arg2: memref<2x3x7xf32>) /// ``` class BatchMatmulOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a batched matrix-vector multiplication. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class BatchMatvecOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a batched matrix-matrix-transpose multiplication of two /// batched-4D (5D) inputs. /// Besides the outermost batch dimension has the same semantic as /// linalg.batch_matmul, the differences from linalg.batch_matmul in the /// non-batch dimensions are the same as linalg.mmt4d vs. linalg.matmul. See the /// description of lingalg.mmt4d. class BatchMmt4DOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a batch-reduce matrix multiplication on two inputs. /// The partial multiplication results are reduced into a 2D output. /// Numeric casting is performed on the operands to the inner multiply, /// promoting them to the same data type as the accumulator/output. /// /// Broadcast and Transpose semantics can be applied by specifying the explicit attribute /// 'indexing_maps' as shown below. This is a list attribute, so must include maps for all /// arguments if specified. /// /// Example Transpose: /// ```mlir /// linalg.batch_reduce_matmul /// indexing_maps = [affine_map<(batch, m, n, k) -> (batch, k, m)>, // transpose /// affine_map<(batch, m, n, k) -> (batch, k, n)>, /// affine_map<(batch, m, n, k) -> (m, n)>] /// ins(%arg0, %arg1 : memref<2x5x3xf32>,memref<2x5x7xf32>) /// outs(%arg2: memref<3x7xf32>) /// ``` /// /// Example Broadcast: /// ```mlir /// linalg.batch_reduce_matmul /// indexing_maps = [affine_map<(batch, m, n, k) -> (k)>, // broadcast /// affine_map<(batch, m, n, k) -> (batch, k, n)>, /// affine_map<(batch, m, n, k) -> (m, n)>] /// ins(%arg0, %arg1 : memref<5xf32>, memref<2x5x7xf32>) /// outs(%arg2: memref<3x7xf32>) /// ``` /// /// Example Broadcast and Transpose: /// ```mlir /// linalg.batch_reduce_matmul /// indexing_maps = [affine_map<(batch, m, n, k) -> (m, k)>, // broadcast /// affine_map<(batch, m, n, k) -> (batch, n, k)>, // transpose /// affine_map<(batch, m, n, k) -> (m, n)>] /// ins(%arg0, %arg1 : memref<3x5xf32>, memref<2x7x5xf32>) /// outs(%arg2: memref<3x7xf32>) /// ``` class BatchReduceMatmulOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a batched matrix-vector multiplication. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class BatchVecmatOp; } // namespace mlir::linalg namespace mlir::linalg { /// Static broadcast operator /// Broadcast the input into the given shape by adding `dimensions`. /// /// Example: /// ```mlir /// %bcast = linalg.broadcast /// ins(%input:tensor<16xf32>) /// outs(%init:tensor<16x64xf32>) /// dimensions = [1] /// ``` class BroadcastOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies ceil(x) elementwise. /// No numeric casting is performed on the input operand. class CeilOp; } // namespace mlir::linalg namespace mlir::linalg { /// Perform a contraction on two inputs, accumulating into the third. /// The semantics of contracting inputs `A` and `B` on top of `C` to produce /// output `D` is given by /// /// `D[H] = (SUM_{(I ∪ J) \ H} A[I] * B[J]) + C[H]` /// /// where `I`, `J`, and `H` are tuples of (pairwise distinct) dimension /// identifiers - meant to range over valid indices - corresponding to the /// results of the mandatory (projected permutation) `indexing_maps` for `A`, /// `B` and `C`. `SUM_{dims}` means reduce over all valid indices for the /// dimensions in the set `dims` (with `I`, `J`, and `K` treated as _sets_ of /// dim identifiers). /// /// The iteration space consists of all dimensions in `I`, `J` and `H`, i.e. the /// domain of each of the `affine_map`s. Like for einsums, the iteration type of /// each dim is inferred and is either: /// /// - reduction: the dim is used to index into `A` and `B` but not `C`. Per the /// above semantics, these dims will be contracted, i.e. reduced over. /// /// - parallel: the dim is used to index into `C` and at least one of `A` and /// `B`, and - deriving from matmul terminology - is either an "M-like" dim /// (if used on `A` and `C`), an "N-like" dim (if used on `B` and `C`) or a /// "batch"-dim (if used to index into `A`, `B`, and `C`). /// /// For example, batch-matmul is given by `I = ⟨ b, m, k ⟩`, `J = ⟨ b, k, n ⟩`, /// `H = ⟨ b, m, n ⟩` (with `k` as a contracting reduction-dimension while `m`, /// `n` and `b` have parallel iteration-type) and gets represented as: /// /// ```mlir /// %D = linalg.contract /// indexing_maps = [affine_map<(batch, m, n, k) -> (batch, m, k)>, /// affine_map<(batch, m, n, k) -> (batch, k, n)>, /// affine_map<(batch, m, n, k) -> (batch, m, n)>] /// ins(%A, %B: tensor, tensor) /// outs(%C: tensor) -> tensor /// ``` /// /// Note that by permuting dims in the `affine_map`s' results, accesses to /// to the inputs and output can be arbitrarily transposed. Similarly, arbitrary /// broadcasts can be achieved through leaving out dims on either input operand. /// For example, the following is a variant of batch-matmul with a transposition /// applied to `A` while `B`'s 2D-matrix gets broadcasted along the batch dim: /// /// ```mlir /// linalg.contract /// indexing_maps = [affine_map<(batch, m, n, k) -> (batch, k, m)>, /// affine_map<(batch, m, n, k) -> (k, n)>, /// affine_map<(batch, m, n, k) -> (batch, m, n)>] /// ins(%A, %B: memref, memref) /// outs(%C: memref) /// ``` /// /// Numeric casting is performed on the operands to the inner multiplication, /// promoting/truncating them to the same data type as the accumulator/output. /// /// TODO: Allow control over the combining/accumulating op and possibly the /// multiplication op. class ContractOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 1-D convolution. /// Layout: /// * Input: NCW. /// * Kernel: FCW. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv1DNcwFcwOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 1-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv1DNwcWcfOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 1-D convolution with no channels. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv1DOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D convolution. /// Layout: /// * Input: NCHW. /// * Kernel: FCHW. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv2DNchwFchwOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D convolution with zero point offsets. /// Layout: /// * Input: NCHW. /// * Kernel: FCHW. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. This includes the zero /// point offsets common to quantized operations. class Conv2DNchwFchwQOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D grouped convolution. /// Layout: /// * Input: NGCHW. /// * Kernel: FGCHW. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv2DNgchwFgchwOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D grouped convolution. /// Layout: /// * Input: NGCHW. /// * Kernel: GFCHW. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv2DNgchwGfchwOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D grouped convolution with zero-point offsets. /// Layout: /// * Input: NGCHW. /// * Kernel: GFCHW. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. This includes the zero /// point offsets common to quantized operations. class Conv2DNgchwGfchwQOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D convolution. /// Layout: /// * Input: NHWC. /// * Kernel: FHWC. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv2DNhwcFhwcOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D convolution with zero point offsets. /// Layout: /// * Input: NHWC. /// * Kernel: FHWC. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. This includes the zero /// point offsets common to quantized operations. class Conv2DNhwcFhwcQOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D convolution. /// Layout: /// * Input: NHWC. /// * Kernel: HWCF. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv2DNhwcHwcfOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D convolution with zero point offsets. /// Layout: /// * Input: NHWC. /// * Kernel: HWCF. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. This includes the zero /// point offsets common to quantized operations. class Conv2DNhwcHwcfQOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D grouped convolution. /// Layout: /// * Input: NHWGC. /// * Kernel: GFHWC. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv2DNhwgcGfhwcOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D grouped convolution with zero point offsets. /// Layout: /// * Input: NHWGC. /// * Kernel: GFHWC. /// /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. This includes the zero /// point offsets common to quantized operations. class Conv2DNhwgcGfhwcQOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 2-D convolution with no channels. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv2DOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 3-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv3DNcdhwFcdhwOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 3-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv3DNdhwcDhwcfOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 3-D convolution with zero point offsets. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. This includes the zero /// point offsets common to quantized operations. class Conv3DNdhwcDhwcfQOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 3-D convolution with no channels. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class Conv3DOp; } // namespace mlir::linalg namespace mlir::linalg { /// Copies the tensor elementwise. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class CopyOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 1-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. Multiplier is set to 1 /// which is a special case for most depthwise convolutions. class DepthwiseConv1DNcwCwOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 1-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. Multiplier is set to 1 /// which is a special case for most depthwise convolutions. class DepthwiseConv1DNwcWcOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 1-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class DepthwiseConv1DNwcWcmOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 2-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. Multiplier is set to 1 /// which is a special case for most depthwise convolutions. class DepthwiseConv2DNchwChwOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 2-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. Multiplier is set to 1 /// which is a special case for most depthwise convolutions. class DepthwiseConv2DNhwcHwcOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 2-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class DepthwiseConv2DNhwcHwcQOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 2-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class DepthwiseConv2DNhwcHwcmOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 2-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class DepthwiseConv2DNhwcHwcmQOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 3-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. Multiplier is set to 1 /// which is a special case for most depthwise convolutions. class DepthwiseConv3DNcdhwCdhwOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 3-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. Multiplier is set to 1 /// which is a special case for most depthwise convolutions. class DepthwiseConv3DNdhwcDhwcOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs depth-wise 3-D convolution. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class DepthwiseConv3DNdhwcDhwcmOp; } // namespace mlir::linalg namespace mlir::linalg { /// Divides the first tensor by the second tensor, elementwise. /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.div` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class DivOp; } // namespace mlir::linalg namespace mlir::linalg { /// Divides the first tensor by the second tensor, elementwise. For integer /// types, performs an unsigned division. /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.div` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class DivUnsignedOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a dot product of two vectors to a scalar result. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class DotOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs element-wise operation /// The attribute `kind` describes arithmetic operation to perform. The /// operation kind can be unary (e.g. max), binary (e.g. add) or ternary /// (e.g. select). /// /// By default, all indexing maps are identities. In the case of default /// indexing map, all input and output shapes must match. The number of dims in /// each of the identity maps is equal to the rank of the output type. /// /// Affine-maps for operands and result are required to be provided by the user /// when a transpose and/or broadcast is needed on any operand. When a map is not /// provided, default identity maps are inferred for each operand. /// /// Iterator-types are always all `parallel`. /// Iterator-types are needed for constructing the underlying structured op. /// /// The number of dims of the iterator-types are inferred from the rank of /// the result type. /// /// Example: /// /// Defining a unary linalg.elementwise with default indexing-map: /// ```mlir /// %exp = linalg.elementwise /// kind=#linalg.elementwise_kind /// ins(%x : tensor<4x16x8xf32>) /// outs(%y: tensor<4x16x8xf32>) -> tensor<4x16x8xf32> /// ``` /// /// Defining a binary linalg.elementwise with user-defined indexing-map: /// ```mlir /// %add = linalg.elementwise /// kind=#linalg.elementwise_kind /// indexing_maps = [#transpose, #broadcast, #identity] /// ins(%exp, %arg1 : tensor<4x16x8xf32>, tensor<4x16xf32>) /// outs(%arg2: tensor<4x8x16xf32>) -> tensor<4x8x16xf32> /// ``` class ElementwiseOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies erf(x) elementwise. /// No numeric casting is performed on the input operand. class ErfOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies exp(x) elementwise. /// No numeric casting is performed on the input operand. class ExpOp; } // namespace mlir::linalg namespace mlir::linalg { /// Fills the output tensor with the given value. /// Works for arbitrary ranked output tensors since the operation performs /// scalar accesses only and is thus rank polymorphic. The value operand /// type must match the element type of the output. class FillOp; } // namespace mlir::linalg namespace mlir::linalg { /// Fills the output tensor with pseudo random numbers. /// The operation generations pseudo random numbers using a linear congruential /// generator. It provides no guarantees regarding the distribution of the /// generated random numbers. Instead of generating the random numbers /// sequentially, it instantiates one random number generator per data element /// and runs them in parallel. The seed operand and the indices of the data /// element seed the random number generation. The min and max operands limit /// the range of the generated random numbers. class FillRng2DOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies floor(x) elementwise. /// No numeric casting is performed on the input operand. class FloorOp; } // namespace mlir::linalg namespace mlir::linalg { /// Generic Linalg op form where the key properties of the computation are /// specified as attributes. In pretty form, a `linalg.generic` op is written /// as: /// /// ```mlir /// linalg.generic #trait_attribute /// ins(%A, %B : memref, /// memref) /// outs(%C : memref) /// attrs = {other-optional-attributes} /// {region} /// ``` /// /// Where #trait_attributes is an alias of a dictionary attribute containing: /// - doc [optional]: a documentation string /// - indexing_maps: a list of AffineMapAttr, one AffineMapAttr per each input /// and output view. Such AffineMapAttr specifies the mapping between the /// loops and the indexing within each view. /// - library_call [optional]: a StringAttr containing the name of an /// external library function that the linalg.generic operation maps to. /// The external library is assumed to be dynamically linked and no strong /// compile-time guarantees are provided. In the absence of such a library /// call, linalg.generic will always lower to loops. /// - iterator_types: an ArrayAttr specifying the type of the enclosing loops. /// Each element of the list represents and iterator of one of the following /// types: /// parallel, reduction, window /// /// Example: /// Defining a #matmul_trait attribute in MLIR can be done as follows: /// ```mlir /// #matmul_accesses = [ /// (m, n, k) -> (m, k), /// (m, n, k) -> (k, n), /// (m, n, k) -> (m, n) /// ] /// #matmul_trait = { /// doc = "C(m, n) += A(m, k) * B(k, n)", /// indexing_maps = #matmul_accesses, /// library_call = "linalg_matmul", /// iterator_types = ["parallel", "parallel", "reduction"] /// } /// ``` /// /// And can be reused in multiple places as: /// ```mlir /// linalg.generic #matmul_trait /// ins(%A, %B : memref, /// memref) /// outs(%C : memref) /// {other-optional-attributes} { /// ^bb0(%a: f32, %b: f32, %c: f32) : /// %d = arith.mulf %a, %b: f32 /// %e = arith.addf %c, %d: f32 /// linalg.yield %e : f32 /// } /// ``` /// /// This may lower to either: /// ```mlir /// call @linalg_matmul(%A, %B, %C) : /// (memref, /// memref, /// memref) /// -> () /// ``` /// /// or IR resembling: /// ```mlir /// scf.for %m = %c0 to %M step %c1 { /// scf.for %n = %c0 to %N step %c1 { /// scf.for %k = %c0 to %K step %c1 { /// %a = load %A[%m, %k] : memref /// %b = load %B[%k, %n] : memref /// %c = load %C[%m, %n] : memref /// %d = arith.mulf %a, %b: f32 /// %e = arith.addf %c, %d: f32 /// store %e, %C[%m, %n] : memref /// } /// } /// } /// ``` class GenericOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies log(x) elementwise. /// No numeric casting is performed on the input operand. class LogOp; } // namespace mlir::linalg namespace mlir::linalg { /// Elementwise operations /// Models elementwise operations on tensors in terms of arithmetic operations /// on the corresponding elements. /// /// Example: /// ```mlir /// %add = linalg.map /// ins(%lhs, %rhs : tensor<64xf32>, tensor<64xf32>) /// outs(%init: tensor<64xf32>) /// (%lhs_elem: f32, %rhs_elem: f32) { /// %0 = arith.addf %lhs_elem, %rhs_elem: f32 /// linalg.yield %0: f32 /// } /// ``` /// /// Shortened print form is available for simple maps where the body contains exactly /// two operations (the payload operation and a yield), the payload operation has /// the same number of operands as block arguments with operands matching block /// arguments in order, and the yield operand is the result of the payload operation. /// /// The example above will be printed using the shortened form as: /// ```mlir /// %add = linalg.map { arith.addf } /// ins(%lhs, %rhs : tensor<64xf32>, tensor<64xf32>) /// outs(%init: tensor<64xf32>) /// ``` class MapOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a matrix multiplication of two 2D inputs without broadcast or transpose. /// Numeric casting is performed on the operands to the inner multiply, /// promoting them to the same data type as the accumulator/output. /// /// Broadcast and Transpose semantics can be appiled by specifying the explicit attribute /// 'indexing_maps' as shown below.This is a list attribute, so the list must include all /// the maps if specified. /// /// Example Transpose: /// ```mlir /// linalg.matmul /// indexing_maps = [affine_map<(m, n, k) -> (k, m)>, // transpose /// affine_map<(m, n, k) -> (k, n)>, /// affine_map<(m, n, k) -> (m, n)>] /// ins(%arg0, %arg1 : memref<5x3xf32>,memref<5x7xf32>) /// outs(%arg2: memref<3x7xf32>) /// ``` /// /// Example Broadcast: /// ```mlir /// linalg.matmul /// indexing_maps = [affine_map<(m, n, k) -> (k)>, // broadcast /// affine_map<(m, n, k) -> (k, n)>, /// affine_map<(m, n, k) -> (m, n)>] /// ins(%arg0, %arg1 : memref<3xf32>, memref<5x7xf32>) /// outs(%arg2: memref<3x7xf32>) /// ``` /// /// Example Broadcast and transpose: /// ```mlir /// linalg.matmul /// indexing_maps = [affine_map<(m, n, k) -> (k, m)>, // transpose /// affine_map<(m, n, k) -> (k)>, // broadcast /// affine_map<(m, n, k) -> (m, n)>] /// ins(%arg0, %arg1 : memref<5x3xf32>, memref<7xf32>) /// outs(%arg2: memref<3x7xf32>) /// ``` class MatmulOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a matrix-vector multiplication. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class MatvecOp; } // namespace mlir::linalg namespace mlir::linalg { /// Takes the max (signed) between two inputs, elementwise. /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.max` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class MaxOp; } // namespace mlir::linalg namespace mlir::linalg { /// Takes the min (signed) between two inputs, elementwise. /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.min` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class MinOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a matrix-matrix-transpose multiplication of two 4D inputs. /// Differences from linalg.matmul: /// * The right hand side is transposed, whence the 't' in 'mmt'. /// * The input and output tensors have a 4D shape instead of a 2D shape. They /// are interpreted as 2D matrices with one level of 2D tile subdivision, /// whence the 2+2=4 dimensions. The inner tile dimensions are identified with /// '0' suffixes below, for instance the LHS matrix shape (M, K, M0, K0) reads /// as: MxK tiles, each of shape M0xK0. class Mmt4DOp; } // namespace mlir::linalg namespace mlir::linalg { /// Multiplies two tensors elementwise. /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.mul` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class MulOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies negf(x) elementwise. /// No numeric casting is performed on the input operand. class NegFOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs max pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNchwMaxOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs sum pooling. /// Layout: /// * Input: NCHW. /// * Kernel: HW. /// /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNchwSumOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs max pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNcwMaxOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs sum pooling. /// Layout: /// * Input: NCW. /// * Kernel: W. /// /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNcwSumOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 3D max pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNdhwcMaxOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 3D min pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNdhwcMinOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs 3D sum pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNdhwcSumOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs max pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNhwcMaxOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs unsigned max pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNhwcMaxUnsignedOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs min pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNhwcMinOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs unsigned min pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNhwcMinUnsignedOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs sum pooling. /// Layout: /// * Input: NHWC. /// * Kernel: HW. /// /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNhwcSumOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs max pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNwcMaxOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs unsigned max pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNwcMaxUnsignedOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs min pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNwcMinOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs unsigned min pooling. /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNwcMinUnsignedOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs sum pooling. /// Layout: /// * Input: NWC. /// * Kernel: W. /// /// Numeric casting is performed on the input operand, promoting it to the same /// data type as the accumulator/output. class PoolingNwcSumOp; } // namespace mlir::linalg namespace mlir::linalg { /// Takes the powf(lhs, rhs) between two inputs, elementwise. For powf(arg, 2) use `linalg.square`. /// Only applies to floating point values. /// /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.powf` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class PowFOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a batched matrix multiplication of two 3D inputs. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. The quantized variant /// includes zero-point adjustments for the left and right operands of the /// matmul. class QuantizedBatchMatmulOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a matrix multiplication of two 2D inputs. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. The quantized variant /// includes zero-point adjustments for the left and right operands of the /// matmul. class QuantizedMatmulOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies reciprocal(x) elementwise. /// No numeric casting is performed on the input operand. class ReciprocalOp; } // namespace mlir::linalg namespace mlir::linalg { /// Reduce operator /// Executes `combiner` on the `dimensions` of `inputs` and returns the /// reduced result. The `dimensions` attribute needs to list the reduction /// dimensions in increasing order. /// /// Example: /// ```mlir /// %reduce = linalg.reduce /// ins(%input:tensor<16x32x64xf32>) /// outs(%init:tensor<16x64xf32>) /// dimensions = [1] /// (%in: f32, %out: f32) { /// %0 = arith.addf %out, %in: f32 /// linalg.yield %0: f32 /// } /// ``` /// /// Shortened print form is available for simple reduces where the body contains exactly /// two operations (the payload operation and a yield), the payload operation has the /// same number of operands as block arguments, the first block argument (init) is the /// last operand of the payload operation with remaining operands matching remaining /// block arguments in order, and the yield operand is the result of the payload operation. /// /// The example above will be printed using the shortened form as: /// ```mlir /// %reduce = linalg.reduce { arith.addf } /// ins(%input:tensor<16x32x64xf32>) /// outs(%init:tensor<16x64xf32>) /// dimensions = [1] /// ``` class ReduceOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies round(x) elementwise. /// No numeric casting is performed on the input operand. class RoundOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies rsqrt(x) elementwise. /// No numeric casting is performed on the input operand. class RsqrtOp; } // namespace mlir::linalg namespace mlir::linalg { /// Chooses one value based on a binary condition supplied as its first operand. /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.select` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class SelectOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies sqrt(x) elementwise. /// No numeric casting is performed on the input operand. class SqrtOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies square(x) elementwise. /// No numeric casting is performed on the input operand. class SquareOp; } // namespace mlir::linalg namespace mlir::linalg { /// Subtracts two tensors elementwise. /// The shapes and element types must be identical. The appropriate casts, /// broadcasts and reductions should be done previously to calling this op. /// /// This means reduction/broadcast/element cast semantics is explicit. Further /// passes can take that into account when lowering this code. For example, /// a `linalg.broadcast` + `linalg.sub` sequence can be lowered to a /// `linalg.generic` with different affine maps for the two operands. class SubOp; } // namespace mlir::linalg namespace mlir::linalg { /// Applies tanh(x) elementwise. /// No numeric casting is performed on the input operand. class TanhOp; } // namespace mlir::linalg namespace mlir::linalg { /// Transpose operator /// Permutes the dimensions of `input` according to the given `permutation`. /// `dim(result, i) = dim(input, permutation[i])` /// /// This op actually moves data, unlike `memref.transpose` which is a metadata /// operation only that produces a transposed "view". /// /// Example: /// ```mlir /// %transpose = linalg.transpose /// ins(%input:tensor<16x64xf32>) /// outs(%init:tensor<64x16xf32>) /// permutation = [1, 0] /// ``` class TransposeOp; } // namespace mlir::linalg namespace mlir::linalg { /// Performs a vector-matrix multiplication. /// Numeric casting is performed on the operands to the inner multiply, promoting /// them to the same data type as the accumulator/output. class VecmatOp; } // namespace mlir::linalg #ifdef GET_OP_CLASSES #undef GET_OP_CLASSES namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::AbsOp declarations //===----------------------------------------------------------------------===// namespace detail { class AbsOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.abs", odsAttrs.getContext()); } AbsOpGenericAdaptorBase(AbsOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AbsOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : AbsOpGenericAdaptor(values, attrs, Properties{}, {}) {} AbsOpGenericAdaptor(RangeT values, const AbsOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> { public: using AbsOpGenericAdaptor::AbsOpGenericAdaptor; AbsOpAdaptor(AbsOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AbsOpAdaptor; template using GenericAdaptor = AbsOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.abs"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static AbsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static AbsOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static AbsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static AbsOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static AbsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static AbsOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::AbsOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::AbsOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::AddOp declarations //===----------------------------------------------------------------------===// namespace detail { class AddOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.add", odsAttrs.getContext()); } AddOpGenericAdaptorBase(AddOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AddOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : AddOpGenericAdaptor(values, attrs, Properties{}, {}) {} AddOpGenericAdaptor(RangeT values, const AddOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { public: using AddOpGenericAdaptor::AddOpGenericAdaptor; AddOpAdaptor(AddOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AddOpAdaptor; template using GenericAdaptor = AddOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.add"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static AddOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static AddOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static AddOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::AddOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::AddOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::BatchMatmulOp declarations //===----------------------------------------------------------------------===// namespace detail { class BatchMatmulOpGenericAdaptorBase { public: struct Properties { using castTy = ::mlir::linalg::TypeFnAttr; castTy cast; auto getCast() const { auto &propStorage = this->cast; return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); } void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { this->cast = propValue; } using indexing_mapsTy = ::mlir::ArrayAttr; indexing_mapsTy indexing_maps; auto getIndexingMaps() const { auto &propStorage = this->indexing_maps; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setIndexingMaps(const ::mlir::ArrayAttr &propValue) { this->indexing_maps = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.cast == this->cast && rhs.indexing_maps == this->indexing_maps && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BatchMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.batch_matmul", odsAttrs.getContext()); } BatchMatmulOpGenericAdaptorBase(BatchMatmulOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getIndexingMapsAttr(); ::mlir::ArrayAttr getIndexingMaps(); ::mlir::linalg::TypeFnAttr getCastAttr(); ::mlir::linalg::TypeFn getCast(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class BatchMatmulOpGenericAdaptor : public detail::BatchMatmulOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BatchMatmulOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: BatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BatchMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : BatchMatmulOpGenericAdaptor(values, attrs, Properties{}, {}) {} BatchMatmulOpGenericAdaptor(RangeT values, const BatchMatmulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BatchMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BatchMatmulOpAdaptor : public BatchMatmulOpGenericAdaptor<::mlir::ValueRange> { public: using BatchMatmulOpGenericAdaptor::BatchMatmulOpGenericAdaptor; BatchMatmulOpAdaptor(BatchMatmulOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BatchMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BatchMatmulOpAdaptor; template using GenericAdaptor = BatchMatmulOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("indexing_maps"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getCastAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getIndexingMapsAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getIndexingMapsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.batch_matmul"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getIndexingMapsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().indexing_maps); } ::mlir::ArrayAttr getIndexingMaps(); ::mlir::linalg::TypeFnAttr getCastAttr() { return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); } ::mlir::linalg::TypeFn getCast(); void setIndexingMapsAttr(::mlir::ArrayAttr attr) { getProperties().indexing_maps = attr; } void setCastAttr(::mlir::linalg::TypeFnAttr attr) { getProperties().cast = attr; } void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); ::mlir::Attribute removeIndexingMapsAttr() { auto attr = getProperties().indexing_maps; getProperties().indexing_maps = {}; return attr; } ::mlir::Attribute removeCastAttr() { auto attr = getProperties().cast; getProperties().cast = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, Attribute cast, ArrayRef attributes = {}); static BatchMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, Attribute cast, ArrayRef attributes = {}); static BatchMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, Attribute cast, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } SmallVector getIteratorTypesArray(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref)> getRegionBuilder() { return regionBuilder; } /// Returns a list with default AffineMap(s), i.e. without broadcasts and transpositions. static SmallVector getDefaultIndexingMaps(MLIRContext *context); /// Returns true if the AffineMap is the default batch matmul indexing charactristic. static bool isDefaultIndexingMaps(Attribute attr); /// Returns true if the given broadcast map \p bcastMap is valid for this op. bool isValidLhsRhsBroadcastMap(AffineMap bcastMap, bool isLHS = true); ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); bool hasDynamicIndexingMaps() { return true; } std::string getLibraryCallName(); /// Returns true if the user defined indexing maps are not equal to default maps. bool hasUserDefinedMaps(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatmulOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::BatchMatmulOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::BatchMatvecOp declarations //===----------------------------------------------------------------------===// namespace detail { class BatchMatvecOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BatchMatvecOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.batch_matvec", odsAttrs.getContext()); } BatchMatvecOpGenericAdaptorBase(BatchMatvecOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class BatchMatvecOpGenericAdaptor : public detail::BatchMatvecOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BatchMatvecOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: BatchMatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BatchMatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BatchMatvecOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BatchMatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : BatchMatvecOpGenericAdaptor(values, attrs, Properties{}, {}) {} BatchMatvecOpGenericAdaptor(RangeT values, const BatchMatvecOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BatchMatvecOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BatchMatvecOpAdaptor : public BatchMatvecOpGenericAdaptor<::mlir::ValueRange> { public: using BatchMatvecOpGenericAdaptor::BatchMatvecOpGenericAdaptor; BatchMatvecOpAdaptor(BatchMatvecOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BatchMatvecOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BatchMatvecOpAdaptor; template using GenericAdaptor = BatchMatvecOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.batch_matvec"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMatvecOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMatvecOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMatvecOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMatvecOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static BatchMatvecOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static BatchMatvecOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMatvecOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::BatchMatvecOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::BatchMmt4DOp declarations //===----------------------------------------------------------------------===// namespace detail { class BatchMmt4DOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BatchMmt4DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.batch_mmt4d", odsAttrs.getContext()); } BatchMmt4DOpGenericAdaptorBase(BatchMmt4DOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class BatchMmt4DOpGenericAdaptor : public detail::BatchMmt4DOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BatchMmt4DOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: BatchMmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BatchMmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BatchMmt4DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BatchMmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : BatchMmt4DOpGenericAdaptor(values, attrs, Properties{}, {}) {} BatchMmt4DOpGenericAdaptor(RangeT values, const BatchMmt4DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BatchMmt4DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BatchMmt4DOpAdaptor : public BatchMmt4DOpGenericAdaptor<::mlir::ValueRange> { public: using BatchMmt4DOpGenericAdaptor::BatchMmt4DOpGenericAdaptor; BatchMmt4DOpAdaptor(BatchMmt4DOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BatchMmt4DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BatchMmt4DOpAdaptor; template using GenericAdaptor = BatchMmt4DOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.batch_mmt4d"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMmt4DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMmt4DOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMmt4DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchMmt4DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static BatchMmt4DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static BatchMmt4DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchMmt4DOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::BatchMmt4DOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::BatchReduceMatmulOp declarations //===----------------------------------------------------------------------===// namespace detail { class BatchReduceMatmulOpGenericAdaptorBase { public: struct Properties { using castTy = ::mlir::linalg::TypeFnAttr; castTy cast; auto getCast() const { auto &propStorage = this->cast; return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); } void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { this->cast = propValue; } using indexing_mapsTy = ::mlir::ArrayAttr; indexing_mapsTy indexing_maps; auto getIndexingMaps() const { auto &propStorage = this->indexing_maps; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setIndexingMaps(const ::mlir::ArrayAttr &propValue) { this->indexing_maps = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.cast == this->cast && rhs.indexing_maps == this->indexing_maps && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BatchReduceMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.batch_reduce_matmul", odsAttrs.getContext()); } BatchReduceMatmulOpGenericAdaptorBase(BatchReduceMatmulOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getIndexingMapsAttr(); ::mlir::ArrayAttr getIndexingMaps(); ::mlir::linalg::TypeFnAttr getCastAttr(); ::mlir::linalg::TypeFn getCast(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class BatchReduceMatmulOpGenericAdaptor : public detail::BatchReduceMatmulOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BatchReduceMatmulOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: BatchReduceMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BatchReduceMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BatchReduceMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BatchReduceMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : BatchReduceMatmulOpGenericAdaptor(values, attrs, Properties{}, {}) {} BatchReduceMatmulOpGenericAdaptor(RangeT values, const BatchReduceMatmulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BatchReduceMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BatchReduceMatmulOpAdaptor : public BatchReduceMatmulOpGenericAdaptor<::mlir::ValueRange> { public: using BatchReduceMatmulOpGenericAdaptor::BatchReduceMatmulOpGenericAdaptor; BatchReduceMatmulOpAdaptor(BatchReduceMatmulOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BatchReduceMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BatchReduceMatmulOpAdaptor; template using GenericAdaptor = BatchReduceMatmulOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("indexing_maps"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getCastAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getIndexingMapsAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getIndexingMapsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.batch_reduce_matmul"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getIndexingMapsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().indexing_maps); } ::mlir::ArrayAttr getIndexingMaps(); ::mlir::linalg::TypeFnAttr getCastAttr() { return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); } ::mlir::linalg::TypeFn getCast(); void setIndexingMapsAttr(::mlir::ArrayAttr attr) { getProperties().indexing_maps = attr; } void setCastAttr(::mlir::linalg::TypeFnAttr attr) { getProperties().cast = attr; } void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); ::mlir::Attribute removeIndexingMapsAttr() { auto attr = getProperties().indexing_maps; getProperties().indexing_maps = {}; return attr; } ::mlir::Attribute removeCastAttr() { auto attr = getProperties().cast; getProperties().cast = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchReduceMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchReduceMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchReduceMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchReduceMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static BatchReduceMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static BatchReduceMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } SmallVector getIteratorTypesArray(); /// Implements the block region builder. static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); /// Returns a list of AffineMap with the default batch_reduce_matmul indexing charactristic. static SmallVector getDefaultIndexingMaps(MLIRContext *context); /// Returns true if the AffineMap is the default batch reduce matmul indexing charactristic. static bool isDefaultIndexingMaps(Attribute attr); /// Returns true if the given broadcast map \p bcastMap is valid for this op. bool isValidLhsRhsBroadcastMap(AffineMap bcastMap, bool isLHS = true); static std::function, function_ref)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps() { return true; }; /// Returns true if the user defined indexing maps are not equal to default maps. bool hasUserDefinedMaps(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchReduceMatmulOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::BatchReduceMatmulOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::BatchVecmatOp declarations //===----------------------------------------------------------------------===// namespace detail { class BatchVecmatOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BatchVecmatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.batch_vecmat", odsAttrs.getContext()); } BatchVecmatOpGenericAdaptorBase(BatchVecmatOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class BatchVecmatOpGenericAdaptor : public detail::BatchVecmatOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BatchVecmatOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: BatchVecmatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BatchVecmatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BatchVecmatOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BatchVecmatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : BatchVecmatOpGenericAdaptor(values, attrs, Properties{}, {}) {} BatchVecmatOpGenericAdaptor(RangeT values, const BatchVecmatOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BatchVecmatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BatchVecmatOpAdaptor : public BatchVecmatOpGenericAdaptor<::mlir::ValueRange> { public: using BatchVecmatOpGenericAdaptor::BatchVecmatOpGenericAdaptor; BatchVecmatOpAdaptor(BatchVecmatOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BatchVecmatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BatchVecmatOpAdaptor; template using GenericAdaptor = BatchVecmatOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.batch_vecmat"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchVecmatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchVecmatOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchVecmatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static BatchVecmatOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static BatchVecmatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static BatchVecmatOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BatchVecmatOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::BatchVecmatOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::BroadcastOp declarations //===----------------------------------------------------------------------===// namespace detail { class BroadcastOpGenericAdaptorBase { public: struct Properties { using dimensionsTy = ::mlir::DenseI64ArrayAttr; dimensionsTy dimensions; auto getDimensions() const { auto &propStorage = this->dimensions; return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); } void setDimensions(const ::mlir::DenseI64ArrayAttr &propValue) { this->dimensions = propValue; } bool operator==(const Properties &rhs) const { return rhs.dimensions == this->dimensions && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BroadcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.broadcast", odsAttrs.getContext()); } BroadcastOpGenericAdaptorBase(BroadcastOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseI64ArrayAttr getDimensionsAttr() { auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().dimensions); return attr; } ::llvm::ArrayRef getDimensions(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class BroadcastOpGenericAdaptor : public detail::BroadcastOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BroadcastOpGenericAdaptorBase; static constexpr int odsIndex_input = 0; static constexpr int odsIndex_init = 1; public: BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BroadcastOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BroadcastOpGenericAdaptor(values, attrs, Properties{}, {}) {} BroadcastOpGenericAdaptor(RangeT values, const BroadcastOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BroadcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } ValueT getInput() { return (*getODSOperands(0).begin()); } ValueT getInit() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BroadcastOpAdaptor : public BroadcastOpGenericAdaptor<::mlir::ValueRange> { public: using BroadcastOpGenericAdaptor::BroadcastOpGenericAdaptor; BroadcastOpAdaptor(BroadcastOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BroadcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BroadcastOpAdaptor; template using GenericAdaptor = BroadcastOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_input = 0; static constexpr int odsIndex_init = 1; using Properties = FoldAdaptor::Properties; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockArgumentNames; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockNames; using ::mlir::OpAsmOpInterface::Trait::getDefaultDialect; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDimensionsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.broadcast"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::ShapedType> getInput() { return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::ShapedType> getInit() { return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getInputMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getInitMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResult() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseI64ArrayAttr getDimensionsAttr() { return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().dimensions); } ::llvm::ArrayRef getDimensions(); void setDimensionsAttr(::mlir::DenseI64ArrayAttr attr) { getProperties().dimensions = attr; } void setDimensions(::llvm::ArrayRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value init, DenseI64ArrayAttr dimensions, ArrayRef attributes = {}); static BroadcastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value input, Value init, DenseI64ArrayAttr dimensions, ArrayRef attributes = {}); static BroadcastOp create(::mlir::ImplicitLocOpBuilder &builder, Value input, Value init, DenseI64ArrayAttr dimensions, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value init, ArrayRef dimensions, ArrayRef attributes = {}); static BroadcastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value input, Value init, ArrayRef dimensions, ArrayRef attributes = {}); static BroadcastOp create(::mlir::ImplicitLocOpBuilder &builder, Value input, Value init, ArrayRef dimensions, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Declare functions necessary for LinalgStructuredInterface. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); std::string getLibraryCallName() { return "op_has_no_registered_library_name"; } // Implement functions necessary for DestinationStyleOpInterface. MutableOperandRange getDpsInitsMutable() { return getInitMutable(); } static void regionBuilder(mlir::ImplicitLocOpBuilder &b, mlir::Block &block, mlir::ArrayRef, function_ref emitError) { OpBuilder::InsertionGuard guard(b); linalg::YieldOp::create(b, b.getLoc(), block.getArgument(0)); } static std::function, function_ref)> getRegionBuilder() { return regionBuilder; } }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::BroadcastOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::BroadcastOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::CeilOp declarations //===----------------------------------------------------------------------===// namespace detail { class CeilOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.ceil", odsAttrs.getContext()); } CeilOpGenericAdaptorBase(CeilOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class CeilOpGenericAdaptor : public detail::CeilOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CeilOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CeilOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : CeilOpGenericAdaptor(values, attrs, Properties{}, {}) {} CeilOpGenericAdaptor(RangeT values, const CeilOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CeilOpAdaptor : public CeilOpGenericAdaptor<::mlir::ValueRange> { public: using CeilOpGenericAdaptor::CeilOpGenericAdaptor; CeilOpAdaptor(CeilOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CeilOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CeilOpAdaptor; template using GenericAdaptor = CeilOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.ceil"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static CeilOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static CeilOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static CeilOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static CeilOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static CeilOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static CeilOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::CeilOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::CeilOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::ContractOp declarations //===----------------------------------------------------------------------===// namespace detail { class ContractOpGenericAdaptorBase { public: struct Properties { using castTy = ::mlir::linalg::TypeFnAttr; castTy cast; auto getCast() const { auto &propStorage = this->cast; return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); } void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { this->cast = propValue; } using indexing_mapsTy = ::mlir::ArrayAttr; indexing_mapsTy indexing_maps; auto getIndexingMaps() const { auto &propStorage = this->indexing_maps; return ::llvm::cast<::mlir::ArrayAttr>(propStorage); } void setIndexingMaps(const ::mlir::ArrayAttr &propValue) { this->indexing_maps = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.cast == this->cast && rhs.indexing_maps == this->indexing_maps && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ContractOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.contract", odsAttrs.getContext()); } ContractOpGenericAdaptorBase(ContractOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getIndexingMapsAttr() { auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().indexing_maps); return attr; } ::mlir::ArrayAttr getIndexingMaps(); ::mlir::linalg::TypeFnAttr getCastAttr(); ::mlir::linalg::TypeFn getCast(); ::mlir::Region &getCombiner() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ContractOpGenericAdaptor : public detail::ContractOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ContractOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: ContractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ContractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ContractOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ContractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ContractOpGenericAdaptor(values, attrs, Properties{}, {}) {} ContractOpGenericAdaptor(RangeT values, const ContractOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ContractOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ContractOpAdaptor : public ContractOpGenericAdaptor<::mlir::ValueRange> { public: using ContractOpGenericAdaptor::ContractOpGenericAdaptor; ContractOpAdaptor(ContractOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ContractOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ContractOpAdaptor; template using GenericAdaptor = ContractOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("indexing_maps"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getCastAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getIndexingMapsAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getIndexingMapsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.contract"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getCombiner() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getIndexingMapsAttr() { return ::llvm::cast<::mlir::ArrayAttr>(getProperties().indexing_maps); } ::mlir::ArrayAttr getIndexingMaps(); ::mlir::linalg::TypeFnAttr getCastAttr() { return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); } ::mlir::linalg::TypeFn getCast(); void setIndexingMapsAttr(::mlir::ArrayAttr attr) { getProperties().indexing_maps = attr; } void setCastAttr(::mlir::linalg::TypeFnAttr attr) { getProperties().cast = attr; } void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); ::mlir::Attribute removeCastAttr() { auto attr = getProperties().cast; getProperties().cast = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ContractOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ContractOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayRef attributes = {}); static ContractOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayRef attributes = {}); static ContractOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayRef attributes = {}); static ContractOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayRef attributes = {}); static ContractOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Declare/implement functions necessary for LinalgStructuredInterface. /// Infer iterator types for each dim in the domain of IndexingMaps. SmallVector getIteratorTypesArray(); /// IndexingMaps always depends on attr associated to current Op instance. bool hasDynamicIndexingMaps() { return true; }; bool hasUserDefinedMaps() { return true; }; static unsigned getNumRegionArgs(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref)> getRegionBuilder() { return regionBuilder; } std::string getLibraryCallName() { return "op_has_no_registered_library_name"; } // Implement function necessary for DestinationStyleOpInterface. ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ContractOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::ContractOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv1DNcwFcwOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv1DNcwFcwOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv1DNcwFcwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_1d_ncw_fcw", odsAttrs.getContext()); } Conv1DNcwFcwOpGenericAdaptorBase(Conv1DNcwFcwOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv1DNcwFcwOpGenericAdaptor : public detail::Conv1DNcwFcwOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv1DNcwFcwOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv1DNcwFcwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv1DNcwFcwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv1DNcwFcwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv1DNcwFcwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv1DNcwFcwOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv1DNcwFcwOpGenericAdaptor(RangeT values, const Conv1DNcwFcwOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv1DNcwFcwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv1DNcwFcwOpAdaptor : public Conv1DNcwFcwOpGenericAdaptor<::mlir::ValueRange> { public: using Conv1DNcwFcwOpGenericAdaptor::Conv1DNcwFcwOpGenericAdaptor; Conv1DNcwFcwOpAdaptor(Conv1DNcwFcwOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv1DNcwFcwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv1DNcwFcwOpAdaptor; template using GenericAdaptor = Conv1DNcwFcwOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_1d_ncw_fcw"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DNcwFcwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DNcwFcwOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DNcwFcwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DNcwFcwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv1DNcwFcwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv1DNcwFcwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv1DNcwFcwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv1DNcwFcwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DNcwFcwOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv1DNcwFcwOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv1DNwcWcfOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv1DNwcWcfOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv1DNwcWcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_1d_nwc_wcf", odsAttrs.getContext()); } Conv1DNwcWcfOpGenericAdaptorBase(Conv1DNwcWcfOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv1DNwcWcfOpGenericAdaptor : public detail::Conv1DNwcWcfOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv1DNwcWcfOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv1DNwcWcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv1DNwcWcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv1DNwcWcfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv1DNwcWcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv1DNwcWcfOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv1DNwcWcfOpGenericAdaptor(RangeT values, const Conv1DNwcWcfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv1DNwcWcfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv1DNwcWcfOpAdaptor : public Conv1DNwcWcfOpGenericAdaptor<::mlir::ValueRange> { public: using Conv1DNwcWcfOpGenericAdaptor::Conv1DNwcWcfOpGenericAdaptor; Conv1DNwcWcfOpAdaptor(Conv1DNwcWcfOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv1DNwcWcfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv1DNwcWcfOpAdaptor; template using GenericAdaptor = Conv1DNwcWcfOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_1d_nwc_wcf"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DNwcWcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DNwcWcfOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DNwcWcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DNwcWcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv1DNwcWcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv1DNwcWcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv1DNwcWcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv1DNwcWcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DNwcWcfOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv1DNwcWcfOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv1DOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv1DOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv1DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_1d", odsAttrs.getContext()); } Conv1DOpGenericAdaptorBase(Conv1DOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv1DOpGenericAdaptor : public detail::Conv1DOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv1DOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv1DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv1DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv1DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv1DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv1DOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv1DOpGenericAdaptor(RangeT values, const Conv1DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv1DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv1DOpAdaptor : public Conv1DOpGenericAdaptor<::mlir::ValueRange> { public: using Conv1DOpGenericAdaptor::Conv1DOpGenericAdaptor; Conv1DOpAdaptor(Conv1DOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv1DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv1DOpAdaptor; template using GenericAdaptor = Conv1DOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_1d"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv1DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv1DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv1DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv1DOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv1DOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNchwFchwOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNchwFchwOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNchwFchwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_nchw_fchw", odsAttrs.getContext()); } Conv2DNchwFchwOpGenericAdaptorBase(Conv2DNchwFchwOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNchwFchwOpGenericAdaptor : public detail::Conv2DNchwFchwOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNchwFchwOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNchwFchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNchwFchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNchwFchwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNchwFchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNchwFchwOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNchwFchwOpGenericAdaptor(RangeT values, const Conv2DNchwFchwOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNchwFchwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNchwFchwOpAdaptor : public Conv2DNchwFchwOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNchwFchwOpGenericAdaptor::Conv2DNchwFchwOpGenericAdaptor; Conv2DNchwFchwOpAdaptor(Conv2DNchwFchwOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNchwFchwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNchwFchwOpAdaptor; template using GenericAdaptor = Conv2DNchwFchwOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_nchw_fchw"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNchwFchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNchwFchwOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNchwFchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNchwFchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNchwFchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNchwFchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNchwFchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNchwFchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNchwFchwOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNchwFchwOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNchwFchwQOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNchwFchwQOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNchwFchwQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_nchw_fchw_q", odsAttrs.getContext()); } Conv2DNchwFchwQOpGenericAdaptorBase(Conv2DNchwFchwQOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNchwFchwQOpGenericAdaptor : public detail::Conv2DNchwFchwQOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNchwFchwQOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNchwFchwQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNchwFchwQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNchwFchwQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNchwFchwQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNchwFchwQOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNchwFchwQOpGenericAdaptor(RangeT values, const Conv2DNchwFchwQOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNchwFchwQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNchwFchwQOpAdaptor : public Conv2DNchwFchwQOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNchwFchwQOpGenericAdaptor::Conv2DNchwFchwQOpGenericAdaptor; Conv2DNchwFchwQOpAdaptor(Conv2DNchwFchwQOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNchwFchwQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNchwFchwQOpAdaptor; template using GenericAdaptor = Conv2DNchwFchwQOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_nchw_fchw_q"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNchwFchwQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNchwFchwQOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNchwFchwQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNchwFchwQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNchwFchwQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNchwFchwQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNchwFchwQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNchwFchwQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNchwFchwQOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNchwFchwQOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNgchwFgchwOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNgchwFgchwOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNgchwFgchwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_ngchw_fgchw", odsAttrs.getContext()); } Conv2DNgchwFgchwOpGenericAdaptorBase(Conv2DNgchwFgchwOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNgchwFgchwOpGenericAdaptor : public detail::Conv2DNgchwFgchwOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNgchwFgchwOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNgchwFgchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNgchwFgchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNgchwFgchwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNgchwFgchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNgchwFgchwOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNgchwFgchwOpGenericAdaptor(RangeT values, const Conv2DNgchwFgchwOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNgchwFgchwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNgchwFgchwOpAdaptor : public Conv2DNgchwFgchwOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNgchwFgchwOpGenericAdaptor::Conv2DNgchwFgchwOpGenericAdaptor; Conv2DNgchwFgchwOpAdaptor(Conv2DNgchwFgchwOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNgchwFgchwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNgchwFgchwOpAdaptor; template using GenericAdaptor = Conv2DNgchwFgchwOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_ngchw_fgchw"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwFgchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwFgchwOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwFgchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwFgchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNgchwFgchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNgchwFgchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNgchwFgchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNgchwFgchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNgchwFgchwOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNgchwFgchwOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNgchwGfchwOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNgchwGfchwOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNgchwGfchwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_ngchw_gfchw", odsAttrs.getContext()); } Conv2DNgchwGfchwOpGenericAdaptorBase(Conv2DNgchwGfchwOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNgchwGfchwOpGenericAdaptor : public detail::Conv2DNgchwGfchwOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNgchwGfchwOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNgchwGfchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNgchwGfchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNgchwGfchwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNgchwGfchwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNgchwGfchwOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNgchwGfchwOpGenericAdaptor(RangeT values, const Conv2DNgchwGfchwOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNgchwGfchwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNgchwGfchwOpAdaptor : public Conv2DNgchwGfchwOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNgchwGfchwOpGenericAdaptor::Conv2DNgchwGfchwOpGenericAdaptor; Conv2DNgchwGfchwOpAdaptor(Conv2DNgchwGfchwOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNgchwGfchwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNgchwGfchwOpAdaptor; template using GenericAdaptor = Conv2DNgchwGfchwOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_ngchw_gfchw"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwGfchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwGfchwOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwGfchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwGfchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNgchwGfchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNgchwGfchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNgchwGfchwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNgchwGfchwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNgchwGfchwOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNgchwGfchwOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNgchwGfchwQOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNgchwGfchwQOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNgchwGfchwQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_ngchw_gfchw_q", odsAttrs.getContext()); } Conv2DNgchwGfchwQOpGenericAdaptorBase(Conv2DNgchwGfchwQOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNgchwGfchwQOpGenericAdaptor : public detail::Conv2DNgchwGfchwQOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNgchwGfchwQOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNgchwGfchwQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNgchwGfchwQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNgchwGfchwQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNgchwGfchwQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNgchwGfchwQOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNgchwGfchwQOpGenericAdaptor(RangeT values, const Conv2DNgchwGfchwQOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNgchwGfchwQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNgchwGfchwQOpAdaptor : public Conv2DNgchwGfchwQOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNgchwGfchwQOpGenericAdaptor::Conv2DNgchwGfchwQOpGenericAdaptor; Conv2DNgchwGfchwQOpAdaptor(Conv2DNgchwGfchwQOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNgchwGfchwQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNgchwGfchwQOpAdaptor; template using GenericAdaptor = Conv2DNgchwGfchwQOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_ngchw_gfchw_q"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwGfchwQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwGfchwQOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwGfchwQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNgchwGfchwQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNgchwGfchwQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNgchwGfchwQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNgchwGfchwQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNgchwGfchwQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNgchwGfchwQOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNgchwGfchwQOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNhwcFhwcOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNhwcFhwcOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNhwcFhwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_nhwc_fhwc", odsAttrs.getContext()); } Conv2DNhwcFhwcOpGenericAdaptorBase(Conv2DNhwcFhwcOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNhwcFhwcOpGenericAdaptor : public detail::Conv2DNhwcFhwcOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNhwcFhwcOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNhwcFhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNhwcFhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNhwcFhwcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNhwcFhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNhwcFhwcOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNhwcFhwcOpGenericAdaptor(RangeT values, const Conv2DNhwcFhwcOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNhwcFhwcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNhwcFhwcOpAdaptor : public Conv2DNhwcFhwcOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNhwcFhwcOpGenericAdaptor::Conv2DNhwcFhwcOpGenericAdaptor; Conv2DNhwcFhwcOpAdaptor(Conv2DNhwcFhwcOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNhwcFhwcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNhwcFhwcOpAdaptor; template using GenericAdaptor = Conv2DNhwcFhwcOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_nhwc_fhwc"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcFhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcFhwcOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcFhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcFhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwcFhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwcFhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwcFhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwcFhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcFhwcOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNhwcFhwcOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNhwcFhwcQOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNhwcFhwcQOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNhwcFhwcQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_nhwc_fhwc_q", odsAttrs.getContext()); } Conv2DNhwcFhwcQOpGenericAdaptorBase(Conv2DNhwcFhwcQOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNhwcFhwcQOpGenericAdaptor : public detail::Conv2DNhwcFhwcQOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNhwcFhwcQOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNhwcFhwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNhwcFhwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNhwcFhwcQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNhwcFhwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNhwcFhwcQOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNhwcFhwcQOpGenericAdaptor(RangeT values, const Conv2DNhwcFhwcQOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNhwcFhwcQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNhwcFhwcQOpAdaptor : public Conv2DNhwcFhwcQOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNhwcFhwcQOpGenericAdaptor::Conv2DNhwcFhwcQOpGenericAdaptor; Conv2DNhwcFhwcQOpAdaptor(Conv2DNhwcFhwcQOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNhwcFhwcQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNhwcFhwcQOpAdaptor; template using GenericAdaptor = Conv2DNhwcFhwcQOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_nhwc_fhwc_q"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcFhwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcFhwcQOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcFhwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcFhwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwcFhwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwcFhwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwcFhwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwcFhwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcFhwcQOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNhwcFhwcQOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNhwcHwcfOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNhwcHwcfOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNhwcHwcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_nhwc_hwcf", odsAttrs.getContext()); } Conv2DNhwcHwcfOpGenericAdaptorBase(Conv2DNhwcHwcfOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNhwcHwcfOpGenericAdaptor : public detail::Conv2DNhwcHwcfOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNhwcHwcfOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNhwcHwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNhwcHwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNhwcHwcfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNhwcHwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNhwcHwcfOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNhwcHwcfOpGenericAdaptor(RangeT values, const Conv2DNhwcHwcfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNhwcHwcfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNhwcHwcfOpAdaptor : public Conv2DNhwcHwcfOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNhwcHwcfOpGenericAdaptor::Conv2DNhwcHwcfOpGenericAdaptor; Conv2DNhwcHwcfOpAdaptor(Conv2DNhwcHwcfOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNhwcHwcfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNhwcHwcfOpAdaptor; template using GenericAdaptor = Conv2DNhwcHwcfOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_nhwc_hwcf"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcHwcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcHwcfOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcHwcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcHwcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwcHwcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwcHwcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwcHwcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwcHwcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcHwcfOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNhwcHwcfOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNhwcHwcfQOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNhwcHwcfQOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNhwcHwcfQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_nhwc_hwcf_q", odsAttrs.getContext()); } Conv2DNhwcHwcfQOpGenericAdaptorBase(Conv2DNhwcHwcfQOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNhwcHwcfQOpGenericAdaptor : public detail::Conv2DNhwcHwcfQOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNhwcHwcfQOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNhwcHwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNhwcHwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNhwcHwcfQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNhwcHwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNhwcHwcfQOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNhwcHwcfQOpGenericAdaptor(RangeT values, const Conv2DNhwcHwcfQOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNhwcHwcfQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNhwcHwcfQOpAdaptor : public Conv2DNhwcHwcfQOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNhwcHwcfQOpGenericAdaptor::Conv2DNhwcHwcfQOpGenericAdaptor; Conv2DNhwcHwcfQOpAdaptor(Conv2DNhwcHwcfQOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNhwcHwcfQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNhwcHwcfQOpAdaptor; template using GenericAdaptor = Conv2DNhwcHwcfQOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_nhwc_hwcf_q"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcHwcfQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcHwcfQOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcHwcfQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwcHwcfQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwcHwcfQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwcHwcfQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwcHwcfQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwcHwcfQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwcHwcfQOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNhwcHwcfQOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNhwgcGfhwcOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNhwgcGfhwcOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNhwgcGfhwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_nhwgc_gfhwc", odsAttrs.getContext()); } Conv2DNhwgcGfhwcOpGenericAdaptorBase(Conv2DNhwgcGfhwcOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNhwgcGfhwcOpGenericAdaptor : public detail::Conv2DNhwgcGfhwcOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNhwgcGfhwcOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNhwgcGfhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNhwgcGfhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNhwgcGfhwcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNhwgcGfhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNhwgcGfhwcOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNhwgcGfhwcOpGenericAdaptor(RangeT values, const Conv2DNhwgcGfhwcOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNhwgcGfhwcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNhwgcGfhwcOpAdaptor : public Conv2DNhwgcGfhwcOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNhwgcGfhwcOpGenericAdaptor::Conv2DNhwgcGfhwcOpGenericAdaptor; Conv2DNhwgcGfhwcOpAdaptor(Conv2DNhwgcGfhwcOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNhwgcGfhwcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNhwgcGfhwcOpAdaptor; template using GenericAdaptor = Conv2DNhwgcGfhwcOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_nhwgc_gfhwc"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwgcGfhwcOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNhwgcGfhwcOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DNhwgcGfhwcQOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DNhwgcGfhwcQOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DNhwgcGfhwcQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d_nhwgc_gfhwc_q", odsAttrs.getContext()); } Conv2DNhwgcGfhwcQOpGenericAdaptorBase(Conv2DNhwgcGfhwcQOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DNhwgcGfhwcQOpGenericAdaptor : public detail::Conv2DNhwgcGfhwcQOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DNhwgcGfhwcQOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DNhwgcGfhwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DNhwgcGfhwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DNhwgcGfhwcQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DNhwgcGfhwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DNhwgcGfhwcQOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DNhwgcGfhwcQOpGenericAdaptor(RangeT values, const Conv2DNhwgcGfhwcQOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DNhwgcGfhwcQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DNhwgcGfhwcQOpAdaptor : public Conv2DNhwgcGfhwcQOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DNhwgcGfhwcQOpGenericAdaptor::Conv2DNhwgcGfhwcQOpGenericAdaptor; Conv2DNhwgcGfhwcQOpAdaptor(Conv2DNhwgcGfhwcQOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DNhwgcGfhwcQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DNhwgcGfhwcQOpAdaptor; template using GenericAdaptor = Conv2DNhwgcGfhwcQOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d_nhwgc_gfhwc_q"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcQOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv2DNhwgcGfhwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DNhwgcGfhwcQOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DNhwgcGfhwcQOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv2DOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv2DOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_2d", odsAttrs.getContext()); } Conv2DOpGenericAdaptorBase(Conv2DOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv2DOpGenericAdaptor : public detail::Conv2DOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv2DOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv2DOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv2DOpGenericAdaptor(RangeT values, const Conv2DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv2DOpAdaptor : public Conv2DOpGenericAdaptor<::mlir::ValueRange> { public: using Conv2DOpGenericAdaptor::Conv2DOpGenericAdaptor; Conv2DOpAdaptor(Conv2DOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv2DOpAdaptor; template using GenericAdaptor = Conv2DOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_2d"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv2DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv2DOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv2DOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv3DNcdhwFcdhwOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv3DNcdhwFcdhwOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv3DNcdhwFcdhwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_3d_ncdhw_fcdhw", odsAttrs.getContext()); } Conv3DNcdhwFcdhwOpGenericAdaptorBase(Conv3DNcdhwFcdhwOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv3DNcdhwFcdhwOpGenericAdaptor : public detail::Conv3DNcdhwFcdhwOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv3DNcdhwFcdhwOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv3DNcdhwFcdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv3DNcdhwFcdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv3DNcdhwFcdhwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv3DNcdhwFcdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv3DNcdhwFcdhwOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv3DNcdhwFcdhwOpGenericAdaptor(RangeT values, const Conv3DNcdhwFcdhwOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv3DNcdhwFcdhwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv3DNcdhwFcdhwOpAdaptor : public Conv3DNcdhwFcdhwOpGenericAdaptor<::mlir::ValueRange> { public: using Conv3DNcdhwFcdhwOpGenericAdaptor::Conv3DNcdhwFcdhwOpGenericAdaptor; Conv3DNcdhwFcdhwOpAdaptor(Conv3DNcdhwFcdhwOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv3DNcdhwFcdhwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv3DNcdhwFcdhwOpAdaptor; template using GenericAdaptor = Conv3DNcdhwFcdhwOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_3d_ncdhw_fcdhw"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNcdhwFcdhwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNcdhwFcdhwOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNcdhwFcdhwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNcdhwFcdhwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv3DNcdhwFcdhwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv3DNcdhwFcdhwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv3DNcdhwFcdhwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv3DNcdhwFcdhwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNcdhwFcdhwOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv3DNcdhwFcdhwOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv3DNdhwcDhwcfOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv3DNdhwcDhwcfOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv3DNdhwcDhwcfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_3d_ndhwc_dhwcf", odsAttrs.getContext()); } Conv3DNdhwcDhwcfOpGenericAdaptorBase(Conv3DNdhwcDhwcfOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv3DNdhwcDhwcfOpGenericAdaptor : public detail::Conv3DNdhwcDhwcfOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv3DNdhwcDhwcfOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv3DNdhwcDhwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv3DNdhwcDhwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv3DNdhwcDhwcfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv3DNdhwcDhwcfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv3DNdhwcDhwcfOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv3DNdhwcDhwcfOpGenericAdaptor(RangeT values, const Conv3DNdhwcDhwcfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv3DNdhwcDhwcfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv3DNdhwcDhwcfOpAdaptor : public Conv3DNdhwcDhwcfOpGenericAdaptor<::mlir::ValueRange> { public: using Conv3DNdhwcDhwcfOpGenericAdaptor::Conv3DNdhwcDhwcfOpGenericAdaptor; Conv3DNdhwcDhwcfOpAdaptor(Conv3DNdhwcDhwcfOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv3DNdhwcDhwcfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv3DNdhwcDhwcfOpAdaptor; template using GenericAdaptor = Conv3DNdhwcDhwcfOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_3d_ndhwc_dhwcf"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNdhwcDhwcfOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv3DNdhwcDhwcfOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv3DNdhwcDhwcfQOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv3DNdhwcDhwcfQOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv3DNdhwcDhwcfQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_3d_ndhwc_dhwcf_q", odsAttrs.getContext()); } Conv3DNdhwcDhwcfQOpGenericAdaptorBase(Conv3DNdhwcDhwcfQOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv3DNdhwcDhwcfQOpGenericAdaptor : public detail::Conv3DNdhwcDhwcfQOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv3DNdhwcDhwcfQOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv3DNdhwcDhwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv3DNdhwcDhwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv3DNdhwcDhwcfQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv3DNdhwcDhwcfQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv3DNdhwcDhwcfQOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv3DNdhwcDhwcfQOpGenericAdaptor(RangeT values, const Conv3DNdhwcDhwcfQOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv3DNdhwcDhwcfQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv3DNdhwcDhwcfQOpAdaptor : public Conv3DNdhwcDhwcfQOpGenericAdaptor<::mlir::ValueRange> { public: using Conv3DNdhwcDhwcfQOpGenericAdaptor::Conv3DNdhwcDhwcfQOpGenericAdaptor; Conv3DNdhwcDhwcfQOpAdaptor(Conv3DNdhwcDhwcfQOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv3DNdhwcDhwcfQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv3DNdhwcDhwcfQOpAdaptor; template using GenericAdaptor = Conv3DNdhwcDhwcfQOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_3d_ndhwc_dhwcf_q"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfQOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static Conv3DNdhwcDhwcfQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DNdhwcDhwcfQOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv3DNdhwcDhwcfQOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Conv3DOp declarations //===----------------------------------------------------------------------===// namespace detail { class Conv3DOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Conv3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.conv_3d", odsAttrs.getContext()); } Conv3DOpGenericAdaptorBase(Conv3DOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Conv3DOpGenericAdaptor : public detail::Conv3DOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Conv3DOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Conv3DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Conv3DOpGenericAdaptor(values, attrs, Properties{}, {}) {} Conv3DOpGenericAdaptor(RangeT values, const Conv3DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Conv3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Conv3DOpAdaptor : public Conv3DOpGenericAdaptor<::mlir::ValueRange> { public: using Conv3DOpGenericAdaptor::Conv3DOpGenericAdaptor; Conv3DOpAdaptor(Conv3DOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Conv3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Conv3DOpAdaptor; template using GenericAdaptor = Conv3DOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.conv_3d"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv3DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Conv3DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Conv3DOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Conv3DOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::CopyOp declarations //===----------------------------------------------------------------------===// namespace detail { class CopyOpGenericAdaptorBase { public: struct Properties { using castTy = ::mlir::linalg::TypeFnAttr; castTy cast; auto getCast() const { auto &propStorage = this->cast; return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); } void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { this->cast = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.cast == this->cast && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: CopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.copy", odsAttrs.getContext()); } CopyOpGenericAdaptorBase(CopyOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::linalg::TypeFnAttr getCastAttr(); ::mlir::linalg::TypeFn getCast(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class CopyOpGenericAdaptor : public detail::CopyOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CopyOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CopyOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : CopyOpGenericAdaptor(values, attrs, Properties{}, {}) {} CopyOpGenericAdaptor(RangeT values, const CopyOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CopyOpAdaptor : public CopyOpGenericAdaptor<::mlir::ValueRange> { public: using CopyOpGenericAdaptor::CopyOpGenericAdaptor; CopyOpAdaptor(CopyOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CopyOpAdaptor; template using GenericAdaptor = CopyOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getCastAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.copy"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::linalg::TypeFnAttr getCastAttr() { return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); } ::mlir::linalg::TypeFn getCast(); void setCastAttr(::mlir::linalg::TypeFnAttr attr) { getProperties().cast = attr; } void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); ::mlir::Attribute removeCastAttr() { auto attr = getProperties().cast; getProperties().cast = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static CopyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static CopyOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static CopyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static CopyOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static CopyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static CopyOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static CopyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static CopyOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::CopyOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::CopyOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv1DNcwCwOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv1DNcwCwOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv1DNcwCwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_1d_ncw_cw", odsAttrs.getContext()); } DepthwiseConv1DNcwCwOpGenericAdaptorBase(DepthwiseConv1DNcwCwOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv1DNcwCwOpGenericAdaptor : public detail::DepthwiseConv1DNcwCwOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv1DNcwCwOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv1DNcwCwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv1DNcwCwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv1DNcwCwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv1DNcwCwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv1DNcwCwOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv1DNcwCwOpGenericAdaptor(RangeT values, const DepthwiseConv1DNcwCwOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv1DNcwCwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv1DNcwCwOpAdaptor : public DepthwiseConv1DNcwCwOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv1DNcwCwOpGenericAdaptor::DepthwiseConv1DNcwCwOpGenericAdaptor; DepthwiseConv1DNcwCwOpAdaptor(DepthwiseConv1DNcwCwOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv1DNcwCwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv1DNcwCwOpAdaptor; template using GenericAdaptor = DepthwiseConv1DNcwCwOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_1d_ncw_cw"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNcwCwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNcwCwOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNcwCwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNcwCwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv1DNcwCwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv1DNcwCwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv1DNcwCwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv1DNcwCwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNcwCwOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv1DNcwCwOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv1DNwcWcOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv1DNwcWcOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv1DNwcWcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_1d_nwc_wc", odsAttrs.getContext()); } DepthwiseConv1DNwcWcOpGenericAdaptorBase(DepthwiseConv1DNwcWcOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv1DNwcWcOpGenericAdaptor : public detail::DepthwiseConv1DNwcWcOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv1DNwcWcOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv1DNwcWcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv1DNwcWcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv1DNwcWcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv1DNwcWcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv1DNwcWcOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv1DNwcWcOpGenericAdaptor(RangeT values, const DepthwiseConv1DNwcWcOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv1DNwcWcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv1DNwcWcOpAdaptor : public DepthwiseConv1DNwcWcOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv1DNwcWcOpGenericAdaptor::DepthwiseConv1DNwcWcOpGenericAdaptor; DepthwiseConv1DNwcWcOpAdaptor(DepthwiseConv1DNwcWcOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv1DNwcWcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv1DNwcWcOpAdaptor; template using GenericAdaptor = DepthwiseConv1DNwcWcOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_1d_nwc_wc"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNwcWcOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv1DNwcWcOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv1DNwcWcmOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv1DNwcWcmOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv1DNwcWcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_1d_nwc_wcm", odsAttrs.getContext()); } DepthwiseConv1DNwcWcmOpGenericAdaptorBase(DepthwiseConv1DNwcWcmOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv1DNwcWcmOpGenericAdaptor : public detail::DepthwiseConv1DNwcWcmOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv1DNwcWcmOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv1DNwcWcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv1DNwcWcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv1DNwcWcmOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv1DNwcWcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv1DNwcWcmOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv1DNwcWcmOpGenericAdaptor(RangeT values, const DepthwiseConv1DNwcWcmOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv1DNwcWcmOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv1DNwcWcmOpAdaptor : public DepthwiseConv1DNwcWcmOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv1DNwcWcmOpGenericAdaptor::DepthwiseConv1DNwcWcmOpGenericAdaptor; DepthwiseConv1DNwcWcmOpAdaptor(DepthwiseConv1DNwcWcmOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv1DNwcWcmOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv1DNwcWcmOpAdaptor; template using GenericAdaptor = DepthwiseConv1DNwcWcmOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_1d_nwc_wcm"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcmOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv1DNwcWcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv1DNwcWcmOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv1DNwcWcmOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv2DNchwChwOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv2DNchwChwOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv2DNchwChwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_2d_nchw_chw", odsAttrs.getContext()); } DepthwiseConv2DNchwChwOpGenericAdaptorBase(DepthwiseConv2DNchwChwOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv2DNchwChwOpGenericAdaptor : public detail::DepthwiseConv2DNchwChwOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv2DNchwChwOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv2DNchwChwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv2DNchwChwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNchwChwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv2DNchwChwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv2DNchwChwOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv2DNchwChwOpGenericAdaptor(RangeT values, const DepthwiseConv2DNchwChwOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv2DNchwChwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv2DNchwChwOpAdaptor : public DepthwiseConv2DNchwChwOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv2DNchwChwOpGenericAdaptor::DepthwiseConv2DNchwChwOpGenericAdaptor; DepthwiseConv2DNchwChwOpAdaptor(DepthwiseConv2DNchwChwOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv2DNchwChwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv2DNchwChwOpAdaptor; template using GenericAdaptor = DepthwiseConv2DNchwChwOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nchw_chw"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNchwChwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNchwChwOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNchwChwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNchwChwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNchwChwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNchwChwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNchwChwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNchwChwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNchwChwOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv2DNchwChwOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv2DNhwcHwcOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv2DNhwcHwcOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv2DNhwcHwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_2d_nhwc_hwc", odsAttrs.getContext()); } DepthwiseConv2DNhwcHwcOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv2DNhwcHwcOpGenericAdaptor : public detail::DepthwiseConv2DNhwcHwcOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv2DNhwcHwcOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv2DNhwcHwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv2DNhwcHwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNhwcHwcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv2DNhwcHwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv2DNhwcHwcOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv2DNhwcHwcOpGenericAdaptor(RangeT values, const DepthwiseConv2DNhwcHwcOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv2DNhwcHwcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv2DNhwcHwcOpAdaptor : public DepthwiseConv2DNhwcHwcOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv2DNhwcHwcOpGenericAdaptor::DepthwiseConv2DNhwcHwcOpGenericAdaptor; DepthwiseConv2DNhwcHwcOpAdaptor(DepthwiseConv2DNhwcHwcOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv2DNhwcHwcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv2DNhwcHwcOpAdaptor; template using GenericAdaptor = DepthwiseConv2DNhwcHwcOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nhwc_hwc"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv2DNhwcHwcOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv2DNhwcHwcQOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_2d_nhwc_hwc_q", odsAttrs.getContext()); } DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcQOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv2DNhwcHwcQOpGenericAdaptor : public detail::DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv2DNhwcHwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv2DNhwcHwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNhwcHwcQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv2DNhwcHwcQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv2DNhwcHwcQOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv2DNhwcHwcQOpGenericAdaptor(RangeT values, const DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv2DNhwcHwcQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv2DNhwcHwcQOpAdaptor : public DepthwiseConv2DNhwcHwcQOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv2DNhwcHwcQOpGenericAdaptor::DepthwiseConv2DNhwcHwcQOpGenericAdaptor; DepthwiseConv2DNhwcHwcQOpAdaptor(DepthwiseConv2DNhwcHwcQOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv2DNhwcHwcQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv2DNhwcHwcQOpAdaptor; template using GenericAdaptor = DepthwiseConv2DNhwcHwcQOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nhwc_hwc_q"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcQOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcQOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv2DNhwcHwcQOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv2DNhwcHwcmOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_2d_nhwc_hwcm", odsAttrs.getContext()); } DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcmOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv2DNhwcHwcmOpGenericAdaptor : public detail::DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv2DNhwcHwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv2DNhwcHwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNhwcHwcmOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv2DNhwcHwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv2DNhwcHwcmOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv2DNhwcHwcmOpGenericAdaptor(RangeT values, const DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv2DNhwcHwcmOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv2DNhwcHwcmOpAdaptor : public DepthwiseConv2DNhwcHwcmOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv2DNhwcHwcmOpGenericAdaptor::DepthwiseConv2DNhwcHwcmOpGenericAdaptor; DepthwiseConv2DNhwcHwcmOpAdaptor(DepthwiseConv2DNhwcHwcmOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv2DNhwcHwcmOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv2DNhwcHwcmOpAdaptor; template using GenericAdaptor = DepthwiseConv2DNhwcHwcmOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nhwc_hwcm"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcmOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv2DNhwcHwcmOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv2DNhwcHwcmQOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_2d_nhwc_hwcm_q", odsAttrs.getContext()); } DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase(DepthwiseConv2DNhwcHwcmQOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv2DNhwcHwcmQOpGenericAdaptor : public detail::DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(RangeT values, const DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv2DNhwcHwcmQOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv2DNhwcHwcmQOpAdaptor : public DepthwiseConv2DNhwcHwcmQOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv2DNhwcHwcmQOpGenericAdaptor::DepthwiseConv2DNhwcHwcmQOpGenericAdaptor; DepthwiseConv2DNhwcHwcmQOpAdaptor(DepthwiseConv2DNhwcHwcmQOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv2DNhwcHwcmQOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv2DNhwcHwcmQOpAdaptor; template using GenericAdaptor = DepthwiseConv2DNhwcHwcmQOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_2d_nhwc_hwcm_q"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmQOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmQOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv2DNhwcHwcmQOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv2DNhwcHwcmQOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv2DNhwcHwcmQOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv3DNcdhwCdhwOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_3d_ncdhw_cdhw", odsAttrs.getContext()); } DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase(DepthwiseConv3DNcdhwCdhwOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv3DNcdhwCdhwOpGenericAdaptor : public detail::DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(RangeT values, const DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv3DNcdhwCdhwOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv3DNcdhwCdhwOpAdaptor : public DepthwiseConv3DNcdhwCdhwOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv3DNcdhwCdhwOpGenericAdaptor::DepthwiseConv3DNcdhwCdhwOpGenericAdaptor; DepthwiseConv3DNcdhwCdhwOpAdaptor(DepthwiseConv3DNcdhwCdhwOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv3DNcdhwCdhwOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv3DNcdhwCdhwOpAdaptor; template using GenericAdaptor = DepthwiseConv3DNcdhwCdhwOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_3d_ncdhw_cdhw"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNcdhwCdhwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNcdhwCdhwOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNcdhwCdhwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNcdhwCdhwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv3DNcdhwCdhwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv3DNcdhwCdhwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv3DNcdhwCdhwOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv3DNcdhwCdhwOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNcdhwCdhwOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv3DNcdhwCdhwOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv3DNdhwcDhwcOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_3d_ndhwc_dhwc", odsAttrs.getContext()); } DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase(DepthwiseConv3DNdhwcDhwcOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv3DNdhwcDhwcOpGenericAdaptor : public detail::DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(RangeT values, const DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv3DNdhwcDhwcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv3DNdhwcDhwcOpAdaptor : public DepthwiseConv3DNdhwcDhwcOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv3DNdhwcDhwcOpGenericAdaptor::DepthwiseConv3DNdhwcDhwcOpGenericAdaptor; DepthwiseConv3DNdhwcDhwcOpAdaptor(DepthwiseConv3DNdhwcDhwcOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv3DNdhwcDhwcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv3DNdhwcDhwcOpAdaptor; template using GenericAdaptor = DepthwiseConv3DNdhwcDhwcOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_3d_ndhwc_dhwc"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNdhwcDhwcOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv3DNdhwcDhwcOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DepthwiseConv3DNdhwcDhwcmOp declarations //===----------------------------------------------------------------------===// namespace detail { class DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.depthwise_conv_3d_ndhwc_dhwcm", odsAttrs.getContext()); } DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase(DepthwiseConv3DNdhwcDhwcmOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor : public detail::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(values, attrs, Properties{}, {}) {} DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(RangeT values, const DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DepthwiseConv3DNdhwcDhwcmOpAdaptor : public DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor<::mlir::ValueRange> { public: using DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor; DepthwiseConv3DNdhwcDhwcmOpAdaptor(DepthwiseConv3DNdhwcDhwcmOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DepthwiseConv3DNdhwcDhwcmOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DepthwiseConv3DNdhwcDhwcmOpAdaptor; template using GenericAdaptor = DepthwiseConv3DNdhwcDhwcmOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.depthwise_conv_3d_ndhwc_dhwcm"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcmOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcmOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static DepthwiseConv3DNdhwcDhwcmOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DepthwiseConv3DNdhwcDhwcmOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DepthwiseConv3DNdhwcDhwcmOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DivOp declarations //===----------------------------------------------------------------------===// namespace detail { class DivOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.div", odsAttrs.getContext()); } DivOpGenericAdaptorBase(DivOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DivOpGenericAdaptor : public detail::DivOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DivOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DivOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DivOpGenericAdaptor(values, attrs, Properties{}, {}) {} DivOpGenericAdaptor(RangeT values, const DivOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DivOpAdaptor : public DivOpGenericAdaptor<::mlir::ValueRange> { public: using DivOpGenericAdaptor::DivOpGenericAdaptor; DivOpAdaptor(DivOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DivOpAdaptor; template using GenericAdaptor = DivOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.div"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DivOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DivOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DivOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DivOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DivOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DivUnsignedOp declarations //===----------------------------------------------------------------------===// namespace detail { class DivUnsignedOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DivUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.div_unsigned", odsAttrs.getContext()); } DivUnsignedOpGenericAdaptorBase(DivUnsignedOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DivUnsignedOpGenericAdaptor : public detail::DivUnsignedOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DivUnsignedOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DivUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DivUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DivUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DivUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DivUnsignedOpGenericAdaptor(values, attrs, Properties{}, {}) {} DivUnsignedOpGenericAdaptor(RangeT values, const DivUnsignedOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DivUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DivUnsignedOpAdaptor : public DivUnsignedOpGenericAdaptor<::mlir::ValueRange> { public: using DivUnsignedOpGenericAdaptor::DivUnsignedOpGenericAdaptor; DivUnsignedOpAdaptor(DivUnsignedOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DivUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DivUnsignedOpAdaptor; template using GenericAdaptor = DivUnsignedOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.div_unsigned"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DivUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DivUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DivUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DivUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DivUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DivUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DivUnsignedOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DivUnsignedOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::DotOp declarations //===----------------------------------------------------------------------===// namespace detail { class DotOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.dot", odsAttrs.getContext()); } DotOpGenericAdaptorBase(DotOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DotOpGenericAdaptor : public detail::DotOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DotOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DotOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DotOpGenericAdaptor(values, attrs, Properties{}, {}) {} DotOpGenericAdaptor(RangeT values, const DotOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DotOpAdaptor : public DotOpGenericAdaptor<::mlir::ValueRange> { public: using DotOpGenericAdaptor::DotOpGenericAdaptor; DotOpAdaptor(DotOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DotOpAdaptor; template using GenericAdaptor = DotOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.dot"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DotOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static DotOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static DotOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::DotOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::DotOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::ElementwiseOp declarations //===----------------------------------------------------------------------===// namespace detail { class ElementwiseOpGenericAdaptorBase { public: struct Properties { using indexing_mapsTy = ::mlir::ArrayAttr; indexing_mapsTy indexing_maps; auto getIndexingMaps() const { auto &propStorage = this->indexing_maps; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setIndexingMaps(const ::mlir::ArrayAttr &propValue) { this->indexing_maps = propValue; } using kindTy = ::mlir::linalg::ElementwiseKindAttr; kindTy kind; auto getKind() const { auto &propStorage = this->kind; return ::llvm::cast<::mlir::linalg::ElementwiseKindAttr>(propStorage); } void setKind(const ::mlir::linalg::ElementwiseKindAttr &propValue) { this->kind = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.indexing_maps == this->indexing_maps && rhs.kind == this->kind && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ElementwiseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.elementwise", odsAttrs.getContext()); } ElementwiseOpGenericAdaptorBase(ElementwiseOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::linalg::ElementwiseKindAttr getKindAttr() { auto attr = ::llvm::cast<::mlir::linalg::ElementwiseKindAttr>(getProperties().kind); return attr; } ::mlir::linalg::ElementwiseKind getKind(); ::mlir::ArrayAttr getIndexingMapsAttr(); ::mlir::ArrayAttr getIndexingMaps(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ElementwiseOpGenericAdaptor : public detail::ElementwiseOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ElementwiseOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: ElementwiseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ElementwiseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ElementwiseOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ElementwiseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ElementwiseOpGenericAdaptor(values, attrs, Properties{}, {}) {} ElementwiseOpGenericAdaptor(RangeT values, const ElementwiseOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ElementwiseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ElementwiseOpAdaptor : public ElementwiseOpGenericAdaptor<::mlir::ValueRange> { public: using ElementwiseOpGenericAdaptor::ElementwiseOpGenericAdaptor; ElementwiseOpAdaptor(ElementwiseOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ElementwiseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ElementwiseOpAdaptor; template using GenericAdaptor = ElementwiseOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("indexing_maps"), ::llvm::StringRef("kind"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getIndexingMapsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getIndexingMapsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getKindAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getKindAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.elementwise"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::linalg::ElementwiseKindAttr getKindAttr() { return ::llvm::cast<::mlir::linalg::ElementwiseKindAttr>(getProperties().kind); } ::mlir::linalg::ElementwiseKind getKind(); ::mlir::ArrayAttr getIndexingMapsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().indexing_maps); } ::mlir::ArrayAttr getIndexingMaps(); void setKindAttr(::mlir::linalg::ElementwiseKindAttr attr) { getProperties().kind = attr; } void setKind(::mlir::linalg::ElementwiseKind attrValue); void setIndexingMapsAttr(::mlir::ArrayAttr attr) { getProperties().indexing_maps = attr; } ::mlir::Attribute removeIndexingMapsAttr() { auto attr = getProperties().indexing_maps; getProperties().indexing_maps = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ElementwiseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ElementwiseOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ElementwiseKindAttr kind, ArrayAttr indexingMaps, ArrayRef attributes = {}); static ElementwiseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ElementwiseKindAttr kind, ArrayAttr indexingMaps, ArrayRef attributes = {}); static ElementwiseOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ElementwiseKindAttr kind, ArrayAttr indexingMaps, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } /// Get the arity enum corresponding to the kind of op, e.g. if arg is /// `ElementwiseKind::add`, return `ElementwiseArityGroup::Binary`. static ElementwiseArityGroup getArityGroup(ElementwiseKind n); /// Both user-specified and default indexing map will always depend on /// the current Op instance. static bool hasDynamicIndexingMaps() { return true; } /// Implements the block region builder for the elementwiseOp. This is /// called by the 'fillStructuredOpRegion'. static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref)> getRegionBuilder() { return regionBuilder; } /// Returns rank of the result tensor/memref. Useful for knowing /// the dimensionality of the iteration space when others means /// are not possible e.g. absence of user-provided indexing map. unsigned getResultRank() { Value output = getDpsInitOperand(0)->get(); ShapedType shapedType = llvm::cast(output.getType()); return shapedType.getRank(); } /// Returns N 'parallel' iterator types where N is rank of result. SmallVector getIteratorTypesArray(); /// The default indexing maps are identities. /// There will be N+1 such maps, where N is the arity of the Op. static SmallVector getDefaultIndexingMaps(unsigned NumMaps, unsigned numDims, MLIRContext *context); /// Destination passing style interface method. ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. std::string getLibraryCallName() { return generateLibraryCallName(getOperation()); } }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ElementwiseOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::ElementwiseOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::ErfOp declarations //===----------------------------------------------------------------------===// namespace detail { class ErfOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ErfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.erf", odsAttrs.getContext()); } ErfOpGenericAdaptorBase(ErfOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ErfOpGenericAdaptor : public detail::ErfOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ErfOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ErfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ErfOpGenericAdaptor(values, attrs, Properties{}, {}) {} ErfOpGenericAdaptor(RangeT values, const ErfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ErfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ErfOpAdaptor : public ErfOpGenericAdaptor<::mlir::ValueRange> { public: using ErfOpGenericAdaptor::ErfOpGenericAdaptor; ErfOpAdaptor(ErfOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ErfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ErfOpAdaptor; template using GenericAdaptor = ErfOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.erf"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ErfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ErfOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ErfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ErfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ErfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ErfOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ErfOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::ErfOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::ExpOp declarations //===----------------------------------------------------------------------===// namespace detail { class ExpOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.exp", odsAttrs.getContext()); } ExpOpGenericAdaptorBase(ExpOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ExpOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ExpOpGenericAdaptor(values, attrs, Properties{}, {}) {} ExpOpGenericAdaptor(RangeT values, const ExpOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { public: using ExpOpGenericAdaptor::ExpOpGenericAdaptor; ExpOpAdaptor(ExpOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ExpOpAdaptor; template using GenericAdaptor = ExpOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.exp"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ExpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ExpOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ExpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ExpOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ExpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ExpOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ExpOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::ExpOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::FillOp declarations //===----------------------------------------------------------------------===// namespace detail { class FillOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: FillOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.fill", odsAttrs.getContext()); } FillOpGenericAdaptorBase(FillOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class FillOpGenericAdaptor : public detail::FillOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FillOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FillOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : FillOpGenericAdaptor(values, attrs, Properties{}, {}) {} FillOpGenericAdaptor(RangeT values, const FillOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FillOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class FillOpAdaptor : public FillOpGenericAdaptor<::mlir::ValueRange> { public: using FillOpGenericAdaptor::FillOpGenericAdaptor; FillOpAdaptor(FillOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FillOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::FillOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = FillOpAdaptor; template using GenericAdaptor = FillOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.fill"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FillOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FillOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FillOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FillOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static FillOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static FillOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::FillOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::FillOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::FillRng2DOp declarations //===----------------------------------------------------------------------===// namespace detail { class FillRng2DOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: FillRng2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.fill_rng_2d", odsAttrs.getContext()); } FillRng2DOpGenericAdaptorBase(FillRng2DOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class FillRng2DOpGenericAdaptor : public detail::FillRng2DOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FillRng2DOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: FillRng2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FillRng2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FillRng2DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FillRng2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : FillRng2DOpGenericAdaptor(values, attrs, Properties{}, {}) {} FillRng2DOpGenericAdaptor(RangeT values, const FillRng2DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FillRng2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class FillRng2DOpAdaptor : public FillRng2DOpGenericAdaptor<::mlir::ValueRange> { public: using FillRng2DOpGenericAdaptor::FillRng2DOpGenericAdaptor; FillRng2DOpAdaptor(FillRng2DOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FillRng2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = FillRng2DOpAdaptor; template using GenericAdaptor = FillRng2DOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.fill_rng_2d"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FillRng2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FillRng2DOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FillRng2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FillRng2DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static FillRng2DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static FillRng2DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::FillRng2DOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::FillRng2DOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::FloorOp declarations //===----------------------------------------------------------------------===// namespace detail { class FloorOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.floor", odsAttrs.getContext()); } FloorOpGenericAdaptorBase(FloorOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class FloorOpGenericAdaptor : public detail::FloorOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FloorOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FloorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : FloorOpGenericAdaptor(values, attrs, Properties{}, {}) {} FloorOpGenericAdaptor(RangeT values, const FloorOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class FloorOpAdaptor : public FloorOpGenericAdaptor<::mlir::ValueRange> { public: using FloorOpGenericAdaptor::FloorOpGenericAdaptor; FloorOpAdaptor(FloorOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FloorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = FloorOpAdaptor; template using GenericAdaptor = FloorOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.floor"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FloorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FloorOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FloorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static FloorOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static FloorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static FloorOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::FloorOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::FloorOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::GenericOp declarations //===----------------------------------------------------------------------===// namespace detail { class GenericOpGenericAdaptorBase { public: struct Properties { using docTy = ::mlir::StringAttr; docTy doc; auto getDoc() const { auto &propStorage = this->doc; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setDoc(const ::mlir::StringAttr &propValue) { this->doc = propValue; } using indexing_mapsTy = ::mlir::ArrayAttr; indexing_mapsTy indexing_maps; auto getIndexingMaps() const { auto &propStorage = this->indexing_maps; return ::llvm::cast<::mlir::ArrayAttr>(propStorage); } void setIndexingMaps(const ::mlir::ArrayAttr &propValue) { this->indexing_maps = propValue; } using iterator_typesTy = ::mlir::ArrayAttr; iterator_typesTy iterator_types; auto getIteratorTypes() const { auto &propStorage = this->iterator_types; return ::llvm::cast<::mlir::ArrayAttr>(propStorage); } void setIteratorTypes(const ::mlir::ArrayAttr &propValue) { this->iterator_types = propValue; } using library_callTy = ::mlir::StringAttr; library_callTy library_call; auto getLibraryCall() const { auto &propStorage = this->library_call; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setLibraryCall(const ::mlir::StringAttr &propValue) { this->library_call = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.doc == this->doc && rhs.indexing_maps == this->indexing_maps && rhs.iterator_types == this->iterator_types && rhs.library_call == this->library_call && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: GenericOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.generic", odsAttrs.getContext()); } GenericOpGenericAdaptorBase(GenericOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getIndexingMapsAttr() { auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().indexing_maps); return attr; } ::mlir::ArrayAttr getIndexingMaps(); ::mlir::ArrayAttr getIteratorTypesAttr() { auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().iterator_types); return attr; } ::mlir::ArrayAttr getIteratorTypes(); ::mlir::StringAttr getDocAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().doc); return attr; } ::std::optional< ::llvm::StringRef > getDoc(); ::mlir::StringAttr getLibraryCallAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().library_call); return attr; } ::std::optional< ::llvm::StringRef > getLibraryCall(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class GenericOpGenericAdaptor : public detail::GenericOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GenericOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: GenericOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GenericOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GenericOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GenericOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : GenericOpGenericAdaptor(values, attrs, Properties{}, {}) {} GenericOpGenericAdaptor(RangeT values, const GenericOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GenericOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class GenericOpAdaptor : public GenericOpGenericAdaptor<::mlir::ValueRange> { public: using GenericOpGenericAdaptor::GenericOpGenericAdaptor; GenericOpAdaptor(GenericOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GenericOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = GenericOpAdaptor; template using GenericAdaptor = GenericOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; using ::mlir::OpAsmOpInterface::Trait::getAsmResultNames; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockNames; using ::mlir::OpAsmOpInterface::Trait::getDefaultDialect; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("doc"), ::llvm::StringRef("indexing_maps"), ::llvm::StringRef("iterator_types"), ::llvm::StringRef("library_call"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDocAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDocAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getIndexingMapsAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getIndexingMapsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getIteratorTypesAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getIteratorTypesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getLibraryCallAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getLibraryCallAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.generic"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getIndexingMapsAttr() { return ::llvm::cast<::mlir::ArrayAttr>(getProperties().indexing_maps); } ::mlir::ArrayAttr getIndexingMaps(); ::mlir::ArrayAttr getIteratorTypesAttr() { return ::llvm::cast<::mlir::ArrayAttr>(getProperties().iterator_types); } ::mlir::ArrayAttr getIteratorTypes(); ::mlir::StringAttr getDocAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().doc); } ::std::optional< ::llvm::StringRef > getDoc(); ::mlir::StringAttr getLibraryCallAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().library_call); } ::std::optional< ::llvm::StringRef > getLibraryCall(); void setIndexingMapsAttr(::mlir::ArrayAttr attr) { getProperties().indexing_maps = attr; } void setIteratorTypesAttr(::mlir::ArrayAttr attr) { getProperties().iterator_types = attr; } void setDocAttr(::mlir::StringAttr attr) { getProperties().doc = attr; } void setDoc(::std::optional<::llvm::StringRef> attrValue); void setLibraryCallAttr(::mlir::StringAttr attr) { getProperties().library_call = attr; } void setLibraryCall(::std::optional<::llvm::StringRef> attrValue); ::mlir::Attribute removeDocAttr() { auto attr = getProperties().doc; getProperties().doc = {}; return attr; } ::mlir::Attribute removeLibraryCallAttr() { auto attr = getProperties().library_call; getProperties().library_call = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayAttr iteratorTypes, StringAttr doc, StringAttr libraryCall, function_ref odsArg7, ArrayRef attributes = {}); static GenericOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayAttr iteratorTypes, StringAttr doc, StringAttr libraryCall, function_ref odsArg7, ArrayRef attributes = {}); static GenericOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayAttr indexingMaps, ArrayAttr iteratorTypes, StringAttr doc, StringAttr libraryCall, function_ref odsArg7, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef indexingMaps, ArrayRef iteratorTypes, StringRef doc, StringRef libraryCall, function_ref odsArg7 = nullptr, ArrayRef attributes = {}); static GenericOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef indexingMaps, ArrayRef iteratorTypes, StringRef doc, StringRef libraryCall, function_ref odsArg7 = nullptr, ArrayRef attributes = {}); static GenericOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef indexingMaps, ArrayRef iteratorTypes, StringRef doc, StringRef libraryCall, function_ref odsArg7 = nullptr, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputBuffers, ArrayRef indexingMaps, ArrayRef iteratorTypes, StringRef doc, StringRef libraryCall, function_ref odsArg6 = nullptr, ArrayRef attributes = {}); static GenericOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputBuffers, ArrayRef indexingMaps, ArrayRef iteratorTypes, StringRef doc, StringRef libraryCall, function_ref odsArg6 = nullptr, ArrayRef attributes = {}); static GenericOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputBuffers, ArrayRef indexingMaps, ArrayRef iteratorTypes, StringRef doc, StringRef libraryCall, function_ref odsArg6 = nullptr, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef indexingMaps, ArrayRef iteratorTypes, function_ref odsArg5 = nullptr, ArrayRef attributes = {}); static GenericOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef indexingMaps, ArrayRef iteratorTypes, function_ref odsArg5 = nullptr, ArrayRef attributes = {}); static GenericOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef indexingMaps, ArrayRef iteratorTypes, function_ref odsArg5 = nullptr, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputBuffers, ArrayRef indexingMaps, ArrayRef iteratorTypes, function_ref odsArg4 = nullptr, ArrayRef attributes = {}); static GenericOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputBuffers, ArrayRef indexingMaps, ArrayRef iteratorTypes, function_ref odsArg4 = nullptr, ArrayRef attributes = {}); static GenericOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputBuffers, ArrayRef indexingMaps, ArrayRef iteratorTypes, function_ref odsArg4 = nullptr, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result_tensors, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::ArrayAttr indexing_maps, ::mlir::ArrayAttr iterator_types, /*optional*/::mlir::StringAttr doc, /*optional*/::mlir::StringAttr library_call); static GenericOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange result_tensors, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::ArrayAttr indexing_maps, ::mlir::ArrayAttr iterator_types, /*optional*/::mlir::StringAttr doc, /*optional*/::mlir::StringAttr library_call); static GenericOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange result_tensors, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::ArrayAttr indexing_maps, ::mlir::ArrayAttr iterator_types, /*optional*/::mlir::StringAttr doc, /*optional*/::mlir::StringAttr library_call); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GenericOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GenericOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GenericOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GenericOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); void getAsmBlockArgumentNames(::mlir::Region®ion, ::mlir::OpAsmSetValueNameFn setNameFn); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 4 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } SmallVector linalgTraitAttrNames() { return SmallVector{ getDocAttrName(), getIndexingMapsAttrName(), getLibraryCallAttrName(), getIteratorTypesAttrName(), }; } std::string getLibraryCallName() { return getLibraryCall() ? getLibraryCall()->str() : "op_has_no_registered_library_name"; } static std::function, function_ref)> getRegionBuilder() { return nullptr; } MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Return true only if GenericOp has a single input and single // output, and the body is a single yieldOp that yields the input. // This check is useful when trying to determine if the op is // essentially a transpose, broadcast, copy or something like that. bool isSingleYieldOp() { if (!isSingleInputOutput()) return false; Block *body = getBody(); if (body->getOperations().size() != 1) return false; auto yieldOp = dyn_cast(body->back()); if (!yieldOp || yieldOp.getNumOperands() != 1 || yieldOp->getOperand(0) != body->getArgument(0)) return false; return true; } }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::GenericOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::GenericOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::LogOp declarations //===----------------------------------------------------------------------===// namespace detail { class LogOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.log", odsAttrs.getContext()); } LogOpGenericAdaptorBase(LogOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::LogOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : LogOpGenericAdaptor(values, attrs, Properties{}, {}) {} LogOpGenericAdaptor(RangeT values, const LogOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { public: using LogOpGenericAdaptor::LogOpGenericAdaptor; LogOpAdaptor(LogOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = LogOpAdaptor; template using GenericAdaptor = LogOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.log"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static LogOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static LogOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static LogOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static LogOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static LogOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static LogOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::LogOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::LogOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::MapOp declarations //===----------------------------------------------------------------------===// namespace detail { class MapOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: MapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.map", odsAttrs.getContext()); } MapOpGenericAdaptorBase(MapOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getMapper() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class MapOpGenericAdaptor : public detail::MapOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MapOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_init = 1; public: MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MapOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MapOpGenericAdaptor(values, attrs, Properties{}, {}) {} MapOpGenericAdaptor(RangeT values, const MapOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MapOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } ValueT getInit() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MapOpAdaptor : public MapOpGenericAdaptor<::mlir::ValueRange> { public: using MapOpGenericAdaptor::MapOpGenericAdaptor; MapOpAdaptor(MapOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MapOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MapOpAdaptor; template using GenericAdaptor = MapOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_init = 1; using Properties = FoldAdaptor::Properties; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockArgumentNames; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockNames; using ::mlir::OpAsmOpInterface::Trait::getDefaultDialect; using ::mlir::OpAsmOpInterface::Trait::getAsmResultNames; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.map"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::TypedValue<::mlir::ShapedType> getInit() { return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(1).begin()); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::OpOperand &getInitMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResult() { return getODSResults(0); } ::mlir::Region &getMapper() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, Value init, function_ref odsArg2, ArrayRef attributes = {}); static MapOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, Value init, function_ref odsArg2, ArrayRef attributes = {}); static MapOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, Value init, function_ref odsArg2, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result, ::mlir::ValueRange inputs, ::mlir::Value init); static MapOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange result, ::mlir::ValueRange inputs, ::mlir::Value init); static MapOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange result, ::mlir::ValueRange inputs, ::mlir::Value init); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MapOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MapOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static MapOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static MapOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); void getAsmBlockArgumentNames(::mlir::Region®ion, ::mlir::OpAsmSetValueNameFn setNameFn); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Implement functions necessary for LinalgStructuredInterface. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); std::string getLibraryCallName() { return "op_has_no_registered_library_name"; } // Implement functions necessary for DestinationStyleOpInterface. MutableOperandRange getDpsInitsMutable() { return getInitMutable(); } bool payloadUsesValueFromOperand(OpOperand * opOperand) { if (isDpsInit(opOperand)) return false; return !getMatchingBlockArgument(opOperand).use_empty(); } static std::function, function_ref)> getRegionBuilder() { return nullptr; } }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MapOp) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::MatmulOp declarations //===----------------------------------------------------------------------===// namespace detail { class MatmulOpGenericAdaptorBase { public: struct Properties { using castTy = ::mlir::linalg::TypeFnAttr; castTy cast; auto getCast() const { auto &propStorage = this->cast; return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(propStorage); } void setCast(const ::mlir::linalg::TypeFnAttr &propValue) { this->cast = propValue; } using indexing_mapsTy = ::mlir::ArrayAttr; indexing_mapsTy indexing_maps; auto getIndexingMaps() const { auto &propStorage = this->indexing_maps; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setIndexingMaps(const ::mlir::ArrayAttr &propValue) { this->indexing_maps = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.cast == this->cast && rhs.indexing_maps == this->indexing_maps && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: MatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.matmul", odsAttrs.getContext()); } MatmulOpGenericAdaptorBase(MatmulOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getIndexingMapsAttr(); ::mlir::ArrayAttr getIndexingMaps(); ::mlir::linalg::TypeFnAttr getCastAttr(); ::mlir::linalg::TypeFn getCast(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class MatmulOpGenericAdaptor : public detail::MatmulOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MatmulOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: MatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : MatmulOpGenericAdaptor(values, attrs, Properties{}, {}) {} MatmulOpGenericAdaptor(RangeT values, const MatmulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MatmulOpAdaptor : public MatmulOpGenericAdaptor<::mlir::ValueRange> { public: using MatmulOpGenericAdaptor::MatmulOpGenericAdaptor; MatmulOpAdaptor(MatmulOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MatmulOpAdaptor; template using GenericAdaptor = MatmulOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cast"), ::llvm::StringRef("indexing_maps"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getCastAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getCastAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getIndexingMapsAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getIndexingMapsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.matmul"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getIndexingMapsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().indexing_maps); } ::mlir::ArrayAttr getIndexingMaps(); ::mlir::linalg::TypeFnAttr getCastAttr() { return ::llvm::dyn_cast_or_null<::mlir::linalg::TypeFnAttr>(getProperties().cast); } ::mlir::linalg::TypeFn getCast(); void setIndexingMapsAttr(::mlir::ArrayAttr attr) { getProperties().indexing_maps = attr; } void setCastAttr(::mlir::linalg::TypeFnAttr attr) { getProperties().cast = attr; } void setCast(::std::optional<::mlir::linalg::TypeFn> attrValue); ::mlir::Attribute removeIndexingMapsAttr() { auto attr = getProperties().indexing_maps; getProperties().indexing_maps = {}; return attr; } ::mlir::Attribute removeCastAttr() { auto attr = getProperties().cast; getProperties().cast = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MatmulOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static MatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static MatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute cast, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } SmallVector getIteratorTypesArray(); /// Implements the block region builder. static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); /// Returns a list of AffineMap with the default matmul indexing charactristic. static SmallVector getDefaultIndexingMaps(MLIRContext *context); /// Returns true if the AffineMap is the default matmul indexing charactristic. static bool isDefaultIndexingMaps(Attribute attr); /// Returns true if the given broadcast map \p bcastMap is valid for this op. bool isValidLhsRhsBroadcastMap(AffineMap bcastMap); static std::function, function_ref)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); /// Returns true if the user defined indexing maps are not equal to default maps. bool hasUserDefinedMaps(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MatmulOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::MatmulOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::MatvecOp declarations //===----------------------------------------------------------------------===// namespace detail { class MatvecOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: MatvecOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.matvec", odsAttrs.getContext()); } MatvecOpGenericAdaptorBase(MatvecOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class MatvecOpGenericAdaptor : public detail::MatvecOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MatvecOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: MatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MatvecOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MatvecOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : MatvecOpGenericAdaptor(values, attrs, Properties{}, {}) {} MatvecOpGenericAdaptor(RangeT values, const MatvecOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MatvecOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MatvecOpAdaptor : public MatvecOpGenericAdaptor<::mlir::ValueRange> { public: using MatvecOpGenericAdaptor::MatvecOpGenericAdaptor; MatvecOpAdaptor(MatvecOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MatvecOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MatvecOpAdaptor; template using GenericAdaptor = MatvecOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.matvec"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MatvecOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MatvecOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MatvecOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MatvecOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static MatvecOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static MatvecOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MatvecOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::MatvecOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::MaxOp declarations //===----------------------------------------------------------------------===// namespace detail { class MaxOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: MaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.max", odsAttrs.getContext()); } MaxOpGenericAdaptorBase(MaxOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class MaxOpGenericAdaptor : public detail::MaxOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MaxOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : MaxOpGenericAdaptor(values, attrs, Properties{}, {}) {} MaxOpGenericAdaptor(RangeT values, const MaxOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MaxOpAdaptor : public MaxOpGenericAdaptor<::mlir::ValueRange> { public: using MaxOpGenericAdaptor::MaxOpGenericAdaptor; MaxOpAdaptor(MaxOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MaxOpAdaptor; template using GenericAdaptor = MaxOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.max"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MaxOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static MaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static MaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MaxOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::MaxOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::MinOp declarations //===----------------------------------------------------------------------===// namespace detail { class MinOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: MinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.min", odsAttrs.getContext()); } MinOpGenericAdaptorBase(MinOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class MinOpGenericAdaptor : public detail::MinOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MinOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : MinOpGenericAdaptor(values, attrs, Properties{}, {}) {} MinOpGenericAdaptor(RangeT values, const MinOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MinOpAdaptor : public MinOpGenericAdaptor<::mlir::ValueRange> { public: using MinOpGenericAdaptor::MinOpGenericAdaptor; MinOpAdaptor(MinOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MinOpAdaptor; template using GenericAdaptor = MinOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.min"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MinOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static MinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static MinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MinOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::MinOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::Mmt4DOp declarations //===----------------------------------------------------------------------===// namespace detail { class Mmt4DOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: Mmt4DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.mmt4d", odsAttrs.getContext()); } Mmt4DOpGenericAdaptorBase(Mmt4DOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class Mmt4DOpGenericAdaptor : public detail::Mmt4DOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::Mmt4DOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: Mmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} Mmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : Mmt4DOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} Mmt4DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : Mmt4DOpGenericAdaptor(values, attrs, Properties{}, {}) {} Mmt4DOpGenericAdaptor(RangeT values, const Mmt4DOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> Mmt4DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class Mmt4DOpAdaptor : public Mmt4DOpGenericAdaptor<::mlir::ValueRange> { public: using Mmt4DOpGenericAdaptor::Mmt4DOpGenericAdaptor; Mmt4DOpAdaptor(Mmt4DOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class Mmt4DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = Mmt4DOpAdaptor; template using GenericAdaptor = Mmt4DOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.mmt4d"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Mmt4DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Mmt4DOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Mmt4DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static Mmt4DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Mmt4DOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static Mmt4DOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::Mmt4DOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::Mmt4DOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::MulOp declarations //===----------------------------------------------------------------------===// namespace detail { class MulOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.mul", odsAttrs.getContext()); } MulOpGenericAdaptorBase(MulOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MulOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : MulOpGenericAdaptor(values, attrs, Properties{}, {}) {} MulOpGenericAdaptor(RangeT values, const MulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { public: using MulOpGenericAdaptor::MulOpGenericAdaptor; MulOpAdaptor(MulOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MulOpAdaptor; template using GenericAdaptor = MulOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.mul"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MulOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static MulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static MulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::MulOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::MulOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::NegFOp declarations //===----------------------------------------------------------------------===// namespace detail { class NegFOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: NegFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.negf", odsAttrs.getContext()); } NegFOpGenericAdaptorBase(NegFOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class NegFOpGenericAdaptor : public detail::NegFOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::NegFOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: NegFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} NegFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : NegFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} NegFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : NegFOpGenericAdaptor(values, attrs, Properties{}, {}) {} NegFOpGenericAdaptor(RangeT values, const NegFOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> NegFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class NegFOpAdaptor : public NegFOpGenericAdaptor<::mlir::ValueRange> { public: using NegFOpGenericAdaptor::NegFOpGenericAdaptor; NegFOpAdaptor(NegFOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class NegFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = NegFOpAdaptor; template using GenericAdaptor = NegFOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.negf"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static NegFOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static NegFOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static NegFOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static NegFOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static NegFOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static NegFOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::NegFOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::NegFOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNchwMaxOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNchwMaxOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNchwMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nchw_max", odsAttrs.getContext()); } PoolingNchwMaxOpGenericAdaptorBase(PoolingNchwMaxOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNchwMaxOpGenericAdaptor : public detail::PoolingNchwMaxOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNchwMaxOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNchwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNchwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNchwMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNchwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNchwMaxOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNchwMaxOpGenericAdaptor(RangeT values, const PoolingNchwMaxOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNchwMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNchwMaxOpAdaptor : public PoolingNchwMaxOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNchwMaxOpGenericAdaptor::PoolingNchwMaxOpGenericAdaptor; PoolingNchwMaxOpAdaptor(PoolingNchwMaxOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNchwMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNchwMaxOpAdaptor; template using GenericAdaptor = PoolingNchwMaxOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nchw_max"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNchwMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNchwMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNchwMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNchwMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNchwMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNchwMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNchwMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNchwMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNchwMaxOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNchwMaxOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNchwSumOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNchwSumOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNchwSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nchw_sum", odsAttrs.getContext()); } PoolingNchwSumOpGenericAdaptorBase(PoolingNchwSumOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNchwSumOpGenericAdaptor : public detail::PoolingNchwSumOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNchwSumOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNchwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNchwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNchwSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNchwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNchwSumOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNchwSumOpGenericAdaptor(RangeT values, const PoolingNchwSumOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNchwSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNchwSumOpAdaptor : public PoolingNchwSumOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNchwSumOpGenericAdaptor::PoolingNchwSumOpGenericAdaptor; PoolingNchwSumOpAdaptor(PoolingNchwSumOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNchwSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNchwSumOpAdaptor; template using GenericAdaptor = PoolingNchwSumOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nchw_sum"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNchwSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNchwSumOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNchwSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNchwSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNchwSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNchwSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNchwSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNchwSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNchwSumOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNchwSumOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNcwMaxOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNcwMaxOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNcwMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_ncw_max", odsAttrs.getContext()); } PoolingNcwMaxOpGenericAdaptorBase(PoolingNcwMaxOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNcwMaxOpGenericAdaptor : public detail::PoolingNcwMaxOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNcwMaxOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNcwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNcwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNcwMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNcwMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNcwMaxOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNcwMaxOpGenericAdaptor(RangeT values, const PoolingNcwMaxOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNcwMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNcwMaxOpAdaptor : public PoolingNcwMaxOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNcwMaxOpGenericAdaptor::PoolingNcwMaxOpGenericAdaptor; PoolingNcwMaxOpAdaptor(PoolingNcwMaxOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNcwMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNcwMaxOpAdaptor; template using GenericAdaptor = PoolingNcwMaxOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_ncw_max"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNcwMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNcwMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNcwMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNcwMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNcwMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNcwMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNcwMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNcwMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNcwMaxOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNcwMaxOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNcwSumOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNcwSumOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNcwSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_ncw_sum", odsAttrs.getContext()); } PoolingNcwSumOpGenericAdaptorBase(PoolingNcwSumOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNcwSumOpGenericAdaptor : public detail::PoolingNcwSumOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNcwSumOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNcwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNcwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNcwSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNcwSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNcwSumOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNcwSumOpGenericAdaptor(RangeT values, const PoolingNcwSumOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNcwSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNcwSumOpAdaptor : public PoolingNcwSumOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNcwSumOpGenericAdaptor::PoolingNcwSumOpGenericAdaptor; PoolingNcwSumOpAdaptor(PoolingNcwSumOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNcwSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNcwSumOpAdaptor; template using GenericAdaptor = PoolingNcwSumOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_ncw_sum"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNcwSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNcwSumOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNcwSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNcwSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNcwSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNcwSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNcwSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNcwSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNcwSumOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNcwSumOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNdhwcMaxOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNdhwcMaxOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNdhwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_ndhwc_max", odsAttrs.getContext()); } PoolingNdhwcMaxOpGenericAdaptorBase(PoolingNdhwcMaxOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNdhwcMaxOpGenericAdaptor : public detail::PoolingNdhwcMaxOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNdhwcMaxOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNdhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNdhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNdhwcMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNdhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNdhwcMaxOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNdhwcMaxOpGenericAdaptor(RangeT values, const PoolingNdhwcMaxOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNdhwcMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNdhwcMaxOpAdaptor : public PoolingNdhwcMaxOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNdhwcMaxOpGenericAdaptor::PoolingNdhwcMaxOpGenericAdaptor; PoolingNdhwcMaxOpAdaptor(PoolingNdhwcMaxOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNdhwcMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNdhwcMaxOpAdaptor; template using GenericAdaptor = PoolingNdhwcMaxOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_ndhwc_max"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNdhwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNdhwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNdhwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNdhwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcMaxOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNdhwcMaxOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNdhwcMinOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNdhwcMinOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNdhwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_ndhwc_min", odsAttrs.getContext()); } PoolingNdhwcMinOpGenericAdaptorBase(PoolingNdhwcMinOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNdhwcMinOpGenericAdaptor : public detail::PoolingNdhwcMinOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNdhwcMinOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNdhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNdhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNdhwcMinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNdhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNdhwcMinOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNdhwcMinOpGenericAdaptor(RangeT values, const PoolingNdhwcMinOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNdhwcMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNdhwcMinOpAdaptor : public PoolingNdhwcMinOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNdhwcMinOpGenericAdaptor::PoolingNdhwcMinOpGenericAdaptor; PoolingNdhwcMinOpAdaptor(PoolingNdhwcMinOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNdhwcMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNdhwcMinOpAdaptor; template using GenericAdaptor = PoolingNdhwcMinOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_ndhwc_min"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNdhwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNdhwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNdhwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNdhwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcMinOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNdhwcMinOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNdhwcSumOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNdhwcSumOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNdhwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_ndhwc_sum", odsAttrs.getContext()); } PoolingNdhwcSumOpGenericAdaptorBase(PoolingNdhwcSumOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNdhwcSumOpGenericAdaptor : public detail::PoolingNdhwcSumOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNdhwcSumOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNdhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNdhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNdhwcSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNdhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNdhwcSumOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNdhwcSumOpGenericAdaptor(RangeT values, const PoolingNdhwcSumOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNdhwcSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNdhwcSumOpAdaptor : public PoolingNdhwcSumOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNdhwcSumOpGenericAdaptor::PoolingNdhwcSumOpGenericAdaptor; PoolingNdhwcSumOpAdaptor(PoolingNdhwcSumOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNdhwcSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNdhwcSumOpAdaptor; template using GenericAdaptor = PoolingNdhwcSumOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_ndhwc_sum"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNdhwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNdhwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNdhwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNdhwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNdhwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNdhwcSumOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNdhwcSumOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNhwcMaxOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNhwcMaxOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNhwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nhwc_max", odsAttrs.getContext()); } PoolingNhwcMaxOpGenericAdaptorBase(PoolingNhwcMaxOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNhwcMaxOpGenericAdaptor : public detail::PoolingNhwcMaxOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNhwcMaxOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNhwcMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNhwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNhwcMaxOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNhwcMaxOpGenericAdaptor(RangeT values, const PoolingNhwcMaxOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNhwcMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNhwcMaxOpAdaptor : public PoolingNhwcMaxOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNhwcMaxOpGenericAdaptor::PoolingNhwcMaxOpGenericAdaptor; PoolingNhwcMaxOpAdaptor(PoolingNhwcMaxOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNhwcMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNhwcMaxOpAdaptor; template using GenericAdaptor = PoolingNhwcMaxOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nhwc_max"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMaxOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNhwcMaxOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNhwcMaxUnsignedOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNhwcMaxUnsignedOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNhwcMaxUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nhwc_max_unsigned", odsAttrs.getContext()); } PoolingNhwcMaxUnsignedOpGenericAdaptorBase(PoolingNhwcMaxUnsignedOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNhwcMaxUnsignedOpGenericAdaptor : public detail::PoolingNhwcMaxUnsignedOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNhwcMaxUnsignedOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNhwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNhwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNhwcMaxUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNhwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNhwcMaxUnsignedOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNhwcMaxUnsignedOpGenericAdaptor(RangeT values, const PoolingNhwcMaxUnsignedOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNhwcMaxUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNhwcMaxUnsignedOpAdaptor : public PoolingNhwcMaxUnsignedOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNhwcMaxUnsignedOpGenericAdaptor::PoolingNhwcMaxUnsignedOpGenericAdaptor; PoolingNhwcMaxUnsignedOpAdaptor(PoolingNhwcMaxUnsignedOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNhwcMaxUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNhwcMaxUnsignedOpAdaptor; template using GenericAdaptor = PoolingNhwcMaxUnsignedOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nhwc_max_unsigned"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMaxUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMaxUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMaxUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMaxUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcMaxUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcMaxUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcMaxUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcMaxUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMaxUnsignedOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNhwcMaxUnsignedOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNhwcMinOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNhwcMinOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNhwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nhwc_min", odsAttrs.getContext()); } PoolingNhwcMinOpGenericAdaptorBase(PoolingNhwcMinOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNhwcMinOpGenericAdaptor : public detail::PoolingNhwcMinOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNhwcMinOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNhwcMinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNhwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNhwcMinOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNhwcMinOpGenericAdaptor(RangeT values, const PoolingNhwcMinOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNhwcMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNhwcMinOpAdaptor : public PoolingNhwcMinOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNhwcMinOpGenericAdaptor::PoolingNhwcMinOpGenericAdaptor; PoolingNhwcMinOpAdaptor(PoolingNhwcMinOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNhwcMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNhwcMinOpAdaptor; template using GenericAdaptor = PoolingNhwcMinOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nhwc_min"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMinOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNhwcMinOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNhwcMinUnsignedOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNhwcMinUnsignedOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNhwcMinUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nhwc_min_unsigned", odsAttrs.getContext()); } PoolingNhwcMinUnsignedOpGenericAdaptorBase(PoolingNhwcMinUnsignedOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNhwcMinUnsignedOpGenericAdaptor : public detail::PoolingNhwcMinUnsignedOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNhwcMinUnsignedOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNhwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNhwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNhwcMinUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNhwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNhwcMinUnsignedOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNhwcMinUnsignedOpGenericAdaptor(RangeT values, const PoolingNhwcMinUnsignedOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNhwcMinUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNhwcMinUnsignedOpAdaptor : public PoolingNhwcMinUnsignedOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNhwcMinUnsignedOpGenericAdaptor::PoolingNhwcMinUnsignedOpGenericAdaptor; PoolingNhwcMinUnsignedOpAdaptor(PoolingNhwcMinUnsignedOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNhwcMinUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNhwcMinUnsignedOpAdaptor; template using GenericAdaptor = PoolingNhwcMinUnsignedOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nhwc_min_unsigned"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMinUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMinUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMinUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcMinUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcMinUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcMinUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcMinUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcMinUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcMinUnsignedOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNhwcMinUnsignedOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNhwcSumOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNhwcSumOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNhwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nhwc_sum", odsAttrs.getContext()); } PoolingNhwcSumOpGenericAdaptorBase(PoolingNhwcSumOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNhwcSumOpGenericAdaptor : public detail::PoolingNhwcSumOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNhwcSumOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNhwcSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNhwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNhwcSumOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNhwcSumOpGenericAdaptor(RangeT values, const PoolingNhwcSumOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNhwcSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNhwcSumOpAdaptor : public PoolingNhwcSumOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNhwcSumOpGenericAdaptor::PoolingNhwcSumOpGenericAdaptor; PoolingNhwcSumOpAdaptor(PoolingNhwcSumOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNhwcSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNhwcSumOpAdaptor; template using GenericAdaptor = PoolingNhwcSumOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nhwc_sum"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNhwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNhwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNhwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNhwcSumOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNhwcSumOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNwcMaxOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNwcMaxOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNwcMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nwc_max", odsAttrs.getContext()); } PoolingNwcMaxOpGenericAdaptorBase(PoolingNwcMaxOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNwcMaxOpGenericAdaptor : public detail::PoolingNwcMaxOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNwcMaxOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNwcMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNwcMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNwcMaxOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNwcMaxOpGenericAdaptor(RangeT values, const PoolingNwcMaxOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNwcMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNwcMaxOpAdaptor : public PoolingNwcMaxOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNwcMaxOpGenericAdaptor::PoolingNwcMaxOpGenericAdaptor; PoolingNwcMaxOpAdaptor(PoolingNwcMaxOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNwcMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNwcMaxOpAdaptor; template using GenericAdaptor = PoolingNwcMaxOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nwc_max"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcMaxOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcMaxOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMaxOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNwcMaxOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNwcMaxUnsignedOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNwcMaxUnsignedOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNwcMaxUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nwc_max_unsigned", odsAttrs.getContext()); } PoolingNwcMaxUnsignedOpGenericAdaptorBase(PoolingNwcMaxUnsignedOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNwcMaxUnsignedOpGenericAdaptor : public detail::PoolingNwcMaxUnsignedOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNwcMaxUnsignedOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNwcMaxUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNwcMaxUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNwcMaxUnsignedOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNwcMaxUnsignedOpGenericAdaptor(RangeT values, const PoolingNwcMaxUnsignedOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNwcMaxUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNwcMaxUnsignedOpAdaptor : public PoolingNwcMaxUnsignedOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNwcMaxUnsignedOpGenericAdaptor::PoolingNwcMaxUnsignedOpGenericAdaptor; PoolingNwcMaxUnsignedOpAdaptor(PoolingNwcMaxUnsignedOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNwcMaxUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNwcMaxUnsignedOpAdaptor; template using GenericAdaptor = PoolingNwcMaxUnsignedOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nwc_max_unsigned"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMaxUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMaxUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMaxUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMaxUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcMaxUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcMaxUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcMaxUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcMaxUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMaxUnsignedOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNwcMaxUnsignedOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNwcMinOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNwcMinOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNwcMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nwc_min", odsAttrs.getContext()); } PoolingNwcMinOpGenericAdaptorBase(PoolingNwcMinOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNwcMinOpGenericAdaptor : public detail::PoolingNwcMinOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNwcMinOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNwcMinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNwcMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNwcMinOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNwcMinOpGenericAdaptor(RangeT values, const PoolingNwcMinOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNwcMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNwcMinOpAdaptor : public PoolingNwcMinOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNwcMinOpGenericAdaptor::PoolingNwcMinOpGenericAdaptor; PoolingNwcMinOpAdaptor(PoolingNwcMinOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNwcMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNwcMinOpAdaptor; template using GenericAdaptor = PoolingNwcMinOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nwc_min"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcMinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcMinOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMinOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNwcMinOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNwcMinUnsignedOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNwcMinUnsignedOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNwcMinUnsignedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nwc_min_unsigned", odsAttrs.getContext()); } PoolingNwcMinUnsignedOpGenericAdaptorBase(PoolingNwcMinUnsignedOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNwcMinUnsignedOpGenericAdaptor : public detail::PoolingNwcMinUnsignedOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNwcMinUnsignedOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNwcMinUnsignedOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNwcMinUnsignedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNwcMinUnsignedOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNwcMinUnsignedOpGenericAdaptor(RangeT values, const PoolingNwcMinUnsignedOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNwcMinUnsignedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNwcMinUnsignedOpAdaptor : public PoolingNwcMinUnsignedOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNwcMinUnsignedOpGenericAdaptor::PoolingNwcMinUnsignedOpGenericAdaptor; PoolingNwcMinUnsignedOpAdaptor(PoolingNwcMinUnsignedOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNwcMinUnsignedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNwcMinUnsignedOpAdaptor; template using GenericAdaptor = PoolingNwcMinUnsignedOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nwc_min_unsigned"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMinUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMinUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMinUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcMinUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcMinUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcMinUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcMinUnsignedOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcMinUnsignedOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcMinUnsignedOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNwcMinUnsignedOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PoolingNwcSumOp declarations //===----------------------------------------------------------------------===// namespace detail { class PoolingNwcSumOpGenericAdaptorBase { public: struct Properties { using dilationsTy = ::mlir::DenseIntElementsAttr; dilationsTy dilations; auto getDilations() const { auto &propStorage = this->dilations; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setDilations(const ::mlir::DenseIntElementsAttr &propValue) { this->dilations = propValue; } using stridesTy = ::mlir::DenseIntElementsAttr; stridesTy strides; auto getStrides() const { auto &propStorage = this->strides; return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(propStorage); } void setStrides(const ::mlir::DenseIntElementsAttr &propValue) { this->strides = propValue; } using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.dilations == this->dilations && rhs.strides == this->strides && rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PoolingNwcSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.pooling_nwc_sum", odsAttrs.getContext()); } PoolingNwcSumOpGenericAdaptorBase(PoolingNwcSumOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseIntElementsAttr getStridesAttr(); ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr(); ::mlir::DenseIntElementsAttr getDilations(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PoolingNwcSumOpGenericAdaptor : public detail::PoolingNwcSumOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PoolingNwcSumOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PoolingNwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PoolingNwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PoolingNwcSumOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PoolingNwcSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PoolingNwcSumOpGenericAdaptor(values, attrs, Properties{}, {}) {} PoolingNwcSumOpGenericAdaptor(RangeT values, const PoolingNwcSumOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PoolingNwcSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PoolingNwcSumOpAdaptor : public PoolingNwcSumOpGenericAdaptor<::mlir::ValueRange> { public: using PoolingNwcSumOpGenericAdaptor::PoolingNwcSumOpGenericAdaptor; PoolingNwcSumOpAdaptor(PoolingNwcSumOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PoolingNwcSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ConvolutionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PoolingNwcSumOpAdaptor; template using GenericAdaptor = PoolingNwcSumOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dilations"), ::llvm::StringRef("strides"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDilationsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getStridesAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.pooling_nwc_sum"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseIntElementsAttr getStridesAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().strides); } ::mlir::DenseIntElementsAttr getStrides(); ::mlir::DenseIntElementsAttr getDilationsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseIntElementsAttr>(getProperties().dilations); } ::mlir::DenseIntElementsAttr getDilations(); void setStridesAttr(::mlir::DenseIntElementsAttr attr) { getProperties().strides = attr; } void setDilationsAttr(::mlir::DenseIntElementsAttr attr) { getProperties().dilations = attr; } ::mlir::Attribute removeStridesAttr() { auto attr = getProperties().strides; getProperties().strides = {}; return attr; } ::mlir::Attribute removeDilationsAttr() { auto attr = getProperties().dilations; getProperties().dilations = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PoolingNwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PoolingNwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcSumOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static PoolingNwcSumOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, Attribute strides, Attribute dilations, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); bool hasDynamicIndexingMaps(); LogicalResult verifyIndexingMapRequiredAttributes(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PoolingNwcSumOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PoolingNwcSumOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::PowFOp declarations //===----------------------------------------------------------------------===// namespace detail { class PowFOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PowFOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.powf", odsAttrs.getContext()); } PowFOpGenericAdaptorBase(PowFOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PowFOpGenericAdaptor : public detail::PowFOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PowFOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: PowFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PowFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PowFOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PowFOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PowFOpGenericAdaptor(values, attrs, Properties{}, {}) {} PowFOpGenericAdaptor(RangeT values, const PowFOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PowFOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PowFOpAdaptor : public PowFOpGenericAdaptor<::mlir::ValueRange> { public: using PowFOpGenericAdaptor::PowFOpGenericAdaptor; PowFOpAdaptor(PowFOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PowFOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PowFOpAdaptor; template using GenericAdaptor = PowFOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.powf"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PowFOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PowFOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PowFOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static PowFOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PowFOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static PowFOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::PowFOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::PowFOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::QuantizedBatchMatmulOp declarations //===----------------------------------------------------------------------===// namespace detail { class QuantizedBatchMatmulOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: QuantizedBatchMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.quantized_batch_matmul", odsAttrs.getContext()); } QuantizedBatchMatmulOpGenericAdaptorBase(QuantizedBatchMatmulOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class QuantizedBatchMatmulOpGenericAdaptor : public detail::QuantizedBatchMatmulOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::QuantizedBatchMatmulOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: QuantizedBatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} QuantizedBatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : QuantizedBatchMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} QuantizedBatchMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : QuantizedBatchMatmulOpGenericAdaptor(values, attrs, Properties{}, {}) {} QuantizedBatchMatmulOpGenericAdaptor(RangeT values, const QuantizedBatchMatmulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> QuantizedBatchMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class QuantizedBatchMatmulOpAdaptor : public QuantizedBatchMatmulOpGenericAdaptor<::mlir::ValueRange> { public: using QuantizedBatchMatmulOpGenericAdaptor::QuantizedBatchMatmulOpGenericAdaptor; QuantizedBatchMatmulOpAdaptor(QuantizedBatchMatmulOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class QuantizedBatchMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = QuantizedBatchMatmulOpAdaptor; template using GenericAdaptor = QuantizedBatchMatmulOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.quantized_batch_matmul"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static QuantizedBatchMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static QuantizedBatchMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static QuantizedBatchMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static QuantizedBatchMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static QuantizedBatchMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static QuantizedBatchMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::QuantizedBatchMatmulOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::QuantizedBatchMatmulOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::QuantizedMatmulOp declarations //===----------------------------------------------------------------------===// namespace detail { class QuantizedMatmulOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: QuantizedMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.quantized_matmul", odsAttrs.getContext()); } QuantizedMatmulOpGenericAdaptorBase(QuantizedMatmulOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class QuantizedMatmulOpGenericAdaptor : public detail::QuantizedMatmulOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::QuantizedMatmulOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: QuantizedMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} QuantizedMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : QuantizedMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} QuantizedMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : QuantizedMatmulOpGenericAdaptor(values, attrs, Properties{}, {}) {} QuantizedMatmulOpGenericAdaptor(RangeT values, const QuantizedMatmulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> QuantizedMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class QuantizedMatmulOpAdaptor : public QuantizedMatmulOpGenericAdaptor<::mlir::ValueRange> { public: using QuantizedMatmulOpGenericAdaptor::QuantizedMatmulOpGenericAdaptor; QuantizedMatmulOpAdaptor(QuantizedMatmulOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class QuantizedMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = QuantizedMatmulOpAdaptor; template using GenericAdaptor = QuantizedMatmulOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.quantized_matmul"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static QuantizedMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static QuantizedMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static QuantizedMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static QuantizedMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static QuantizedMatmulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static QuantizedMatmulOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::QuantizedMatmulOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::QuantizedMatmulOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::ReciprocalOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReciprocalOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ReciprocalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.reciprocal", odsAttrs.getContext()); } ReciprocalOpGenericAdaptorBase(ReciprocalOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ReciprocalOpGenericAdaptor : public detail::ReciprocalOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReciprocalOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReciprocalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ReciprocalOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReciprocalOpGenericAdaptor(RangeT values, const ReciprocalOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReciprocalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReciprocalOpAdaptor : public ReciprocalOpGenericAdaptor<::mlir::ValueRange> { public: using ReciprocalOpGenericAdaptor::ReciprocalOpGenericAdaptor; ReciprocalOpAdaptor(ReciprocalOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReciprocalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ReciprocalOpAdaptor; template using GenericAdaptor = ReciprocalOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.reciprocal"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ReciprocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ReciprocalOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ReciprocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static ReciprocalOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ReciprocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ReciprocalOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ReciprocalOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::ReciprocalOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::ReduceOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReduceOpGenericAdaptorBase { public: struct Properties { using dimensionsTy = ::mlir::DenseI64ArrayAttr; dimensionsTy dimensions; auto getDimensions() const { auto &propStorage = this->dimensions; return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); } void setDimensions(const ::mlir::DenseI64ArrayAttr &propValue) { this->dimensions = propValue; } bool operator==(const Properties &rhs) const { return rhs.dimensions == this->dimensions && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.reduce", odsAttrs.getContext()); } ReduceOpGenericAdaptorBase(ReduceOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseI64ArrayAttr getDimensionsAttr() { auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().dimensions); return attr; } ::llvm::ArrayRef getDimensions(); ::mlir::Region &getCombiner() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ReduceOpGenericAdaptor : public detail::ReduceOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReduceOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_inits = 1; public: ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReduceOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReduceOpGenericAdaptor(RangeT values, const ReduceOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getInits() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReduceOpAdaptor : public ReduceOpGenericAdaptor<::mlir::ValueRange> { public: using ReduceOpGenericAdaptor::ReduceOpGenericAdaptor; ReduceOpAdaptor(ReduceOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ReduceOpAdaptor; template using GenericAdaptor = ReduceOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_inits = 1; using Properties = FoldAdaptor::Properties; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockArgumentNames; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockNames; using ::mlir::OpAsmOpInterface::Trait::getDefaultDialect; using ::mlir::OpAsmOpInterface::Trait::getAsmResultNames; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDimensionsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.reduce"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getInits() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getInitsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Region &getCombiner() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseI64ArrayAttr getDimensionsAttr() { return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().dimensions); } ::llvm::ArrayRef getDimensions(); void setDimensionsAttr(::mlir::DenseI64ArrayAttr attr) { getProperties().dimensions = attr; } void setDimensions(::llvm::ArrayRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange inits, ArrayRef dimensions, function_ref odsArg3, ArrayRef attributes = {}); static ReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange inits, ArrayRef dimensions, function_ref odsArg3, ArrayRef attributes = {}); static ReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange inits, ArrayRef dimensions, function_ref odsArg3, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::mlir::DenseI64ArrayAttr dimensions); static ReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::mlir::DenseI64ArrayAttr dimensions); static ReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::mlir::DenseI64ArrayAttr dimensions); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::llvm::ArrayRef dimensions); static ReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::llvm::ArrayRef dimensions); static ReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, ::llvm::ArrayRef dimensions); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReduceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReduceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); void getAsmBlockArgumentNames(::mlir::Region®ion, ::mlir::OpAsmSetValueNameFn setNameFn); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Declare functions necessary for LinalgStructuredInterface. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); std::string getLibraryCallName() { return "op_has_no_registered_library_name"; } // Implement functions necessary for DestinationStyleOpInterface. static std::function, function_ref)> getRegionBuilder() { return nullptr; } MutableOperandRange getDpsInitsMutable() { return getInitsMutable(); } }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::ReduceOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::ReduceOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::RoundOp declarations //===----------------------------------------------------------------------===// namespace detail { class RoundOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.round", odsAttrs.getContext()); } RoundOpGenericAdaptorBase(RoundOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class RoundOpGenericAdaptor : public detail::RoundOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::RoundOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RoundOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : RoundOpGenericAdaptor(values, attrs, Properties{}, {}) {} RoundOpGenericAdaptor(RangeT values, const RoundOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> RoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class RoundOpAdaptor : public RoundOpGenericAdaptor<::mlir::ValueRange> { public: using RoundOpGenericAdaptor::RoundOpGenericAdaptor; RoundOpAdaptor(RoundOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class RoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = RoundOpAdaptor; template using GenericAdaptor = RoundOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.round"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static RoundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static RoundOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static RoundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static RoundOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static RoundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static RoundOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::RoundOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::RoundOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::RsqrtOp declarations //===----------------------------------------------------------------------===// namespace detail { class RsqrtOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.rsqrt", odsAttrs.getContext()); } RsqrtOpGenericAdaptorBase(RsqrtOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class RsqrtOpGenericAdaptor : public detail::RsqrtOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::RsqrtOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RsqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : RsqrtOpGenericAdaptor(values, attrs, Properties{}, {}) {} RsqrtOpGenericAdaptor(RangeT values, const RsqrtOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> RsqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class RsqrtOpAdaptor : public RsqrtOpGenericAdaptor<::mlir::ValueRange> { public: using RsqrtOpGenericAdaptor::RsqrtOpGenericAdaptor; RsqrtOpAdaptor(RsqrtOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class RsqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = RsqrtOpAdaptor; template using GenericAdaptor = RsqrtOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.rsqrt"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static RsqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static RsqrtOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static RsqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static RsqrtOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static RsqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static RsqrtOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::RsqrtOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::RsqrtOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::SelectOp declarations //===----------------------------------------------------------------------===// namespace detail { class SelectOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.select", odsAttrs.getContext()); } SelectOpGenericAdaptorBase(SelectOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class SelectOpGenericAdaptor : public detail::SelectOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SelectOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SelectOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : SelectOpGenericAdaptor(values, attrs, Properties{}, {}) {} SelectOpGenericAdaptor(RangeT values, const SelectOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SelectOpAdaptor : public SelectOpGenericAdaptor<::mlir::ValueRange> { public: using SelectOpGenericAdaptor::SelectOpGenericAdaptor; SelectOpAdaptor(SelectOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SelectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = SelectOpAdaptor; template using GenericAdaptor = SelectOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.select"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SelectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SelectOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SelectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SelectOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static SelectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static SelectOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::SelectOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::SelectOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::SqrtOp declarations //===----------------------------------------------------------------------===// namespace detail { class SqrtOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.sqrt", odsAttrs.getContext()); } SqrtOpGenericAdaptorBase(SqrtOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class SqrtOpGenericAdaptor : public detail::SqrtOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SqrtOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : SqrtOpGenericAdaptor(values, attrs, Properties{}, {}) {} SqrtOpGenericAdaptor(RangeT values, const SqrtOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SqrtOpAdaptor : public SqrtOpGenericAdaptor<::mlir::ValueRange> { public: using SqrtOpGenericAdaptor::SqrtOpGenericAdaptor; SqrtOpAdaptor(SqrtOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = SqrtOpAdaptor; template using GenericAdaptor = SqrtOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.sqrt"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SqrtOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SqrtOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static SqrtOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static SqrtOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::SqrtOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::SqrtOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::SquareOp declarations //===----------------------------------------------------------------------===// namespace detail { class SquareOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: SquareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.square", odsAttrs.getContext()); } SquareOpGenericAdaptorBase(SquareOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class SquareOpGenericAdaptor : public detail::SquareOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SquareOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: SquareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SquareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SquareOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SquareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : SquareOpGenericAdaptor(values, attrs, Properties{}, {}) {} SquareOpGenericAdaptor(RangeT values, const SquareOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SquareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SquareOpAdaptor : public SquareOpGenericAdaptor<::mlir::ValueRange> { public: using SquareOpGenericAdaptor::SquareOpGenericAdaptor; SquareOpAdaptor(SquareOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SquareOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = SquareOpAdaptor; template using GenericAdaptor = SquareOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.square"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SquareOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SquareOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SquareOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SquareOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static SquareOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static SquareOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::SquareOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::SquareOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::SubOp declarations //===----------------------------------------------------------------------===// namespace detail { class SubOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.sub", odsAttrs.getContext()); } SubOpGenericAdaptorBase(SubOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SubOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : SubOpGenericAdaptor(values, attrs, Properties{}, {}) {} SubOpGenericAdaptor(RangeT values, const SubOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> { public: using SubOpGenericAdaptor::SubOpGenericAdaptor; SubOpAdaptor(SubOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = SubOpAdaptor; template using GenericAdaptor = SubOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.sub"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SubOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static SubOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static SubOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::SubOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::SubOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::TanhOp declarations //===----------------------------------------------------------------------===// namespace detail { class TanhOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.tanh", odsAttrs.getContext()); } TanhOpGenericAdaptorBase(TanhOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class TanhOpGenericAdaptor : public detail::TanhOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::TanhOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TanhOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : TanhOpGenericAdaptor(values, attrs, Properties{}, {}) {} TanhOpGenericAdaptor(RangeT values, const TanhOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> TanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class TanhOpAdaptor : public TanhOpGenericAdaptor<::mlir::ValueRange> { public: using TanhOpGenericAdaptor::TanhOpGenericAdaptor; TanhOpAdaptor(TanhOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class TanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = TanhOpAdaptor; template using GenericAdaptor = TanhOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.tanh"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static TanhOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static TanhOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static TanhOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static TanhOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static TanhOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static TanhOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::TanhOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::TanhOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::TransposeOp declarations //===----------------------------------------------------------------------===// namespace detail { class TransposeOpGenericAdaptorBase { public: struct Properties { using permutationTy = ::mlir::DenseI64ArrayAttr; permutationTy permutation; auto getPermutation() const { auto &propStorage = this->permutation; return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); } void setPermutation(const ::mlir::DenseI64ArrayAttr &propValue) { this->permutation = propValue; } bool operator==(const Properties &rhs) const { return rhs.permutation == this->permutation && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.transpose", odsAttrs.getContext()); } TransposeOpGenericAdaptorBase(TransposeOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseI64ArrayAttr getPermutationAttr() { auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().permutation); return attr; } ::llvm::ArrayRef getPermutation(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class TransposeOpGenericAdaptor : public detail::TransposeOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::TransposeOpGenericAdaptorBase; static constexpr int odsIndex_input = 0; static constexpr int odsIndex_init = 1; public: TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : TransposeOpGenericAdaptor(values, attrs, Properties{}, {}) {} TransposeOpGenericAdaptor(RangeT values, const TransposeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> TransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } ValueT getInput() { return (*getODSOperands(0).begin()); } ValueT getInit() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class TransposeOpAdaptor : public TransposeOpGenericAdaptor<::mlir::ValueRange> { public: using TransposeOpGenericAdaptor::TransposeOpGenericAdaptor; TransposeOpAdaptor(TransposeOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class TransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = TransposeOpAdaptor; template using GenericAdaptor = TransposeOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_input = 0; static constexpr int odsIndex_init = 1; using Properties = FoldAdaptor::Properties; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockArgumentNames; using ::mlir::OpAsmOpInterface::Trait::getAsmBlockNames; using ::mlir::OpAsmOpInterface::Trait::getDefaultDialect; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("permutation")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getPermutationAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getPermutationAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.transpose"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::ShapedType> getInput() { return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::ShapedType> getInit() { return ::llvm::cast<::mlir::TypedValue<::mlir::ShapedType>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getInputMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getInitMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResult() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::DenseI64ArrayAttr getPermutationAttr() { return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().permutation); } ::llvm::ArrayRef getPermutation(); void setPermutationAttr(::mlir::DenseI64ArrayAttr attr) { getProperties().permutation = attr; } void setPermutation(::llvm::ArrayRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value init, DenseI64ArrayAttr permutation, ArrayRef attributes = {}); static TransposeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value input, Value init, DenseI64ArrayAttr permutation, ArrayRef attributes = {}); static TransposeOp create(::mlir::ImplicitLocOpBuilder &builder, Value input, Value init, DenseI64ArrayAttr permutation, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value init, ArrayRef permutation, ArrayRef attributes = {}); static TransposeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value input, Value init, ArrayRef permutation, ArrayRef attributes = {}); static TransposeOp create(::mlir::ImplicitLocOpBuilder &builder, Value input, Value init, ArrayRef permutation, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Declare functions necessary for LinalgStructuredInterface. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); std::string getLibraryCallName() { return "op_has_no_registered_library_name"; } // Implement functions necessary for DestinationStyleOpInterface. MutableOperandRange getDpsInitsMutable() { return getInitMutable(); } static void regionBuilder(mlir::ImplicitLocOpBuilder &b, mlir::Block &block, mlir::ArrayRef, function_ref emitError) { OpBuilder::InsertionGuard guard(b); linalg::YieldOp::create(b, b.getLoc(), block.getArgument(0)); } static std::function, function_ref)> getRegionBuilder() { return regionBuilder; } }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::TransposeOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::TransposeOpGenericAdaptorBase::Properties) namespace mlir::linalg { //===----------------------------------------------------------------------===// // ::mlir::linalg::VecmatOp declarations //===----------------------------------------------------------------------===// namespace detail { class VecmatOpGenericAdaptorBase { public: struct Properties { using operandSegmentSizesTy = std::array; operandSegmentSizesTy operandSegmentSizes; ::llvm::ArrayRef getOperandSegmentSizes() const { auto &propStorage = this->operandSegmentSizes; return propStorage; } void setOperandSegmentSizes(::llvm::ArrayRef propValue) { auto &propStorage = this->operandSegmentSizes; ::llvm::copy(propValue, propStorage.begin()); } bool operator==(const Properties &rhs) const { return rhs.operandSegmentSizes == this->operandSegmentSizes && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: VecmatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("linalg.vecmat", odsAttrs.getContext()); } VecmatOpGenericAdaptorBase(VecmatOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class VecmatOpGenericAdaptor : public detail::VecmatOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::VecmatOpGenericAdaptorBase; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; public: VecmatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} VecmatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : VecmatOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} VecmatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : VecmatOpGenericAdaptor(values, attrs, Properties{}, {}) {} VecmatOpGenericAdaptor(RangeT values, const VecmatOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> VecmatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getInputs() { return getODSOperands(0); } RangeT getOutputs() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class VecmatOpAdaptor : public VecmatOpGenericAdaptor<::mlir::ValueRange> { public: using VecmatOpGenericAdaptor::VecmatOpGenericAdaptor; VecmatOpAdaptor(VecmatOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class VecmatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::IndexingMapOpInterface::Trait, ::mlir::linalg::LinalgOp::Trait, ::mlir::ReifyRankedShapedTypeOpInterface::Trait, ::mlir::linalg::ContractionOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = VecmatOpAdaptor; template using GenericAdaptor = VecmatOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_inputs = 0; static constexpr int odsIndex_outputs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getOperandSegmentSizesAttrName() { return (*this)->getName().getAttributeNames().back(); } static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { return name.getAttributeNames().back(); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("linalg.vecmat"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getInputs() { return getODSOperands(0); } ::mlir::Operation::operand_range getOutputs() { return getODSOperands(1); } ::mlir::MutableOperandRange getInputsMutable(); ::mlir::MutableOperandRange getOutputsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::result_range getResultTensors() { return getODSResults(0); } ::mlir::Region &getRegion() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static VecmatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static VecmatOp create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static VecmatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static VecmatOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static VecmatOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static VecmatOp create(::mlir::ImplicitLocOpBuilder &builder, TypeRange resultTensorTypes, ValueRange operands, ArrayRef attributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); ::mlir::Speculation::Speculatability getSpeculatability(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: // Return whether the op accesses the iteration indices. bool hasIndexSemantics() { return !this->getBody()->getOps().empty(); } LogicalResult reifyResultShapes(OpBuilder &b, ReifiedRankedShapedTypeDims &reifiedReturnShapes) { return llvm::cast(getOperation()).reifyResultShapes(b, reifiedReturnShapes); } // Auto-generated. SmallVector getIteratorTypesArray(); ArrayAttr getIndexingMaps(); static void regionBuilder(ImplicitLocOpBuilder &b, Block &block, ArrayRef attrs, function_ref emitError); static std::function, function_ref emitError)> getRegionBuilder() { return regionBuilder; } ::mlir::MutableOperandRange getDpsInitsMutable() { return getOutputsMutable(); } // Generic methods. static unsigned getNumRegionArgs(); std::string getLibraryCallName(); }; } // namespace mlir::linalg MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::VecmatOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::linalg::detail::VecmatOpGenericAdaptorBase::Properties) #endif // GET_OP_CLASSES