/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Op Declarations *| |* *| |* Automatically generated file, do not edit! *| |* From: OpenACCOps.td *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::acc { /// performs an atomic capture /// This operation performs an atomic capture. /// /// The region has the following allowed forms: /// /// ``` /// acc.atomic.capture { /// acc.atomic.update ... /// acc.atomic.read ... /// acc.terminator /// } /// /// acc.atomic.capture { /// acc.atomic.read ... /// acc.atomic.update ... /// acc.terminator /// } /// /// acc.atomic.capture { /// acc.atomic.read ... /// acc.atomic.write ... /// acc.terminator /// } /// ``` class AtomicCaptureOp; } // namespace mlir::acc namespace mlir::acc { /// performs an atomic read /// This operation performs an atomic read. /// /// The operand `x` is the address from where the value is atomically read. /// The operand `v` is the address where the value is stored after reading. class AtomicReadOp; } // namespace mlir::acc namespace mlir::acc { /// performs an atomic update /// This operation performs an atomic update. /// /// The operand `x` is exactly the same as the operand `x` in the OpenACC /// Standard (OpenACC 3.3, section 2.12). It is the address of the variable /// that is being updated. `x` is atomically read/written. /// /// The region describes how to update the value of `x`. It takes the value at /// `x` as an input and must yield the updated value. Only the update to `x` is /// atomic. Generally the region must have only one instruction, but can /// potentially have more than one instructions too. The update is sematically /// similar to a compare-exchange loop based atomic update. /// /// The syntax of atomic update operation is different from atomic read and /// atomic write operations. This is because only the host dialect knows how to /// appropriately update a value. For example, while generating LLVM IR, if /// there are no special `atomicrmw` instructions for the operation-type /// combination in atomic update, a compare-exchange loop is generated, where /// the core update operation is directly translated like regular operations by /// the host dialect. The front-end must handle semantic checks for allowed /// operations. class AtomicUpdateOp; } // namespace mlir::acc namespace mlir::acc { /// performs an atomic write /// This operation performs an atomic write. /// /// The operand `x` is the address to where the `expr` is atomically /// written w.r.t. multiple threads. The evaluation of `expr` need not be /// atomic w.r.t. the write to address. In general, the type(x) must /// dereference to type(expr). class AtomicWriteOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc attach semantics which updates a pointer in device memory with the corresponding device address of the pointee. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class AttachOp; } // namespace mlir::acc namespace mlir::acc { /// Represents the cache directive that is associated with a loop. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class CacheOp; } // namespace mlir::acc namespace mlir::acc { /// Compute region for GPU execution /// The `acc.compute_region` operation wraps a region of code that will be /// compiled and executed on a GPU. It is typically produced by lowering /// OpenACC compute constructs (`acc.parallel`, `acc.kernels`, `acc.serial`) /// but can also be targeted directly by other frontends or lowered from /// other constructs that benefit from the automatic parallelization and data /// mapping facilities that the `acc` dialect provides. It serves as the /// bridge between the high-level representation and the `gpu.launch` /// operation. /// /// The operation is `IsolatedFromAbove`: all values used inside the /// region must be explicitly captured. Values are captured in two ways: /// /// - Launch arguments (`launch`): Results of `acc.par_width` /// operations that define the parallel launch configuration. These /// become `index`-typed block arguments representing the parallel /// width for each dimension. /// /// - Input arguments (`ins`): Arbitrary values captured from outside /// the region (data pointers, scalars, etc.). These become block /// arguments with their original types. /// /// The `origin` attribute records which construct produced this compute /// region (e.g., `"acc.parallel"`, `"acc.kernels"`). This is intended to /// be solely informational. /// /// Canonicalization may simplify `ins` captures: duplicate `ins` operands /// (same SSA value threaded more than once) are merged by reusing the first /// block argument, and unused `ins` operands (block arguments with no uses) /// are removed. `launch` operands are never merged or dropped. /// /// Example: /// /// ```mlir /// %w0 = acc.par_width %c128 {par_dim = #acc.par_dim} /// %w1 = acc.par_width %c8 {par_dim = #acc.par_dim} /// acc.compute_region launch(%arg0 = %w0, %arg1 = %w1) /// ins(%arg2 = %data) : (memref<1024xf32>) { /// %c0 = arith.constant 0 : index /// %c1 = arith.constant 1 : index /// %c1024 = arith.constant 1024 : index /// scf.parallel (%iv) = (%c0) to (%c1024) step (%c1) { /// %v = memref.load %arg2[%iv] : memref<1024xf32> /// scf.reduce /// } {acc.par_dims = #acc} /// acc.yield /// } {origin = "acc.parallel"} /// ``` class ComputeRegionOp; } // namespace mlir::acc namespace mlir::acc { /// Represents copyin semantics for acc data clauses like acc copyin and acc copy. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class CopyinOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc copyout semantics - reverse of copyin. /// - `varPtr`: The address of variable to copy back to. /// - `accVar`: The acc variable. This is the link from the data-entry /// operation used. /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, always, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data exit operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class CopyoutOp; } // namespace mlir::acc namespace mlir::acc { /// Represents create semantics for acc data clauses like acc create and acc copyout. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class CreateOp; } // namespace mlir::acc namespace mlir::acc { /// Represents normalized bounds information for acc data clause. /// This operation is used to record bounds used in acc data clause in a /// normalized fashion (zero-based). This works well with the `PointerLikeType` /// requirement in data clauses - since a `lowerbound` of 0 means looking /// at data at the zero offset from pointer. /// /// The operation must have an `upperbound` or `extent` (or both are allowed - /// but not checked for consistency). When the source language's arrays are /// not zero-based, the `startIdx` must specify the zero-position index. /// /// The `stride` represents the distance between consecutive elements. For /// multi-dimensional arrays, the `stride` for each outer dimension must account /// for the complete size of all inner dimensions. /// /// The `strideInBytes` flag indicates that the `stride` is specified in bytes /// rather than the number of elements. /// /// Examples below show copying a slice of 10-element array except first element. /// Note that the examples use extent in data clause for C++ and upperbound /// for Fortran (as per 2.7.1). To simplify examples, the constants are used /// directly in the acc.bounds operands - this is not the syntax of operation. /// /// C++: /// ``` /// int array[10]; /// #pragma acc copy(array[1:9]) /// ``` /// => /// ```mlir /// acc.bounds lb(1) ub(9) extent(9) startIdx(0) stride(1) /// ``` /// /// Fortran: /// ``` /// integer :: array(1:10) /// !$acc copy(array(2:10)) /// ``` /// => /// ```mlir /// acc.bounds lb(1) ub(9) extent(9) startIdx(1) stride(1) /// ``` class DataBoundsOp; } // namespace mlir::acc namespace mlir::acc { /// data construct /// The "acc.data" operation represents a data construct. It defines vars to /// be allocated in the current device memory for the duration of the region, /// whether data should be copied from local memory to the current device /// memory upon region entry , and copied from device memory to local memory /// upon region exit. /// /// Example: /// /// ```mlir /// acc.data present(%a: memref<10x10xf32>, %b: memref<10x10xf32>, /// %c: memref<10xf32>, %d: memref<10xf32>) { /// // data region /// } /// ``` /// /// `async` and `wait` operands are supported with `device_type` information. /// They should only be accessed by the extra provided getters. If modified, /// the corresponding `device_type` attributes must be modified as well. class DataOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc declare device_resident semantics. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class DeclareDeviceResidentOp; } // namespace mlir::acc namespace mlir::acc { /// declare directive - entry to implicit data region /// The "acc.declare_enter" operation represents the OpenACC declare directive /// and captures the entry semantics to the implicit data region. /// This operation is modeled similarly to "acc.enter_data". /// /// Example showing `acc declare create(a)`: /// /// ```mlir /// %0 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr /// acc.declare_enter dataOperands(%0 : !llvm.ptr) /// ``` class DeclareEnterOp; } // namespace mlir::acc namespace mlir::acc { /// declare directive - exit from implicit data region /// The "acc.declare_exit" operation represents the OpenACC declare directive /// and captures the exit semantics from the implicit data region. /// This operation is modeled similarly to "acc.exit_data". /// /// Example showing `acc declare device_resident(a)`: /// /// ```mlir /// %0 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr {dataClause = #acc} /// acc.declare_exit dataOperands(%0 : !llvm.ptr) /// acc.delete accPtr(%0 : !llvm.ptr) {dataClause = #acc} /// ``` class DeclareExitOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc declare link semantics. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class DeclareLinkOp; } // namespace mlir::acc namespace mlir::acc { /// declare implicit region /// The "acc.declare" operation represents an implicit declare region in /// function (and subroutine in Fortran). /// /// Example: /// /// ```mlir /// %pa = acc.present varPtr(%a : memref<10x10xf32>) -> memref<10x10xf32> /// acc.declare dataOperands(%pa: memref<10x10xf32>) { /// // implicit region /// } /// ``` class DeclareOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc delete semantics - reverse of create. /// - `accVar`: The acc variable. This is the link from the data-entry /// operation used. /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, always, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data exit operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class DeleteOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc detach semantics - reverse of attach. /// - `accVar`: The acc variable. This is the link from the data-entry /// operation used. /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, always, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data exit operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class DetachOp; } // namespace mlir::acc namespace mlir::acc { /// Specifies that the variable pointer is a device pointer. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class DevicePtrOp; } // namespace mlir::acc namespace mlir::acc { /// enter data operation /// The "acc.enter_data" operation represents the OpenACC enter data directive. /// /// Example: /// /// ```mlir /// acc.enter_data create(%d1 : memref<10xf32>) attributes {async} /// ``` class EnterDataOp; } // namespace mlir::acc namespace mlir::acc { /// exit data operation /// The "acc.exit_data" operation represents the OpenACC exit data directive. /// /// Example: /// /// ```mlir /// acc.exit_data delete(%d1 : memref<10xf32>) attributes {async} /// ``` class ExitDataOp; } // namespace mlir::acc namespace mlir::acc { /// Represents the mapping of the initial value for firstprivate semantics. /// The `acc.firstprivate_map` operation is an intermediate representation /// used during the decomposition of `acc.firstprivate` operations. It /// represents the mapping of the initial value from the host to the device, /// which is then used to initialize per-thread private copies. /// /// This operation is distinct from `acc.copyin` because: /// - `acc.copyin` includes present counter updates, but private variables /// do not impact reference counters /// - The mapped value is used to initialize private copies rather than /// being accessed directly class FirstprivateMapInitialOp; } // namespace mlir::acc namespace mlir::acc { /// Represents firstprivate semantic for the acc firstprivate clause. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class FirstprivateOp; } // namespace mlir::acc namespace mlir::acc { /// privatization recipe /// Declares an OpenACC privatization recipe with copy of the initial value. /// The operation requires two mandatory regions and one optional. /// /// 1. The initializer region specifies how to allocate and initialize a new /// private value. For example in Fortran, a derived-type might have a /// default initialization. The region has an argument that contains the /// original value that needs to be privatized, followed by bounds arguments /// (if any) in order from innermost to outermost dimension. The region must /// yield the privatized copy. /// 2. The copy region specifies how to copy the initial value to the newly /// created private value. It takes the original value, the privatized /// value, followed by bounds arguments (if any) in the same order. /// 3. The destroy region specifies how to destruct the value when it reaches /// its end of life. It takes the original value, the privatized value, and /// bounds arguments (if any) in the same order. It is optional. /// /// A single privatization recipe can be used for multiple operand if they have /// the same type and do not require a specific default initialization. /// /// Example: /// /// ```mlir /// acc.firstprivate.recipe @firstprivate_memref : memref<10x20xf32> init { /// ^bb0(%original: memref<10x20xf32>): /// // init region contains a sequence of operations to create and /// // initialize the copy. It yields the privatized copy. /// %alloca = memref.alloca() : memref<10x20xf32> /// acc.yield %alloca : memref<10x20xf32> /// } copy { /// ^bb0(%original: memref<10x20xf32>, %privatized: memref<10x20xf32>): /// // copy region contains a sequence of operations to copy the initial value /// // of the firstprivate value to the newly created value. /// memref.copy %original, %privatized : memref<10x20xf32> to memref<10x20xf32> /// acc.terminator /// } destroy { /// ^bb0(%original: memref<10x20xf32>, %privatized: memref<10x20xf32>): /// // destroy region is empty since alloca is automatically cleaned up /// acc.terminator /// } /// /// // Example with bounds for array slicing: /// acc.firstprivate.recipe @firstprivate_slice : memref<10x20xf32> init { /// ^bb0(%original: memref<10x20xf32>, %bounds_inner: !acc.data_bounds_ty, %bounds_outer: !acc.data_bounds_ty): /// // Extract bounds and create appropriately sized allocation /// %extent_inner = acc.get_extent %bounds_inner : (!acc.data_bounds_ty) -> index /// %extent_outer = acc.get_extent %bounds_outer : (!acc.data_bounds_ty) -> index /// %slice_alloc = memref.alloca(%extent_outer, %extent_inner) : memref /// // ... base pointer adjustment logic ... /// acc.yield %result : memref<10x20xf32> /// } copy { /// ^bb0(%original: memref<10x20xf32>, %privatized: memref<10x20xf32>, %bounds_inner: !acc.data_bounds_ty, %bounds_outer: !acc.data_bounds_ty): /// // Copy the slice portion from original to privatized /// %lb_inner = acc.get_lowerbound %bounds_inner : (!acc.data_bounds_ty) -> index /// %lb_outer = acc.get_lowerbound %bounds_outer : (!acc.data_bounds_ty) -> index /// %extent_inner = acc.get_extent %bounds_inner : (!acc.data_bounds_ty) -> index /// %extent_outer = acc.get_extent %bounds_outer : (!acc.data_bounds_ty) -> index /// %subview = memref.subview %original[%lb_outer, %lb_inner][%extent_outer, %extent_inner][1, 1] /// : memref<10x20xf32> to memref> /// // Copy subview to privatized... /// acc.terminator /// } /// /// // The privatization symbol is then used in the corresponding operation. /// acc.parallel firstprivate(@firstprivate_memref -> %a : memref<10x20xf32>) { /// } /// ``` class FirstprivateRecipeOp; } // namespace mlir::acc namespace mlir::acc { /// Gets device address if variable exists on device. /// This operation is used to get the `accPtr` for a variable. This is often /// used in conjunction with data exit operations when the data entry /// operation is not visible. This operation can have a `dataClause` argument /// that is any of the valid `mlir::acc::DataClause` entries. /// \ /// /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class GetDevicePtrOp; } // namespace mlir::acc namespace mlir::acc { /// Extract extent from OpenACC data bounds. /// This operation extracts the extent value from an `acc.bounds` value. /// If the data bounds does not have an extent specified, it is computed /// from the upperbound. /// /// Example: /// ```mlir /// %extent = acc.get_extent %bounds : (!acc.data_bounds_ty) -> index /// ``` class GetExtentOp; } // namespace mlir::acc namespace mlir::acc { /// Extract lowerbound from OpenACC data bounds. /// This operation extracts the lowerbound value from an `acc.bounds` value. /// If the data bounds does not have a lowerbound specified, it means it is zero. /// /// Example: /// ```mlir /// %lb = acc.get_lowerbound %bounds : (!acc.data_bounds_ty) -> index /// ``` class GetLowerboundOp; } // namespace mlir::acc namespace mlir::acc { /// Extract stride from OpenACC data bounds. /// This operation extracts the stride value from an `acc.bounds` value. /// If the data bounds does not have a stride specified, it defaults to 1. /// /// Example: /// ```mlir /// %stride = acc.get_stride %bounds : (!acc.data_bounds_ty) -> index /// ``` class GetStrideOp; } // namespace mlir::acc namespace mlir::acc { /// Extract upperbound from OpenACC data bounds. /// This operation extracts the upperbound value from an `acc.bounds` value. /// If the data bounds does not have an upperbound specified, this operation /// uses the extent to compute it. /// /// Example: /// ```mlir /// %ub = acc.get_upperbound %bounds : (!acc.data_bounds_ty) -> index /// ``` class GetUpperboundOp; } // namespace mlir::acc namespace mlir::acc { /// Used to hold construction operations associated with globals such as declare /// The "acc.global_ctor" operation is used to capture OpenACC actions to apply /// on globals (such as `acc declare`) at the entry to the implicit data region. /// This operation is isolated and intended to be used in a module. /// /// Example showing `declare create` of global: /// /// ```mlir /// llvm.mlir.global external @globalvar() : i32 { /// %0 = llvm.mlir.constant(0 : i32) : i32 /// llvm.return %0 : i32 /// } /// acc.global_ctor @acc_constructor { /// %0 = llvm.mlir.addressof @globalvar : !llvm.ptr /// %1 = acc.create varPtr(%0 : !llvm.ptr) -> !llvm.ptr /// acc.declare_enter dataOperands(%1 : !llvm.ptr) /// } /// ``` class GlobalConstructorOp; } // namespace mlir::acc namespace mlir::acc { /// Used to hold destruction operations associated with globals such as declare /// The "acc.global_dtor" operation is used to capture OpenACC actions to apply /// on globals (such as `acc declare`) at the exit from the implicit data /// region. This operation is isolated and intended to be used in a module. /// /// Example showing delete associated with `declare create` of global: /// /// ```mlir /// llvm.mlir.global external @globalvar() : i32 { /// %0 = llvm.mlir.constant(0 : i32) : i32 /// llvm.return %0 : i32 /// } /// acc.global_dtor @acc_destructor { /// %0 = llvm.mlir.addressof @globalvar : !llvm.ptr /// %1 = acc.getdeviceptr varPtr(%0 : !llvm.ptr) -> !llvm.ptr {dataClause = #acc} /// acc.declare_exit dataOperands(%1 : !llvm.ptr) /// acc.delete accPtr(%1 : !llvm.ptr) {dataClause = #acc} /// } /// ``` class GlobalDestructorOp; } // namespace mlir::acc namespace mlir::acc { /// host_data construct /// The "acc.host_data" operation represents the OpenACC host_data construct. /// /// Example: /// /// ```mlir /// %0 = acc.use_device varPtr(%a : !llvm.ptr) -> !llvm.ptr /// acc.host_data dataOperands(%0 : !llvm.ptr) { /// /// } /// ``` class HostDataOp; } // namespace mlir::acc namespace mlir::acc { /// init operation /// The "acc.init" operation represents the OpenACC init executable /// directive. /// /// Example: /// /// ```mlir /// acc.init /// acc.init device_num(%dev1 : i32) /// ``` class InitOp; } // namespace mlir::acc namespace mlir::acc { /// Decomposition of compute constructs to capture data mapping and asynchronous behavior information /// The `acc.kernel_environment` operation represents a decomposition of /// any OpenACC compute construct (acc.kernels, acc.parallel, or /// acc.serial) that captures data mapping and asynchronous behavior: /// - data clause operands /// - async clause operands /// - wait clause operands /// /// This allows kernel execution parallelism and privatization to be /// handled separately, facilitating eventual lowering to GPU dialect where /// kernel launching and compute offloading are handled separately. class KernelEnvironmentOp; } // namespace mlir::acc namespace mlir::acc { /// kernels construct /// The "acc.kernels" operation represents a kernels construct block. It has /// one region to be compiled into a sequence of kernels for execution on the /// current device. /// /// Example: /// /// ```mlir /// acc.kernels num_gangs(%c10) num_workers(%c10) /// private(%c : memref<10xf32>) { /// // kernels region /// } /// ``` /// /// `collapse`, `gang`, `worker`, `vector`, `seq`, `independent`, `auto` and /// `tile` operands are supported with `device_type` information. They should /// only be accessed by the extra provided getters. If modified, the /// corresponding `device_type` attributes must be modified as well. class KernelsOp; } // namespace mlir::acc namespace mlir::acc { /// loop construct /// The `acc.loop` operation represents the OpenACC loop construct and when /// bounds are included, the associated source language loop iterators. The /// lower and upper bounds specify a half-open range: the range includes the /// lower bound but does not include the upper bound. If the `inclusive` /// attribute is set then the upper bound is included. /// /// In cases where the OpenACC loop directive needs to capture multiple /// source language loops, such as in the case of `collapse` or `tile`, /// the multiple induction arguments are used to capture each case. Having /// such a representation makes sure no intermediate transformation such /// as Loop Invariant Code Motion breaks the property requested by the /// clause on the loop constructs. /// /// Each `acc.loop` holds private and reduction operands which are the /// ssa values from the corresponding `acc.private` or `acc.reduction` /// operations. Additionally, firstprivate operands are supported to /// represent cases where privatization is needed with initialization /// from an original value. While the OpenACC specification does not /// explicitly support firstprivate on loop constructs, this extension /// enables representing privatization scenarios that arise from an /// optimization and codegen pipeline operating on acc dialect. /// /// The operation supports capturing information that it comes combined /// constructs (e.g., `parallel loop`, `kernels loop`, `serial loop`) /// through the `combined` attribute despite requiring the `acc.loop` /// to be decomposed from the compute operation representing compute /// construct. /// /// Example: /// /// ```mlir /// acc.loop gang() vector() (%arg3 : index, %arg4 : index, %arg5 : index) = /// (%c0, %c0, %c0 : index, index, index) to /// (%c10, %c10, %c10 : index, index, index) step /// (%c1, %c1, %c1 : index, index, index) { /// // Loop body /// acc.yield /// } attributes { collapse = [3] } /// ``` /// /// `collapse`, `gang`, `worker`, `vector`, `seq`, `independent`, `auto`, /// `cache`, and `tile` operands are supported with `device_type` /// information. These clauses should only be accessed through the provided /// device-type-aware getter methods. When modifying these operands, the /// corresponding `device_type` attributes must be updated to maintain /// consistency between operands and their target device types. /// /// The `unstructured` attribute indicates that the loops inside the OpenACC /// construct contain early exits and cannot be lowered to structured MLIR /// operations. When this flag is set, the acc.loop should have no induction /// variables and the loop must be implemented via explicit control flow /// inside its body. class LoopOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc no_create semantics. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class NoCreateOp; } // namespace mlir::acc namespace mlir::acc { /// Specify parallel width for a GPU dimension /// The `acc.par_width` operation specifies the parallel width for a /// given GPU parallel dimension. It is used as an input to /// `acc.compute_region` to define the launch configuration. /// /// The optional `launchArg` operand provides a known width value. When /// absent, the width is unknown and must be determined later (either at /// compile time by analysis or at runtime). /// /// Examples: /// /// ```mlir /// // Known width from SSA value /// %w1 = acc.par_width %vector_len {par_dim = #acc.par_dim} /// /// // Unknown width (to be computed later) /// %w2 = acc.par_width {par_dim = #acc.par_dim} /// ``` class ParWidthOp; } // namespace mlir::acc namespace mlir::acc { /// parallel construct /// The "acc.parallel" operation represents a parallel construct block. It has /// one region to be executed in parallel on the current device. /// /// Example: /// /// ```mlir /// acc.parallel num_gangs(%c10) num_workers(%c10) /// private(%c : memref<10xf32>) { /// // parallel region /// } /// ``` /// /// `async`, `wait`, `num_gangs`, `num_workers` and `vector_length` operands are /// supported with `device_type` information. They should only be accessed by /// the extra provided getters. If modified, the corresponding `device_type` /// attributes must be modified as well. class ParallelOp; } // namespace mlir::acc namespace mlir::acc { /// Groups operations at intermediate loop-nest points /// Groups statements within an `acc.compute_region` that sit at an /// intermediate point in a loop nest (outside a partitioned loop body, /// between or around nested loops). This grouping marks code whose execution /// scope differs from that of surrounding partitioned loops, so predication /// and synchronization can be applied correctly during lowering. Corresponds /// to OpenACC single or redundant execution at nest transitions. /// /// Example: /// ```mlir /// // !$acc parallel num_gangs(NG) vector_length(VL) /// // !$acc loop gang /// // !$acc atomic update /// // !$acc loop vector /// // !$acc atomic update /// %w_gang = acc.par_width %cNG {par_dim = #acc.par_dim} /// %w_vector = acc.par_width %cVL {par_dim = #acc.par_dim} /// acc.compute_region launch(%ng = %w_gang, %vl = %w_vector) /// ins(%arg_c1 = %c1, %arg_c2 = %c2) : (memref, memref) { /// scf.parallel (%i) = (%c1) to (%cN) step (%c1) { /// acc.predicate_region { /// acc.atomic.update %arg_c1 : memref { /// ^bb0(%old: i32): /// %one = arith.constant 1 : i32 /// %sum = arith.addi %old, %one : i32 /// acc.yield %sum : i32 /// } /// } /// scf.parallel (%j) = (%c1) to (%cN) step (%c1) { /// acc.atomic.update %arg_c2 : memref { /// ^bb0(%old: i32): /// %one = arith.constant 1 : i32 /// %sum = arith.addi %old, %one : i32 /// acc.yield %sum : i32 /// } /// scf.reduce /// } {acc.par_dims = #acc} /// scf.reduce /// } {acc.par_dims = #acc} /// acc.yield /// } {origin = "acc.parallel"} /// ``` class PredicateRegionOp; } // namespace mlir::acc namespace mlir::acc { /// Specifies that the variable is already present on device. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class PresentOp; } // namespace mlir::acc namespace mlir::acc { /// Materialize privatized storage for the current parallelism context /// Given a value of type `acc.private_type`, materializes the underlying /// storage (typically a `memref`) for the current thread / iteration. Which /// slice of the privatized allocation is selected is determined by surrounding /// parallelism assigned in the context. /// /// The result type is usually `T` (often a `memref` that matches the logical /// storage type). The result may instead use a different surface type that /// still aliases the same underlying storage as `T`; in that case passes that /// consume this operation must treat the handle type and the result type as /// describing the same storage layout. class PrivateLocalOp; } // namespace mlir::acc namespace mlir::acc { /// Represents private semantics for acc private clause. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class PrivateOp; } // namespace mlir::acc namespace mlir::acc { /// privatization recipe /// Declares an OpenACC privatization recipe. The operation requires one /// mandatory and one optional region. /// /// 1. The initializer region specifies how to allocate and initialize a new /// private value. For example in Fortran, a derived-type might have a /// default initialization. The region has an argument that contains the /// original value that needs to be privatized, followed by bounds arguments /// (if any) in order from innermost to outermost dimension. The region /// must yield the privatized copy. /// 2. The destroy region specifies how to destruct the value when it reaches /// its end of life. It takes the original value, the privatized value, and /// bounds arguments (if any) in the same order as the init region. /// /// A single privatization recipe can be used for multiple operand if they have /// the same type and do not require a specific default initialization. /// /// Example: /// /// ```mlir /// acc.private.recipe @privatization_memref : memref<10x20xf32> init { /// ^bb0(%original: memref<10x20xf32>): /// // init region contains a sequence of operations to create and /// // initialize the copy. It yields the privatized copy. /// %alloca = memref.alloca() : memref<10x20xf32> /// acc.yield %alloca : memref<10x20xf32> /// } destroy { /// ^bb0(%original: memref<10x20xf32>, %privatized: memref<10x20xf32>): /// // destroy region is empty since alloca is automatically cleaned up /// acc.terminator /// } /// /// // Example with bounds for array slicing: /// acc.private.recipe @privatization_slice : memref<10x20xf32> init { /// ^bb0(%original: memref<10x20xf32>, %bounds_inner: !acc.data_bounds_ty, %bounds_outer: !acc.data_bounds_ty): /// // Extract bounds and create appropriately sized allocation /// %extent_inner = acc.get_extent %bounds_inner : (!acc.data_bounds_ty) -> index /// %extent_outer = acc.get_extent %bounds_outer : (!acc.data_bounds_ty) -> index /// %slice_alloc = memref.alloca(%extent_outer, %extent_inner) : memref /// // ... base pointer adjustment logic ... /// acc.yield %result : memref<10x20xf32> /// } destroy { /// ^bb0(%original: memref<10x20xf32>, %privatized: memref<10x20xf32>, %bounds_inner: !acc.data_bounds_ty, %bounds_outer: !acc.data_bounds_ty): /// // Cleanup is automatic for alloca-based allocations /// acc.terminator /// } /// /// // The privatization symbol is then used in the corresponding operation. /// acc.parallel private(@privatization_memref -> %a : memref<10x20xf32>) { /// } /// ``` class PrivateRecipeOp; } // namespace mlir::acc namespace mlir::acc { /// Create a handle for privatized storage along parallel dimensions /// Introduces a privatization handle for storage that varies across the active /// parallel dimensions (for example OpenACC `private` / `firstprivate` after /// recipe materialization). The handle type is `acc.private_type` where /// `T` is the logical storage type (commonly a `memref`). /// /// Optional `index` operands supply dynamic sizes when the privatized shape /// depends on SSA values (for example `memref` row lengths). /// /// The optional `acc.par_dims` attribute records which GPU parallel dimensions /// participate in the privatization. class PrivatizeOp; } // namespace mlir::acc namespace mlir::acc { /// Accumulate an SSA value into a reduction variable /// Accumulates a scalar SSA value into a pointer-like reduction variable. /// /// Example: /// ```mlir /// %private = memref.alloca() {acc.par_dims = #acc} : memref /// memref.store %c0, %private[] : memref /// %partial = scf.parallel (%iv) = (%c0) to (%cN) step (%c1) init (%c0) -> i32 { /// %v = memref.load %data[%iv] : memref /// scf.reduce(%v : i32) { /// ^bb0(%lhs: i32, %rhs: i32): /// %sum = arith.addi %lhs, %rhs : i32 /// scf.reduce.return %sum : i32 /// } /// } {acc.par_dims = #acc} /// acc.reduction_accumulate %partial to %private /// : i32 -> memref {par_dims = #acc} /// acc.reduction_combine %private into %shared : memref /// {acc.par_dims = #acc} /// ``` class ReductionAccumulateOp; } // namespace mlir::acc namespace mlir::acc { /// Combine a reduction partial sum with its original value /// This operation is a composite to do a typical update of a reduction /// variable. The intention of this operator is to facilitate codegen /// decisions (such as generate an atomic update). E.g. /// /// ``` /// acc.reduction_combine %src into %dest : memref /// ``` /// /// Might lower to something similar to /// /// ``` /// %loadSrc = memref.load %src[] : memref /// %loadDest = memref.load %dest[] : memref /// %combine = arith.addi %loadSrc, %loadDest : i32 /// memref.store %combine, %dest[] : memref /// ``` /// /// The $destMemref operand is a "pointer" to the original reduction /// variable (typically shared). The $srcMemref operand is a "pointer" /// to the partial sum of the reduction (typically private). /// /// The $kind is the OpenACC reduction operator that determines how to /// accumulate the two values. class ReductionCombineOp; } // namespace mlir::acc namespace mlir::acc { /// Combine a reduction private value with its original (recipe) /// This operation provides materialized reduction combine code from an /// OpenACC reduction recipe. The region takes the partially reduced value(s) /// from the private reduction variable and combines them with the current /// value(s) in the original/shared reduction variable. The region is /// terminated by `acc.yield` with no operands. /// /// The destVar operand is the original/shared reduction variable. /// The srcVar operand is typically the result of acc.reduction_init. class ReductionCombineRegionOp; } // namespace mlir::acc namespace mlir::acc { /// Allocate and initialize a reduction variable from a recipe /// This operation provides materialized allocation and initialization for a /// private reduction variable from an OpenACC reduction recipe. The region /// contains the recipe's init code and must yield a single value (the private /// reduction storage) via `acc.yield`. /// /// The var operand is the original/shared reduction variable. The /// reduction_operator specifies the reduction kind (e.g. add, mul). class ReductionInitOp; } // namespace mlir::acc namespace mlir::acc { /// Represents reduction semantics for acc reduction clause. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class ReductionOp; } // namespace mlir::acc namespace mlir::acc { /// reduction recipe /// Declares an OpenACC reduction recipe. The operation requires two /// mandatory regions and one optional region. /// /// 1. The initializer region specifies how to initialize the local reduction /// value. The region has a first argument that contains the original value /// that needs to be reduced, followed by bounds arguments (if any) in order /// from innermost to outermost dimension. It is expected to `acc.yield` the /// initialized reduction value. /// 2. The combiner region contains a sequence of operations to combine two /// values of the reduction type into one. It has the first reduction value, /// the second reduction value, followed by bounds arguments (if any) in the /// same order. It is expected to `acc.yield` the combined value. /// 3. The optional destroy region specifies how to destruct the value when it /// reaches its end of life. It takes the original value, the reduction value, /// and bounds arguments (if any) in the same order. /// /// Example: /// /// ```mlir /// acc.reduction.recipe @reduction_add_memref : memref<10x20xf32> reduction_operator init { /// ^bb0(%original: memref<10x20xf32>): /// // init region contains a sequence of operations to initialize the local /// // reduction value as specified in 2.5.15 /// %alloca = memref.alloca() : memref<10x20xf32> /// %cst = arith.constant 0.0 : f32 /// linalg.fill ins(%cst : f32) outs(%alloca : memref<10x20xf32>) /// acc.yield %alloca : memref<10x20xf32> /// } combiner { /// ^bb0(%lhs: memref<10x20xf32>, %rhs: memref<10x20xf32>): /// // combiner region contains a sequence of operations to combine /// // two values into one. /// linalg.add ins(%lhs, %rhs : memref<10x20xf32>, memref<10x20xf32>) /// outs(%lhs : memref<10x20xf32>) /// acc.yield %lhs : memref<10x20xf32> /// } destroy { /// ^bb0(%original: memref<10x20xf32>, %reduction: memref<10x20xf32>): /// // destroy region is empty since alloca is automatically cleaned up /// acc.terminator /// } /// /// // Example with bounds for array slicing: /// acc.reduction.recipe @reduction_add_slice : memref<10x20xf32> reduction_operator init { /// ^bb0(%original: memref<10x20xf32>, %bounds_inner: !acc.data_bounds_ty, %bounds_outer: !acc.data_bounds_ty): /// // Extract bounds and create appropriately sized allocation /// %extent_inner = acc.get_extent %bounds_inner : (!acc.data_bounds_ty) -> index /// %extent_outer = acc.get_extent %bounds_outer : (!acc.data_bounds_ty) -> index /// %slice_alloc = memref.alloca(%extent_outer, %extent_inner) : memref /// %cst = arith.constant 0.0 : f32 /// linalg.fill ins(%cst : f32) outs(%slice_alloc : memref) /// // ... base pointer adjustment logic ... /// acc.yield %result : memref<10x20xf32> /// } combiner { /// ^bb0(%lhs: memref<10x20xf32>, %rhs: memref<10x20xf32>, %bounds_inner: !acc.data_bounds_ty, %bounds_outer: !acc.data_bounds_ty): /// // Extract bounds to operate only on the slice portion /// %lb_inner = acc.get_lowerbound %bounds_inner : (!acc.data_bounds_ty) -> index /// %lb_outer = acc.get_lowerbound %bounds_outer : (!acc.data_bounds_ty) -> index /// %extent_inner = acc.get_extent %bounds_inner : (!acc.data_bounds_ty) -> index /// %extent_outer = acc.get_extent %bounds_outer : (!acc.data_bounds_ty) -> index /// /// // Create subviews to access only the slice portions /// %lhs_slice = memref.subview %lhs[%lb_outer, %lb_inner][%extent_outer, %extent_inner][1, 1] /// : memref<10x20xf32> to memref> /// %rhs_slice = memref.subview %rhs[%lb_outer, %lb_inner][%extent_outer, %extent_inner][1, 1] /// : memref<10x20xf32> to memref> /// /// // Combine only the slice portions /// linalg.add ins(%lhs_slice, %rhs_slice : memref>, memref>) /// outs(%lhs_slice : memref>) /// acc.yield %lhs : memref<10x20xf32> /// } /// /// // The reduction symbol is then used in the corresponding operation. /// acc.parallel reduction(@reduction_add_memref -> %a : memref<10x20xf32>) { /// } /// ``` /// /// The following table lists the valid operators and the initialization values /// according to OpenACC 3.3: /// /// |------------------------------------------------| /// | C/C++ | Fortran | /// |-----------------------|------------------------| /// | operator | init value | operator | init value | /// | + | 0 | + | 0 | /// | * | 1 | * | 1 | /// | max | least | max | least | /// | min | largest | min | largest | /// | & | ~0 | iand | all bits on | /// | | | 0 | ior | 0 | /// | ^ | 0 | ieor | 0 | /// | && | 1 | .and. | .true. | /// | || | 0 | .or. | .false. | /// | | | .eqv. | .true. | /// | | | .neqv. | .false. | /// -------------------------------------------------| class ReductionRecipeOp; } // namespace mlir::acc namespace mlir::acc { /// acc routine operation /// The `acc.routine` operation is used to capture the clauses of acc /// routine directive, including the associated function name. The associated /// function keeps track of its corresponding routine declaration through /// the `RoutineInfoAttr`. /// /// Example: /// /// ```mlir /// func.func @acc_func(%a : i64) -> () attributes /// {acc.routine_info = #acc.routine_info<[@acc_func_rout1]>} { /// return /// } /// acc.routine @acc_func_rout1 func(@acc_func) gang /// ``` /// /// `bind`, `gang`, `worker`, `vector` and `seq` operands are supported with /// `device_type` information. They should only be accessed by the extra /// provided getters. If modified, the corresponding `device_type` attributes /// must be modified as well. class RoutineOp; } // namespace mlir::acc namespace mlir::acc { /// serial construct /// The "acc.serial" operation represents a serial construct block. It has /// one region to be executed in serial on the current device. /// /// Example: /// /// ```mlir /// acc.serial private(%c : memref<10xf32>) { /// // serial region /// } /// ``` /// /// `async` and `wait` operands are supported with `device_type` information. /// They should only be accessed by the extra provided getters. If modified, /// the corresponding `device_type` attributes must be modified as well. class SerialOp; } // namespace mlir::acc namespace mlir::acc { /// set operation /// The "acc.set" operation represents the OpenACC set directive. /// /// Example: /// /// ```mlir /// acc.set device_num(%dev1 : i32) /// ``` class SetOp; } // namespace mlir::acc namespace mlir::acc { /// shutdown operation /// The "acc.shutdown" operation represents the OpenACC shutdown executable /// directive. /// /// Example: /// /// ```mlir /// acc.shutdown /// acc.shutdown device_num(%dev1 : i32) /// ``` class ShutdownOp; } // namespace mlir::acc namespace mlir::acc { /// Generic terminator for OpenACC regions /// A terminator operation for regions that appear in the body of OpenACC /// operation. Generic OpenACC construct regions are not expected to return any /// value so the terminator takes no operands. The terminator op returns control /// to the enclosing op. class TerminatorOp; } // namespace mlir::acc namespace mlir::acc { /// Unwrap acc.private_type handle to pointer-like storage /// Converts a privatization handle (`acc.private_type`) to a pointer-like /// view of the underlying private storage. class UnwrapPrivateOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc update device semantics. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class UpdateDeviceOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc update host semantics. /// - `varPtr`: The address of variable to copy back to. /// - `accVar`: The acc variable. This is the link from the data-entry /// operation used. /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, always, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data exit operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class UpdateHostOp; } // namespace mlir::acc namespace mlir::acc { /// update operation /// The `acc.update` operation represents the OpenACC update executable /// directive. /// As host and self clauses are synonyms, any operands for host and self are /// add to $hostOperands. /// /// Example: /// /// ```mlir /// acc.update device(%d1 : memref<10xf32>) attributes {async} /// ``` /// /// `async` and `wait` operands are supported with `device_type` information. /// They should only be accessed by the extra provided getters. If modified, /// the corresponding `device_type` attributes must be modified as well. class UpdateOp; } // namespace mlir::acc namespace mlir::acc { /// Represents acc use_device semantics. /// Description of arguments: /// - `var`: The variable to copy. Must be either `MappableType` or /// `PointerLikeType`. /// - `varType`: The type of the variable that is being copied. When `var` is /// a `MappableType`, this matches the type of `var`. When `var` is a /// `PointerLikeType`, this type holds information about the target of the /// pointer. /// - `varPtrPtr`: Specifies the address of the address of `var` - only used /// when the variable copied is a field in a struct. This is important for /// OpenACC due to implicit attach semantics on data clauses (2.6.4). /// - `bounds`: Used when copying just slice of array or array's bounds are not /// encoded in type. They are in rank order where rank 0 is inner-most dimension. /// - `asyncOperands` and `asyncOperandsDeviceType`: /// pair-wise lists of the async clause values associated with device_type's. /// - `asyncOnly`: a list of device_type's for which async clause /// does not specify a value (default is acc_async_noval - OpenACC 3.3 2.16.1). /// - `dataClause`: Keeps track of the data clause the user used. This is because /// the acc operations are decomposed. So a 'copy' clause is decomposed to both /// `acc.copyin` and `acc.copyout` operations, but both have dataClause that /// specifies `acc_copy` in this field. /// - `structured`: Flag to note whether this is associated with structured region /// (parallel, kernels, data) or unstructured (enter data, exit data). This is /// important due to spec specifically calling out structured and dynamic reference /// counters (2.6.7). /// - `implicit`: Whether this is an implicitly generated operation, such as copies /// done to satisfy "Variables with Implicitly Determined Data Attributes" in 2.6.2. /// - `modifiers`: Keeps track of the data clause modifiers (eg zero, readonly, etc) /// - `name`: Holds the name of variable as specified in user clause (including bounds). /// /// The async values attached to the data entry operation imply that the data /// action applies to all device types specified by the device_type clauses /// using the activity queues on these devices as defined by the async values. class UseDeviceOp; } // namespace mlir::acc namespace mlir::acc { /// wait operation /// The "acc.wait" operation represents the OpenACC wait executable /// directive. /// /// Example: /// /// ```mlir /// acc.wait(%value1: index) /// acc.wait() async(%async1: i32) /// ``` /// /// acc.wait does not implement MemoryEffects interface, /// so it affects all the resources. This is conservatively /// correct. More precise modelling of the memory effects /// seems to be impossible without the whole program analysis. class WaitOp; } // namespace mlir::acc namespace mlir::acc { /// Acc yield and termination operation /// `acc.yield` is a special terminator operation for block inside regions in /// various acc ops (including parallel, loop, atomic.update). It returns values /// to the immediately enclosing acc op. class YieldOp; } // namespace mlir::acc #ifdef GET_OP_CLASSES #undef GET_OP_CLASSES namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::AtomicCaptureOp declarations //===----------------------------------------------------------------------===// namespace detail { class AtomicCaptureOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AtomicCaptureOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.atomic.capture", odsAttrs.getContext()); } AtomicCaptureOpGenericAdaptorBase(AtomicCaptureOp 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 AtomicCaptureOpGenericAdaptor : public detail::AtomicCaptureOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AtomicCaptureOpGenericAdaptorBase; static constexpr int odsIndex_ifCond = 0; public: AtomicCaptureOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AtomicCaptureOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AtomicCaptureOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AtomicCaptureOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AtomicCaptureOpGenericAdaptor(values, attrs, Properties{}, {}) {} AtomicCaptureOpGenericAdaptor(RangeT values, const AtomicCaptureOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AtomicCaptureOpGenericAdaptor(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 getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AtomicCaptureOpAdaptor : public AtomicCaptureOpGenericAdaptor<::mlir::ValueRange> { public: using AtomicCaptureOpGenericAdaptor::AtomicCaptureOpGenericAdaptor; AtomicCaptureOpAdaptor(AtomicCaptureOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AtomicCaptureOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::accomp::AtomicCaptureOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AtomicCaptureOpAdaptor; template using GenericAdaptor = AtomicCaptureOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_ifCond = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.atomic.capture"); } 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::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::MutableOperandRange getIfCondMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond); static AtomicCaptureOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond); static AtomicCaptureOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond); static AtomicCaptureOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond); static AtomicCaptureOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AtomicCaptureOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AtomicCaptureOp 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 AtomicCaptureOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AtomicCaptureOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verifyRegions(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: /// Returns the `atomic.read` operation inside the region, if any. /// Otherwise, it returns nullptr. AtomicReadOp getAtomicReadOp(); /// Returns the `atomic.write` operation inside the region, if any. /// Otherwise, it returns nullptr. AtomicWriteOp getAtomicWriteOp(); /// Returns the `atomic.update` operation inside the region, if any. /// Otherwise, it returns nullptr. AtomicUpdateOp getAtomicUpdateOp(); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicCaptureOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::AtomicReadOp declarations //===----------------------------------------------------------------------===// namespace detail { class AtomicReadOpGenericAdaptorBase { public: struct Properties { using element_typeTy = ::mlir::TypeAttr; element_typeTy element_type; auto getElementType() const { auto &propStorage = this->element_type; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setElementType(const ::mlir::TypeAttr &propValue) { this->element_type = propValue; } bool operator==(const Properties &rhs) const { return rhs.element_type == this->element_type && 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: AtomicReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.atomic.read", odsAttrs.getContext()); } AtomicReadOpGenericAdaptorBase(AtomicReadOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getElementTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().element_type); return attr; } ::mlir::Type getElementType(); }; } // namespace detail template class AtomicReadOpGenericAdaptor : public detail::AtomicReadOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AtomicReadOpGenericAdaptorBase; static constexpr int odsIndex_x = 0; static constexpr int odsIndex_v = 1; static constexpr int odsIndex_ifCond = 2; public: AtomicReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AtomicReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AtomicReadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AtomicReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AtomicReadOpGenericAdaptor(values, attrs, Properties{}, {}) {} AtomicReadOpGenericAdaptor(RangeT values, const AtomicReadOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AtomicReadOpGenericAdaptor(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 getX() { return (*getODSOperands(0).begin()); } ValueT getV() { return (*getODSOperands(1).begin()); } ValueT getIfCond() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AtomicReadOpAdaptor : public AtomicReadOpGenericAdaptor<::mlir::ValueRange> { public: using AtomicReadOpGenericAdaptor::AtomicReadOpGenericAdaptor; AtomicReadOpAdaptor(AtomicReadOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AtomicReadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::accomp::AtomicReadOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AtomicReadOpAdaptor; template using GenericAdaptor = AtomicReadOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_x = 0; static constexpr int odsIndex_v = 1; static constexpr int odsIndex_ifCond = 2; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_type")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getElementTypeAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getElementTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.atomic.read"); } 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::TypedValue<::mlir::acc::PointerLikeType> getX() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getV() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(1).begin()); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::OpOperand &getXMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getVMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getIfCondMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::TypeAttr getElementTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().element_type); } ::mlir::Type getElementType(); void setElementTypeAttr(::mlir::TypeAttr attr) { getProperties().element_type = attr; } void setElementType(::mlir::Type attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::Value ifCond); static AtomicReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::Value ifCond); static AtomicReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::Value ifCond); static AtomicReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::Value ifCond); static AtomicReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::TypeAttr element_type, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/::mlir::Value ifCond); static AtomicReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/::mlir::Value ifCond); static AtomicReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/::mlir::Value ifCond); static AtomicReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/::mlir::Value ifCond); static AtomicReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value v, ::mlir::Type element_type, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AtomicReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AtomicReadOp 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 AtomicReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AtomicReadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicReadOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::AtomicReadOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::AtomicUpdateOp declarations //===----------------------------------------------------------------------===// namespace detail { class AtomicUpdateOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AtomicUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.atomic.update", odsAttrs.getContext()); } AtomicUpdateOpGenericAdaptorBase(AtomicUpdateOp 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 AtomicUpdateOpGenericAdaptor : public detail::AtomicUpdateOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AtomicUpdateOpGenericAdaptorBase; static constexpr int odsIndex_x = 0; static constexpr int odsIndex_ifCond = 1; public: AtomicUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AtomicUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AtomicUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AtomicUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AtomicUpdateOpGenericAdaptor(values, attrs, Properties{}, {}) {} AtomicUpdateOpGenericAdaptor(RangeT values, const AtomicUpdateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AtomicUpdateOpGenericAdaptor(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 getX() { return (*getODSOperands(0).begin()); } ValueT getIfCond() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AtomicUpdateOpAdaptor : public AtomicUpdateOpGenericAdaptor<::mlir::ValueRange> { public: using AtomicUpdateOpGenericAdaptor::AtomicUpdateOpGenericAdaptor; AtomicUpdateOpAdaptor(AtomicUpdateOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AtomicUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::accomp::AtomicUpdateOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AtomicUpdateOpAdaptor; template using GenericAdaptor = AtomicUpdateOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_x = 0; static constexpr int odsIndex_ifCond = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.atomic.update"); } 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::TypedValue<::mlir::acc::PointerLikeType> getX() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::OpOperand &getXMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getIfCondMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::mlir::Value ifCond); static AtomicUpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, /*optional*/::mlir::Value ifCond); static AtomicUpdateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::Value ifCond); static AtomicUpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::Value ifCond); static AtomicUpdateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AtomicUpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AtomicUpdateOp 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 AtomicUpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AtomicUpdateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); ::llvm::LogicalResult verifyRegions(); static ::llvm::LogicalResult canonicalize(AtomicUpdateOp op, ::mlir::PatternRewriter &rewriter); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: Operation* getFirstOp() { return &getRegion().front().getOperations().front(); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicUpdateOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::AtomicWriteOp declarations //===----------------------------------------------------------------------===// namespace detail { class AtomicWriteOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AtomicWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.atomic.write", odsAttrs.getContext()); } AtomicWriteOpGenericAdaptorBase(AtomicWriteOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class AtomicWriteOpGenericAdaptor : public detail::AtomicWriteOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AtomicWriteOpGenericAdaptorBase; static constexpr int odsIndex_x = 0; static constexpr int odsIndex_expr = 1; static constexpr int odsIndex_ifCond = 2; public: AtomicWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AtomicWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AtomicWriteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AtomicWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AtomicWriteOpGenericAdaptor(values, attrs, Properties{}, {}) {} AtomicWriteOpGenericAdaptor(RangeT values, const AtomicWriteOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AtomicWriteOpGenericAdaptor(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 getX() { return (*getODSOperands(0).begin()); } ValueT getExpr() { return (*getODSOperands(1).begin()); } ValueT getIfCond() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AtomicWriteOpAdaptor : public AtomicWriteOpGenericAdaptor<::mlir::ValueRange> { public: using AtomicWriteOpGenericAdaptor::AtomicWriteOpGenericAdaptor; AtomicWriteOpAdaptor(AtomicWriteOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AtomicWriteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::accomp::AtomicWriteOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AtomicWriteOpAdaptor; template using GenericAdaptor = AtomicWriteOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_x = 0; static constexpr int odsIndex_expr = 1; static constexpr int odsIndex_ifCond = 2; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.atomic.write"); } 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::TypedValue<::mlir::acc::PointerLikeType> getX() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getExpr() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::OpOperand &getXMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getExprMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getIfCondMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::Value ifCond); static AtomicWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::Value ifCond); static AtomicWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::Value ifCond); static AtomicWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::Value ifCond); static AtomicWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value expr, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AtomicWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AtomicWriteOp 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 AtomicWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AtomicWriteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AtomicWriteOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::AttachOp declarations //===----------------------------------------------------------------------===// namespace detail { class AttachOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: AttachOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.attach", odsAttrs.getContext()); } AttachOpGenericAdaptorBase(AttachOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class AttachOpGenericAdaptor : public detail::AttachOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AttachOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: AttachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AttachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AttachOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AttachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : AttachOpGenericAdaptor(values, attrs, Properties{}, {}) {} AttachOpGenericAdaptor(RangeT values, const AttachOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AttachOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AttachOpAdaptor : public AttachOpGenericAdaptor<::mlir::ValueRange> { public: using AttachOpGenericAdaptor::AttachOpGenericAdaptor; AttachOpAdaptor(AttachOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AttachOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AttachOpAdaptor; template using GenericAdaptor = AttachOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.attach"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AttachOp 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 AttachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AttachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::AttachOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::AttachOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::CacheOp declarations //===----------------------------------------------------------------------===// namespace detail { class CacheOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: CacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.cache", odsAttrs.getContext()); } CacheOpGenericAdaptorBase(CacheOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class CacheOpGenericAdaptor : public detail::CacheOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CacheOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: CacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CacheOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : CacheOpGenericAdaptor(values, attrs, Properties{}, {}) {} CacheOpGenericAdaptor(RangeT values, const CacheOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CacheOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CacheOpAdaptor : public CacheOpGenericAdaptor<::mlir::ValueRange> { public: using CacheOpGenericAdaptor::CacheOpGenericAdaptor; CacheOpAdaptor(CacheOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CacheOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CacheOpAdaptor; template using GenericAdaptor = CacheOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.cache"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CacheOp 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 CacheOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CacheOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } /// Check if this is a cache with readonly modifier. bool isCacheReadonly(); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::CacheOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::CacheOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ComputeRegionOp declarations //===----------------------------------------------------------------------===// namespace detail { class ComputeRegionOpGenericAdaptorBase { public: struct Properties { using kernel_func_nameTy = ::mlir::FlatSymbolRefAttr; kernel_func_nameTy kernel_func_name; auto getKernelFuncName() const { auto &propStorage = this->kernel_func_name; return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(propStorage); } void setKernelFuncName(const ::mlir::FlatSymbolRefAttr &propValue) { this->kernel_func_name = propValue; } using kernel_module_nameTy = ::mlir::FlatSymbolRefAttr; kernel_module_nameTy kernel_module_name; auto getKernelModuleName() const { auto &propStorage = this->kernel_module_name; return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(propStorage); } void setKernelModuleName(const ::mlir::FlatSymbolRefAttr &propValue) { this->kernel_module_name = propValue; } using originTy = ::mlir::StringAttr; originTy origin; auto getOrigin() const { auto &propStorage = this->origin; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setOrigin(const ::mlir::StringAttr &propValue) { this->origin = 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.kernel_func_name == this->kernel_func_name && rhs.kernel_module_name == this->kernel_module_name && rhs.origin == this->origin && 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: ComputeRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.compute_region", odsAttrs.getContext()); } ComputeRegionOpGenericAdaptorBase(ComputeRegionOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getOriginAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().origin); return attr; } ::llvm::StringRef getOrigin(); ::mlir::FlatSymbolRefAttr getKernelFuncNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().kernel_func_name); return attr; } ::std::optional< ::llvm::StringRef > getKernelFuncName(); ::mlir::FlatSymbolRefAttr getKernelModuleNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().kernel_module_name); return attr; } ::std::optional< ::llvm::StringRef > getKernelModuleName(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ComputeRegionOpGenericAdaptor : public detail::ComputeRegionOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ComputeRegionOpGenericAdaptorBase; static constexpr int odsIndex_launchArgs = 0; static constexpr int odsIndex_inputArgs = 1; static constexpr int odsIndex_stream = 2; public: ComputeRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ComputeRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ComputeRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ComputeRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ComputeRegionOpGenericAdaptor(values, attrs, Properties{}, {}) {} ComputeRegionOpGenericAdaptor(RangeT values, const ComputeRegionOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ComputeRegionOpGenericAdaptor(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 getLaunchArgs() { return getODSOperands(0); } RangeT getInputArgs() { return getODSOperands(1); } ValueT getStream() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ComputeRegionOpAdaptor : public ComputeRegionOpGenericAdaptor<::mlir::ValueRange> { public: using ComputeRegionOpGenericAdaptor::ComputeRegionOpGenericAdaptor; ComputeRegionOpAdaptor(ComputeRegionOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ComputeRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::acc::OffloadRegionOpInterface::Trait, ::mlir::OpTrait::AffineScope, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::OpTrait::IsIsolatedFromAbove> { public: using Op::Op; using Op::print; using Adaptor = ComputeRegionOpAdaptor; template using GenericAdaptor = ComputeRegionOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_launchArgs = 0; static constexpr int odsIndex_inputArgs = 1; static constexpr int odsIndex_stream = 2; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("kernel_func_name"), ::llvm::StringRef("kernel_module_name"), ::llvm::StringRef("origin"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getKernelFuncNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getKernelFuncNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getKernelModuleNameAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getKernelModuleNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getOriginAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getOriginAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::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("acc.compute_region"); } 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 getLaunchArgs() { return getODSOperands(0); } ::mlir::Operation::operand_range getInputArgs() { return getODSOperands(1); } ::mlir::TypedValue<::mlir::Type> getStream() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::MutableOperandRange getLaunchArgsMutable(); ::mlir::MutableOperandRange getInputArgsMutable(); ::mlir::MutableOperandRange getStreamMutable(); 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 getResults() { 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::StringAttr getOriginAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().origin); } ::llvm::StringRef getOrigin(); ::mlir::FlatSymbolRefAttr getKernelFuncNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().kernel_func_name); } ::std::optional< ::llvm::StringRef > getKernelFuncName(); ::mlir::FlatSymbolRefAttr getKernelModuleNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::FlatSymbolRefAttr>(getProperties().kernel_module_name); } ::std::optional< ::llvm::StringRef > getKernelModuleName(); void setOriginAttr(::mlir::StringAttr attr) { getProperties().origin = attr; } void setOrigin(::llvm::StringRef attrValue); void setKernelFuncNameAttr(::mlir::FlatSymbolRefAttr attr) { getProperties().kernel_func_name = attr; } void setKernelFuncName(::std::optional<::llvm::StringRef> attrValue); void setKernelModuleNameAttr(::mlir::FlatSymbolRefAttr attr) { getProperties().kernel_module_name = attr; } void setKernelModuleName(::std::optional<::llvm::StringRef> attrValue); ::mlir::Attribute removeKernelFuncNameAttr() { auto attr = getProperties().kernel_func_name; getProperties().kernel_func_name = {}; return attr; } ::mlir::Attribute removeKernelModuleNameAttr() { auto attr = getProperties().kernel_module_name; getProperties().kernel_module_name = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange launchArgs, ::mlir::ValueRange inputArgs, /*optional*/::mlir::Value stream, ::mlir::StringAttr origin, /*optional*/::mlir::FlatSymbolRefAttr kernel_func_name, /*optional*/::mlir::FlatSymbolRefAttr kernel_module_name); static ComputeRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::ValueRange launchArgs, ::mlir::ValueRange inputArgs, /*optional*/::mlir::Value stream, ::mlir::StringAttr origin, /*optional*/::mlir::FlatSymbolRefAttr kernel_func_name, /*optional*/::mlir::FlatSymbolRefAttr kernel_module_name); static ComputeRegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::ValueRange launchArgs, ::mlir::ValueRange inputArgs, /*optional*/::mlir::Value stream, ::mlir::StringAttr origin, /*optional*/::mlir::FlatSymbolRefAttr kernel_func_name, /*optional*/::mlir::FlatSymbolRefAttr kernel_module_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange launchArgs, ::mlir::ValueRange inputArgs, /*optional*/::mlir::Value stream, ::llvm::StringRef origin, /*optional*/::mlir::FlatSymbolRefAttr kernel_func_name, /*optional*/::mlir::FlatSymbolRefAttr kernel_module_name); static ComputeRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::ValueRange launchArgs, ::mlir::ValueRange inputArgs, /*optional*/::mlir::Value stream, ::llvm::StringRef origin, /*optional*/::mlir::FlatSymbolRefAttr kernel_func_name, /*optional*/::mlir::FlatSymbolRefAttr kernel_module_name); static ComputeRegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::ValueRange launchArgs, ::mlir::ValueRange inputArgs, /*optional*/::mlir::Value stream, ::llvm::StringRef origin, /*optional*/::mlir::FlatSymbolRefAttr kernel_func_name, /*optional*/::mlir::FlatSymbolRefAttr kernel_module_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ComputeRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ComputeRegionOp 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 ComputeRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ComputeRegionOp 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(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); 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 < 3 && "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: /// Look up the par_width op for the given dimension among launch args. std::optional getLaunchArg( ::mlir::acc::GPUParallelDimAttr parDim); /// Get the known (non-empty) launch value for a dimension. std::optional getKnownLaunchArg( ::mlir::acc::GPUParallelDimAttr parDim); /// Get the known constant launch value for a dimension. std::optional getKnownConstantLaunchArg( ::mlir::acc::GPUParallelDimAttr parDim); /// Add a new input argument, appending to both the operand list and /// the region block arguments. Returns the new block argument. ::mlir::BlockArgument appendInputArg(::mlir::Value); /// After hoisting `value`'s defining op, wire it into this region: append it /// as an `ins` operand, add the matching body entry argument, and replace /// uses under this region with that argument (excluding this op's own `ins` /// operand uses). /// /// Requires that `value` is defined outside `getRegion()` and is still used /// inside the region. Otherwise returns `std::nullopt`. std::optional<::mlir::BlockArgument> wireHoistedValueThroughIns(::mlir::Value value); /// Check whether all parallel dimensions have width 1. bool isEffectivelySerial(); /// Get the block argument representing the width for a given dimension. ::mlir::BlockArgument parDimToWidth( ::mlir::acc::GPUParallelDimAttr parDim); /// Get the block argument for a specific gpu::Processor. ::mlir::BlockArgument gpuParWidth(::mlir::gpu::Processor); /// Collect all GPU parallel dimensions present in the launch config. llvm::SmallVector<::mlir::acc::GPUParallelDimAttr> getLaunchParDims(); /// Get the body block of the compute region. ::mlir::Block *getBody() { return &getRegion().front(); } /// Get the terminator of the compute region. ::mlir::Operation *getTerminator() { return &getRegion().back().back(); } /// Return the `launch` or `ins` operand threaded to `blockArg`, or a null /// `Value` if `blockArg` is not an argument of `getBody()` or its index is /// out of range for this op's `launch` and `ins` operands. ::mlir::Value getOperand(::mlir::BlockArgument blockArg); /// If `value` is a launch or input operand, return the body block argument /// it is threaded through; otherwise `std::nullopt`. If `value` matches /// more than one `ins` operand, the first match is returned (canonicalization /// may merge duplicate `ins` values). Duplicate `launch` operands are not /// folded. std::optional<::mlir::BlockArgument> getBlockArg(::mlir::Value value); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ComputeRegionOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ComputeRegionOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::CopyinOp declarations //===----------------------------------------------------------------------===// namespace detail { class CopyinOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: CopyinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.copyin", odsAttrs.getContext()); } CopyinOpGenericAdaptorBase(CopyinOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class CopyinOpGenericAdaptor : public detail::CopyinOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CopyinOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: CopyinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CopyinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CopyinOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CopyinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : CopyinOpGenericAdaptor(values, attrs, Properties{}, {}) {} CopyinOpGenericAdaptor(RangeT values, const CopyinOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CopyinOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CopyinOpAdaptor : public CopyinOpGenericAdaptor<::mlir::ValueRange> { public: using CopyinOpGenericAdaptor::CopyinOpGenericAdaptor; CopyinOpAdaptor(CopyinOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CopyinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CopyinOpAdaptor; template using GenericAdaptor = CopyinOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.copyin"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CopyinOp 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 CopyinOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CopyinOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } /// Check if this is a copyin with readonly modifier. bool isCopyinReadonly(); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::CopyinOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::CopyinOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::CopyoutOp declarations //===----------------------------------------------------------------------===// namespace detail { class CopyoutOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.structured == this->structured && rhs.varType == this->varType && 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: CopyoutOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.copyout", odsAttrs.getContext()); } CopyoutOpGenericAdaptorBase(CopyoutOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); }; } // namespace detail template class CopyoutOpGenericAdaptor : public detail::CopyoutOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CopyoutOpGenericAdaptorBase; static constexpr int odsIndex_accVar = 0; static constexpr int odsIndex_var = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: CopyoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CopyoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CopyoutOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CopyoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : CopyoutOpGenericAdaptor(values, attrs, Properties{}, {}) {} CopyoutOpGenericAdaptor(RangeT values, const CopyoutOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CopyoutOpGenericAdaptor(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 getAccVar() { return (*getODSOperands(0).begin()); } ValueT getVar() { return (*getODSOperands(1).begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CopyoutOpAdaptor : public CopyoutOpGenericAdaptor<::mlir::ValueRange> { public: using CopyoutOpGenericAdaptor::CopyoutOpGenericAdaptor; CopyoutOpAdaptor(CopyoutOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CopyoutOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CopyoutOpAdaptor; template using GenericAdaptor = CopyoutOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_accVar = 0; static constexpr int odsIndex_var = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::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("acc.copyout"); } 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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getAccVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static CopyoutOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static CopyoutOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static CopyoutOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static CopyoutOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static CopyoutOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static CopyoutOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static CopyoutOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CopyoutOp 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 CopyoutOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CopyoutOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 8 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } /// Check if this is a copyout with zero modifier. bool isCopyoutZero(); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::CopyoutOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::CopyoutOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::CreateOp declarations //===----------------------------------------------------------------------===// namespace detail { class CreateOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: CreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.create", odsAttrs.getContext()); } CreateOpGenericAdaptorBase(CreateOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class CreateOpGenericAdaptor : public detail::CreateOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CreateOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: CreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CreateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : CreateOpGenericAdaptor(values, attrs, Properties{}, {}) {} CreateOpGenericAdaptor(RangeT values, const CreateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CreateOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CreateOpAdaptor : public CreateOpGenericAdaptor<::mlir::ValueRange> { public: using CreateOpGenericAdaptor::CreateOpGenericAdaptor; CreateOpAdaptor(CreateOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CreateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CreateOpAdaptor; template using GenericAdaptor = CreateOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.create"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CreateOp 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 CreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } /// Check if this is a create with zero modifier. bool isCreateZero(); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::CreateOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::CreateOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DataBoundsOp declarations //===----------------------------------------------------------------------===// namespace detail { class DataBoundsOpGenericAdaptorBase { public: struct Properties { using strideInBytesTy = ::mlir::BoolAttr; strideInBytesTy strideInBytes; auto getStrideInBytes() const { auto &propStorage = this->strideInBytes; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStrideInBytes(const ::mlir::BoolAttr &propValue) { this->strideInBytes = 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.strideInBytes == this->strideInBytes && 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: DataBoundsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.bounds", odsAttrs.getContext()); } DataBoundsOpGenericAdaptorBase(DataBoundsOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::BoolAttr getStrideInBytesAttr(); bool getStrideInBytes(); }; } // namespace detail template class DataBoundsOpGenericAdaptor : public detail::DataBoundsOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DataBoundsOpGenericAdaptorBase; static constexpr int odsIndex_lowerbound = 0; static constexpr int odsIndex_upperbound = 1; static constexpr int odsIndex_extent = 2; static constexpr int odsIndex_stride = 3; static constexpr int odsIndex_startIdx = 4; public: DataBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DataBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DataBoundsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DataBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DataBoundsOpGenericAdaptor(values, attrs, Properties{}, {}) {} DataBoundsOpGenericAdaptor(RangeT values, const DataBoundsOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DataBoundsOpGenericAdaptor(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 getLowerbound() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getUpperbound() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getExtent() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getStride() { auto operands = getODSOperands(3); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getStartIdx() { auto operands = getODSOperands(4); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DataBoundsOpAdaptor : public DataBoundsOpGenericAdaptor<::mlir::ValueRange> { public: using DataBoundsOpGenericAdaptor::DataBoundsOpGenericAdaptor; DataBoundsOpAdaptor(DataBoundsOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DataBoundsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::acc::OutlineRematerializationOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DataBoundsOpAdaptor; template using GenericAdaptor = DataBoundsOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lowerbound = 0; static constexpr int odsIndex_upperbound = 1; static constexpr int odsIndex_extent = 2; static constexpr int odsIndex_stride = 3; static constexpr int odsIndex_startIdx = 4; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("strideInBytes"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getStrideInBytesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getStrideInBytesAttrName(::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("acc.bounds"); } 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::TypedValue<::mlir::Type> getLowerbound() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getUpperbound() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getExtent() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getStride() { auto operands = getODSOperands(3); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getStartIdx() { auto operands = getODSOperands(4); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::MutableOperandRange getLowerboundMutable(); ::mlir::MutableOperandRange getUpperboundMutable(); ::mlir::MutableOperandRange getExtentMutable(); ::mlir::MutableOperandRange getStrideMutable(); ::mlir::MutableOperandRange getStartIdxMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::acc::DataBoundsType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::DataBoundsType>>(*getODSResults(0).begin()); } 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::BoolAttr getStrideInBytesAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().strideInBytes); } bool getStrideInBytes(); void setStrideInBytesAttr(::mlir::BoolAttr attr) { getProperties().strideInBytes = attr; } void setStrideInBytes(bool attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value extent); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value extent); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value extent); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lowerbound, ::mlir::Value upperbound); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lowerbound, ::mlir::Value upperbound); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lowerbound, ::mlir::Value upperbound); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, ::mlir::BoolAttr strideInBytes, /*optional*/::mlir::Value startIdx); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value lowerbound, /*optional*/::mlir::Value upperbound, /*optional*/::mlir::Value extent, /*optional*/::mlir::Value stride, bool strideInBytes, /*optional*/::mlir::Value startIdx); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::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 DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DataBoundsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DataBoundsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DataBoundsOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::DataBoundsOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DataOp declarations //===----------------------------------------------------------------------===// namespace detail { class DataOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using defaultAttrTy = ::mlir::acc::ClauseDefaultValueAttr; defaultAttrTy defaultAttr; auto getDefaultAttr() const { auto &propStorage = this->defaultAttr; return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(propStorage); } void setDefaultAttr(const ::mlir::acc::ClauseDefaultValueAttr &propValue) { this->defaultAttr = propValue; } using hasWaitDevnumTy = ::mlir::ArrayAttr; hasWaitDevnumTy hasWaitDevnum; auto getHasWaitDevnum() const { auto &propStorage = this->hasWaitDevnum; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setHasWaitDevnum(const ::mlir::ArrayAttr &propValue) { this->hasWaitDevnum = propValue; } using waitOnlyTy = ::mlir::ArrayAttr; waitOnlyTy waitOnly; auto getWaitOnly() const { auto &propStorage = this->waitOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOnly(const ::mlir::ArrayAttr &propValue) { this->waitOnly = propValue; } using waitOperandsDeviceTypeTy = ::mlir::ArrayAttr; waitOperandsDeviceTypeTy waitOperandsDeviceType; auto getWaitOperandsDeviceType() const { auto &propStorage = this->waitOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->waitOperandsDeviceType = propValue; } using waitOperandsSegmentsTy = ::mlir::DenseI32ArrayAttr; waitOperandsSegmentsTy waitOperandsSegments; auto getWaitOperandsSegments() const { auto &propStorage = this->waitOperandsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setWaitOperandsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->waitOperandsSegments = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.defaultAttr == this->defaultAttr && rhs.hasWaitDevnum == this->hasWaitDevnum && rhs.waitOnly == this->waitOnly && rhs.waitOperandsDeviceType == this->waitOperandsDeviceType && rhs.waitOperandsSegments == this->waitOperandsSegments && 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: DataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.data", odsAttrs.getContext()); } DataOpGenericAdaptorBase(DataOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); return attr; } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); return attr; } ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DataOpGenericAdaptor : public detail::DataOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DataOpGenericAdaptorBase; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_asyncOperands = 1; static constexpr int odsIndex_waitOperands = 2; static constexpr int odsIndex_dataClauseOperands = 3; public: DataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DataOpGenericAdaptor(values, attrs, Properties{}, {}) {} DataOpGenericAdaptor(RangeT values, const DataOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DataOpGenericAdaptor(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 getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getAsyncOperands() { return getODSOperands(1); } RangeT getWaitOperands() { return getODSOperands(2); } RangeT getDataClauseOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DataOpAdaptor : public DataOpGenericAdaptor<::mlir::ValueRange> { public: using DataOpGenericAdaptor::DataOpGenericAdaptor; DataOpAdaptor(DataOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DataOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = DataOpAdaptor; template using GenericAdaptor = DataOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_asyncOperands = 1; static constexpr int odsIndex_waitOperands = 2; static constexpr int odsIndex_dataClauseOperands = 3; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::getRegionInvocationBounds; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("defaultAttr"), ::llvm::StringRef("hasWaitDevnum"), ::llvm::StringRef("waitOnly"), ::llvm::StringRef("waitOperandsDeviceType"), ::llvm::StringRef("waitOperandsSegments"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDefaultAttrAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDefaultAttrAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getHasWaitDevnumAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getHasWaitDevnumAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getWaitOnlyAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getWaitOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getWaitOperandsSegmentsAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getWaitOperandsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::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("acc.data"); } 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::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(1); } ::mlir::Operation::operand_range getWaitOperands() { return getODSOperands(2); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(3); } ::mlir::MutableOperandRange getIfCondMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); ::mlir::MutableOperandRange getWaitOperandsMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); } ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setWaitOperandsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().waitOperandsSegments = attr; } void setWaitOperandsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setWaitOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().waitOperandsDeviceType = attr; } void setHasWaitDevnumAttr(::mlir::ArrayAttr attr) { getProperties().hasWaitDevnum = attr; } void setWaitOnlyAttr(::mlir::ArrayAttr attr) { getProperties().waitOnly = attr; } void setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr) { getProperties().defaultAttr = attr; } void setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeWaitOperandsSegmentsAttr() { auto attr = getProperties().waitOperandsSegments; getProperties().waitOperandsSegments = {}; return attr; } ::mlir::Attribute removeWaitOperandsDeviceTypeAttr() { auto attr = getProperties().waitOperandsDeviceType; getProperties().waitOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeHasWaitDevnumAttr() { auto attr = getProperties().hasWaitDevnum; getProperties().hasWaitDevnum = {}; return attr; } ::mlir::Attribute removeWaitOnlyAttr() { auto attr = getProperties().waitOnly; getProperties().waitOnly = {}; return attr; } ::mlir::Attribute removeDefaultAttrAttr() { auto attr = getProperties().defaultAttr; getProperties().defaultAttr = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); static DataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); static DataOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); static DataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); static DataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DataOp 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 DataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 7 && "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: /// The number of data operands. unsigned getNumDataOperands(); /// The i-th data operand passed. Value getDataOperand(unsigned i); /// Return true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly(); /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType); /// Return the value of the async clause if present. mlir::Value getAsyncValue(); /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType); /// Return true if the op has the wait attribute for the /// mlir::acc::DeviceType::None device_type. bool hasWaitOnly(); /// Return true if the op has the wait attribute for the given device_type. bool hasWaitOnly(mlir::acc::DeviceType deviceType); /// Return the values of the wait clause if present. mlir::Operation::operand_range getWaitValues(); /// Return the values of the wait clause for the given device_type if /// present. mlir::Operation::operand_range getWaitValues(mlir::acc::DeviceType deviceType); /// Return the wait devnum value clause if present; mlir::Value getWaitDevnum(); /// Return the wait devnum value clause for the given device_type if /// present. mlir::Value getWaitDevnum(mlir::acc::DeviceType deviceType); /// Add an entry to the 'async-only' attribute (clause spelled without /// arguments) for each of the additional device types (or a none if it is /// empty). void addAsyncOnly(MLIRContext *, llvm::ArrayRef); /// Add a value to the 'async' with the current list of device types. void addAsyncOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an entry to the 'wait-only' attribute (clause spelled without /// arguments) for each of the additional device types (or a none if it is /// empty). void addWaitOnly(MLIRContext *, llvm::ArrayRef); /// Add an array-like entry to the 'wait' with the current list of device /// types. void addWaitOperands(MLIRContext *, bool hasDevnum, mlir::ValueRange, llvm::ArrayRef); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DataOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::DataOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DeclareDeviceResidentOp declarations //===----------------------------------------------------------------------===// namespace detail { class DeclareDeviceResidentOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: DeclareDeviceResidentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.declare_device_resident", odsAttrs.getContext()); } DeclareDeviceResidentOpGenericAdaptorBase(DeclareDeviceResidentOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class DeclareDeviceResidentOpGenericAdaptor : public detail::DeclareDeviceResidentOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DeclareDeviceResidentOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: DeclareDeviceResidentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DeclareDeviceResidentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DeclareDeviceResidentOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DeclareDeviceResidentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DeclareDeviceResidentOpGenericAdaptor(values, attrs, Properties{}, {}) {} DeclareDeviceResidentOpGenericAdaptor(RangeT values, const DeclareDeviceResidentOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DeclareDeviceResidentOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DeclareDeviceResidentOpAdaptor : public DeclareDeviceResidentOpGenericAdaptor<::mlir::ValueRange> { public: using DeclareDeviceResidentOpGenericAdaptor::DeclareDeviceResidentOpGenericAdaptor; DeclareDeviceResidentOpAdaptor(DeclareDeviceResidentOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DeclareDeviceResidentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DeclareDeviceResidentOpAdaptor; template using GenericAdaptor = DeclareDeviceResidentOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.declare_device_resident"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareDeviceResidentOp 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 DeclareDeviceResidentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeclareDeviceResidentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareDeviceResidentOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::DeclareDeviceResidentOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DeclareEnterOp declarations //===----------------------------------------------------------------------===// namespace detail { class DeclareEnterOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DeclareEnterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.declare_enter", odsAttrs.getContext()); } DeclareEnterOpGenericAdaptorBase(DeclareEnterOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class DeclareEnterOpGenericAdaptor : public detail::DeclareEnterOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DeclareEnterOpGenericAdaptorBase; static constexpr int odsIndex_dataClauseOperands = 0; public: DeclareEnterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DeclareEnterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DeclareEnterOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DeclareEnterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DeclareEnterOpGenericAdaptor(values, attrs, Properties{}, {}) {} DeclareEnterOpGenericAdaptor(RangeT values, const DeclareEnterOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DeclareEnterOpGenericAdaptor(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 getDataClauseOperands() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DeclareEnterOpAdaptor : public DeclareEnterOpGenericAdaptor<::mlir::ValueRange> { public: using DeclareEnterOpGenericAdaptor::DeclareEnterOpGenericAdaptor; DeclareEnterOpAdaptor(DeclareEnterOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DeclareEnterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DeclareEnterOpAdaptor; template using GenericAdaptor = DeclareEnterOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_dataClauseOperands = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.declare_enter"); } 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 getDataClauseOperands() { return getODSOperands(0); } ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::acc::DeclareTokenType> getToken() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::DeclareTokenType>>(*getODSResults(0).begin()); } 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, ::mlir::Type token, ::mlir::ValueRange dataClauseOperands); static DeclareEnterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type token, ::mlir::ValueRange dataClauseOperands); static DeclareEnterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type token, ::mlir::ValueRange dataClauseOperands); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareEnterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareEnterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareEnterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareEnterOp create(::mlir::ImplicitLocOpBuilder &builder, ::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 DeclareEnterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeclareEnterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeclareEnterOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeclareEnterOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareEnterOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DeclareExitOp declarations //===----------------------------------------------------------------------===// namespace detail { class DeclareExitOpGenericAdaptorBase { 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: DeclareExitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.declare_exit", odsAttrs.getContext()); } DeclareExitOpGenericAdaptorBase(DeclareExitOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class DeclareExitOpGenericAdaptor : public detail::DeclareExitOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DeclareExitOpGenericAdaptorBase; static constexpr int odsIndex_token = 0; static constexpr int odsIndex_dataClauseOperands = 1; public: DeclareExitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DeclareExitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DeclareExitOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DeclareExitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DeclareExitOpGenericAdaptor(values, attrs, Properties{}, {}) {} DeclareExitOpGenericAdaptor(RangeT values, const DeclareExitOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DeclareExitOpGenericAdaptor(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 getToken() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getDataClauseOperands() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DeclareExitOpAdaptor : public DeclareExitOpGenericAdaptor<::mlir::ValueRange> { public: using DeclareExitOpGenericAdaptor::DeclareExitOpGenericAdaptor; DeclareExitOpAdaptor(DeclareExitOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DeclareExitOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = DeclareExitOpAdaptor; template using GenericAdaptor = DeclareExitOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_token = 0; static constexpr int odsIndex_dataClauseOperands = 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("acc.declare_exit"); } 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::TypedValue<::mlir::acc::DeclareTokenType> getToken() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::DeclareTokenType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::DeclareTokenType>>(*operands.begin()); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(1); } ::mlir::MutableOperandRange getTokenMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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, /*optional*/::mlir::Value token, ::mlir::ValueRange dataClauseOperands); static DeclareExitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value token, ::mlir::ValueRange dataClauseOperands); static DeclareExitOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value token, ::mlir::ValueRange dataClauseOperands); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value token, ::mlir::ValueRange dataClauseOperands); static DeclareExitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value token, ::mlir::ValueRange dataClauseOperands); static DeclareExitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value token, ::mlir::ValueRange dataClauseOperands); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareExitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareExitOp 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 DeclareExitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeclareExitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { return {}; } public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareExitOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::DeclareExitOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DeclareLinkOp declarations //===----------------------------------------------------------------------===// namespace detail { class DeclareLinkOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: DeclareLinkOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.declare_link", odsAttrs.getContext()); } DeclareLinkOpGenericAdaptorBase(DeclareLinkOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class DeclareLinkOpGenericAdaptor : public detail::DeclareLinkOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DeclareLinkOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: DeclareLinkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DeclareLinkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DeclareLinkOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DeclareLinkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DeclareLinkOpGenericAdaptor(values, attrs, Properties{}, {}) {} DeclareLinkOpGenericAdaptor(RangeT values, const DeclareLinkOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DeclareLinkOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DeclareLinkOpAdaptor : public DeclareLinkOpGenericAdaptor<::mlir::ValueRange> { public: using DeclareLinkOpGenericAdaptor::DeclareLinkOpGenericAdaptor; DeclareLinkOpAdaptor(DeclareLinkOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DeclareLinkOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DeclareLinkOpAdaptor; template using GenericAdaptor = DeclareLinkOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.declare_link"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareLinkOp 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 DeclareLinkOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeclareLinkOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareLinkOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::DeclareLinkOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DeclareOp declarations //===----------------------------------------------------------------------===// namespace detail { class DeclareOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DeclareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.declare", odsAttrs.getContext()); } DeclareOpGenericAdaptorBase(DeclareOp 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 DeclareOpGenericAdaptor : public detail::DeclareOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DeclareOpGenericAdaptorBase; static constexpr int odsIndex_dataClauseOperands = 0; public: DeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DeclareOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DeclareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DeclareOpGenericAdaptor(values, attrs, Properties{}, {}) {} DeclareOpGenericAdaptor(RangeT values, const DeclareOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DeclareOpGenericAdaptor(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 getDataClauseOperands() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DeclareOpAdaptor : public DeclareOpGenericAdaptor<::mlir::ValueRange> { public: using DeclareOpGenericAdaptor::DeclareOpGenericAdaptor; DeclareOpAdaptor(DeclareOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DeclareOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = DeclareOpAdaptor; template using GenericAdaptor = DeclareOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_dataClauseOperands = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.declare"); } 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 getDataClauseOperands() { return getODSOperands(0); } ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands); static DeclareOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange dataClauseOperands); static DeclareOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange dataClauseOperands); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareOp 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 DeclareOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeclareOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DeleteOp declarations //===----------------------------------------------------------------------===// namespace detail { class DeleteOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.structured == this->structured && 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: DeleteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.delete", odsAttrs.getContext()); } DeleteOpGenericAdaptorBase(DeleteOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); }; } // namespace detail template class DeleteOpGenericAdaptor : public detail::DeleteOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DeleteOpGenericAdaptorBase; static constexpr int odsIndex_accVar = 0; static constexpr int odsIndex_bounds = 1; static constexpr int odsIndex_asyncOperands = 2; public: DeleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DeleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DeleteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DeleteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DeleteOpGenericAdaptor(values, attrs, Properties{}, {}) {} DeleteOpGenericAdaptor(RangeT values, const DeleteOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DeleteOpGenericAdaptor(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 getAccVar() { return (*getODSOperands(0).begin()); } RangeT getBounds() { return getODSOperands(1); } RangeT getAsyncOperands() { return getODSOperands(2); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DeleteOpAdaptor : public DeleteOpGenericAdaptor<::mlir::ValueRange> { public: using DeleteOpGenericAdaptor::DeleteOpGenericAdaptor; DeleteOpAdaptor(DeleteOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DeleteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DeleteOpAdaptor; template using GenericAdaptor = DeleteOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_accVar = 0; static constexpr int odsIndex_bounds = 1; static constexpr int odsIndex_asyncOperands = 2; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::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("acc.delete"); } 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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(1); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(2); } ::mlir::OpOperand &getAccVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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 getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DeleteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DeleteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DeleteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static DeleteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static DeleteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static DeleteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static DeleteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeleteOp 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 DeleteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeleteOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 7 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DeleteOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::DeleteOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DetachOp declarations //===----------------------------------------------------------------------===// namespace detail { class DetachOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.structured == this->structured && 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: DetachOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.detach", odsAttrs.getContext()); } DetachOpGenericAdaptorBase(DetachOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); }; } // namespace detail template class DetachOpGenericAdaptor : public detail::DetachOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DetachOpGenericAdaptorBase; static constexpr int odsIndex_accVar = 0; static constexpr int odsIndex_bounds = 1; static constexpr int odsIndex_asyncOperands = 2; public: DetachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DetachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DetachOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DetachOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DetachOpGenericAdaptor(values, attrs, Properties{}, {}) {} DetachOpGenericAdaptor(RangeT values, const DetachOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DetachOpGenericAdaptor(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 getAccVar() { return (*getODSOperands(0).begin()); } RangeT getBounds() { return getODSOperands(1); } RangeT getAsyncOperands() { return getODSOperands(2); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DetachOpAdaptor : public DetachOpGenericAdaptor<::mlir::ValueRange> { public: using DetachOpGenericAdaptor::DetachOpGenericAdaptor; DetachOpAdaptor(DetachOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DetachOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DetachOpAdaptor; template using GenericAdaptor = DetachOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_accVar = 0; static constexpr int odsIndex_bounds = 1; static constexpr int odsIndex_asyncOperands = 2; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::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("acc.detach"); } 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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(1); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(2); } ::mlir::OpOperand &getAccVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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 getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DetachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DetachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DetachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static DetachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static DetachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static DetachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static DetachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DetachOp 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 DetachOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DetachOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 7 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DetachOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::DetachOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::DevicePtrOp declarations //===----------------------------------------------------------------------===// namespace detail { class DevicePtrOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: DevicePtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.deviceptr", odsAttrs.getContext()); } DevicePtrOpGenericAdaptorBase(DevicePtrOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class DevicePtrOpGenericAdaptor : public detail::DevicePtrOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DevicePtrOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: DevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DevicePtrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : DevicePtrOpGenericAdaptor(values, attrs, Properties{}, {}) {} DevicePtrOpGenericAdaptor(RangeT values, const DevicePtrOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DevicePtrOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DevicePtrOpAdaptor : public DevicePtrOpGenericAdaptor<::mlir::ValueRange> { public: using DevicePtrOpGenericAdaptor::DevicePtrOpGenericAdaptor; DevicePtrOpAdaptor(DevicePtrOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DevicePtrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DevicePtrOpAdaptor; template using GenericAdaptor = DevicePtrOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.deviceptr"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DevicePtrOp 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 DevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::DevicePtrOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::DevicePtrOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::EnterDataOp declarations //===----------------------------------------------------------------------===// namespace detail { class EnterDataOpGenericAdaptorBase { public: struct Properties { using asyncTy = ::mlir::UnitAttr; asyncTy async; auto getAsync() const { auto &propStorage = this->async; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setAsync(const ::mlir::UnitAttr &propValue) { this->async = propValue; } using waitTy = ::mlir::UnitAttr; waitTy wait; auto getWait() const { auto &propStorage = this->wait; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setWait(const ::mlir::UnitAttr &propValue) { this->wait = 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.async == this->async && rhs.wait == this->wait && 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: EnterDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.enter_data", odsAttrs.getContext()); } EnterDataOpGenericAdaptorBase(EnterDataOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::UnitAttr getAsyncAttr(); bool getAsync(); ::mlir::UnitAttr getWaitAttr(); bool getWait(); }; } // namespace detail template class EnterDataOpGenericAdaptor : public detail::EnterDataOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::EnterDataOpGenericAdaptorBase; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_asyncOperand = 1; static constexpr int odsIndex_waitDevnum = 2; static constexpr int odsIndex_waitOperands = 3; static constexpr int odsIndex_dataClauseOperands = 4; public: EnterDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} EnterDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : EnterDataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} EnterDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : EnterDataOpGenericAdaptor(values, attrs, Properties{}, {}) {} EnterDataOpGenericAdaptor(RangeT values, const EnterDataOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> EnterDataOpGenericAdaptor(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 getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getAsyncOperand() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getWaitDevnum() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getWaitOperands() { return getODSOperands(3); } RangeT getDataClauseOperands() { return getODSOperands(4); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class EnterDataOpAdaptor : public EnterDataOpGenericAdaptor<::mlir::ValueRange> { public: using EnterDataOpGenericAdaptor::EnterDataOpGenericAdaptor; EnterDataOpAdaptor(EnterDataOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class EnterDataOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = EnterDataOpAdaptor; template using GenericAdaptor = EnterDataOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_asyncOperand = 1; static constexpr int odsIndex_waitDevnum = 2; static constexpr int odsIndex_waitOperands = 3; static constexpr int odsIndex_dataClauseOperands = 4; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("async"), ::llvm::StringRef("wait"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getWaitAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getWaitAttrName(::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("acc.enter_data"); } 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::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getAsyncOperand() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getWaitDevnum() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::Operation::operand_range getWaitOperands() { return getODSOperands(3); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(4); } ::mlir::MutableOperandRange getIfCondMutable(); ::mlir::MutableOperandRange getAsyncOperandMutable(); ::mlir::MutableOperandRange getWaitDevnumMutable(); ::mlir::MutableOperandRange getWaitOperandsMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::UnitAttr getAsyncAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); } bool getAsync(); ::mlir::UnitAttr getWaitAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wait); } bool getWait(); void setAsyncAttr(::mlir::UnitAttr attr) { getProperties().async = attr; } void setAsync(bool attrValue); void setWaitAttr(::mlir::UnitAttr attr) { getProperties().wait = attr; } void setWait(bool attrValue); ::mlir::Attribute removeAsyncAttr() { auto attr = getProperties().async; getProperties().async = {}; return attr; } ::mlir::Attribute removeWaitAttr() { auto attr = getProperties().wait; getProperties().wait = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands); static EnterDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands); static EnterDataOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands); static EnterDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands); static EnterDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands); static EnterDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands); static EnterDataOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands); static EnterDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands); static EnterDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static EnterDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static EnterDataOp 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 EnterDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static EnterDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); 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: /// The number of data operands. unsigned getNumDataOperands(); /// The i-th data operand passed. Value getDataOperand(unsigned i); /// Add an entry to the 'async-only' attribute (clause spelled without /// arguments). DeviceType array is supplied even though it should always be /// empty, so this can mirror other versions of this function. void addAsyncOnly(MLIRContext *, llvm::ArrayRef); /// Add a value to the 'async'. DeviceType array is supplied even though it /// should always be empty, so this can mirror other versions of this /// function. void addAsyncOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an entry to the 'wait-only' attribute (clause spelled without /// arguments). DeviceType array is supplied even though it should always be /// empty, so this can mirror other versions of this function. void addWaitOnly(MLIRContext *, llvm::ArrayRef); /// Add an array-like entry to the 'wait'. DeviceType array is supplied /// even though it should always be empty, so this can mirror other versions /// of this function. void addWaitOperands(MLIRContext *, bool hasDevnum, mlir::ValueRange, llvm::ArrayRef); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::EnterDataOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::EnterDataOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ExitDataOp declarations //===----------------------------------------------------------------------===// namespace detail { class ExitDataOpGenericAdaptorBase { public: struct Properties { using asyncTy = ::mlir::UnitAttr; asyncTy async; auto getAsync() const { auto &propStorage = this->async; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setAsync(const ::mlir::UnitAttr &propValue) { this->async = propValue; } using finalizeTy = ::mlir::UnitAttr; finalizeTy finalize; auto getFinalize() const { auto &propStorage = this->finalize; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setFinalize(const ::mlir::UnitAttr &propValue) { this->finalize = propValue; } using waitTy = ::mlir::UnitAttr; waitTy wait; auto getWait() const { auto &propStorage = this->wait; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setWait(const ::mlir::UnitAttr &propValue) { this->wait = 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.async == this->async && rhs.finalize == this->finalize && rhs.wait == this->wait && 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: ExitDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.exit_data", odsAttrs.getContext()); } ExitDataOpGenericAdaptorBase(ExitDataOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::UnitAttr getAsyncAttr(); bool getAsync(); ::mlir::UnitAttr getWaitAttr(); bool getWait(); ::mlir::UnitAttr getFinalizeAttr(); bool getFinalize(); }; } // namespace detail template class ExitDataOpGenericAdaptor : public detail::ExitDataOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ExitDataOpGenericAdaptorBase; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_asyncOperand = 1; static constexpr int odsIndex_waitDevnum = 2; static constexpr int odsIndex_waitOperands = 3; static constexpr int odsIndex_dataClauseOperands = 4; public: ExitDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ExitDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ExitDataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ExitDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ExitDataOpGenericAdaptor(values, attrs, Properties{}, {}) {} ExitDataOpGenericAdaptor(RangeT values, const ExitDataOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ExitDataOpGenericAdaptor(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 getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getAsyncOperand() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getWaitDevnum() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getWaitOperands() { return getODSOperands(3); } RangeT getDataClauseOperands() { return getODSOperands(4); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ExitDataOpAdaptor : public ExitDataOpGenericAdaptor<::mlir::ValueRange> { public: using ExitDataOpGenericAdaptor::ExitDataOpGenericAdaptor; ExitDataOpAdaptor(ExitDataOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ExitDataOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = ExitDataOpAdaptor; template using GenericAdaptor = ExitDataOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_asyncOperand = 1; static constexpr int odsIndex_waitDevnum = 2; static constexpr int odsIndex_waitOperands = 3; static constexpr int odsIndex_dataClauseOperands = 4; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("async"), ::llvm::StringRef("finalize"), ::llvm::StringRef("wait"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getFinalizeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getFinalizeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getWaitAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getWaitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::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("acc.exit_data"); } 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::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getAsyncOperand() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getWaitDevnum() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::Operation::operand_range getWaitOperands() { return getODSOperands(3); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(4); } ::mlir::MutableOperandRange getIfCondMutable(); ::mlir::MutableOperandRange getAsyncOperandMutable(); ::mlir::MutableOperandRange getWaitDevnumMutable(); ::mlir::MutableOperandRange getWaitOperandsMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::UnitAttr getAsyncAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); } bool getAsync(); ::mlir::UnitAttr getWaitAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wait); } bool getWait(); ::mlir::UnitAttr getFinalizeAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().finalize); } bool getFinalize(); void setAsyncAttr(::mlir::UnitAttr attr) { getProperties().async = attr; } void setAsync(bool attrValue); void setWaitAttr(::mlir::UnitAttr attr) { getProperties().wait = attr; } void setWait(bool attrValue); void setFinalizeAttr(::mlir::UnitAttr attr) { getProperties().finalize = attr; } void setFinalize(bool attrValue); ::mlir::Attribute removeAsyncAttr() { auto attr = getProperties().async; getProperties().async = {}; return attr; } ::mlir::Attribute removeWaitAttr() { auto attr = getProperties().wait; getProperties().wait = {}; return attr; } ::mlir::Attribute removeFinalizeAttr() { auto attr = getProperties().finalize; getProperties().finalize = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize); static ExitDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize); static ExitDataOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize); static ExitDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize); static ExitDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr wait, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr finalize); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize = false); static ExitDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize = false); static ExitDataOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize = false); static ExitDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize = false); static ExitDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value asyncOperand, /*optional*/bool async, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool wait, ::mlir::ValueRange dataClauseOperands, /*optional*/bool finalize = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ExitDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ExitDataOp 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 ExitDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ExitDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 3 && "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: /// The number of data operands. unsigned getNumDataOperands(); /// The i-th data operand passed. Value getDataOperand(unsigned i); /// Add an entry to the 'async-only' attribute (clause spelled without /// arguments). DeviceType array is supplied even though it should always be /// empty, so this can mirror other versions of this function. void addAsyncOnly(MLIRContext *, llvm::ArrayRef); /// Add a value to the 'async'. DeviceType array is supplied even though it /// should always be empty, so this can mirror other versions of this /// function. void addAsyncOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an entry to the 'wait-only' attribute (clause spelled without /// arguments). DeviceType array is supplied even though it should always be /// empty, so this can mirror other versions of this function. void addWaitOnly(MLIRContext *, llvm::ArrayRef); /// Add an array-like entry to the 'wait'. DeviceType array is supplied /// even though it should always be empty, so this can mirror other versions /// of this function. void addWaitOperands(MLIRContext *, bool hasDevnum, mlir::ValueRange, llvm::ArrayRef); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ExitDataOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ExitDataOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::FirstprivateMapInitialOp declarations //===----------------------------------------------------------------------===// namespace detail { class FirstprivateMapInitialOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: FirstprivateMapInitialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.firstprivate_map", odsAttrs.getContext()); } FirstprivateMapInitialOpGenericAdaptorBase(FirstprivateMapInitialOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class FirstprivateMapInitialOpGenericAdaptor : public detail::FirstprivateMapInitialOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FirstprivateMapInitialOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: FirstprivateMapInitialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FirstprivateMapInitialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FirstprivateMapInitialOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FirstprivateMapInitialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : FirstprivateMapInitialOpGenericAdaptor(values, attrs, Properties{}, {}) {} FirstprivateMapInitialOpGenericAdaptor(RangeT values, const FirstprivateMapInitialOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FirstprivateMapInitialOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class FirstprivateMapInitialOpAdaptor : public FirstprivateMapInitialOpGenericAdaptor<::mlir::ValueRange> { public: using FirstprivateMapInitialOpGenericAdaptor::FirstprivateMapInitialOpGenericAdaptor; FirstprivateMapInitialOpAdaptor(FirstprivateMapInitialOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FirstprivateMapInitialOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = FirstprivateMapInitialOpAdaptor; template using GenericAdaptor = FirstprivateMapInitialOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.firstprivate_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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FirstprivateMapInitialOp 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 FirstprivateMapInitialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static FirstprivateMapInitialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::FirstprivateMapInitialOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::FirstprivateMapInitialOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::FirstprivateOp declarations //===----------------------------------------------------------------------===// namespace detail { class FirstprivateOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: FirstprivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.firstprivate", odsAttrs.getContext()); } FirstprivateOpGenericAdaptorBase(FirstprivateOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class FirstprivateOpGenericAdaptor : public detail::FirstprivateOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FirstprivateOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: FirstprivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FirstprivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FirstprivateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FirstprivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : FirstprivateOpGenericAdaptor(values, attrs, Properties{}, {}) {} FirstprivateOpGenericAdaptor(RangeT values, const FirstprivateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FirstprivateOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class FirstprivateOpAdaptor : public FirstprivateOpGenericAdaptor<::mlir::ValueRange> { public: using FirstprivateOpGenericAdaptor::FirstprivateOpGenericAdaptor; FirstprivateOpAdaptor(FirstprivateOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FirstprivateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = FirstprivateOpAdaptor; template using GenericAdaptor = FirstprivateOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.firstprivate"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FirstprivateOp 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 FirstprivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static FirstprivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::FirstprivateOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::FirstprivateOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::FirstprivateRecipeOp declarations //===----------------------------------------------------------------------===// namespace detail { class FirstprivateRecipeOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } using typeTy = ::mlir::TypeAttr; typeTy type; auto getType() const { auto &propStorage = this->type; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setType(const ::mlir::TypeAttr &propValue) { this->type = propValue; } bool operator==(const Properties &rhs) const { return rhs.sym_name == this->sym_name && rhs.type == this->type && 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: FirstprivateRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.firstprivate.recipe", odsAttrs.getContext()); } FirstprivateRecipeOpGenericAdaptorBase(FirstprivateRecipeOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::TypeAttr getTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); return attr; } ::mlir::Type getType(); ::mlir::Region &getInitRegion() { return *odsRegions[0]; } ::mlir::Region &getCopyRegion() { return *odsRegions[1]; } ::mlir::Region &getDestroyRegion() { return *odsRegions[2]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class FirstprivateRecipeOpGenericAdaptor : public detail::FirstprivateRecipeOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FirstprivateRecipeOpGenericAdaptorBase; public: FirstprivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FirstprivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FirstprivateRecipeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FirstprivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FirstprivateRecipeOpGenericAdaptor(values, attrs, Properties{}, {}) {} FirstprivateRecipeOpGenericAdaptor(RangeT values, const FirstprivateRecipeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FirstprivateRecipeOpGenericAdaptor(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 getOperands() { return odsOperands; } private: RangeT odsOperands; }; class FirstprivateRecipeOpAdaptor : public FirstprivateRecipeOpGenericAdaptor<::mlir::ValueRange> { public: using FirstprivateRecipeOpGenericAdaptor::FirstprivateRecipeOpGenericAdaptor; FirstprivateRecipeOpAdaptor(FirstprivateRecipeOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FirstprivateRecipeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::SymbolOpInterface::Trait, ::mlir::accomp::RecipeInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope> { public: using Op::Op; using Op::print; using Adaptor = FirstprivateRecipeOpAdaptor; template using GenericAdaptor = FirstprivateRecipeOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.firstprivate.recipe"); } 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)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &getInitRegion() { return (*this)->getRegion(0); } ::mlir::Region &getCopyRegion() { return (*this)->getRegion(1); } ::mlir::Region &getDestroyRegion() { return (*this)->getRegion(2); } 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::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); ::mlir::TypeAttr getTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); } ::mlir::Type getType(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); void setTypeAttr(::mlir::TypeAttr attr) { getProperties().type = attr; } void setType(::mlir::Type attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static FirstprivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static FirstprivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static FirstprivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static FirstprivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type); static FirstprivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::Type type); static FirstprivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::Type type); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); static FirstprivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); static FirstprivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FirstprivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FirstprivateRecipeOp 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 FirstprivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static FirstprivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verifyRegions(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: /// Creates a FirstprivateRecipeOp and populates its regions based on the /// variable type as long as the type implements MappableType or /// PointerLikeType interface. If a type implements both, the MappableType /// API will be preferred. Returns std::nullopt if the recipe cannot be /// created or populated. The builder's current insertion point will be used /// and it must be a valid place for this operation to be inserted. The /// `recipeName` must be a unique name to prevent "redefinition of symbol" /// IR errors. /// The `hostVar` is the original host variable from which the type and /// language-specific metadata are derived. static std::optional createAndPopulate( ::mlir::OpBuilder &builder, ::mlir::Location loc, ::llvm::StringRef recipeName, ::mlir::Value hostVar, ::llvm::StringRef varName = "", ::mlir::ValueRange bounds = {}); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::FirstprivateRecipeOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::FirstprivateRecipeOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::GetDevicePtrOp declarations //===----------------------------------------------------------------------===// namespace detail { class GetDevicePtrOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: GetDevicePtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.getdeviceptr", odsAttrs.getContext()); } GetDevicePtrOpGenericAdaptorBase(GetDevicePtrOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class GetDevicePtrOpGenericAdaptor : public detail::GetDevicePtrOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GetDevicePtrOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: GetDevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GetDevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GetDevicePtrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GetDevicePtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : GetDevicePtrOpGenericAdaptor(values, attrs, Properties{}, {}) {} GetDevicePtrOpGenericAdaptor(RangeT values, const GetDevicePtrOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GetDevicePtrOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class GetDevicePtrOpAdaptor : public GetDevicePtrOpGenericAdaptor<::mlir::ValueRange> { public: using GetDevicePtrOpGenericAdaptor::GetDevicePtrOpGenericAdaptor; GetDevicePtrOpAdaptor(GetDevicePtrOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GetDevicePtrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = GetDevicePtrOpAdaptor; template using GenericAdaptor = GetDevicePtrOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.getdeviceptr"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetDevicePtrOp 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 GetDevicePtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetDevicePtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GetDevicePtrOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::GetDevicePtrOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::GetExtentOp declarations //===----------------------------------------------------------------------===// namespace detail { class GetExtentOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: GetExtentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.get_extent", odsAttrs.getContext()); } GetExtentOpGenericAdaptorBase(GetExtentOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class GetExtentOpGenericAdaptor : public detail::GetExtentOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GetExtentOpGenericAdaptorBase; static constexpr int odsIndex_bounds = 0; public: GetExtentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GetExtentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GetExtentOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GetExtentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GetExtentOpGenericAdaptor(values, attrs, Properties{}, {}) {} GetExtentOpGenericAdaptor(RangeT values, const GetExtentOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GetExtentOpGenericAdaptor(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 getBounds() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class GetExtentOpAdaptor : public GetExtentOpGenericAdaptor<::mlir::ValueRange> { public: using GetExtentOpGenericAdaptor::GetExtentOpGenericAdaptor; GetExtentOpAdaptor(GetExtentOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GetExtentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = GetExtentOpAdaptor; template using GenericAdaptor = GetExtentOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_bounds = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.get_extent"); } 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::acc::DataBoundsType> getBounds() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::DataBoundsType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getBoundsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::IndexType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); } 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, ::mlir::Type result, ::mlir::Value bounds); static GetExtentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value bounds); static GetExtentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value bounds); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bounds); static GetExtentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value bounds); static GetExtentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value bounds); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static GetExtentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static GetExtentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetExtentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetExtentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetExtentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetExtentOp create(::mlir::ImplicitLocOpBuilder &builder, ::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 GetExtentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetExtentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetExtentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetExtentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GetExtentOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::GetLowerboundOp declarations //===----------------------------------------------------------------------===// namespace detail { class GetLowerboundOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: GetLowerboundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.get_lowerbound", odsAttrs.getContext()); } GetLowerboundOpGenericAdaptorBase(GetLowerboundOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class GetLowerboundOpGenericAdaptor : public detail::GetLowerboundOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GetLowerboundOpGenericAdaptorBase; static constexpr int odsIndex_bounds = 0; public: GetLowerboundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GetLowerboundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GetLowerboundOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GetLowerboundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GetLowerboundOpGenericAdaptor(values, attrs, Properties{}, {}) {} GetLowerboundOpGenericAdaptor(RangeT values, const GetLowerboundOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GetLowerboundOpGenericAdaptor(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 getBounds() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class GetLowerboundOpAdaptor : public GetLowerboundOpGenericAdaptor<::mlir::ValueRange> { public: using GetLowerboundOpGenericAdaptor::GetLowerboundOpGenericAdaptor; GetLowerboundOpAdaptor(GetLowerboundOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GetLowerboundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = GetLowerboundOpAdaptor; template using GenericAdaptor = GetLowerboundOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_bounds = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.get_lowerbound"); } 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::acc::DataBoundsType> getBounds() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::DataBoundsType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getBoundsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::IndexType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); } 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, ::mlir::Type result, ::mlir::Value bounds); static GetLowerboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value bounds); static GetLowerboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value bounds); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bounds); static GetLowerboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value bounds); static GetLowerboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value bounds); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static GetLowerboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static GetLowerboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetLowerboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetLowerboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetLowerboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetLowerboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::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 GetLowerboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetLowerboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetLowerboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetLowerboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GetLowerboundOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::GetStrideOp declarations //===----------------------------------------------------------------------===// namespace detail { class GetStrideOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: GetStrideOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.get_stride", odsAttrs.getContext()); } GetStrideOpGenericAdaptorBase(GetStrideOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class GetStrideOpGenericAdaptor : public detail::GetStrideOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GetStrideOpGenericAdaptorBase; static constexpr int odsIndex_bounds = 0; public: GetStrideOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GetStrideOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GetStrideOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GetStrideOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GetStrideOpGenericAdaptor(values, attrs, Properties{}, {}) {} GetStrideOpGenericAdaptor(RangeT values, const GetStrideOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GetStrideOpGenericAdaptor(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 getBounds() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class GetStrideOpAdaptor : public GetStrideOpGenericAdaptor<::mlir::ValueRange> { public: using GetStrideOpGenericAdaptor::GetStrideOpGenericAdaptor; GetStrideOpAdaptor(GetStrideOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GetStrideOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = GetStrideOpAdaptor; template using GenericAdaptor = GetStrideOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_bounds = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.get_stride"); } 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::acc::DataBoundsType> getBounds() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::DataBoundsType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getBoundsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::IndexType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); } 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, ::mlir::Type result, ::mlir::Value bounds); static GetStrideOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value bounds); static GetStrideOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value bounds); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bounds); static GetStrideOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value bounds); static GetStrideOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value bounds); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static GetStrideOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static GetStrideOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetStrideOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetStrideOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetStrideOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetStrideOp create(::mlir::ImplicitLocOpBuilder &builder, ::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 GetStrideOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetStrideOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetStrideOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetStrideOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GetStrideOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::GetUpperboundOp declarations //===----------------------------------------------------------------------===// namespace detail { class GetUpperboundOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: GetUpperboundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.get_upperbound", odsAttrs.getContext()); } GetUpperboundOpGenericAdaptorBase(GetUpperboundOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class GetUpperboundOpGenericAdaptor : public detail::GetUpperboundOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GetUpperboundOpGenericAdaptorBase; static constexpr int odsIndex_bounds = 0; public: GetUpperboundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GetUpperboundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GetUpperboundOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GetUpperboundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GetUpperboundOpGenericAdaptor(values, attrs, Properties{}, {}) {} GetUpperboundOpGenericAdaptor(RangeT values, const GetUpperboundOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GetUpperboundOpGenericAdaptor(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 getBounds() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class GetUpperboundOpAdaptor : public GetUpperboundOpGenericAdaptor<::mlir::ValueRange> { public: using GetUpperboundOpGenericAdaptor::GetUpperboundOpGenericAdaptor; GetUpperboundOpAdaptor(GetUpperboundOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GetUpperboundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = GetUpperboundOpAdaptor; template using GenericAdaptor = GetUpperboundOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_bounds = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.get_upperbound"); } 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::acc::DataBoundsType> getBounds() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::DataBoundsType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getBoundsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::IndexType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); } 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, ::mlir::Type result, ::mlir::Value bounds); static GetUpperboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value bounds); static GetUpperboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value bounds); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bounds); static GetUpperboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value bounds); static GetUpperboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value bounds); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static GetUpperboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static GetUpperboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value bounds); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetUpperboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetUpperboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetUpperboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetUpperboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::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 GetUpperboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetUpperboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetUpperboundOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetUpperboundOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GetUpperboundOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::GlobalConstructorOp declarations //===----------------------------------------------------------------------===// namespace detail { class GlobalConstructorOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } bool operator==(const Properties &rhs) const { return rhs.sym_name == this->sym_name && 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: GlobalConstructorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.global_ctor", odsAttrs.getContext()); } GlobalConstructorOpGenericAdaptorBase(GlobalConstructorOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class GlobalConstructorOpGenericAdaptor : public detail::GlobalConstructorOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GlobalConstructorOpGenericAdaptorBase; public: GlobalConstructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GlobalConstructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GlobalConstructorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GlobalConstructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GlobalConstructorOpGenericAdaptor(values, attrs, Properties{}, {}) {} GlobalConstructorOpGenericAdaptor(RangeT values, const GlobalConstructorOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GlobalConstructorOpGenericAdaptor(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 getOperands() { return odsOperands; } private: RangeT odsOperands; }; class GlobalConstructorOpAdaptor : public GlobalConstructorOpGenericAdaptor<::mlir::ValueRange> { public: using GlobalConstructorOpGenericAdaptor::GlobalConstructorOpGenericAdaptor; GlobalConstructorOpAdaptor(GlobalConstructorOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GlobalConstructorOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = GlobalConstructorOpAdaptor; template using GenericAdaptor = GlobalConstructorOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.global_ctor"); } 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)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name); static GlobalConstructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name); static GlobalConstructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static GlobalConstructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static GlobalConstructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); static GlobalConstructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name); static GlobalConstructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static GlobalConstructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static GlobalConstructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GlobalConstructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GlobalConstructorOp 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 GlobalConstructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GlobalConstructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GlobalConstructorOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::GlobalConstructorOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::GlobalDestructorOp declarations //===----------------------------------------------------------------------===// namespace detail { class GlobalDestructorOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } bool operator==(const Properties &rhs) const { return rhs.sym_name == this->sym_name && 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: GlobalDestructorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.global_dtor", odsAttrs.getContext()); } GlobalDestructorOpGenericAdaptorBase(GlobalDestructorOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class GlobalDestructorOpGenericAdaptor : public detail::GlobalDestructorOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GlobalDestructorOpGenericAdaptorBase; public: GlobalDestructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GlobalDestructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GlobalDestructorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GlobalDestructorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GlobalDestructorOpGenericAdaptor(values, attrs, Properties{}, {}) {} GlobalDestructorOpGenericAdaptor(RangeT values, const GlobalDestructorOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GlobalDestructorOpGenericAdaptor(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 getOperands() { return odsOperands; } private: RangeT odsOperands; }; class GlobalDestructorOpAdaptor : public GlobalDestructorOpGenericAdaptor<::mlir::ValueRange> { public: using GlobalDestructorOpGenericAdaptor::GlobalDestructorOpGenericAdaptor; GlobalDestructorOpAdaptor(GlobalDestructorOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GlobalDestructorOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = GlobalDestructorOpAdaptor; template using GenericAdaptor = GlobalDestructorOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.global_dtor"); } 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)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name); static GlobalDestructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name); static GlobalDestructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static GlobalDestructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static GlobalDestructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); static GlobalDestructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name); static GlobalDestructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static GlobalDestructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static GlobalDestructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GlobalDestructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GlobalDestructorOp 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 GlobalDestructorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GlobalDestructorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::GlobalDestructorOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::GlobalDestructorOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::HostDataOp declarations //===----------------------------------------------------------------------===// namespace detail { class HostDataOpGenericAdaptorBase { public: struct Properties { using ifPresentTy = ::mlir::UnitAttr; ifPresentTy ifPresent; auto getIfPresent() const { auto &propStorage = this->ifPresent; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setIfPresent(const ::mlir::UnitAttr &propValue) { this->ifPresent = 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.ifPresent == this->ifPresent && 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: HostDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.host_data", odsAttrs.getContext()); } HostDataOpGenericAdaptorBase(HostDataOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::UnitAttr getIfPresentAttr(); bool getIfPresent(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class HostDataOpGenericAdaptor : public detail::HostDataOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::HostDataOpGenericAdaptorBase; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_dataClauseOperands = 1; public: HostDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} HostDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : HostDataOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} HostDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : HostDataOpGenericAdaptor(values, attrs, Properties{}, {}) {} HostDataOpGenericAdaptor(RangeT values, const HostDataOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> HostDataOpGenericAdaptor(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 getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getDataClauseOperands() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class HostDataOpAdaptor : public HostDataOpGenericAdaptor<::mlir::ValueRange> { public: using HostDataOpGenericAdaptor::HostDataOpGenericAdaptor; HostDataOpAdaptor(HostDataOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class HostDataOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = HostDataOpAdaptor; template using GenericAdaptor = HostDataOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_dataClauseOperands = 1; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::getRegionInvocationBounds; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("ifPresent"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getIfPresentAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getIfPresentAttrName(::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("acc.host_data"); } 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::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(1); } ::mlir::MutableOperandRange getIfCondMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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::UnitAttr getIfPresentAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().ifPresent); } bool getIfPresent(); void setIfPresentAttr(::mlir::UnitAttr attr) { getProperties().ifPresent = attr; } void setIfPresent(bool attrValue); ::mlir::Attribute removeIfPresentAttr() { auto attr = getProperties().ifPresent; getProperties().ifPresent = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static HostDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static HostDataOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static HostDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static HostDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static HostDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static HostDataOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static HostDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static HostDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static HostDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static HostDataOp 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 HostDataOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static HostDataOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::HostDataOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::HostDataOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::InitOp declarations //===----------------------------------------------------------------------===// namespace detail { class InitOpGenericAdaptorBase { public: struct Properties { using device_typesTy = ::mlir::ArrayAttr; device_typesTy device_types; auto getDeviceTypes() const { auto &propStorage = this->device_types; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setDeviceTypes(const ::mlir::ArrayAttr &propValue) { this->device_types = 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.device_types == this->device_types && 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: InitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.init", odsAttrs.getContext()); } InitOpGenericAdaptorBase(InitOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getDeviceTypesAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().device_types); return attr; } ::std::optional< ::mlir::ArrayAttr > getDeviceTypes(); }; } // namespace detail template class InitOpGenericAdaptor : public detail::InitOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::InitOpGenericAdaptorBase; static constexpr int odsIndex_deviceNum = 0; static constexpr int odsIndex_ifCond = 1; public: InitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} InitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : InitOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} InitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : InitOpGenericAdaptor(values, attrs, Properties{}, {}) {} InitOpGenericAdaptor(RangeT values, const InitOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> InitOpGenericAdaptor(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 getDeviceNum() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getIfCond() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class InitOpAdaptor : public InitOpGenericAdaptor<::mlir::ValueRange> { public: using InitOpGenericAdaptor::InitOpGenericAdaptor; InitOpAdaptor(InitOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class InitOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = InitOpAdaptor; template using GenericAdaptor = InitOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_deviceNum = 0; static constexpr int odsIndex_ifCond = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device_types"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDeviceTypesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDeviceTypesAttrName(::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("acc.init"); } 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::TypedValue<::mlir::Type> getDeviceNum() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::MutableOperandRange getDeviceNumMutable(); ::mlir::MutableOperandRange getIfCondMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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 getDeviceTypesAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().device_types); } ::std::optional< ::mlir::ArrayAttr > getDeviceTypes(); void setDeviceTypesAttr(::mlir::ArrayAttr attr) { getProperties().device_types = attr; } ::mlir::Attribute removeDeviceTypesAttr() { auto attr = getProperties().device_types; getProperties().device_types = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static InitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static InitOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static InitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static InitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static InitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static InitOp 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 InitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static InitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: /// Adds a device type to the list of device types for this directive. void addDeviceType(MLIRContext *, mlir::acc::DeviceType); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::InitOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::InitOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::KernelEnvironmentOp declarations //===----------------------------------------------------------------------===// namespace detail { class KernelEnvironmentOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::UnitAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setAsyncOnly(const ::mlir::UnitAttr &propValue) { this->asyncOnly = propValue; } using waitOnlyTy = ::mlir::UnitAttr; waitOnlyTy waitOnly; auto getWaitOnly() const { auto &propStorage = this->waitOnly; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setWaitOnly(const ::mlir::UnitAttr &propValue) { this->waitOnly = 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.asyncOnly == this->asyncOnly && rhs.waitOnly == this->waitOnly && 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: KernelEnvironmentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.kernel_environment", odsAttrs.getContext()); } KernelEnvironmentOpGenericAdaptorBase(KernelEnvironmentOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::UnitAttr getAsyncOnlyAttr(); bool getAsyncOnly(); ::mlir::UnitAttr getWaitOnlyAttr(); bool getWaitOnly(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class KernelEnvironmentOpGenericAdaptor : public detail::KernelEnvironmentOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::KernelEnvironmentOpGenericAdaptorBase; static constexpr int odsIndex_dataClauseOperands = 0; static constexpr int odsIndex_asyncOperand = 1; static constexpr int odsIndex_waitDevnum = 2; static constexpr int odsIndex_waitOperands = 3; public: KernelEnvironmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} KernelEnvironmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : KernelEnvironmentOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} KernelEnvironmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : KernelEnvironmentOpGenericAdaptor(values, attrs, Properties{}, {}) {} KernelEnvironmentOpGenericAdaptor(RangeT values, const KernelEnvironmentOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> KernelEnvironmentOpGenericAdaptor(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 getDataClauseOperands() { return getODSOperands(0); } ValueT getAsyncOperand() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getWaitDevnum() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getWaitOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class KernelEnvironmentOpAdaptor : public KernelEnvironmentOpGenericAdaptor<::mlir::ValueRange> { public: using KernelEnvironmentOpGenericAdaptor::KernelEnvironmentOpGenericAdaptor; KernelEnvironmentOpAdaptor(KernelEnvironmentOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class KernelEnvironmentOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = KernelEnvironmentOpAdaptor; template using GenericAdaptor = KernelEnvironmentOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_dataClauseOperands = 0; static constexpr int odsIndex_asyncOperand = 1; static constexpr int odsIndex_waitDevnum = 2; static constexpr int odsIndex_waitOperands = 3; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::getRegionInvocationBounds; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("waitOnly"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getWaitOnlyAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getWaitOnlyAttrName(::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("acc.kernel_environment"); } 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 getDataClauseOperands() { return getODSOperands(0); } ::mlir::TypedValue<::mlir::Type> getAsyncOperand() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getWaitDevnum() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::Operation::operand_range getWaitOperands() { return getODSOperands(3); } ::mlir::MutableOperandRange getDataClauseOperandsMutable(); ::mlir::MutableOperandRange getAsyncOperandMutable(); ::mlir::MutableOperandRange getWaitDevnumMutable(); ::mlir::MutableOperandRange getWaitOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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::UnitAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().asyncOnly); } bool getAsyncOnly(); ::mlir::UnitAttr getWaitOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().waitOnly); } bool getWaitOnly(); void setAsyncOnlyAttr(::mlir::UnitAttr attr) { getProperties().asyncOnly = attr; } void setAsyncOnly(bool attrValue); void setWaitOnlyAttr(::mlir::UnitAttr attr) { getProperties().waitOnly = attr; } void setWaitOnly(bool attrValue); ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeWaitOnlyAttr() { auto attr = getProperties().waitOnly; getProperties().waitOnly = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitOnly); static KernelEnvironmentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitOnly); static KernelEnvironmentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitOnly); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitOnly); static KernelEnvironmentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitOnly); static KernelEnvironmentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::UnitAttr asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/::mlir::UnitAttr waitOnly); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/bool asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitOnly = false); static KernelEnvironmentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/bool asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitOnly = false); static KernelEnvironmentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/bool asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitOnly = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/bool asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitOnly = false); static KernelEnvironmentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/bool asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitOnly = false); static KernelEnvironmentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/bool asyncOnly, /*optional*/::mlir::Value waitDevnum, ::mlir::ValueRange waitOperands, /*optional*/bool waitOnly = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static KernelEnvironmentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static KernelEnvironmentOp 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 KernelEnvironmentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static KernelEnvironmentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); 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: /// Create a `KernelEnvironmentOp` populated with data mapping and the /// async/wait clauses for `deviceType` extracted from the given ACC compute /// construct. Emplaces a block in the region and sets the rewriter's /// insertion point to the start of that block so callers can create /// operations inside it (e.g., `acc.compute_region`). template static KernelEnvironmentOp createAndPopulate( ComputeConstructT computeConstruct, ::mlir::acc::DeviceType deviceType, ::mlir::OpBuilder &builder); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::KernelEnvironmentOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::KernelEnvironmentOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::KernelsOp declarations //===----------------------------------------------------------------------===// namespace detail { class KernelsOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using combinedTy = ::mlir::UnitAttr; combinedTy combined; auto getCombined() const { auto &propStorage = this->combined; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setCombined(const ::mlir::UnitAttr &propValue) { this->combined = propValue; } using defaultAttrTy = ::mlir::acc::ClauseDefaultValueAttr; defaultAttrTy defaultAttr; auto getDefaultAttr() const { auto &propStorage = this->defaultAttr; return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(propStorage); } void setDefaultAttr(const ::mlir::acc::ClauseDefaultValueAttr &propValue) { this->defaultAttr = propValue; } using hasWaitDevnumTy = ::mlir::ArrayAttr; hasWaitDevnumTy hasWaitDevnum; auto getHasWaitDevnum() const { auto &propStorage = this->hasWaitDevnum; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setHasWaitDevnum(const ::mlir::ArrayAttr &propValue) { this->hasWaitDevnum = propValue; } using numGangsDeviceTypeTy = ::mlir::ArrayAttr; numGangsDeviceTypeTy numGangsDeviceType; auto getNumGangsDeviceType() const { auto &propStorage = this->numGangsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setNumGangsDeviceType(const ::mlir::ArrayAttr &propValue) { this->numGangsDeviceType = propValue; } using numGangsSegmentsTy = ::mlir::DenseI32ArrayAttr; numGangsSegmentsTy numGangsSegments; auto getNumGangsSegments() const { auto &propStorage = this->numGangsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setNumGangsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->numGangsSegments = propValue; } using numWorkersDeviceTypeTy = ::mlir::ArrayAttr; numWorkersDeviceTypeTy numWorkersDeviceType; auto getNumWorkersDeviceType() const { auto &propStorage = this->numWorkersDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setNumWorkersDeviceType(const ::mlir::ArrayAttr &propValue) { this->numWorkersDeviceType = propValue; } using selfAttrTy = ::mlir::UnitAttr; selfAttrTy selfAttr; auto getSelfAttr() const { auto &propStorage = this->selfAttr; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setSelfAttr(const ::mlir::UnitAttr &propValue) { this->selfAttr = propValue; } using vectorLengthDeviceTypeTy = ::mlir::ArrayAttr; vectorLengthDeviceTypeTy vectorLengthDeviceType; auto getVectorLengthDeviceType() const { auto &propStorage = this->vectorLengthDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setVectorLengthDeviceType(const ::mlir::ArrayAttr &propValue) { this->vectorLengthDeviceType = propValue; } using waitOnlyTy = ::mlir::ArrayAttr; waitOnlyTy waitOnly; auto getWaitOnly() const { auto &propStorage = this->waitOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOnly(const ::mlir::ArrayAttr &propValue) { this->waitOnly = propValue; } using waitOperandsDeviceTypeTy = ::mlir::ArrayAttr; waitOperandsDeviceTypeTy waitOperandsDeviceType; auto getWaitOperandsDeviceType() const { auto &propStorage = this->waitOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->waitOperandsDeviceType = propValue; } using waitOperandsSegmentsTy = ::mlir::DenseI32ArrayAttr; waitOperandsSegmentsTy waitOperandsSegments; auto getWaitOperandsSegments() const { auto &propStorage = this->waitOperandsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setWaitOperandsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->waitOperandsSegments = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.combined == this->combined && rhs.defaultAttr == this->defaultAttr && rhs.hasWaitDevnum == this->hasWaitDevnum && rhs.numGangsDeviceType == this->numGangsDeviceType && rhs.numGangsSegments == this->numGangsSegments && rhs.numWorkersDeviceType == this->numWorkersDeviceType && rhs.selfAttr == this->selfAttr && rhs.vectorLengthDeviceType == this->vectorLengthDeviceType && rhs.waitOnly == this->waitOnly && rhs.waitOperandsDeviceType == this->waitOperandsDeviceType && rhs.waitOperandsSegments == this->waitOperandsSegments && 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: KernelsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.kernels", odsAttrs.getContext()); } KernelsOpGenericAdaptorBase(KernelsOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); return attr; } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::DenseI32ArrayAttr getNumGangsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numGangsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getNumGangsSegments(); ::mlir::ArrayAttr getNumGangsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().numGangsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getNumGangsDeviceType(); ::mlir::ArrayAttr getNumWorkersDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().numWorkersDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getNumWorkersDeviceType(); ::mlir::ArrayAttr getVectorLengthDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vectorLengthDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getVectorLengthDeviceType(); ::mlir::UnitAttr getSelfAttrAttr(); bool getSelfAttr(); ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); return attr; } ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); ::mlir::UnitAttr getCombinedAttr(); bool getCombined(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class KernelsOpGenericAdaptor : public detail::KernelsOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::KernelsOpGenericAdaptorBase; static constexpr int odsIndex_asyncOperands = 0; static constexpr int odsIndex_waitOperands = 1; static constexpr int odsIndex_numGangs = 2; static constexpr int odsIndex_numWorkers = 3; static constexpr int odsIndex_vectorLength = 4; static constexpr int odsIndex_ifCond = 5; static constexpr int odsIndex_selfCond = 6; static constexpr int odsIndex_reductionOperands = 7; static constexpr int odsIndex_privateOperands = 8; static constexpr int odsIndex_firstprivateOperands = 9; static constexpr int odsIndex_dataClauseOperands = 10; public: KernelsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} KernelsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : KernelsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} KernelsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : KernelsOpGenericAdaptor(values, attrs, Properties{}, {}) {} KernelsOpGenericAdaptor(RangeT values, const KernelsOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> KernelsOpGenericAdaptor(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 getAsyncOperands() { return getODSOperands(0); } RangeT getWaitOperands() { return getODSOperands(1); } RangeT getNumGangs() { return getODSOperands(2); } RangeT getNumWorkers() { return getODSOperands(3); } RangeT getVectorLength() { return getODSOperands(4); } ValueT getIfCond() { auto operands = getODSOperands(5); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getSelfCond() { auto operands = getODSOperands(6); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getReductionOperands() { return getODSOperands(7); } RangeT getPrivateOperands() { return getODSOperands(8); } RangeT getFirstprivateOperands() { return getODSOperands(9); } RangeT getDataClauseOperands() { return getODSOperands(10); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class KernelsOpAdaptor : public KernelsOpGenericAdaptor<::mlir::ValueRange> { public: using KernelsOpGenericAdaptor::KernelsOpGenericAdaptor; KernelsOpAdaptor(KernelsOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class KernelsOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = KernelsOpAdaptor; template using GenericAdaptor = KernelsOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_asyncOperands = 0; static constexpr int odsIndex_waitOperands = 1; static constexpr int odsIndex_numGangs = 2; static constexpr int odsIndex_numWorkers = 3; static constexpr int odsIndex_vectorLength = 4; static constexpr int odsIndex_ifCond = 5; static constexpr int odsIndex_selfCond = 6; static constexpr int odsIndex_reductionOperands = 7; static constexpr int odsIndex_privateOperands = 8; static constexpr int odsIndex_firstprivateOperands = 9; static constexpr int odsIndex_dataClauseOperands = 10; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::getRegionInvocationBounds; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("combined"), ::llvm::StringRef("defaultAttr"), ::llvm::StringRef("hasWaitDevnum"), ::llvm::StringRef("numGangsDeviceType"), ::llvm::StringRef("numGangsSegments"), ::llvm::StringRef("numWorkersDeviceType"), ::llvm::StringRef("selfAttr"), ::llvm::StringRef("vectorLengthDeviceType"), ::llvm::StringRef("waitOnly"), ::llvm::StringRef("waitOperandsDeviceType"), ::llvm::StringRef("waitOperandsSegments"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getCombinedAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getCombinedAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getDefaultAttrAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getDefaultAttrAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getHasWaitDevnumAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getHasWaitDevnumAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNumGangsDeviceTypeAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNumGangsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getNumGangsSegmentsAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getNumGangsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getNumWorkersDeviceTypeAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getNumWorkersDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getSelfAttrAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getSelfAttrAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::mlir::StringAttr getVectorLengthDeviceTypeAttrName() { return getAttributeNameForIndex(9); } static ::mlir::StringAttr getVectorLengthDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 9); } ::mlir::StringAttr getWaitOnlyAttrName() { return getAttributeNameForIndex(10); } static ::mlir::StringAttr getWaitOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 10); } ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(11); } static ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 11); } ::mlir::StringAttr getWaitOperandsSegmentsAttrName() { return getAttributeNameForIndex(12); } static ::mlir::StringAttr getWaitOperandsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 12); } ::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("acc.kernels"); } 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 getAsyncOperands() { return getODSOperands(0); } ::mlir::Operation::operand_range getWaitOperands() { return getODSOperands(1); } ::mlir::Operation::operand_range getNumGangs() { return getODSOperands(2); } ::mlir::Operation::operand_range getNumWorkers() { return getODSOperands(3); } ::mlir::Operation::operand_range getVectorLength() { return getODSOperands(4); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(5); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::TypedValue<::mlir::IntegerType> getSelfCond() { auto operands = getODSOperands(6); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::Operation::operand_range getReductionOperands() { return getODSOperands(7); } ::mlir::Operation::operand_range getPrivateOperands() { return getODSOperands(8); } ::mlir::Operation::operand_range getFirstprivateOperands() { return getODSOperands(9); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(10); } ::mlir::MutableOperandRange getAsyncOperandsMutable(); ::mlir::MutableOperandRange getWaitOperandsMutable(); ::mlir::MutableOperandRange getNumGangsMutable(); ::mlir::MutableOperandRange getNumWorkersMutable(); ::mlir::MutableOperandRange getVectorLengthMutable(); ::mlir::MutableOperandRange getIfCondMutable(); ::mlir::MutableOperandRange getSelfCondMutable(); ::mlir::MutableOperandRange getReductionOperandsMutable(); ::mlir::MutableOperandRange getPrivateOperandsMutable(); ::mlir::MutableOperandRange getFirstprivateOperandsMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::DenseI32ArrayAttr getNumGangsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numGangsSegments); } ::std::optional<::llvm::ArrayRef> getNumGangsSegments(); ::mlir::ArrayAttr getNumGangsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().numGangsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getNumGangsDeviceType(); ::mlir::ArrayAttr getNumWorkersDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().numWorkersDeviceType); } ::std::optional< ::mlir::ArrayAttr > getNumWorkersDeviceType(); ::mlir::ArrayAttr getVectorLengthDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vectorLengthDeviceType); } ::std::optional< ::mlir::ArrayAttr > getVectorLengthDeviceType(); ::mlir::UnitAttr getSelfAttrAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); } bool getSelfAttr(); ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); } ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); ::mlir::UnitAttr getCombinedAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().combined); } bool getCombined(); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setWaitOperandsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().waitOperandsSegments = attr; } void setWaitOperandsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setWaitOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().waitOperandsDeviceType = attr; } void setHasWaitDevnumAttr(::mlir::ArrayAttr attr) { getProperties().hasWaitDevnum = attr; } void setWaitOnlyAttr(::mlir::ArrayAttr attr) { getProperties().waitOnly = attr; } void setNumGangsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().numGangsSegments = attr; } void setNumGangsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setNumGangsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().numGangsDeviceType = attr; } void setNumWorkersDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().numWorkersDeviceType = attr; } void setVectorLengthDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().vectorLengthDeviceType = attr; } void setSelfAttrAttr(::mlir::UnitAttr attr) { getProperties().selfAttr = attr; } void setSelfAttr(bool attrValue); void setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr) { getProperties().defaultAttr = attr; } void setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue); void setCombinedAttr(::mlir::UnitAttr attr) { getProperties().combined = attr; } void setCombined(bool attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeWaitOperandsSegmentsAttr() { auto attr = getProperties().waitOperandsSegments; getProperties().waitOperandsSegments = {}; return attr; } ::mlir::Attribute removeWaitOperandsDeviceTypeAttr() { auto attr = getProperties().waitOperandsDeviceType; getProperties().waitOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeHasWaitDevnumAttr() { auto attr = getProperties().hasWaitDevnum; getProperties().hasWaitDevnum = {}; return attr; } ::mlir::Attribute removeWaitOnlyAttr() { auto attr = getProperties().waitOnly; getProperties().waitOnly = {}; return attr; } ::mlir::Attribute removeNumGangsSegmentsAttr() { auto attr = getProperties().numGangsSegments; getProperties().numGangsSegments = {}; return attr; } ::mlir::Attribute removeNumGangsDeviceTypeAttr() { auto attr = getProperties().numGangsDeviceType; getProperties().numGangsDeviceType = {}; return attr; } ::mlir::Attribute removeNumWorkersDeviceTypeAttr() { auto attr = getProperties().numWorkersDeviceType; getProperties().numWorkersDeviceType = {}; return attr; } ::mlir::Attribute removeVectorLengthDeviceTypeAttr() { auto attr = getProperties().vectorLengthDeviceType; getProperties().vectorLengthDeviceType = {}; return attr; } ::mlir::Attribute removeSelfAttrAttr() { auto attr = getProperties().selfAttr; getProperties().selfAttr = {}; return attr; } ::mlir::Attribute removeDefaultAttrAttr() { auto attr = getProperties().defaultAttr; getProperties().defaultAttr = {}; return attr; } ::mlir::Attribute removeCombinedAttr() { auto attr = getProperties().combined; getProperties().combined = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static KernelsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static KernelsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static KernelsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static KernelsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static KernelsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static KernelsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static KernelsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static KernelsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static KernelsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static KernelsOp 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 KernelsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static KernelsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 13 && "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: /// The number of data operands. unsigned getNumDataOperands(); /// The i-th data operand passed. Value getDataOperand(unsigned i); /// Used to retrieve the block inside the op's region. Block &getBody() { return getRegion().front(); } /// Return true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly(); /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType); /// Return the value of the async clause if present. mlir::Value getAsyncValue(); /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType); /// Return the value of the num_workers clause if present. mlir::Value getNumWorkersValue(); /// Return the value of the num_workers clause for the given device_type if /// present. mlir::Value getNumWorkersValue(mlir::acc::DeviceType deviceType); /// Return the value of the vector_length clause if present. mlir::Value getVectorLengthValue(); /// Return the value of the vector_length clause for the given device_type /// if present. mlir::Value getVectorLengthValue(mlir::acc::DeviceType deviceType); /// Return the values of the num_gangs clause if present. mlir::Operation::operand_range getNumGangsValues(); /// Return the values of the num_gangs clause for the given device_type if /// present. mlir::Operation::operand_range getNumGangsValues(mlir::acc::DeviceType deviceType); /// Return true if the op has any num_gangs, num_workers, or vector_length /// clause for the given device_type. bool hasAnyGangWorkerVector(mlir::acc::DeviceType deviceType); /// Return true if the op has the wait attribute for the /// mlir::acc::DeviceType::None device_type. bool hasWaitOnly(); /// Return true if the op has the wait attribute for the given device_type. bool hasWaitOnly(mlir::acc::DeviceType deviceType); /// Return the values of the wait clause if present. mlir::Operation::operand_range getWaitValues(); /// Return the values of the wait clause for the given device_type if /// present. mlir::Operation::operand_range getWaitValues(mlir::acc::DeviceType deviceType); /// Return the wait devnum value clause if present; mlir::Value getWaitDevnum(); /// Return the wait devnum value clause for the given device_type if /// present. mlir::Value getWaitDevnum(mlir::acc::DeviceType deviceType); static mlir::acc::Construct getConstructId() { return mlir::acc::Construct::acc_construct_kernels; } /// Add a value to 'num_workers' with the current list of device types. void addNumWorkersOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add a value to 'vector_length' with the current list of device types. void addVectorLengthOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an entry to the 'async-only' attribute (clause spelled without /// arguments) for each of the additional device types (or a none if it is /// empty). void addAsyncOnly(MLIRContext *, llvm::ArrayRef); /// Add a value to the 'async' with the current list of device types. void addAsyncOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an array-like entry to the 'num_gangs' with the current list of /// device types. void addNumGangsOperands(MLIRContext *, mlir::ValueRange, llvm::ArrayRef); /// Add an entry to the 'wait-only' attribute (clause spelled without /// arguments) for each of the additional device types (or a none if it is /// empty). void addWaitOnly(MLIRContext *, llvm::ArrayRef); /// Add an array-like entry to the 'wait' with the current list of device /// types. void addWaitOperands(MLIRContext *, bool hasDevnum, mlir::ValueRange, llvm::ArrayRef); /// Adds a private clause variable to this operation, including its recipe. void addPrivatization(MLIRContext *, mlir::acc::PrivateOp op, mlir::acc::PrivateRecipeOp recipe); /// Adds a firstprivate clause variable to this operation, including its /// recipe. void addFirstPrivatization(MLIRContext *, mlir::acc::FirstprivateOp op, mlir::acc::FirstprivateRecipeOp recipe); /// Adds a reduction clause variable to this operation, including its /// recipe. void addReduction(MLIRContext *, mlir::acc::ReductionOp op, mlir::acc::ReductionRecipeOp recipe); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::KernelsOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::KernelsOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::LoopOp declarations //===----------------------------------------------------------------------===// namespace detail { class LoopOpGenericAdaptorBase { public: struct Properties { using auto_Ty = ::mlir::ArrayAttr; auto_Ty auto_; auto getAuto_() const { auto &propStorage = this->auto_; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAuto_(const ::mlir::ArrayAttr &propValue) { this->auto_ = propValue; } using collapseTy = ::mlir::ArrayAttr; collapseTy collapse; auto getCollapse() const { auto &propStorage = this->collapse; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setCollapse(const ::mlir::ArrayAttr &propValue) { this->collapse = propValue; } using collapseDeviceTypeTy = ::mlir::ArrayAttr; collapseDeviceTypeTy collapseDeviceType; auto getCollapseDeviceType() const { auto &propStorage = this->collapseDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setCollapseDeviceType(const ::mlir::ArrayAttr &propValue) { this->collapseDeviceType = propValue; } using combinedTy = ::mlir::acc::CombinedConstructsTypeAttr; combinedTy combined; auto getCombined() const { auto &propStorage = this->combined; return ::llvm::dyn_cast_or_null<::mlir::acc::CombinedConstructsTypeAttr>(propStorage); } void setCombined(const ::mlir::acc::CombinedConstructsTypeAttr &propValue) { this->combined = propValue; } using gangTy = ::mlir::ArrayAttr; gangTy gang; auto getGang() const { auto &propStorage = this->gang; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setGang(const ::mlir::ArrayAttr &propValue) { this->gang = propValue; } using gangOperandsArgTypeTy = ::mlir::ArrayAttr; gangOperandsArgTypeTy gangOperandsArgType; auto getGangOperandsArgType() const { auto &propStorage = this->gangOperandsArgType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setGangOperandsArgType(const ::mlir::ArrayAttr &propValue) { this->gangOperandsArgType = propValue; } using gangOperandsDeviceTypeTy = ::mlir::ArrayAttr; gangOperandsDeviceTypeTy gangOperandsDeviceType; auto getGangOperandsDeviceType() const { auto &propStorage = this->gangOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setGangOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->gangOperandsDeviceType = propValue; } using gangOperandsSegmentsTy = ::mlir::DenseI32ArrayAttr; gangOperandsSegmentsTy gangOperandsSegments; auto getGangOperandsSegments() const { auto &propStorage = this->gangOperandsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setGangOperandsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->gangOperandsSegments = propValue; } using inclusiveUpperboundTy = ::mlir::DenseBoolArrayAttr; inclusiveUpperboundTy inclusiveUpperbound; auto getInclusiveUpperbound() const { auto &propStorage = this->inclusiveUpperbound; return ::llvm::dyn_cast_or_null<::mlir::DenseBoolArrayAttr>(propStorage); } void setInclusiveUpperbound(const ::mlir::DenseBoolArrayAttr &propValue) { this->inclusiveUpperbound = propValue; } using independentTy = ::mlir::ArrayAttr; independentTy independent; auto getIndependent() const { auto &propStorage = this->independent; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setIndependent(const ::mlir::ArrayAttr &propValue) { this->independent = propValue; } using seqTy = ::mlir::ArrayAttr; seqTy seq; auto getSeq() const { auto &propStorage = this->seq; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setSeq(const ::mlir::ArrayAttr &propValue) { this->seq = propValue; } using tileOperandsDeviceTypeTy = ::mlir::ArrayAttr; tileOperandsDeviceTypeTy tileOperandsDeviceType; auto getTileOperandsDeviceType() const { auto &propStorage = this->tileOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setTileOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->tileOperandsDeviceType = propValue; } using tileOperandsSegmentsTy = ::mlir::DenseI32ArrayAttr; tileOperandsSegmentsTy tileOperandsSegments; auto getTileOperandsSegments() const { auto &propStorage = this->tileOperandsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setTileOperandsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->tileOperandsSegments = propValue; } using unstructuredTy = ::mlir::UnitAttr; unstructuredTy unstructured; auto getUnstructured() const { auto &propStorage = this->unstructured; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setUnstructured(const ::mlir::UnitAttr &propValue) { this->unstructured = propValue; } using vectorTy = ::mlir::ArrayAttr; vectorTy vector; auto getVector() const { auto &propStorage = this->vector; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setVector(const ::mlir::ArrayAttr &propValue) { this->vector = propValue; } using vectorOperandsDeviceTypeTy = ::mlir::ArrayAttr; vectorOperandsDeviceTypeTy vectorOperandsDeviceType; auto getVectorOperandsDeviceType() const { auto &propStorage = this->vectorOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setVectorOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->vectorOperandsDeviceType = propValue; } using workerTy = ::mlir::ArrayAttr; workerTy worker; auto getWorker() const { auto &propStorage = this->worker; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWorker(const ::mlir::ArrayAttr &propValue) { this->worker = propValue; } using workerNumOperandsDeviceTypeTy = ::mlir::ArrayAttr; workerNumOperandsDeviceTypeTy workerNumOperandsDeviceType; auto getWorkerNumOperandsDeviceType() const { auto &propStorage = this->workerNumOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWorkerNumOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->workerNumOperandsDeviceType = 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.auto_ == this->auto_ && rhs.collapse == this->collapse && rhs.collapseDeviceType == this->collapseDeviceType && rhs.combined == this->combined && rhs.gang == this->gang && rhs.gangOperandsArgType == this->gangOperandsArgType && rhs.gangOperandsDeviceType == this->gangOperandsDeviceType && rhs.gangOperandsSegments == this->gangOperandsSegments && rhs.inclusiveUpperbound == this->inclusiveUpperbound && rhs.independent == this->independent && rhs.seq == this->seq && rhs.tileOperandsDeviceType == this->tileOperandsDeviceType && rhs.tileOperandsSegments == this->tileOperandsSegments && rhs.unstructured == this->unstructured && rhs.vector == this->vector && rhs.vectorOperandsDeviceType == this->vectorOperandsDeviceType && rhs.worker == this->worker && rhs.workerNumOperandsDeviceType == this->workerNumOperandsDeviceType && 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: LoopOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.loop", odsAttrs.getContext()); } LoopOpGenericAdaptorBase(LoopOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseBoolArrayAttr getInclusiveUpperboundAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseBoolArrayAttr>(getProperties().inclusiveUpperbound); return attr; } ::std::optional<::llvm::ArrayRef> getInclusiveUpperbound(); ::mlir::ArrayAttr getCollapseAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().collapse); return attr; } ::std::optional< ::mlir::ArrayAttr > getCollapse(); ::mlir::ArrayAttr getCollapseDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().collapseDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getCollapseDeviceType(); ::mlir::ArrayAttr getGangOperandsArgTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gangOperandsArgType); return attr; } ::std::optional< ::mlir::ArrayAttr > getGangOperandsArgType(); ::mlir::DenseI32ArrayAttr getGangOperandsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().gangOperandsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getGangOperandsSegments(); ::mlir::ArrayAttr getGangOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gangOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getGangOperandsDeviceType(); ::mlir::ArrayAttr getWorkerNumOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().workerNumOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getWorkerNumOperandsDeviceType(); ::mlir::ArrayAttr getVectorOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vectorOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getVectorOperandsDeviceType(); ::mlir::ArrayAttr getSeqAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().seq); return attr; } ::std::optional< ::mlir::ArrayAttr > getSeq(); ::mlir::ArrayAttr getIndependentAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().independent); return attr; } ::std::optional< ::mlir::ArrayAttr > getIndependent(); ::mlir::ArrayAttr getAuto_Attr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().auto_); return attr; } ::std::optional< ::mlir::ArrayAttr > getAuto_(); ::mlir::ArrayAttr getGangAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gang); return attr; } ::std::optional< ::mlir::ArrayAttr > getGang(); ::mlir::ArrayAttr getWorkerAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().worker); return attr; } ::std::optional< ::mlir::ArrayAttr > getWorker(); ::mlir::ArrayAttr getVectorAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vector); return attr; } ::std::optional< ::mlir::ArrayAttr > getVector(); ::mlir::DenseI32ArrayAttr getTileOperandsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().tileOperandsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getTileOperandsSegments(); ::mlir::ArrayAttr getTileOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tileOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getTileOperandsDeviceType(); ::mlir::acc::CombinedConstructsTypeAttr getCombinedAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::CombinedConstructsTypeAttr>(getProperties().combined); return attr; } ::std::optional<::mlir::acc::CombinedConstructsType> getCombined(); ::mlir::UnitAttr getUnstructuredAttr(); bool getUnstructured(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class LoopOpGenericAdaptor : public detail::LoopOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::LoopOpGenericAdaptorBase; static constexpr int odsIndex_lowerbound = 0; static constexpr int odsIndex_upperbound = 1; static constexpr int odsIndex_step = 2; static constexpr int odsIndex_gangOperands = 3; static constexpr int odsIndex_workerNumOperands = 4; static constexpr int odsIndex_vectorOperands = 5; static constexpr int odsIndex_tileOperands = 6; static constexpr int odsIndex_cacheOperands = 7; static constexpr int odsIndex_privateOperands = 8; static constexpr int odsIndex_firstprivateOperands = 9; static constexpr int odsIndex_reductionOperands = 10; public: LoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} LoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LoopOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} LoopOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : LoopOpGenericAdaptor(values, attrs, Properties{}, {}) {} LoopOpGenericAdaptor(RangeT values, const LoopOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> LoopOpGenericAdaptor(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 getLowerbound() { return getODSOperands(0); } RangeT getUpperbound() { return getODSOperands(1); } RangeT getStep() { return getODSOperands(2); } RangeT getGangOperands() { return getODSOperands(3); } RangeT getWorkerNumOperands() { return getODSOperands(4); } RangeT getVectorOperands() { return getODSOperands(5); } RangeT getTileOperands() { return getODSOperands(6); } RangeT getCacheOperands() { return getODSOperands(7); } RangeT getPrivateOperands() { return getODSOperands(8); } RangeT getFirstprivateOperands() { return getODSOperands(9); } RangeT getReductionOperands() { return getODSOperands(10); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class LoopOpAdaptor : public LoopOpGenericAdaptor<::mlir::ValueRange> { public: using LoopOpGenericAdaptor::LoopOpGenericAdaptor; LoopOpAdaptor(LoopOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class LoopOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = LoopOpAdaptor; template using GenericAdaptor = LoopOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lowerbound = 0; static constexpr int odsIndex_upperbound = 1; static constexpr int odsIndex_step = 2; static constexpr int odsIndex_gangOperands = 3; static constexpr int odsIndex_workerNumOperands = 4; static constexpr int odsIndex_vectorOperands = 5; static constexpr int odsIndex_tileOperands = 6; static constexpr int odsIndex_cacheOperands = 7; static constexpr int odsIndex_privateOperands = 8; static constexpr int odsIndex_firstprivateOperands = 9; static constexpr int odsIndex_reductionOperands = 10; using Properties = FoldAdaptor::Properties; using ::mlir::LoopLikeOpInterface::Trait::isDefinedOutsideOfLoop; using ::mlir::LoopLikeOpInterface::Trait::moveOutOfLoop; using ::mlir::LoopLikeOpInterface::Trait::promoteIfSingleIteration; using ::mlir::LoopLikeOpInterface::Trait::getLoopInductionVars; using ::mlir::LoopLikeOpInterface::Trait::getLoopLowerBounds; using ::mlir::LoopLikeOpInterface::Trait::getLoopSteps; using ::mlir::LoopLikeOpInterface::Trait::getLoopUpperBounds; using ::mlir::LoopLikeOpInterface::Trait::getInitsMutable; using ::mlir::LoopLikeOpInterface::Trait::getRegionIterArgs; using ::mlir::LoopLikeOpInterface::Trait::getYieldedValuesMutable; using ::mlir::LoopLikeOpInterface::Trait::getLoopResults; using ::mlir::LoopLikeOpInterface::Trait::replaceWithAdditionalYields; using ::mlir::LoopLikeOpInterface::Trait::getStaticTripCount; using ::mlir::LoopLikeOpInterface::Trait::isValidInductionVarType; using ::mlir::LoopLikeOpInterface::Trait::setLoopLowerBounds; using ::mlir::LoopLikeOpInterface::Trait::setLoopUpperBounds; using ::mlir::LoopLikeOpInterface::Trait::setLoopSteps; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::getRegionInvocationBounds; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("auto_"), ::llvm::StringRef("collapse"), ::llvm::StringRef("collapseDeviceType"), ::llvm::StringRef("combined"), ::llvm::StringRef("gang"), ::llvm::StringRef("gangOperandsArgType"), ::llvm::StringRef("gangOperandsDeviceType"), ::llvm::StringRef("gangOperandsSegments"), ::llvm::StringRef("inclusiveUpperbound"), ::llvm::StringRef("independent"), ::llvm::StringRef("seq"), ::llvm::StringRef("tileOperandsDeviceType"), ::llvm::StringRef("tileOperandsSegments"), ::llvm::StringRef("unstructured"), ::llvm::StringRef("vector"), ::llvm::StringRef("vectorOperandsDeviceType"), ::llvm::StringRef("worker"), ::llvm::StringRef("workerNumOperandsDeviceType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAuto_AttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAuto_AttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getCollapseAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getCollapseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getCollapseDeviceTypeAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getCollapseDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getCombinedAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getCombinedAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getGangAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getGangAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getGangOperandsArgTypeAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getGangOperandsArgTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getGangOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getGangOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getGangOperandsSegmentsAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getGangOperandsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getInclusiveUpperboundAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getInclusiveUpperboundAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::mlir::StringAttr getIndependentAttrName() { return getAttributeNameForIndex(9); } static ::mlir::StringAttr getIndependentAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 9); } ::mlir::StringAttr getSeqAttrName() { return getAttributeNameForIndex(10); } static ::mlir::StringAttr getSeqAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 10); } ::mlir::StringAttr getTileOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(11); } static ::mlir::StringAttr getTileOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 11); } ::mlir::StringAttr getTileOperandsSegmentsAttrName() { return getAttributeNameForIndex(12); } static ::mlir::StringAttr getTileOperandsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 12); } ::mlir::StringAttr getUnstructuredAttrName() { return getAttributeNameForIndex(13); } static ::mlir::StringAttr getUnstructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 13); } ::mlir::StringAttr getVectorAttrName() { return getAttributeNameForIndex(14); } static ::mlir::StringAttr getVectorAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 14); } ::mlir::StringAttr getVectorOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(15); } static ::mlir::StringAttr getVectorOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 15); } ::mlir::StringAttr getWorkerAttrName() { return getAttributeNameForIndex(16); } static ::mlir::StringAttr getWorkerAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 16); } ::mlir::StringAttr getWorkerNumOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(17); } static ::mlir::StringAttr getWorkerNumOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 17); } ::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("acc.loop"); } 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 getLowerbound() { return getODSOperands(0); } ::mlir::Operation::operand_range getUpperbound() { return getODSOperands(1); } ::mlir::Operation::operand_range getStep() { return getODSOperands(2); } ::mlir::Operation::operand_range getGangOperands() { return getODSOperands(3); } ::mlir::Operation::operand_range getWorkerNumOperands() { return getODSOperands(4); } ::mlir::Operation::operand_range getVectorOperands() { return getODSOperands(5); } ::mlir::Operation::operand_range getTileOperands() { return getODSOperands(6); } ::mlir::Operation::operand_range getCacheOperands() { return getODSOperands(7); } ::mlir::Operation::operand_range getPrivateOperands() { return getODSOperands(8); } ::mlir::Operation::operand_range getFirstprivateOperands() { return getODSOperands(9); } ::mlir::Operation::operand_range getReductionOperands() { return getODSOperands(10); } ::mlir::MutableOperandRange getLowerboundMutable(); ::mlir::MutableOperandRange getUpperboundMutable(); ::mlir::MutableOperandRange getStepMutable(); ::mlir::MutableOperandRange getGangOperandsMutable(); ::mlir::MutableOperandRange getWorkerNumOperandsMutable(); ::mlir::MutableOperandRange getVectorOperandsMutable(); ::mlir::MutableOperandRange getTileOperandsMutable(); ::mlir::MutableOperandRange getCacheOperandsMutable(); ::mlir::MutableOperandRange getPrivateOperandsMutable(); ::mlir::MutableOperandRange getFirstprivateOperandsMutable(); ::mlir::MutableOperandRange getReductionOperandsMutable(); 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 getResults() { 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::DenseBoolArrayAttr getInclusiveUpperboundAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseBoolArrayAttr>(getProperties().inclusiveUpperbound); } ::std::optional<::llvm::ArrayRef> getInclusiveUpperbound(); ::mlir::ArrayAttr getCollapseAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().collapse); } ::std::optional< ::mlir::ArrayAttr > getCollapse(); ::mlir::ArrayAttr getCollapseDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().collapseDeviceType); } ::std::optional< ::mlir::ArrayAttr > getCollapseDeviceType(); ::mlir::ArrayAttr getGangOperandsArgTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gangOperandsArgType); } ::std::optional< ::mlir::ArrayAttr > getGangOperandsArgType(); ::mlir::DenseI32ArrayAttr getGangOperandsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().gangOperandsSegments); } ::std::optional<::llvm::ArrayRef> getGangOperandsSegments(); ::mlir::ArrayAttr getGangOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gangOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getGangOperandsDeviceType(); ::mlir::ArrayAttr getWorkerNumOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().workerNumOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getWorkerNumOperandsDeviceType(); ::mlir::ArrayAttr getVectorOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vectorOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getVectorOperandsDeviceType(); ::mlir::ArrayAttr getSeqAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().seq); } ::std::optional< ::mlir::ArrayAttr > getSeq(); ::mlir::ArrayAttr getIndependentAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().independent); } ::std::optional< ::mlir::ArrayAttr > getIndependent(); ::mlir::ArrayAttr getAuto_Attr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().auto_); } ::std::optional< ::mlir::ArrayAttr > getAuto_(); ::mlir::ArrayAttr getGangAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gang); } ::std::optional< ::mlir::ArrayAttr > getGang(); ::mlir::ArrayAttr getWorkerAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().worker); } ::std::optional< ::mlir::ArrayAttr > getWorker(); ::mlir::ArrayAttr getVectorAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vector); } ::std::optional< ::mlir::ArrayAttr > getVector(); ::mlir::DenseI32ArrayAttr getTileOperandsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().tileOperandsSegments); } ::std::optional<::llvm::ArrayRef> getTileOperandsSegments(); ::mlir::ArrayAttr getTileOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().tileOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getTileOperandsDeviceType(); ::mlir::acc::CombinedConstructsTypeAttr getCombinedAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::CombinedConstructsTypeAttr>(getProperties().combined); } ::std::optional<::mlir::acc::CombinedConstructsType> getCombined(); ::mlir::UnitAttr getUnstructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unstructured); } bool getUnstructured(); void setInclusiveUpperboundAttr(::mlir::DenseBoolArrayAttr attr) { getProperties().inclusiveUpperbound = attr; } void setInclusiveUpperbound(::std::optional<::llvm::ArrayRef> attrValue); void setCollapseAttr(::mlir::ArrayAttr attr) { getProperties().collapse = attr; } void setCollapseDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().collapseDeviceType = attr; } void setGangOperandsArgTypeAttr(::mlir::ArrayAttr attr) { getProperties().gangOperandsArgType = attr; } void setGangOperandsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().gangOperandsSegments = attr; } void setGangOperandsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setGangOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().gangOperandsDeviceType = attr; } void setWorkerNumOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().workerNumOperandsDeviceType = attr; } void setVectorOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().vectorOperandsDeviceType = attr; } void setSeqAttr(::mlir::ArrayAttr attr) { getProperties().seq = attr; } void setIndependentAttr(::mlir::ArrayAttr attr) { getProperties().independent = attr; } void setAuto_Attr(::mlir::ArrayAttr attr) { getProperties().auto_ = attr; } void setGangAttr(::mlir::ArrayAttr attr) { getProperties().gang = attr; } void setWorkerAttr(::mlir::ArrayAttr attr) { getProperties().worker = attr; } void setVectorAttr(::mlir::ArrayAttr attr) { getProperties().vector = attr; } void setTileOperandsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().tileOperandsSegments = attr; } void setTileOperandsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setTileOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().tileOperandsDeviceType = attr; } void setCombinedAttr(::mlir::acc::CombinedConstructsTypeAttr attr) { getProperties().combined = attr; } void setCombined(::std::optional<::mlir::acc::CombinedConstructsType> attrValue); void setUnstructuredAttr(::mlir::UnitAttr attr) { getProperties().unstructured = attr; } void setUnstructured(bool attrValue); ::mlir::Attribute removeInclusiveUpperboundAttr() { auto attr = getProperties().inclusiveUpperbound; getProperties().inclusiveUpperbound = {}; return attr; } ::mlir::Attribute removeCollapseAttr() { auto attr = getProperties().collapse; getProperties().collapse = {}; return attr; } ::mlir::Attribute removeCollapseDeviceTypeAttr() { auto attr = getProperties().collapseDeviceType; getProperties().collapseDeviceType = {}; return attr; } ::mlir::Attribute removeGangOperandsArgTypeAttr() { auto attr = getProperties().gangOperandsArgType; getProperties().gangOperandsArgType = {}; return attr; } ::mlir::Attribute removeGangOperandsSegmentsAttr() { auto attr = getProperties().gangOperandsSegments; getProperties().gangOperandsSegments = {}; return attr; } ::mlir::Attribute removeGangOperandsDeviceTypeAttr() { auto attr = getProperties().gangOperandsDeviceType; getProperties().gangOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeWorkerNumOperandsDeviceTypeAttr() { auto attr = getProperties().workerNumOperandsDeviceType; getProperties().workerNumOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeVectorOperandsDeviceTypeAttr() { auto attr = getProperties().vectorOperandsDeviceType; getProperties().vectorOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeSeqAttr() { auto attr = getProperties().seq; getProperties().seq = {}; return attr; } ::mlir::Attribute removeIndependentAttr() { auto attr = getProperties().independent; getProperties().independent = {}; return attr; } ::mlir::Attribute removeAuto_Attr() { auto attr = getProperties().auto_; getProperties().auto_ = {}; return attr; } ::mlir::Attribute removeGangAttr() { auto attr = getProperties().gang; getProperties().gang = {}; return attr; } ::mlir::Attribute removeWorkerAttr() { auto attr = getProperties().worker; getProperties().worker = {}; return attr; } ::mlir::Attribute removeVectorAttr() { auto attr = getProperties().vector; getProperties().vector = {}; return attr; } ::mlir::Attribute removeTileOperandsSegmentsAttr() { auto attr = getProperties().tileOperandsSegments; getProperties().tileOperandsSegments = {}; return attr; } ::mlir::Attribute removeTileOperandsDeviceTypeAttr() { auto attr = getProperties().tileOperandsDeviceType; getProperties().tileOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeCombinedAttr() { auto attr = getProperties().combined; getProperties().combined = {}; return attr; } ::mlir::Attribute removeUnstructuredAttr() { auto attr = getProperties().unstructured; getProperties().unstructured = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange lowerbounds, ::mlir::ValueRange upperbounds, ::mlir::ValueRange steps, LoopParMode parMode); static LoopOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange lowerbounds, ::mlir::ValueRange upperbounds, ::mlir::ValueRange steps, LoopParMode parMode); static LoopOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange lowerbounds, ::mlir::ValueRange upperbounds, ::mlir::ValueRange steps, LoopParMode parMode); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange lowerbound, ::mlir::ValueRange upperbound, ::mlir::ValueRange step, /*optional*/::mlir::DenseBoolArrayAttr inclusiveUpperbound, /*optional*/::mlir::ArrayAttr collapse, /*optional*/::mlir::ArrayAttr collapseDeviceType, ::mlir::ValueRange gangOperands, /*optional*/::mlir::ArrayAttr gangOperandsArgType, /*optional*/::mlir::DenseI32ArrayAttr gangOperandsSegments, /*optional*/::mlir::ArrayAttr gangOperandsDeviceType, ::mlir::ValueRange workerNumOperands, /*optional*/::mlir::ArrayAttr workerNumOperandsDeviceType, ::mlir::ValueRange vectorOperands, /*optional*/::mlir::ArrayAttr vectorOperandsDeviceType, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::ArrayAttr independent, /*optional*/::mlir::ArrayAttr auto_, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, ::mlir::ValueRange tileOperands, /*optional*/::mlir::DenseI32ArrayAttr tileOperandsSegments, /*optional*/::mlir::ArrayAttr tileOperandsDeviceType, ::mlir::ValueRange cacheOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::acc::CombinedConstructsTypeAttr combined, /*optional*/::mlir::UnitAttr unstructured); static LoopOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::ValueRange lowerbound, ::mlir::ValueRange upperbound, ::mlir::ValueRange step, /*optional*/::mlir::DenseBoolArrayAttr inclusiveUpperbound, /*optional*/::mlir::ArrayAttr collapse, /*optional*/::mlir::ArrayAttr collapseDeviceType, ::mlir::ValueRange gangOperands, /*optional*/::mlir::ArrayAttr gangOperandsArgType, /*optional*/::mlir::DenseI32ArrayAttr gangOperandsSegments, /*optional*/::mlir::ArrayAttr gangOperandsDeviceType, ::mlir::ValueRange workerNumOperands, /*optional*/::mlir::ArrayAttr workerNumOperandsDeviceType, ::mlir::ValueRange vectorOperands, /*optional*/::mlir::ArrayAttr vectorOperandsDeviceType, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::ArrayAttr independent, /*optional*/::mlir::ArrayAttr auto_, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, ::mlir::ValueRange tileOperands, /*optional*/::mlir::DenseI32ArrayAttr tileOperandsSegments, /*optional*/::mlir::ArrayAttr tileOperandsDeviceType, ::mlir::ValueRange cacheOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::acc::CombinedConstructsTypeAttr combined, /*optional*/::mlir::UnitAttr unstructured); static LoopOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::ValueRange lowerbound, ::mlir::ValueRange upperbound, ::mlir::ValueRange step, /*optional*/::mlir::DenseBoolArrayAttr inclusiveUpperbound, /*optional*/::mlir::ArrayAttr collapse, /*optional*/::mlir::ArrayAttr collapseDeviceType, ::mlir::ValueRange gangOperands, /*optional*/::mlir::ArrayAttr gangOperandsArgType, /*optional*/::mlir::DenseI32ArrayAttr gangOperandsSegments, /*optional*/::mlir::ArrayAttr gangOperandsDeviceType, ::mlir::ValueRange workerNumOperands, /*optional*/::mlir::ArrayAttr workerNumOperandsDeviceType, ::mlir::ValueRange vectorOperands, /*optional*/::mlir::ArrayAttr vectorOperandsDeviceType, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::ArrayAttr independent, /*optional*/::mlir::ArrayAttr auto_, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, ::mlir::ValueRange tileOperands, /*optional*/::mlir::DenseI32ArrayAttr tileOperandsSegments, /*optional*/::mlir::ArrayAttr tileOperandsDeviceType, ::mlir::ValueRange cacheOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::acc::CombinedConstructsTypeAttr combined, /*optional*/::mlir::UnitAttr unstructured); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange lowerbound, ::mlir::ValueRange upperbound, ::mlir::ValueRange step, /*optional*/::mlir::DenseBoolArrayAttr inclusiveUpperbound, /*optional*/::mlir::ArrayAttr collapse, /*optional*/::mlir::ArrayAttr collapseDeviceType, ::mlir::ValueRange gangOperands, /*optional*/::mlir::ArrayAttr gangOperandsArgType, /*optional*/::mlir::DenseI32ArrayAttr gangOperandsSegments, /*optional*/::mlir::ArrayAttr gangOperandsDeviceType, ::mlir::ValueRange workerNumOperands, /*optional*/::mlir::ArrayAttr workerNumOperandsDeviceType, ::mlir::ValueRange vectorOperands, /*optional*/::mlir::ArrayAttr vectorOperandsDeviceType, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::ArrayAttr independent, /*optional*/::mlir::ArrayAttr auto_, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, ::mlir::ValueRange tileOperands, /*optional*/::mlir::DenseI32ArrayAttr tileOperandsSegments, /*optional*/::mlir::ArrayAttr tileOperandsDeviceType, ::mlir::ValueRange cacheOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::acc::CombinedConstructsTypeAttr combined, /*optional*/bool unstructured = false); static LoopOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange results, ::mlir::ValueRange lowerbound, ::mlir::ValueRange upperbound, ::mlir::ValueRange step, /*optional*/::mlir::DenseBoolArrayAttr inclusiveUpperbound, /*optional*/::mlir::ArrayAttr collapse, /*optional*/::mlir::ArrayAttr collapseDeviceType, ::mlir::ValueRange gangOperands, /*optional*/::mlir::ArrayAttr gangOperandsArgType, /*optional*/::mlir::DenseI32ArrayAttr gangOperandsSegments, /*optional*/::mlir::ArrayAttr gangOperandsDeviceType, ::mlir::ValueRange workerNumOperands, /*optional*/::mlir::ArrayAttr workerNumOperandsDeviceType, ::mlir::ValueRange vectorOperands, /*optional*/::mlir::ArrayAttr vectorOperandsDeviceType, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::ArrayAttr independent, /*optional*/::mlir::ArrayAttr auto_, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, ::mlir::ValueRange tileOperands, /*optional*/::mlir::DenseI32ArrayAttr tileOperandsSegments, /*optional*/::mlir::ArrayAttr tileOperandsDeviceType, ::mlir::ValueRange cacheOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::acc::CombinedConstructsTypeAttr combined, /*optional*/bool unstructured = false); static LoopOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange results, ::mlir::ValueRange lowerbound, ::mlir::ValueRange upperbound, ::mlir::ValueRange step, /*optional*/::mlir::DenseBoolArrayAttr inclusiveUpperbound, /*optional*/::mlir::ArrayAttr collapse, /*optional*/::mlir::ArrayAttr collapseDeviceType, ::mlir::ValueRange gangOperands, /*optional*/::mlir::ArrayAttr gangOperandsArgType, /*optional*/::mlir::DenseI32ArrayAttr gangOperandsSegments, /*optional*/::mlir::ArrayAttr gangOperandsDeviceType, ::mlir::ValueRange workerNumOperands, /*optional*/::mlir::ArrayAttr workerNumOperandsDeviceType, ::mlir::ValueRange vectorOperands, /*optional*/::mlir::ArrayAttr vectorOperandsDeviceType, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::ArrayAttr independent, /*optional*/::mlir::ArrayAttr auto_, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, ::mlir::ValueRange tileOperands, /*optional*/::mlir::DenseI32ArrayAttr tileOperandsSegments, /*optional*/::mlir::ArrayAttr tileOperandsDeviceType, ::mlir::ValueRange cacheOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange reductionOperands, /*optional*/::mlir::acc::CombinedConstructsTypeAttr combined, /*optional*/bool unstructured = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LoopOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LoopOp 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 LoopOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static LoopOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); ::llvm::SmallVector<::mlir::Region *> getLoopRegions(); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 18 && "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: static StringRef getAutoAttrStrName() { return "auto"; } static StringRef getGangNumKeyword() { return "num"; } static StringRef getGangDimKeyword() { return "dim"; } static StringRef getGangStaticKeyword() { return "static"; } static StringRef getControlKeyword() { return "control"; } /// The number of private and reduction operands. unsigned getNumDataOperands(); /// The i-th data operand passed. Value getDataOperand(unsigned i); /// Used to retrieve the block inside the op's region. Block &getBody() { return getLoopRegions().front()->front(); } /// Used to determine if this operation is merely a container for a loop /// operation instead of being loop-like itself. bool isLoopLike() { return !getLowerbound().empty(); } bool isContainerLike() { return !isLoopLike(); } /// Return true if the op has the auto attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAuto(); /// Return true if the op has the auto attribute for the given device_type. bool hasAuto(mlir::acc::DeviceType deviceType); /// Return true if the op has the independent attribute for the /// mlir::acc::DeviceType::None device_type. bool hasIndependent(); /// Return true if the op has the independent attribute for the given /// device_type. bool hasIndependent(mlir::acc::DeviceType deviceType); /// Return true if the op has the seq attribute for the /// mlir::acc::DeviceType::None device_type. bool hasSeq(); /// Return true if the op has the seq attribute for the given device_type. bool hasSeq(mlir::acc::DeviceType deviceType); /// Return the value of the vector clause if present. mlir::Value getVectorValue(); /// Return the value of the vector clause for the given device_type /// if present. mlir::Value getVectorValue(mlir::acc::DeviceType deviceType); /// Return true if the op has the vector attribute for the /// mlir::acc::DeviceType::None device_type. bool hasVector(); /// Return true if the op has the vector attribute for the given /// device_type. bool hasVector(mlir::acc::DeviceType deviceType); /// Return the value of the worker clause if present. mlir::Value getWorkerValue(); /// Return the value of the worker clause for the given device_type /// if present. mlir::Value getWorkerValue(mlir::acc::DeviceType deviceType); /// Return true if the op has the worker attribute for the /// mlir::acc::DeviceType::None device_type. bool hasWorker(); /// Return true if the op has the worker attribute for the given /// device_type. bool hasWorker(mlir::acc::DeviceType deviceType); /// Return the values of the tile clause if present. mlir::Operation::operand_range getTileValues(); /// Return the values of the tile clause for the given device_type if /// present. mlir::Operation::operand_range getTileValues(mlir::acc::DeviceType deviceType); /// Return the value of the collapse clause if present. std::optional getCollapseValue(); /// Return the value of the collapse clause for the given device_type /// if present. std::optional getCollapseValue(mlir::acc::DeviceType deviceType); /// Return true if the op has the gang attribute for the /// mlir::acc::DeviceType::None device_type. bool hasGang(); /// Return true if the op has the gang attribute for the given /// device_type. bool hasGang(mlir::acc::DeviceType deviceType); /// Return the value of the worker clause if present. mlir::Value getGangValue(mlir::acc::GangArgType gangArgType); /// Return the value of the worker clause for the given device_type /// if present. mlir::Value getGangValue(mlir::acc::GangArgType gangArgType, mlir::acc::DeviceType deviceType); // Add an entry to the 'seq' attribute for each additional device types. void addSeq(MLIRContext *, llvm::ArrayRef); // Add an entry to the 'independent' attribute for each additional device // types. void addIndependent(MLIRContext *, llvm::ArrayRef); // Add an entry to the 'auto' attribute for each additional device types. void addAuto(MLIRContext *, llvm::ArrayRef); // Sets the collapse value for this 'loop' for a set of DeviceTypes. Note // that this may only be set once per DeviceType, and will fail the verifier // if this is set multiple times. void setCollapseForDeviceTypes(MLIRContext *, llvm::ArrayRef, llvm::APInt); // Sets the tile values for this 'loop' for a set of DeviceTypes. All of the // values should be integral constants, with the '*' represented as a '-1'. void setTileForDeviceTypes(MLIRContext *, llvm::ArrayRef, mlir::ValueRange); // Add a value to the 'vector' list with a current list of device_types. void addVectorOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); // Add an empty value to the 'vector' list with a current list of // device_types. This is for the case where there is no expression specified // in a 'vector'. void addEmptyVector(MLIRContext *, llvm::ArrayRef); // Add a value to the 'worker' list with a current list of device_types. void addWorkerNumOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); // Add an empty value to the 'worker' list with a current list of // device_types. This is for the case where there is no expression specified // in a 'worker'. void addEmptyWorker(MLIRContext *, llvm::ArrayRef); // Adds a collection of operands for a 'gang' clause that has various types // corresponding to each operand. void addGangOperands(MLIRContext *, llvm::ArrayRef, llvm::ArrayRef, mlir::ValueRange); // Add an empty value to the 'gang' list with a current list of // device_types. This is for the case where there is no expression specified // in a 'gang'. void addEmptyGang(MLIRContext *, llvm::ArrayRef); // Return whether this LoopOp has an auto, seq, or independent for the // specified device-type. bool hasParallelismFlag(DeviceType); // Return whether this LoopOp has a gang, worker, or vector applying to the // 'default'/None device-type. bool hasDefaultGangWorkerVector(); // Return whether this LoopOp has a gang, worker, or vector for the given // device-type. bool hasAnyGangWorkerVector(DeviceType deviceType); // Used to obtain the parallelism mode for the requested device type. // This first checks if the mode is set for the device_type requested. // And if not, it returns the non-device_type mode. LoopParMode getDefaultOrDeviceTypeParallelism(DeviceType); /// Adds a private clause variable to this operation, including its recipe. void addPrivatization(MLIRContext *, mlir::acc::PrivateOp op, mlir::acc::PrivateRecipeOp recipe); /// Adds a firstprivate clause variable to this operation, including its /// recipe. void addFirstPrivatization(MLIRContext *, mlir::acc::FirstprivateOp op, mlir::acc::FirstprivateRecipeOp recipe); /// Adds a reduction clause variable to this operation, including its /// recipe. void addReduction(MLIRContext *, mlir::acc::ReductionOp op, mlir::acc::ReductionRecipeOp recipe); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::LoopOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::LoopOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::NoCreateOp declarations //===----------------------------------------------------------------------===// namespace detail { class NoCreateOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: NoCreateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.nocreate", odsAttrs.getContext()); } NoCreateOpGenericAdaptorBase(NoCreateOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class NoCreateOpGenericAdaptor : public detail::NoCreateOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::NoCreateOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: NoCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} NoCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : NoCreateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} NoCreateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : NoCreateOpGenericAdaptor(values, attrs, Properties{}, {}) {} NoCreateOpGenericAdaptor(RangeT values, const NoCreateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> NoCreateOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class NoCreateOpAdaptor : public NoCreateOpGenericAdaptor<::mlir::ValueRange> { public: using NoCreateOpGenericAdaptor::NoCreateOpGenericAdaptor; NoCreateOpAdaptor(NoCreateOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class NoCreateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = NoCreateOpAdaptor; template using GenericAdaptor = NoCreateOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.nocreate"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static NoCreateOp 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 NoCreateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static NoCreateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::NoCreateOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::NoCreateOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ParWidthOp declarations //===----------------------------------------------------------------------===// namespace detail { class ParWidthOpGenericAdaptorBase { public: struct Properties { using par_dimTy = ::mlir::acc::GPUParallelDimAttr; par_dimTy par_dim; auto getParDim() const { auto &propStorage = this->par_dim; return ::llvm::cast<::mlir::acc::GPUParallelDimAttr>(propStorage); } void setParDim(const ::mlir::acc::GPUParallelDimAttr &propValue) { this->par_dim = propValue; } bool operator==(const Properties &rhs) const { return rhs.par_dim == this->par_dim && 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: ParWidthOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.par_width", odsAttrs.getContext()); } ParWidthOpGenericAdaptorBase(ParWidthOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::acc::GPUParallelDimAttr getParDimAttr() { auto attr = ::llvm::cast<::mlir::acc::GPUParallelDimAttr>(getProperties().par_dim); return attr; } ::mlir::acc::GPUParallelDimAttr getParDim(); }; } // namespace detail template class ParWidthOpGenericAdaptor : public detail::ParWidthOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ParWidthOpGenericAdaptorBase; static constexpr int odsIndex_launchArg = 0; public: ParWidthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ParWidthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ParWidthOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ParWidthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ParWidthOpGenericAdaptor(values, attrs, Properties{}, {}) {} ParWidthOpGenericAdaptor(RangeT values, const ParWidthOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ParWidthOpGenericAdaptor(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 getLaunchArg() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ParWidthOpAdaptor : public ParWidthOpGenericAdaptor<::mlir::ValueRange> { public: using ParWidthOpGenericAdaptor::ParWidthOpGenericAdaptor; ParWidthOpAdaptor(ParWidthOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ParWidthOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ParWidthOpAdaptor; template using GenericAdaptor = ParWidthOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_launchArg = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("par_dim")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getParDimAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getParDimAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.par_width"); } 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::TypedValue<::mlir::IndexType> getLaunchArg() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::IndexType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*operands.begin()); } ::mlir::MutableOperandRange getLaunchArgMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::IndexType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin()); } 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::acc::GPUParallelDimAttr getParDimAttr() { return ::llvm::cast<::mlir::acc::GPUParallelDimAttr>(getProperties().par_dim); } ::mlir::acc::GPUParallelDimAttr getParDim(); void setParDimAttr(::mlir::acc::GPUParallelDimAttr attr) { getProperties().par_dim = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static ParWidthOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static ParWidthOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static ParWidthOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static ParWidthOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static ParWidthOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static ParWidthOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value launchArg, ::mlir::acc::GPUParallelDimAttr par_dim); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParWidthOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParWidthOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParWidthOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParWidthOp create(::mlir::ImplicitLocOpBuilder &builder, ::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 ParWidthOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParWidthOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParWidthOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParWidthOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ParWidthOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ParWidthOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ParallelOp declarations //===----------------------------------------------------------------------===// namespace detail { class ParallelOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using combinedTy = ::mlir::UnitAttr; combinedTy combined; auto getCombined() const { auto &propStorage = this->combined; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setCombined(const ::mlir::UnitAttr &propValue) { this->combined = propValue; } using defaultAttrTy = ::mlir::acc::ClauseDefaultValueAttr; defaultAttrTy defaultAttr; auto getDefaultAttr() const { auto &propStorage = this->defaultAttr; return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(propStorage); } void setDefaultAttr(const ::mlir::acc::ClauseDefaultValueAttr &propValue) { this->defaultAttr = propValue; } using hasWaitDevnumTy = ::mlir::ArrayAttr; hasWaitDevnumTy hasWaitDevnum; auto getHasWaitDevnum() const { auto &propStorage = this->hasWaitDevnum; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setHasWaitDevnum(const ::mlir::ArrayAttr &propValue) { this->hasWaitDevnum = propValue; } using numGangsDeviceTypeTy = ::mlir::ArrayAttr; numGangsDeviceTypeTy numGangsDeviceType; auto getNumGangsDeviceType() const { auto &propStorage = this->numGangsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setNumGangsDeviceType(const ::mlir::ArrayAttr &propValue) { this->numGangsDeviceType = propValue; } using numGangsSegmentsTy = ::mlir::DenseI32ArrayAttr; numGangsSegmentsTy numGangsSegments; auto getNumGangsSegments() const { auto &propStorage = this->numGangsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setNumGangsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->numGangsSegments = propValue; } using numWorkersDeviceTypeTy = ::mlir::ArrayAttr; numWorkersDeviceTypeTy numWorkersDeviceType; auto getNumWorkersDeviceType() const { auto &propStorage = this->numWorkersDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setNumWorkersDeviceType(const ::mlir::ArrayAttr &propValue) { this->numWorkersDeviceType = propValue; } using selfAttrTy = ::mlir::UnitAttr; selfAttrTy selfAttr; auto getSelfAttr() const { auto &propStorage = this->selfAttr; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setSelfAttr(const ::mlir::UnitAttr &propValue) { this->selfAttr = propValue; } using vectorLengthDeviceTypeTy = ::mlir::ArrayAttr; vectorLengthDeviceTypeTy vectorLengthDeviceType; auto getVectorLengthDeviceType() const { auto &propStorage = this->vectorLengthDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setVectorLengthDeviceType(const ::mlir::ArrayAttr &propValue) { this->vectorLengthDeviceType = propValue; } using waitOnlyTy = ::mlir::ArrayAttr; waitOnlyTy waitOnly; auto getWaitOnly() const { auto &propStorage = this->waitOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOnly(const ::mlir::ArrayAttr &propValue) { this->waitOnly = propValue; } using waitOperandsDeviceTypeTy = ::mlir::ArrayAttr; waitOperandsDeviceTypeTy waitOperandsDeviceType; auto getWaitOperandsDeviceType() const { auto &propStorage = this->waitOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->waitOperandsDeviceType = propValue; } using waitOperandsSegmentsTy = ::mlir::DenseI32ArrayAttr; waitOperandsSegmentsTy waitOperandsSegments; auto getWaitOperandsSegments() const { auto &propStorage = this->waitOperandsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setWaitOperandsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->waitOperandsSegments = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.combined == this->combined && rhs.defaultAttr == this->defaultAttr && rhs.hasWaitDevnum == this->hasWaitDevnum && rhs.numGangsDeviceType == this->numGangsDeviceType && rhs.numGangsSegments == this->numGangsSegments && rhs.numWorkersDeviceType == this->numWorkersDeviceType && rhs.selfAttr == this->selfAttr && rhs.vectorLengthDeviceType == this->vectorLengthDeviceType && rhs.waitOnly == this->waitOnly && rhs.waitOperandsDeviceType == this->waitOperandsDeviceType && rhs.waitOperandsSegments == this->waitOperandsSegments && 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: ParallelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.parallel", odsAttrs.getContext()); } ParallelOpGenericAdaptorBase(ParallelOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); return attr; } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::DenseI32ArrayAttr getNumGangsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numGangsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getNumGangsSegments(); ::mlir::ArrayAttr getNumGangsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().numGangsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getNumGangsDeviceType(); ::mlir::ArrayAttr getNumWorkersDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().numWorkersDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getNumWorkersDeviceType(); ::mlir::ArrayAttr getVectorLengthDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vectorLengthDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getVectorLengthDeviceType(); ::mlir::UnitAttr getSelfAttrAttr(); bool getSelfAttr(); ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); return attr; } ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); ::mlir::UnitAttr getCombinedAttr(); bool getCombined(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ParallelOpGenericAdaptor : public detail::ParallelOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ParallelOpGenericAdaptorBase; static constexpr int odsIndex_asyncOperands = 0; static constexpr int odsIndex_waitOperands = 1; static constexpr int odsIndex_numGangs = 2; static constexpr int odsIndex_numWorkers = 3; static constexpr int odsIndex_vectorLength = 4; static constexpr int odsIndex_ifCond = 5; static constexpr int odsIndex_selfCond = 6; static constexpr int odsIndex_reductionOperands = 7; static constexpr int odsIndex_privateOperands = 8; static constexpr int odsIndex_firstprivateOperands = 9; static constexpr int odsIndex_dataClauseOperands = 10; public: ParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ParallelOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ParallelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ParallelOpGenericAdaptor(values, attrs, Properties{}, {}) {} ParallelOpGenericAdaptor(RangeT values, const ParallelOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ParallelOpGenericAdaptor(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 getAsyncOperands() { return getODSOperands(0); } RangeT getWaitOperands() { return getODSOperands(1); } RangeT getNumGangs() { return getODSOperands(2); } RangeT getNumWorkers() { return getODSOperands(3); } RangeT getVectorLength() { return getODSOperands(4); } ValueT getIfCond() { auto operands = getODSOperands(5); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getSelfCond() { auto operands = getODSOperands(6); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getReductionOperands() { return getODSOperands(7); } RangeT getPrivateOperands() { return getODSOperands(8); } RangeT getFirstprivateOperands() { return getODSOperands(9); } RangeT getDataClauseOperands() { return getODSOperands(10); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ParallelOpAdaptor : public ParallelOpGenericAdaptor<::mlir::ValueRange> { public: using ParallelOpGenericAdaptor::ParallelOpGenericAdaptor; ParallelOpAdaptor(ParallelOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ParallelOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = ParallelOpAdaptor; template using GenericAdaptor = ParallelOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_asyncOperands = 0; static constexpr int odsIndex_waitOperands = 1; static constexpr int odsIndex_numGangs = 2; static constexpr int odsIndex_numWorkers = 3; static constexpr int odsIndex_vectorLength = 4; static constexpr int odsIndex_ifCond = 5; static constexpr int odsIndex_selfCond = 6; static constexpr int odsIndex_reductionOperands = 7; static constexpr int odsIndex_privateOperands = 8; static constexpr int odsIndex_firstprivateOperands = 9; static constexpr int odsIndex_dataClauseOperands = 10; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::getRegionInvocationBounds; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("combined"), ::llvm::StringRef("defaultAttr"), ::llvm::StringRef("hasWaitDevnum"), ::llvm::StringRef("numGangsDeviceType"), ::llvm::StringRef("numGangsSegments"), ::llvm::StringRef("numWorkersDeviceType"), ::llvm::StringRef("selfAttr"), ::llvm::StringRef("vectorLengthDeviceType"), ::llvm::StringRef("waitOnly"), ::llvm::StringRef("waitOperandsDeviceType"), ::llvm::StringRef("waitOperandsSegments"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getCombinedAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getCombinedAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getDefaultAttrAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getDefaultAttrAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getHasWaitDevnumAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getHasWaitDevnumAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNumGangsDeviceTypeAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNumGangsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getNumGangsSegmentsAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getNumGangsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getNumWorkersDeviceTypeAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getNumWorkersDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getSelfAttrAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getSelfAttrAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::mlir::StringAttr getVectorLengthDeviceTypeAttrName() { return getAttributeNameForIndex(9); } static ::mlir::StringAttr getVectorLengthDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 9); } ::mlir::StringAttr getWaitOnlyAttrName() { return getAttributeNameForIndex(10); } static ::mlir::StringAttr getWaitOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 10); } ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(11); } static ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 11); } ::mlir::StringAttr getWaitOperandsSegmentsAttrName() { return getAttributeNameForIndex(12); } static ::mlir::StringAttr getWaitOperandsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 12); } ::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("acc.parallel"); } 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 getAsyncOperands() { return getODSOperands(0); } ::mlir::Operation::operand_range getWaitOperands() { return getODSOperands(1); } ::mlir::Operation::operand_range getNumGangs() { return getODSOperands(2); } ::mlir::Operation::operand_range getNumWorkers() { return getODSOperands(3); } ::mlir::Operation::operand_range getVectorLength() { return getODSOperands(4); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(5); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::TypedValue<::mlir::IntegerType> getSelfCond() { auto operands = getODSOperands(6); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::Operation::operand_range getReductionOperands() { return getODSOperands(7); } ::mlir::Operation::operand_range getPrivateOperands() { return getODSOperands(8); } ::mlir::Operation::operand_range getFirstprivateOperands() { return getODSOperands(9); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(10); } ::mlir::MutableOperandRange getAsyncOperandsMutable(); ::mlir::MutableOperandRange getWaitOperandsMutable(); ::mlir::MutableOperandRange getNumGangsMutable(); ::mlir::MutableOperandRange getNumWorkersMutable(); ::mlir::MutableOperandRange getVectorLengthMutable(); ::mlir::MutableOperandRange getIfCondMutable(); ::mlir::MutableOperandRange getSelfCondMutable(); ::mlir::MutableOperandRange getReductionOperandsMutable(); ::mlir::MutableOperandRange getPrivateOperandsMutable(); ::mlir::MutableOperandRange getFirstprivateOperandsMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::DenseI32ArrayAttr getNumGangsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numGangsSegments); } ::std::optional<::llvm::ArrayRef> getNumGangsSegments(); ::mlir::ArrayAttr getNumGangsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().numGangsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getNumGangsDeviceType(); ::mlir::ArrayAttr getNumWorkersDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().numWorkersDeviceType); } ::std::optional< ::mlir::ArrayAttr > getNumWorkersDeviceType(); ::mlir::ArrayAttr getVectorLengthDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vectorLengthDeviceType); } ::std::optional< ::mlir::ArrayAttr > getVectorLengthDeviceType(); ::mlir::UnitAttr getSelfAttrAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); } bool getSelfAttr(); ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); } ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); ::mlir::UnitAttr getCombinedAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().combined); } bool getCombined(); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setWaitOperandsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().waitOperandsSegments = attr; } void setWaitOperandsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setWaitOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().waitOperandsDeviceType = attr; } void setHasWaitDevnumAttr(::mlir::ArrayAttr attr) { getProperties().hasWaitDevnum = attr; } void setWaitOnlyAttr(::mlir::ArrayAttr attr) { getProperties().waitOnly = attr; } void setNumGangsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().numGangsSegments = attr; } void setNumGangsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setNumGangsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().numGangsDeviceType = attr; } void setNumWorkersDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().numWorkersDeviceType = attr; } void setVectorLengthDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().vectorLengthDeviceType = attr; } void setSelfAttrAttr(::mlir::UnitAttr attr) { getProperties().selfAttr = attr; } void setSelfAttr(bool attrValue); void setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr) { getProperties().defaultAttr = attr; } void setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue); void setCombinedAttr(::mlir::UnitAttr attr) { getProperties().combined = attr; } void setCombined(bool attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeWaitOperandsSegmentsAttr() { auto attr = getProperties().waitOperandsSegments; getProperties().waitOperandsSegments = {}; return attr; } ::mlir::Attribute removeWaitOperandsDeviceTypeAttr() { auto attr = getProperties().waitOperandsDeviceType; getProperties().waitOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeHasWaitDevnumAttr() { auto attr = getProperties().hasWaitDevnum; getProperties().hasWaitDevnum = {}; return attr; } ::mlir::Attribute removeWaitOnlyAttr() { auto attr = getProperties().waitOnly; getProperties().waitOnly = {}; return attr; } ::mlir::Attribute removeNumGangsSegmentsAttr() { auto attr = getProperties().numGangsSegments; getProperties().numGangsSegments = {}; return attr; } ::mlir::Attribute removeNumGangsDeviceTypeAttr() { auto attr = getProperties().numGangsDeviceType; getProperties().numGangsDeviceType = {}; return attr; } ::mlir::Attribute removeNumWorkersDeviceTypeAttr() { auto attr = getProperties().numWorkersDeviceType; getProperties().numWorkersDeviceType = {}; return attr; } ::mlir::Attribute removeVectorLengthDeviceTypeAttr() { auto attr = getProperties().vectorLengthDeviceType; getProperties().vectorLengthDeviceType = {}; return attr; } ::mlir::Attribute removeSelfAttrAttr() { auto attr = getProperties().selfAttr; getProperties().selfAttr = {}; return attr; } ::mlir::Attribute removeDefaultAttrAttr() { auto attr = getProperties().defaultAttr; getProperties().defaultAttr = {}; return attr; } ::mlir::Attribute removeCombinedAttr() { auto attr = getProperties().combined; getProperties().combined = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, mlir::ValueRange numGangs = {}, mlir::ValueRange numWorkers = {}, mlir::ValueRange vectorLength = {}, mlir::ValueRange asyncOperands = {}, mlir::ValueRange waitOperands = {}, mlir::Value ifCond = {}, mlir::Value selfCond = {}, mlir::ValueRange reductionOperands = {}, mlir::ValueRange privateOperands = {}, mlir::ValueRange firstprivateOperands = {}, mlir::ValueRange dataClauseOperands = {}); static ParallelOp create(::mlir::OpBuilder &builder, ::mlir::Location location, mlir::ValueRange numGangs = {}, mlir::ValueRange numWorkers = {}, mlir::ValueRange vectorLength = {}, mlir::ValueRange asyncOperands = {}, mlir::ValueRange waitOperands = {}, mlir::Value ifCond = {}, mlir::Value selfCond = {}, mlir::ValueRange reductionOperands = {}, mlir::ValueRange privateOperands = {}, mlir::ValueRange firstprivateOperands = {}, mlir::ValueRange dataClauseOperands = {}); static ParallelOp create(::mlir::ImplicitLocOpBuilder &builder, mlir::ValueRange numGangs = {}, mlir::ValueRange numWorkers = {}, mlir::ValueRange vectorLength = {}, mlir::ValueRange asyncOperands = {}, mlir::ValueRange waitOperands = {}, mlir::Value ifCond = {}, mlir::Value selfCond = {}, mlir::ValueRange reductionOperands = {}, mlir::ValueRange privateOperands = {}, mlir::ValueRange firstprivateOperands = {}, mlir::ValueRange dataClauseOperands = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static ParallelOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static ParallelOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static ParallelOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static ParallelOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static ParallelOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static ParallelOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static ParallelOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static ParallelOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange numGangs, /*optional*/::mlir::DenseI32ArrayAttr numGangsSegments, /*optional*/::mlir::ArrayAttr numGangsDeviceType, ::mlir::ValueRange numWorkers, /*optional*/::mlir::ArrayAttr numWorkersDeviceType, ::mlir::ValueRange vectorLength, /*optional*/::mlir::ArrayAttr vectorLengthDeviceType, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParallelOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParallelOp 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 ParallelOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParallelOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 13 && "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: /// The number of data operands. unsigned getNumDataOperands(); /// The i-th data operand passed. Value getDataOperand(unsigned i); /// Used to retrieve the block inside the op's region. Block &getBody() { return getRegion().front(); } /// Return true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly(); /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType); /// Return the value of the async clause if present. mlir::Value getAsyncValue(); /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType); /// Return the value of the num_workers clause if present. mlir::Value getNumWorkersValue(); /// Return the value of the num_workers clause for the given device_type if /// present. mlir::Value getNumWorkersValue(mlir::acc::DeviceType deviceType); /// Return the value of the vector_length clause if present. mlir::Value getVectorLengthValue(); /// Return the value of the vector_length clause for the given device_type /// if present. mlir::Value getVectorLengthValue(mlir::acc::DeviceType deviceType); /// Return the values of the num_gangs clause if present. mlir::Operation::operand_range getNumGangsValues(); /// Return the values of the num_gangs clause for the given device_type if /// present. mlir::Operation::operand_range getNumGangsValues(mlir::acc::DeviceType deviceType); /// Return true if the op has any num_gangs, num_workers, or vector_length /// clause for the given device_type. bool hasAnyGangWorkerVector(mlir::acc::DeviceType deviceType); /// Return true if the op has the wait attribute for the /// mlir::acc::DeviceType::None device_type. bool hasWaitOnly(); /// Return true if the op has the wait attribute for the given device_type. bool hasWaitOnly(mlir::acc::DeviceType deviceType); /// Return the values of the wait clause if present. mlir::Operation::operand_range getWaitValues(); /// Return the values of the wait clause for the given device_type if /// present. mlir::Operation::operand_range getWaitValues(mlir::acc::DeviceType deviceType); /// Return the wait devnum value clause if present; mlir::Value getWaitDevnum(); /// Return the wait devnum value clause for the given device_type if /// present. mlir::Value getWaitDevnum(mlir::acc::DeviceType deviceType); static mlir::acc::Construct getConstructId() { return mlir::acc::Construct::acc_construct_parallel; } /// Add a value to 'num_workers' with the current list of device types. void addNumWorkersOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add a value to 'vector_length' with the current list of device types. void addVectorLengthOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an entry to the 'async-only' attribute (clause spelled without /// arguments)for each of the additional device types (or a none if it is /// empty). void addAsyncOnly(MLIRContext *, llvm::ArrayRef); /// Add a value to the 'async' with the current list of device types. void addAsyncOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an array-like entry to the 'num_gangs' with the current list of /// device types. void addNumGangsOperands(MLIRContext *, mlir::ValueRange, llvm::ArrayRef); /// Add an entry to the 'wait-only' attribute (clause spelled without /// arguments)for each of the additional device types (or a none if it is /// empty). void addWaitOnly(MLIRContext *, llvm::ArrayRef); /// Add an array-like entry to the 'wait' with the current list of device /// types. void addWaitOperands(MLIRContext *, bool hasDevnum, mlir::ValueRange, llvm::ArrayRef); /// Adds a private clause variable to this operation, including its recipe. void addPrivatization(MLIRContext *, mlir::acc::PrivateOp op, mlir::acc::PrivateRecipeOp recipe); /// Adds a firstprivate clause variable to this operation, including its /// recipe. void addFirstPrivatization(MLIRContext *, mlir::acc::FirstprivateOp op, mlir::acc::FirstprivateRecipeOp recipe); /// Adds a reduction clause variable to this operation, including its /// recipe. void addReduction(MLIRContext *, mlir::acc::ReductionOp op, mlir::acc::ReductionRecipeOp recipe); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ParallelOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ParallelOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::PredicateRegionOp declarations //===----------------------------------------------------------------------===// namespace detail { class PredicateRegionOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PredicateRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.predicate_region", odsAttrs.getContext()); } PredicateRegionOpGenericAdaptorBase(PredicateRegionOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } 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 PredicateRegionOpGenericAdaptor : public detail::PredicateRegionOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PredicateRegionOpGenericAdaptorBase; public: PredicateRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PredicateRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PredicateRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PredicateRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : PredicateRegionOpGenericAdaptor(values, attrs, Properties{}, {}) {} PredicateRegionOpGenericAdaptor(RangeT values, const PredicateRegionOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PredicateRegionOpGenericAdaptor(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 getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PredicateRegionOpAdaptor : public PredicateRegionOpGenericAdaptor<::mlir::ValueRange> { public: using PredicateRegionOpGenericAdaptor::PredicateRegionOpGenericAdaptor; PredicateRegionOpAdaptor(PredicateRegionOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PredicateRegionOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = PredicateRegionOpAdaptor; template using GenericAdaptor = PredicateRegionOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.predicate_region"); } 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)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); static PredicateRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location); static PredicateRegionOp create(::mlir::ImplicitLocOpBuilder &builder); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); static PredicateRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes); static PredicateRegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PredicateRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PredicateRegionOp 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 PredicateRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static PredicateRegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PredicateRegionOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::PresentOp declarations //===----------------------------------------------------------------------===// namespace detail { class PresentOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: PresentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.present", odsAttrs.getContext()); } PresentOpGenericAdaptorBase(PresentOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class PresentOpGenericAdaptor : public detail::PresentOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PresentOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: PresentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PresentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PresentOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PresentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PresentOpGenericAdaptor(values, attrs, Properties{}, {}) {} PresentOpGenericAdaptor(RangeT values, const PresentOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PresentOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PresentOpAdaptor : public PresentOpGenericAdaptor<::mlir::ValueRange> { public: using PresentOpGenericAdaptor::PresentOpGenericAdaptor; PresentOpAdaptor(PresentOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PresentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PresentOpAdaptor; template using GenericAdaptor = PresentOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.present"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PresentOp 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 PresentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static PresentOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PresentOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::PresentOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::PrivateLocalOp declarations //===----------------------------------------------------------------------===// namespace detail { class PrivateLocalOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: PrivateLocalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.private_local", odsAttrs.getContext()); } PrivateLocalOpGenericAdaptorBase(PrivateLocalOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class PrivateLocalOpGenericAdaptor : public detail::PrivateLocalOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PrivateLocalOpGenericAdaptorBase; static constexpr int odsIndex_privatized = 0; public: PrivateLocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PrivateLocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PrivateLocalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PrivateLocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : PrivateLocalOpGenericAdaptor(values, attrs, Properties{}, {}) {} PrivateLocalOpGenericAdaptor(RangeT values, const PrivateLocalOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PrivateLocalOpGenericAdaptor(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 getPrivatized() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PrivateLocalOpAdaptor : public PrivateLocalOpGenericAdaptor<::mlir::ValueRange> { public: using PrivateLocalOpGenericAdaptor::PrivateLocalOpGenericAdaptor; PrivateLocalOpAdaptor(PrivateLocalOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PrivateLocalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait> { public: using Op::Op; using Op::print; using Adaptor = PrivateLocalOpAdaptor; template using GenericAdaptor = PrivateLocalOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_privatized = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.private_local"); } 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::acc::PrivateType> getPrivatized() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PrivateType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getPrivatizedMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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, ::mlir::Type resultType, ::mlir::Value privatized); static PrivateLocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType, ::mlir::Value privatized); static PrivateLocalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType, ::mlir::Value privatized); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value privatized); static PrivateLocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value privatized); static PrivateLocalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value privatized); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PrivateLocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PrivateLocalOp 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 PrivateLocalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static PrivateLocalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PrivateLocalOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::PrivateOp declarations //===----------------------------------------------------------------------===// namespace detail { class PrivateOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: PrivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.private", odsAttrs.getContext()); } PrivateOpGenericAdaptorBase(PrivateOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class PrivateOpGenericAdaptor : public detail::PrivateOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PrivateOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: PrivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PrivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PrivateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PrivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : PrivateOpGenericAdaptor(values, attrs, Properties{}, {}) {} PrivateOpGenericAdaptor(RangeT values, const PrivateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PrivateOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PrivateOpAdaptor : public PrivateOpGenericAdaptor<::mlir::ValueRange> { public: using PrivateOpGenericAdaptor::PrivateOpGenericAdaptor; PrivateOpAdaptor(PrivateOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PrivateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PrivateOpAdaptor; template using GenericAdaptor = PrivateOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.private"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PrivateOp 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 PrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static PrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PrivateOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::PrivateOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::PrivateRecipeOp declarations //===----------------------------------------------------------------------===// namespace detail { class PrivateRecipeOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } using typeTy = ::mlir::TypeAttr; typeTy type; auto getType() const { auto &propStorage = this->type; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setType(const ::mlir::TypeAttr &propValue) { this->type = propValue; } bool operator==(const Properties &rhs) const { return rhs.sym_name == this->sym_name && rhs.type == this->type && 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: PrivateRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.private.recipe", odsAttrs.getContext()); } PrivateRecipeOpGenericAdaptorBase(PrivateRecipeOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::TypeAttr getTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); return attr; } ::mlir::Type getType(); ::mlir::Region &getInitRegion() { return *odsRegions[0]; } ::mlir::Region &getDestroyRegion() { return *odsRegions[1]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class PrivateRecipeOpGenericAdaptor : public detail::PrivateRecipeOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PrivateRecipeOpGenericAdaptorBase; public: PrivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PrivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PrivateRecipeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PrivateRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : PrivateRecipeOpGenericAdaptor(values, attrs, Properties{}, {}) {} PrivateRecipeOpGenericAdaptor(RangeT values, const PrivateRecipeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PrivateRecipeOpGenericAdaptor(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 getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PrivateRecipeOpAdaptor : public PrivateRecipeOpGenericAdaptor<::mlir::ValueRange> { public: using PrivateRecipeOpGenericAdaptor::PrivateRecipeOpGenericAdaptor; PrivateRecipeOpAdaptor(PrivateRecipeOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PrivateRecipeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::SymbolOpInterface::Trait, ::mlir::accomp::RecipeInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope> { public: using Op::Op; using Op::print; using Adaptor = PrivateRecipeOpAdaptor; template using GenericAdaptor = PrivateRecipeOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.private.recipe"); } 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)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &getInitRegion() { return (*this)->getRegion(0); } ::mlir::Region &getDestroyRegion() { return (*this)->getRegion(1); } 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::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); ::mlir::TypeAttr getTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); } ::mlir::Type getType(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); void setTypeAttr(::mlir::TypeAttr attr) { getProperties().type = attr; } void setType(::mlir::Type attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static PrivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static PrivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static PrivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static PrivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type); static PrivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::Type type); static PrivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::Type type); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); static PrivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); static PrivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PrivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PrivateRecipeOp 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 PrivateRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static PrivateRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verifyRegions(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: /// Creates a PrivateRecipeOp and populates its regions based on the /// variable type as long as the type implements MappableType or /// PointerLikeType interface. If a type implements both, the MappableType /// API will be preferred. Returns std::nullopt if the recipe cannot be /// created or populated. The builder's current insertion point will be used /// and it must be a valid place for this operation to be inserted. The /// `recipeName` must be a unique name to prevent "redefinition of symbol" /// IR errors. /// The `hostVar` is the original host variable from which the type and /// language-specific metadata are derived. static std::optional createAndPopulate( ::mlir::OpBuilder &builder, ::mlir::Location loc, ::llvm::StringRef recipeName, ::mlir::Value hostVar, ::llvm::StringRef varName = "", ::mlir::ValueRange bounds = {}); /// Creates a PrivateRecipeOp using the same variable type as an existing /// FirstprivateRecipeOp. This is a useful in cases where we promote private variables to firstprivate by analysis /// This function reuses the init region from a firstprivate recipe when building a private /// recipe. Callers thus must ensure that this is semantically valid for the language /// lowering (e.g. that private does not perform extra default initialization /// that firstprivate intentionally omits, such as for C++ classes or Fortran /// derived types with default initialization). static std::optional createAndPopulate( ::mlir::OpBuilder &builder, ::mlir::Location loc, ::llvm::StringRef recipeName, ::mlir::acc::FirstprivateRecipeOp firstprivRecipe); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PrivateRecipeOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::PrivateRecipeOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::PrivatizeOp declarations //===----------------------------------------------------------------------===// namespace detail { class PrivatizeOpGenericAdaptorBase { public: struct Properties { using par_dimsTy = ::mlir::acc::GPUParallelDimsAttr; par_dimsTy par_dims; auto getParDims() const { auto &propStorage = this->par_dims; return ::llvm::dyn_cast_or_null<::mlir::acc::GPUParallelDimsAttr>(propStorage); } void setParDims(const ::mlir::acc::GPUParallelDimsAttr &propValue) { this->par_dims = propValue; } bool operator==(const Properties &rhs) const { return rhs.par_dims == this->par_dims && 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: PrivatizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.privatize", odsAttrs.getContext()); } PrivatizeOpGenericAdaptorBase(PrivatizeOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::acc::GPUParallelDimsAttr getParDimsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::GPUParallelDimsAttr>(getProperties().par_dims); return attr; } ::std::optional<::mlir::acc::GPUParallelDimsAttr> getParDims(); }; } // namespace detail template class PrivatizeOpGenericAdaptor : public detail::PrivatizeOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::PrivatizeOpGenericAdaptorBase; static constexpr int odsIndex_dynamicSizes = 0; public: PrivatizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} PrivatizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : PrivatizeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} PrivatizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : PrivatizeOpGenericAdaptor(values, attrs, Properties{}, {}) {} PrivatizeOpGenericAdaptor(RangeT values, const PrivatizeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> PrivatizeOpGenericAdaptor(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 getDynamicSizes() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class PrivatizeOpAdaptor : public PrivatizeOpGenericAdaptor<::mlir::ValueRange> { public: using PrivatizeOpGenericAdaptor::PrivatizeOpGenericAdaptor; PrivatizeOpAdaptor(PrivatizeOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class PrivatizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = PrivatizeOpAdaptor; template using GenericAdaptor = PrivatizeOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_dynamicSizes = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("par_dims")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getParDimsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getParDimsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.privatize"); } 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 getDynamicSizes() { return getODSOperands(0); } ::mlir::MutableOperandRange getDynamicSizesMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::acc::PrivateType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PrivateType>>(*getODSResults(0).begin()); } 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::acc::GPUParallelDimsAttr getParDimsAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::GPUParallelDimsAttr>(getProperties().par_dims); } ::std::optional<::mlir::acc::GPUParallelDimsAttr> getParDims(); void setParDimsAttr(::mlir::acc::GPUParallelDimsAttr attr) { getProperties().par_dims = attr; } ::mlir::Attribute removeParDimsAttr() { auto attr = getProperties().par_dims; getProperties().par_dims = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::ValueRange dynamicSizes = {}); static PrivatizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType, ::mlir::ValueRange dynamicSizes = {}); static PrivatizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType, ::mlir::ValueRange dynamicSizes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange dynamicSizes, /*optional*/::mlir::acc::GPUParallelDimsAttr par_dims); static PrivatizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange dynamicSizes, /*optional*/::mlir::acc::GPUParallelDimsAttr par_dims); static PrivatizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange dynamicSizes, /*optional*/::mlir::acc::GPUParallelDimsAttr par_dims); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamicSizes, /*optional*/::mlir::acc::GPUParallelDimsAttr par_dims); static PrivatizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamicSizes, /*optional*/::mlir::acc::GPUParallelDimsAttr par_dims); static PrivatizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamicSizes, /*optional*/::mlir::acc::GPUParallelDimsAttr par_dims); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PrivatizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static PrivatizeOp 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 PrivatizeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static PrivatizeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::PrivatizeOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::PrivatizeOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ReductionAccumulateOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReductionAccumulateOpGenericAdaptorBase { public: struct Properties { using par_dimsTy = ::mlir::acc::GPUParallelDimsAttr; par_dimsTy par_dims; auto getParDims() const { auto &propStorage = this->par_dims; return ::llvm::cast<::mlir::acc::GPUParallelDimsAttr>(propStorage); } void setParDims(const ::mlir::acc::GPUParallelDimsAttr &propValue) { this->par_dims = propValue; } using reductionOperatorTy = ::mlir::acc::ReductionOperatorAttr; reductionOperatorTy reductionOperator; auto getReductionOperator() const { auto &propStorage = this->reductionOperator; return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(propStorage); } void setReductionOperator(const ::mlir::acc::ReductionOperatorAttr &propValue) { this->reductionOperator = propValue; } bool operator==(const Properties &rhs) const { return rhs.par_dims == this->par_dims && rhs.reductionOperator == this->reductionOperator && 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: ReductionAccumulateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.reduction_accumulate", odsAttrs.getContext()); } ReductionAccumulateOpGenericAdaptorBase(ReductionAccumulateOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::acc::ReductionOperatorAttr getReductionOperatorAttr() { auto attr = ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); return attr; } ::mlir::acc::ReductionOperator getReductionOperator(); ::mlir::acc::GPUParallelDimsAttr getParDimsAttr() { auto attr = ::llvm::cast<::mlir::acc::GPUParallelDimsAttr>(getProperties().par_dims); return attr; } ::mlir::acc::GPUParallelDimsAttr getParDims(); }; } // namespace detail template class ReductionAccumulateOpGenericAdaptor : public detail::ReductionAccumulateOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReductionAccumulateOpGenericAdaptorBase; static constexpr int odsIndex_value = 0; static constexpr int odsIndex_memref = 1; public: ReductionAccumulateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReductionAccumulateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReductionAccumulateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReductionAccumulateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReductionAccumulateOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReductionAccumulateOpGenericAdaptor(RangeT values, const ReductionAccumulateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReductionAccumulateOpGenericAdaptor(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 getValue() { return (*getODSOperands(0).begin()); } ValueT getMemref() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReductionAccumulateOpAdaptor : public ReductionAccumulateOpGenericAdaptor<::mlir::ValueRange> { public: using ReductionAccumulateOpGenericAdaptor::ReductionAccumulateOpGenericAdaptor; ReductionAccumulateOpAdaptor(ReductionAccumulateOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReductionAccumulateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ReductionAccumulateOpAdaptor; template using GenericAdaptor = ReductionAccumulateOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_value = 0; static constexpr int odsIndex_memref = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("par_dims"), ::llvm::StringRef("reductionOperator")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getParDimsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getParDimsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getReductionOperatorAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getReductionOperatorAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.reduction_accumulate"); } 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::Type> getValue() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getMemref() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getValueMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getMemrefMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::acc::ReductionOperatorAttr getReductionOperatorAttr() { return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); } ::mlir::acc::ReductionOperator getReductionOperator(); ::mlir::acc::GPUParallelDimsAttr getParDimsAttr() { return ::llvm::cast<::mlir::acc::GPUParallelDimsAttr>(getProperties().par_dims); } ::mlir::acc::GPUParallelDimsAttr getParDims(); void setReductionOperatorAttr(::mlir::acc::ReductionOperatorAttr attr) { getProperties().reductionOperator = attr; } void setReductionOperator(::mlir::acc::ReductionOperator attrValue); void setParDimsAttr(::mlir::acc::GPUParallelDimsAttr attr) { getProperties().par_dims = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperatorAttr reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static ReductionAccumulateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperatorAttr reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static ReductionAccumulateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperatorAttr reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperatorAttr reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static ReductionAccumulateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperatorAttr reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static ReductionAccumulateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperatorAttr reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperator reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static ReductionAccumulateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperator reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static ReductionAccumulateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperator reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperator reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static ReductionAccumulateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperator reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static ReductionAccumulateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::acc::ReductionOperator reductionOperator, ::mlir::acc::GPUParallelDimsAttr par_dims); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionAccumulateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionAccumulateOp 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 ReductionAccumulateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReductionAccumulateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionAccumulateOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ReductionAccumulateOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ReductionCombineOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReductionCombineOpGenericAdaptorBase { public: struct Properties { using reductionOperatorTy = ::mlir::acc::ReductionOperatorAttr; reductionOperatorTy reductionOperator; auto getReductionOperator() const { auto &propStorage = this->reductionOperator; return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(propStorage); } void setReductionOperator(const ::mlir::acc::ReductionOperatorAttr &propValue) { this->reductionOperator = propValue; } bool operator==(const Properties &rhs) const { return rhs.reductionOperator == this->reductionOperator && 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: ReductionCombineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.reduction_combine", odsAttrs.getContext()); } ReductionCombineOpGenericAdaptorBase(ReductionCombineOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::acc::ReductionOperatorAttr getReductionOperatorAttr() { auto attr = ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); return attr; } ::mlir::acc::ReductionOperator getReductionOperator(); }; } // namespace detail template class ReductionCombineOpGenericAdaptor : public detail::ReductionCombineOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReductionCombineOpGenericAdaptorBase; static constexpr int odsIndex_destMemref = 0; static constexpr int odsIndex_srcMemref = 1; public: ReductionCombineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReductionCombineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReductionCombineOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReductionCombineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReductionCombineOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReductionCombineOpGenericAdaptor(RangeT values, const ReductionCombineOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReductionCombineOpGenericAdaptor(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 getDestMemref() { return (*getODSOperands(0).begin()); } ValueT getSrcMemref() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReductionCombineOpAdaptor : public ReductionCombineOpGenericAdaptor<::mlir::ValueRange> { public: using ReductionCombineOpGenericAdaptor::ReductionCombineOpGenericAdaptor; ReductionCombineOpAdaptor(ReductionCombineOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReductionCombineOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ReductionCombineOpAdaptor; template using GenericAdaptor = ReductionCombineOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_destMemref = 0; static constexpr int odsIndex_srcMemref = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("reductionOperator")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getReductionOperatorAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getReductionOperatorAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.reduction_combine"); } 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::Type> getDestMemref() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getSrcMemref() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getDestMemrefMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getSrcMemrefMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::acc::ReductionOperatorAttr getReductionOperatorAttr() { return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); } ::mlir::acc::ReductionOperator getReductionOperator(); void setReductionOperatorAttr(::mlir::acc::ReductionOperatorAttr attr) { getProperties().reductionOperator = attr; } void setReductionOperator(::mlir::acc::ReductionOperator attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionCombineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionCombineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperatorAttr reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionCombineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionCombineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperatorAttr reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperator reductionOperator); static ReductionCombineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperator reductionOperator); static ReductionCombineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperator reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperator reductionOperator); static ReductionCombineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperator reductionOperator); static ReductionCombineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value destMemref, ::mlir::Value srcMemref, ::mlir::acc::ReductionOperator reductionOperator); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionCombineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionCombineOp 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 ReductionCombineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReductionCombineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionCombineOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ReductionCombineOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ReductionCombineRegionOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReductionCombineRegionOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ReductionCombineRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.reduction_combine_region", odsAttrs.getContext()); } ReductionCombineRegionOpGenericAdaptorBase(ReductionCombineRegionOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } 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 ReductionCombineRegionOpGenericAdaptor : public detail::ReductionCombineRegionOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReductionCombineRegionOpGenericAdaptorBase; static constexpr int odsIndex_destVar = 0; static constexpr int odsIndex_srcVar = 1; public: ReductionCombineRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReductionCombineRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReductionCombineRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReductionCombineRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReductionCombineRegionOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReductionCombineRegionOpGenericAdaptor(RangeT values, const ReductionCombineRegionOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReductionCombineRegionOpGenericAdaptor(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 getDestVar() { return (*getODSOperands(0).begin()); } ValueT getSrcVar() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReductionCombineRegionOpAdaptor : public ReductionCombineRegionOpGenericAdaptor<::mlir::ValueRange> { public: using ReductionCombineRegionOpGenericAdaptor::ReductionCombineRegionOpGenericAdaptor; ReductionCombineRegionOpAdaptor(ReductionCombineRegionOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReductionCombineRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::RegionBranchOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ReductionCombineRegionOpAdaptor; template using GenericAdaptor = ReductionCombineRegionOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_destVar = 0; static constexpr int odsIndex_srcVar = 1; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.reduction_combine_region"); } 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::Type> getDestVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getSrcVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getDestVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getSrcVarMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value destVar, ::mlir::Value srcVar); static ReductionCombineRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value destVar, ::mlir::Value srcVar); static ReductionCombineRegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value destVar, ::mlir::Value srcVar); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value destVar, ::mlir::Value srcVar); static ReductionCombineRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value destVar, ::mlir::Value srcVar); static ReductionCombineRegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value destVar, ::mlir::Value srcVar); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionCombineRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionCombineRegionOp 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 ReductionCombineRegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReductionCombineRegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionCombineRegionOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ReductionInitOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReductionInitOpGenericAdaptorBase { public: struct Properties { using reductionOperatorTy = ::mlir::acc::ReductionOperatorAttr; reductionOperatorTy reductionOperator; auto getReductionOperator() const { auto &propStorage = this->reductionOperator; return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(propStorage); } void setReductionOperator(const ::mlir::acc::ReductionOperatorAttr &propValue) { this->reductionOperator = propValue; } bool operator==(const Properties &rhs) const { return rhs.reductionOperator == this->reductionOperator && 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: ReductionInitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.reduction_init", odsAttrs.getContext()); } ReductionInitOpGenericAdaptorBase(ReductionInitOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::acc::ReductionOperatorAttr getReductionOperatorAttr() { auto attr = ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); return attr; } ::mlir::acc::ReductionOperator getReductionOperator(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ReductionInitOpGenericAdaptor : public detail::ReductionInitOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReductionInitOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; public: ReductionInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReductionInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReductionInitOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReductionInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReductionInitOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReductionInitOpGenericAdaptor(RangeT values, const ReductionInitOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReductionInitOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReductionInitOpAdaptor : public ReductionInitOpGenericAdaptor<::mlir::ValueRange> { public: using ReductionInitOpGenericAdaptor::ReductionInitOpGenericAdaptor; ReductionInitOpAdaptor(ReductionInitOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReductionInitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::RegionBranchOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ReductionInitOpAdaptor; template using GenericAdaptor = ReductionInitOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("reductionOperator")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getReductionOperatorAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getReductionOperatorAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.reduction_init"); } 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::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } ::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::acc::ReductionOperatorAttr getReductionOperatorAttr() { return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); } ::mlir::acc::ReductionOperator getReductionOperator(); void setReductionOperatorAttr(::mlir::acc::ReductionOperatorAttr attr) { getProperties().reductionOperator = attr; } void setReductionOperator(::mlir::acc::ReductionOperator attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::acc::ReductionOperatorAttr reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::acc::ReductionOperator reductionOperator); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::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 ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReductionInitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReductionInitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionInitOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ReductionInitOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ReductionOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReductionOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: ReductionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.reduction", odsAttrs.getContext()); } ReductionOpGenericAdaptorBase(ReductionOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class ReductionOpGenericAdaptor : public detail::ReductionOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReductionOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: ReductionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReductionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReductionOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReductionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ReductionOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReductionOpGenericAdaptor(RangeT values, const ReductionOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReductionOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReductionOpAdaptor : public ReductionOpGenericAdaptor<::mlir::ValueRange> { public: using ReductionOpGenericAdaptor::ReductionOpGenericAdaptor; ReductionOpAdaptor(ReductionOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReductionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ReductionOpAdaptor; template using GenericAdaptor = ReductionOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.reduction"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionOp 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 ReductionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReductionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ReductionOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ReductionRecipeOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReductionRecipeOpGenericAdaptorBase { public: struct Properties { using reductionOperatorTy = ::mlir::acc::ReductionOperatorAttr; reductionOperatorTy reductionOperator; auto getReductionOperator() const { auto &propStorage = this->reductionOperator; return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(propStorage); } void setReductionOperator(const ::mlir::acc::ReductionOperatorAttr &propValue) { this->reductionOperator = propValue; } using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } using typeTy = ::mlir::TypeAttr; typeTy type; auto getType() const { auto &propStorage = this->type; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setType(const ::mlir::TypeAttr &propValue) { this->type = propValue; } bool operator==(const Properties &rhs) const { return rhs.reductionOperator == this->reductionOperator && rhs.sym_name == this->sym_name && rhs.type == this->type && 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: ReductionRecipeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.reduction.recipe", odsAttrs.getContext()); } ReductionRecipeOpGenericAdaptorBase(ReductionRecipeOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::TypeAttr getTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); return attr; } ::mlir::Type getType(); ::mlir::acc::ReductionOperatorAttr getReductionOperatorAttr() { auto attr = ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); return attr; } ::mlir::acc::ReductionOperator getReductionOperator(); ::mlir::Region &getInitRegion() { return *odsRegions[0]; } ::mlir::Region &getCombinerRegion() { return *odsRegions[1]; } ::mlir::Region &getDestroyRegion() { return *odsRegions[2]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ReductionRecipeOpGenericAdaptor : public detail::ReductionRecipeOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReductionRecipeOpGenericAdaptorBase; public: ReductionRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReductionRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReductionRecipeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReductionRecipeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReductionRecipeOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReductionRecipeOpGenericAdaptor(RangeT values, const ReductionRecipeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReductionRecipeOpGenericAdaptor(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 getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReductionRecipeOpAdaptor : public ReductionRecipeOpGenericAdaptor<::mlir::ValueRange> { public: using ReductionRecipeOpGenericAdaptor::ReductionRecipeOpGenericAdaptor; ReductionRecipeOpAdaptor(ReductionRecipeOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReductionRecipeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::SymbolOpInterface::Trait, ::mlir::accomp::RecipeInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope> { public: using Op::Op; using Op::print; using Adaptor = ReductionRecipeOpAdaptor; template using GenericAdaptor = ReductionRecipeOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("reductionOperator"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getReductionOperatorAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getReductionOperatorAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getTypeAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.reduction.recipe"); } 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)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &getInitRegion() { return (*this)->getRegion(0); } ::mlir::Region &getCombinerRegion() { return (*this)->getRegion(1); } ::mlir::Region &getDestroyRegion() { return (*this)->getRegion(2); } 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::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); ::mlir::TypeAttr getTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); } ::mlir::Type getType(); ::mlir::acc::ReductionOperatorAttr getReductionOperatorAttr() { return ::llvm::cast<::mlir::acc::ReductionOperatorAttr>(getProperties().reductionOperator); } ::mlir::acc::ReductionOperator getReductionOperator(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); void setTypeAttr(::mlir::TypeAttr attr) { getProperties().type = attr; } void setType(::mlir::Type attrValue); void setReductionOperatorAttr(::mlir::acc::ReductionOperatorAttr attr) { getProperties().reductionOperator = attr; } void setReductionOperator(::mlir::acc::ReductionOperator attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator); static ReductionRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, ::mlir::acc::ReductionOperatorAttr reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator); static ReductionRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator); static ReductionRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator); static ReductionRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator); static ReductionRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, ::mlir::acc::ReductionOperator reductionOperator); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReductionRecipeOp 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 ReductionRecipeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReductionRecipeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verifyRegions(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 3 && "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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionRecipeOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ReductionRecipeOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::RoutineOp declarations //===----------------------------------------------------------------------===// namespace detail { class RoutineOpGenericAdaptorBase { public: struct Properties { using bindIdNameTy = ::mlir::ArrayAttr; bindIdNameTy bindIdName; auto getBindIdName() const { auto &propStorage = this->bindIdName; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setBindIdName(const ::mlir::ArrayAttr &propValue) { this->bindIdName = propValue; } using bindIdNameDeviceTypeTy = ::mlir::ArrayAttr; bindIdNameDeviceTypeTy bindIdNameDeviceType; auto getBindIdNameDeviceType() const { auto &propStorage = this->bindIdNameDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setBindIdNameDeviceType(const ::mlir::ArrayAttr &propValue) { this->bindIdNameDeviceType = propValue; } using bindStrNameTy = ::mlir::ArrayAttr; bindStrNameTy bindStrName; auto getBindStrName() const { auto &propStorage = this->bindStrName; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setBindStrName(const ::mlir::ArrayAttr &propValue) { this->bindStrName = propValue; } using bindStrNameDeviceTypeTy = ::mlir::ArrayAttr; bindStrNameDeviceTypeTy bindStrNameDeviceType; auto getBindStrNameDeviceType() const { auto &propStorage = this->bindStrNameDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setBindStrNameDeviceType(const ::mlir::ArrayAttr &propValue) { this->bindStrNameDeviceType = propValue; } using func_nameTy = ::mlir::SymbolRefAttr; func_nameTy func_name; auto getFuncName() const { auto &propStorage = this->func_name; return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); } void setFuncName(const ::mlir::SymbolRefAttr &propValue) { this->func_name = propValue; } using gangTy = ::mlir::ArrayAttr; gangTy gang; auto getGang() const { auto &propStorage = this->gang; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setGang(const ::mlir::ArrayAttr &propValue) { this->gang = propValue; } using gangDimTy = ::mlir::ArrayAttr; gangDimTy gangDim; auto getGangDim() const { auto &propStorage = this->gangDim; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setGangDim(const ::mlir::ArrayAttr &propValue) { this->gangDim = propValue; } using gangDimDeviceTypeTy = ::mlir::ArrayAttr; gangDimDeviceTypeTy gangDimDeviceType; auto getGangDimDeviceType() const { auto &propStorage = this->gangDimDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setGangDimDeviceType(const ::mlir::ArrayAttr &propValue) { this->gangDimDeviceType = propValue; } using implicitTy = ::mlir::UnitAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setImplicit(const ::mlir::UnitAttr &propValue) { this->implicit = propValue; } using nohostTy = ::mlir::UnitAttr; nohostTy nohost; auto getNohost() const { auto &propStorage = this->nohost; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setNohost(const ::mlir::UnitAttr &propValue) { this->nohost = propValue; } using seqTy = ::mlir::ArrayAttr; seqTy seq; auto getSeq() const { auto &propStorage = this->seq; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setSeq(const ::mlir::ArrayAttr &propValue) { this->seq = propValue; } using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } using vectorTy = ::mlir::ArrayAttr; vectorTy vector; auto getVector() const { auto &propStorage = this->vector; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setVector(const ::mlir::ArrayAttr &propValue) { this->vector = propValue; } using workerTy = ::mlir::ArrayAttr; workerTy worker; auto getWorker() const { auto &propStorage = this->worker; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWorker(const ::mlir::ArrayAttr &propValue) { this->worker = propValue; } bool operator==(const Properties &rhs) const { return rhs.bindIdName == this->bindIdName && rhs.bindIdNameDeviceType == this->bindIdNameDeviceType && rhs.bindStrName == this->bindStrName && rhs.bindStrNameDeviceType == this->bindStrNameDeviceType && rhs.func_name == this->func_name && rhs.gang == this->gang && rhs.gangDim == this->gangDim && rhs.gangDimDeviceType == this->gangDimDeviceType && rhs.implicit == this->implicit && rhs.nohost == this->nohost && rhs.seq == this->seq && rhs.sym_name == this->sym_name && rhs.vector == this->vector && rhs.worker == this->worker && 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: RoutineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.routine", odsAttrs.getContext()); } RoutineOpGenericAdaptorBase(RoutineOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::SymbolRefAttr getFuncNameAttr() { auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().func_name); return attr; } ::mlir::SymbolRefAttr getFuncName(); ::mlir::ArrayAttr getBindIdNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().bindIdName); return attr; } ::std::optional< ::mlir::ArrayAttr > getBindIdName(); ::mlir::ArrayAttr getBindStrNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().bindStrName); return attr; } ::std::optional< ::mlir::ArrayAttr > getBindStrName(); ::mlir::ArrayAttr getBindIdNameDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().bindIdNameDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getBindIdNameDeviceType(); ::mlir::ArrayAttr getBindStrNameDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().bindStrNameDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getBindStrNameDeviceType(); ::mlir::ArrayAttr getWorkerAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().worker); return attr; } ::std::optional< ::mlir::ArrayAttr > getWorker(); ::mlir::ArrayAttr getVectorAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vector); return attr; } ::std::optional< ::mlir::ArrayAttr > getVector(); ::mlir::ArrayAttr getSeqAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().seq); return attr; } ::std::optional< ::mlir::ArrayAttr > getSeq(); ::mlir::UnitAttr getNohostAttr(); bool getNohost(); ::mlir::UnitAttr getImplicitAttr(); bool getImplicit(); ::mlir::ArrayAttr getGangAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gang); return attr; } ::std::optional< ::mlir::ArrayAttr > getGang(); ::mlir::ArrayAttr getGangDimAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gangDim); return attr; } ::std::optional< ::mlir::ArrayAttr > getGangDim(); ::mlir::ArrayAttr getGangDimDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gangDimDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getGangDimDeviceType(); }; } // namespace detail template class RoutineOpGenericAdaptor : public detail::RoutineOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::RoutineOpGenericAdaptorBase; public: RoutineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} RoutineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RoutineOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} RoutineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RoutineOpGenericAdaptor(values, attrs, Properties{}, {}) {} RoutineOpGenericAdaptor(RangeT values, const RoutineOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> RoutineOpGenericAdaptor(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 getOperands() { return odsOperands; } private: RangeT odsOperands; }; class RoutineOpAdaptor : public RoutineOpGenericAdaptor<::mlir::ValueRange> { public: using RoutineOpGenericAdaptor::RoutineOpGenericAdaptor; RoutineOpAdaptor(RoutineOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class RoutineOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = RoutineOpAdaptor; template using GenericAdaptor = RoutineOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("bindIdName"), ::llvm::StringRef("bindIdNameDeviceType"), ::llvm::StringRef("bindStrName"), ::llvm::StringRef("bindStrNameDeviceType"), ::llvm::StringRef("func_name"), ::llvm::StringRef("gang"), ::llvm::StringRef("gangDim"), ::llvm::StringRef("gangDimDeviceType"), ::llvm::StringRef("implicit"), ::llvm::StringRef("nohost"), ::llvm::StringRef("seq"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("vector"), ::llvm::StringRef("worker")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getBindIdNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getBindIdNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getBindIdNameDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getBindIdNameDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getBindStrNameAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getBindStrNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getBindStrNameDeviceTypeAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getBindStrNameDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getFuncNameAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getFuncNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getGangAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getGangAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getGangDimAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getGangDimAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getGangDimDeviceTypeAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getGangDimDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::mlir::StringAttr getNohostAttrName() { return getAttributeNameForIndex(9); } static ::mlir::StringAttr getNohostAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 9); } ::mlir::StringAttr getSeqAttrName() { return getAttributeNameForIndex(10); } static ::mlir::StringAttr getSeqAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 10); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(11); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 11); } ::mlir::StringAttr getVectorAttrName() { return getAttributeNameForIndex(12); } static ::mlir::StringAttr getVectorAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 12); } ::mlir::StringAttr getWorkerAttrName() { return getAttributeNameForIndex(13); } static ::mlir::StringAttr getWorkerAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 13); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.routine"); } 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)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); ::mlir::SymbolRefAttr getFuncNameAttr() { return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().func_name); } ::mlir::SymbolRefAttr getFuncName(); ::mlir::ArrayAttr getBindIdNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().bindIdName); } ::std::optional< ::mlir::ArrayAttr > getBindIdName(); ::mlir::ArrayAttr getBindStrNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().bindStrName); } ::std::optional< ::mlir::ArrayAttr > getBindStrName(); ::mlir::ArrayAttr getBindIdNameDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().bindIdNameDeviceType); } ::std::optional< ::mlir::ArrayAttr > getBindIdNameDeviceType(); ::mlir::ArrayAttr getBindStrNameDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().bindStrNameDeviceType); } ::std::optional< ::mlir::ArrayAttr > getBindStrNameDeviceType(); ::mlir::ArrayAttr getWorkerAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().worker); } ::std::optional< ::mlir::ArrayAttr > getWorker(); ::mlir::ArrayAttr getVectorAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().vector); } ::std::optional< ::mlir::ArrayAttr > getVector(); ::mlir::ArrayAttr getSeqAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().seq); } ::std::optional< ::mlir::ArrayAttr > getSeq(); ::mlir::UnitAttr getNohostAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().nohost); } bool getNohost(); ::mlir::UnitAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::ArrayAttr getGangAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gang); } ::std::optional< ::mlir::ArrayAttr > getGang(); ::mlir::ArrayAttr getGangDimAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gangDim); } ::std::optional< ::mlir::ArrayAttr > getGangDim(); ::mlir::ArrayAttr getGangDimDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().gangDimDeviceType); } ::std::optional< ::mlir::ArrayAttr > getGangDimDeviceType(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); void setFuncNameAttr(::mlir::SymbolRefAttr attr) { getProperties().func_name = attr; } void setBindIdNameAttr(::mlir::ArrayAttr attr) { getProperties().bindIdName = attr; } void setBindStrNameAttr(::mlir::ArrayAttr attr) { getProperties().bindStrName = attr; } void setBindIdNameDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().bindIdNameDeviceType = attr; } void setBindStrNameDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().bindStrNameDeviceType = attr; } void setWorkerAttr(::mlir::ArrayAttr attr) { getProperties().worker = attr; } void setVectorAttr(::mlir::ArrayAttr attr) { getProperties().vector = attr; } void setSeqAttr(::mlir::ArrayAttr attr) { getProperties().seq = attr; } void setNohostAttr(::mlir::UnitAttr attr) { getProperties().nohost = attr; } void setNohost(bool attrValue); void setImplicitAttr(::mlir::UnitAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setGangAttr(::mlir::ArrayAttr attr) { getProperties().gang = attr; } void setGangDimAttr(::mlir::ArrayAttr attr) { getProperties().gangDim = attr; } void setGangDimDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().gangDimDeviceType = attr; } ::mlir::Attribute removeBindIdNameAttr() { auto attr = getProperties().bindIdName; getProperties().bindIdName = {}; return attr; } ::mlir::Attribute removeBindStrNameAttr() { auto attr = getProperties().bindStrName; getProperties().bindStrName = {}; return attr; } ::mlir::Attribute removeBindIdNameDeviceTypeAttr() { auto attr = getProperties().bindIdNameDeviceType; getProperties().bindIdNameDeviceType = {}; return attr; } ::mlir::Attribute removeBindStrNameDeviceTypeAttr() { auto attr = getProperties().bindStrNameDeviceType; getProperties().bindStrNameDeviceType = {}; return attr; } ::mlir::Attribute removeWorkerAttr() { auto attr = getProperties().worker; getProperties().worker = {}; return attr; } ::mlir::Attribute removeVectorAttr() { auto attr = getProperties().vector; getProperties().vector = {}; return attr; } ::mlir::Attribute removeSeqAttr() { auto attr = getProperties().seq; getProperties().seq = {}; return attr; } ::mlir::Attribute removeNohostAttr() { auto attr = getProperties().nohost; getProperties().nohost = {}; return attr; } ::mlir::Attribute removeImplicitAttr() { auto attr = getProperties().implicit; getProperties().implicit = {}; return attr; } ::mlir::Attribute removeGangAttr() { auto attr = getProperties().gang; getProperties().gang = {}; return attr; } ::mlir::Attribute removeGangDimAttr() { auto attr = getProperties().gangDim; getProperties().gangDim = {}; return attr; } ::mlir::Attribute removeGangDimDeviceTypeAttr() { auto attr = getProperties().gangDimDeviceType; getProperties().gangDimDeviceType = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static RoutineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static RoutineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static RoutineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static RoutineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/::mlir::UnitAttr nohost, /*optional*/::mlir::UnitAttr implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static RoutineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static RoutineOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static RoutineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static RoutineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr func_name, /*optional*/::mlir::ArrayAttr bindIdName, /*optional*/::mlir::ArrayAttr bindStrName, /*optional*/::mlir::ArrayAttr bindIdNameDeviceType, /*optional*/::mlir::ArrayAttr bindStrNameDeviceType, /*optional*/::mlir::ArrayAttr worker, /*optional*/::mlir::ArrayAttr vector, /*optional*/::mlir::ArrayAttr seq, /*optional*/bool nohost, /*optional*/bool implicit, /*optional*/::mlir::ArrayAttr gang, /*optional*/::mlir::ArrayAttr gangDim, /*optional*/::mlir::ArrayAttr gangDimDeviceType); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RoutineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RoutineOp 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 RoutineOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static RoutineOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 14 && "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: // 'create' function to generate an 'empty' routine. static RoutineOp create(::mlir::OpBuilder & builder, ::mlir::Location location, ::llvm::StringRef sym_name, mlir::SymbolRefAttr func_name, bool implicit) { return create(builder, location, sym_name, func_name, /*bindIDName=*/{}, /*bindStrName=*/{}, /*bindIdNameDeviceType=*/{}, /*bindStrnameDeviceType=*/{}, /*worker=*/{}, /*vector=*/{}, /*seq=*/{}, /*nohost=*/false, implicit, /*gang=*/{}, /*gangDim=*/{}, /*gangDimDeviceType=*/{}); } static StringRef getGangDimKeyword() { return "dim"; } /// Return true if the op has the worker attribute for the /// mlir::acc::DeviceType::None device_type. bool hasWorker(); /// Return true if the op has the worker attribute for the given /// device_type. bool hasWorker(mlir::acc::DeviceType deviceType); /// Return true if the op has the vector attribute for the /// mlir::acc::DeviceType::None device_type. bool hasVector(); /// Return true if the op has the vector attribute for the given /// device_type. bool hasVector(mlir::acc::DeviceType deviceType); /// Return true if the op has the seq attribute for the /// mlir::acc::DeviceType::None device_type. bool hasSeq(); /// Return true if the op has the seq attribute for the given /// device_type. bool hasSeq(mlir::acc::DeviceType deviceType); /// Return true if the op has the gang attribute for the /// mlir::acc::DeviceType::None device_type. bool hasGang(); /// Return true if the op has the gang attribute for the given /// device_type. bool hasGang(mlir::acc::DeviceType deviceType); std::optional getGangDimValue(); std::optional getGangDimValue(mlir::acc::DeviceType deviceType); std::optional<::std::variant> getBindNameValue(); std::optional<::std::variant> getBindNameValue(mlir::acc::DeviceType deviceType); // Add an entry to the 'seq' attribute for each additional device types. void addSeq(MLIRContext *, llvm::ArrayRef); // Add an entry to the 'vector' attribute for each additional device types. void addVector(MLIRContext *, llvm::ArrayRef); // Add an entry to the 'worker' attribute for each additional device types. void addWorker(MLIRContext *, llvm::ArrayRef); // Add an entry to the 'gang' attribute for each additional device type. void addGang(MLIRContext *, llvm::ArrayRef); // Add an entry to the 'gang' attribute with a value for each additional // device type. void addGang(MLIRContext *, llvm::ArrayRef, uint64_t); // Add an entry to the 'bind' string-name attribute for each additional // device_type. void addBindStrName(MLIRContext *, llvm::ArrayRef, mlir::StringAttr); // Add an entry to the 'bind' ID-name attribute for each additional // device_type. void addBindIDName(MLIRContext *, llvm::ArrayRef, mlir::SymbolRefAttr); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::RoutineOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::RoutineOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::SerialOp declarations //===----------------------------------------------------------------------===// namespace detail { class SerialOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using combinedTy = ::mlir::UnitAttr; combinedTy combined; auto getCombined() const { auto &propStorage = this->combined; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setCombined(const ::mlir::UnitAttr &propValue) { this->combined = propValue; } using defaultAttrTy = ::mlir::acc::ClauseDefaultValueAttr; defaultAttrTy defaultAttr; auto getDefaultAttr() const { auto &propStorage = this->defaultAttr; return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(propStorage); } void setDefaultAttr(const ::mlir::acc::ClauseDefaultValueAttr &propValue) { this->defaultAttr = propValue; } using hasWaitDevnumTy = ::mlir::ArrayAttr; hasWaitDevnumTy hasWaitDevnum; auto getHasWaitDevnum() const { auto &propStorage = this->hasWaitDevnum; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setHasWaitDevnum(const ::mlir::ArrayAttr &propValue) { this->hasWaitDevnum = propValue; } using selfAttrTy = ::mlir::UnitAttr; selfAttrTy selfAttr; auto getSelfAttr() const { auto &propStorage = this->selfAttr; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setSelfAttr(const ::mlir::UnitAttr &propValue) { this->selfAttr = propValue; } using waitOnlyTy = ::mlir::ArrayAttr; waitOnlyTy waitOnly; auto getWaitOnly() const { auto &propStorage = this->waitOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOnly(const ::mlir::ArrayAttr &propValue) { this->waitOnly = propValue; } using waitOperandsDeviceTypeTy = ::mlir::ArrayAttr; waitOperandsDeviceTypeTy waitOperandsDeviceType; auto getWaitOperandsDeviceType() const { auto &propStorage = this->waitOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->waitOperandsDeviceType = propValue; } using waitOperandsSegmentsTy = ::mlir::DenseI32ArrayAttr; waitOperandsSegmentsTy waitOperandsSegments; auto getWaitOperandsSegments() const { auto &propStorage = this->waitOperandsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setWaitOperandsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->waitOperandsSegments = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.combined == this->combined && rhs.defaultAttr == this->defaultAttr && rhs.hasWaitDevnum == this->hasWaitDevnum && rhs.selfAttr == this->selfAttr && rhs.waitOnly == this->waitOnly && rhs.waitOperandsDeviceType == this->waitOperandsDeviceType && rhs.waitOperandsSegments == this->waitOperandsSegments && 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: SerialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.serial", odsAttrs.getContext()); } SerialOpGenericAdaptorBase(SerialOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); return attr; } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::UnitAttr getSelfAttrAttr(); bool getSelfAttr(); ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); return attr; } ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); ::mlir::UnitAttr getCombinedAttr(); bool getCombined(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class SerialOpGenericAdaptor : public detail::SerialOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SerialOpGenericAdaptorBase; static constexpr int odsIndex_asyncOperands = 0; static constexpr int odsIndex_waitOperands = 1; static constexpr int odsIndex_ifCond = 2; static constexpr int odsIndex_selfCond = 3; static constexpr int odsIndex_reductionOperands = 4; static constexpr int odsIndex_privateOperands = 5; static constexpr int odsIndex_firstprivateOperands = 6; static constexpr int odsIndex_dataClauseOperands = 7; public: SerialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SerialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SerialOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SerialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : SerialOpGenericAdaptor(values, attrs, Properties{}, {}) {} SerialOpGenericAdaptor(RangeT values, const SerialOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SerialOpGenericAdaptor(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 getAsyncOperands() { return getODSOperands(0); } RangeT getWaitOperands() { return getODSOperands(1); } ValueT getIfCond() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getSelfCond() { auto operands = getODSOperands(3); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getReductionOperands() { return getODSOperands(4); } RangeT getPrivateOperands() { return getODSOperands(5); } RangeT getFirstprivateOperands() { return getODSOperands(6); } RangeT getDataClauseOperands() { return getODSOperands(7); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SerialOpAdaptor : public SerialOpGenericAdaptor<::mlir::ValueRange> { public: using SerialOpGenericAdaptor::SerialOpGenericAdaptor; SerialOpAdaptor(SerialOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SerialOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = SerialOpAdaptor; template using GenericAdaptor = SerialOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_asyncOperands = 0; static constexpr int odsIndex_waitOperands = 1; static constexpr int odsIndex_ifCond = 2; static constexpr int odsIndex_selfCond = 3; static constexpr int odsIndex_reductionOperands = 4; static constexpr int odsIndex_privateOperands = 5; static constexpr int odsIndex_firstprivateOperands = 6; static constexpr int odsIndex_dataClauseOperands = 7; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::getRegionInvocationBounds; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("combined"), ::llvm::StringRef("defaultAttr"), ::llvm::StringRef("hasWaitDevnum"), ::llvm::StringRef("selfAttr"), ::llvm::StringRef("waitOnly"), ::llvm::StringRef("waitOperandsDeviceType"), ::llvm::StringRef("waitOperandsSegments"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getCombinedAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getCombinedAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getDefaultAttrAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getDefaultAttrAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getHasWaitDevnumAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getHasWaitDevnumAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getSelfAttrAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getSelfAttrAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getWaitOnlyAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getWaitOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getWaitOperandsSegmentsAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getWaitOperandsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.serial"); } 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 getAsyncOperands() { return getODSOperands(0); } ::mlir::Operation::operand_range getWaitOperands() { return getODSOperands(1); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::TypedValue<::mlir::IntegerType> getSelfCond() { auto operands = getODSOperands(3); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::Operation::operand_range getReductionOperands() { return getODSOperands(4); } ::mlir::Operation::operand_range getPrivateOperands() { return getODSOperands(5); } ::mlir::Operation::operand_range getFirstprivateOperands() { return getODSOperands(6); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(7); } ::mlir::MutableOperandRange getAsyncOperandsMutable(); ::mlir::MutableOperandRange getWaitOperandsMutable(); ::mlir::MutableOperandRange getIfCondMutable(); ::mlir::MutableOperandRange getSelfCondMutable(); ::mlir::MutableOperandRange getReductionOperandsMutable(); ::mlir::MutableOperandRange getPrivateOperandsMutable(); ::mlir::MutableOperandRange getFirstprivateOperandsMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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 &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 getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::UnitAttr getSelfAttrAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().selfAttr); } bool getSelfAttr(); ::mlir::acc::ClauseDefaultValueAttr getDefaultAttrAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::ClauseDefaultValueAttr>(getProperties().defaultAttr); } ::std::optional<::mlir::acc::ClauseDefaultValue> getDefaultAttr(); ::mlir::UnitAttr getCombinedAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().combined); } bool getCombined(); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setWaitOperandsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().waitOperandsSegments = attr; } void setWaitOperandsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setWaitOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().waitOperandsDeviceType = attr; } void setHasWaitDevnumAttr(::mlir::ArrayAttr attr) { getProperties().hasWaitDevnum = attr; } void setWaitOnlyAttr(::mlir::ArrayAttr attr) { getProperties().waitOnly = attr; } void setSelfAttrAttr(::mlir::UnitAttr attr) { getProperties().selfAttr = attr; } void setSelfAttr(bool attrValue); void setDefaultAttrAttr(::mlir::acc::ClauseDefaultValueAttr attr) { getProperties().defaultAttr = attr; } void setDefaultAttr(::std::optional<::mlir::acc::ClauseDefaultValue> attrValue); void setCombinedAttr(::mlir::UnitAttr attr) { getProperties().combined = attr; } void setCombined(bool attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeWaitOperandsSegmentsAttr() { auto attr = getProperties().waitOperandsSegments; getProperties().waitOperandsSegments = {}; return attr; } ::mlir::Attribute removeWaitOperandsDeviceTypeAttr() { auto attr = getProperties().waitOperandsDeviceType; getProperties().waitOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeHasWaitDevnumAttr() { auto attr = getProperties().hasWaitDevnum; getProperties().hasWaitDevnum = {}; return attr; } ::mlir::Attribute removeWaitOnlyAttr() { auto attr = getProperties().waitOnly; getProperties().waitOnly = {}; return attr; } ::mlir::Attribute removeSelfAttrAttr() { auto attr = getProperties().selfAttr; getProperties().selfAttr = {}; return attr; } ::mlir::Attribute removeDefaultAttrAttr() { auto attr = getProperties().defaultAttr; getProperties().defaultAttr = {}; return attr; } ::mlir::Attribute removeCombinedAttr() { auto attr = getProperties().combined; getProperties().combined = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static SerialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static SerialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static SerialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static SerialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/::mlir::UnitAttr selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/::mlir::UnitAttr combined); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static SerialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static SerialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static SerialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static SerialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, /*optional*/::mlir::Value ifCond, /*optional*/::mlir::Value selfCond, /*optional*/bool selfAttr, ::mlir::ValueRange reductionOperands, ::mlir::ValueRange privateOperands, ::mlir::ValueRange firstprivateOperands, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::acc::ClauseDefaultValueAttr defaultAttr, /*optional*/bool combined = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static SerialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static SerialOp 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 SerialOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static SerialOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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: /// The number of data operands. unsigned getNumDataOperands(); /// The i-th data operand passed. Value getDataOperand(unsigned i); /// Used to retrieve the block inside the op's region. Block &getBody() { return getRegion().front(); } /// Return true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly(); /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType); /// Return the value of the async clause if present. mlir::Value getAsyncValue(); /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType); /// Return true if the op has the wait attribute for the /// mlir::acc::DeviceType::None device_type. bool hasWaitOnly(); /// Return true if the op has the wait attribute for the given device_type. bool hasWaitOnly(mlir::acc::DeviceType deviceType); /// Return the values of the wait clause if present. mlir::Operation::operand_range getWaitValues(); /// Return the values of the wait clause for the given device_type if /// present. mlir::Operation::operand_range getWaitValues(mlir::acc::DeviceType deviceType); /// Return the wait devnum value clause if present; mlir::Value getWaitDevnum(); /// Return the wait devnum value clause for the given device_type if /// present. mlir::Value getWaitDevnum(mlir::acc::DeviceType deviceType); static mlir::acc::Construct getConstructId() { return mlir::acc::Construct::acc_construct_serial; } /// Add an entry to the 'async-only' attribute (clause spelled without /// arguments) for each of the additional device types (or a none if it is /// empty). void addAsyncOnly(MLIRContext *, llvm::ArrayRef); /// Add a value to the 'async' with the current list of device types. void addAsyncOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an entry to the 'wait-only' attribute (clause spelled without /// arguments) for each of the additional device types (or a none if it is /// empty). void addWaitOnly(MLIRContext *, llvm::ArrayRef); /// Add an array-like entry to the 'wait' with the current list of device /// types. void addWaitOperands(MLIRContext *, bool hasDevnum, mlir::ValueRange, llvm::ArrayRef); /// Adds a private clause variable to this operation, including its recipe. void addPrivatization(MLIRContext *, mlir::acc::PrivateOp op, mlir::acc::PrivateRecipeOp recipe); /// Adds a firstprivate clause variable to this operation, including its /// recipe. void addFirstPrivatization(MLIRContext *, mlir::acc::FirstprivateOp op, mlir::acc::FirstprivateRecipeOp recipe); /// Adds a reduction clause variable to this operation, including its /// recipe. void addReduction(MLIRContext *, mlir::acc::ReductionOp op, mlir::acc::ReductionRecipeOp recipe); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::SerialOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::SerialOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::SetOp declarations //===----------------------------------------------------------------------===// namespace detail { class SetOpGenericAdaptorBase { public: struct Properties { using device_typeTy = ::mlir::acc::DeviceTypeAttr; device_typeTy device_type; auto getDeviceType() const { auto &propStorage = this->device_type; return ::llvm::dyn_cast_or_null<::mlir::acc::DeviceTypeAttr>(propStorage); } void setDeviceType(const ::mlir::acc::DeviceTypeAttr &propValue) { this->device_type = 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.device_type == this->device_type && 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: SetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.set", odsAttrs.getContext()); } SetOpGenericAdaptorBase(SetOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::acc::DeviceTypeAttr getDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::acc::DeviceTypeAttr>(getProperties().device_type); return attr; } ::std::optional<::mlir::acc::DeviceType> getDeviceType(); }; } // namespace detail template class SetOpGenericAdaptor : public detail::SetOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SetOpGenericAdaptorBase; static constexpr int odsIndex_defaultAsync = 0; static constexpr int odsIndex_deviceNum = 1; static constexpr int odsIndex_ifCond = 2; public: SetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SetOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : SetOpGenericAdaptor(values, attrs, Properties{}, {}) {} SetOpGenericAdaptor(RangeT values, const SetOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SetOpGenericAdaptor(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 getDefaultAsync() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getDeviceNum() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getIfCond() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SetOpAdaptor : public SetOpGenericAdaptor<::mlir::ValueRange> { public: using SetOpGenericAdaptor::SetOpGenericAdaptor; SetOpAdaptor(SetOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SetOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = SetOpAdaptor; template using GenericAdaptor = SetOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_defaultAsync = 0; static constexpr int odsIndex_deviceNum = 1; static constexpr int odsIndex_ifCond = 2; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device_type"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDeviceTypeAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDeviceTypeAttrName(::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("acc.set"); } 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::TypedValue<::mlir::Type> getDefaultAsync() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getDeviceNum() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::MutableOperandRange getDefaultAsyncMutable(); ::mlir::MutableOperandRange getDeviceNumMutable(); ::mlir::MutableOperandRange getIfCondMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::acc::DeviceTypeAttr getDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DeviceTypeAttr>(getProperties().device_type); } ::std::optional<::mlir::acc::DeviceType> getDeviceType(); void setDeviceTypeAttr(::mlir::acc::DeviceTypeAttr attr) { getProperties().device_type = attr; } void setDeviceType(::std::optional<::mlir::acc::DeviceType> attrValue); ::mlir::Attribute removeDeviceTypeAttr() { auto attr = getProperties().device_type; getProperties().device_type = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::acc::DeviceTypeAttr device_type, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static SetOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::acc::DeviceTypeAttr device_type, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static SetOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::acc::DeviceTypeAttr device_type, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::acc::DeviceTypeAttr device_type, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static SetOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::acc::DeviceTypeAttr device_type, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static SetOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::acc::DeviceTypeAttr device_type, /*optional*/::mlir::Value defaultAsync, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static SetOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static SetOp 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 SetOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static SetOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::SetOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::SetOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::ShutdownOp declarations //===----------------------------------------------------------------------===// namespace detail { class ShutdownOpGenericAdaptorBase { public: struct Properties { using device_typesTy = ::mlir::ArrayAttr; device_typesTy device_types; auto getDeviceTypes() const { auto &propStorage = this->device_types; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setDeviceTypes(const ::mlir::ArrayAttr &propValue) { this->device_types = 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.device_types == this->device_types && 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: ShutdownOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.shutdown", odsAttrs.getContext()); } ShutdownOpGenericAdaptorBase(ShutdownOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getDeviceTypesAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().device_types); return attr; } ::std::optional< ::mlir::ArrayAttr > getDeviceTypes(); }; } // namespace detail template class ShutdownOpGenericAdaptor : public detail::ShutdownOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ShutdownOpGenericAdaptorBase; static constexpr int odsIndex_deviceNum = 0; static constexpr int odsIndex_ifCond = 1; public: ShutdownOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ShutdownOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ShutdownOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ShutdownOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : ShutdownOpGenericAdaptor(values, attrs, Properties{}, {}) {} ShutdownOpGenericAdaptor(RangeT values, const ShutdownOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ShutdownOpGenericAdaptor(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 getDeviceNum() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getIfCond() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ShutdownOpAdaptor : public ShutdownOpGenericAdaptor<::mlir::ValueRange> { public: using ShutdownOpGenericAdaptor::ShutdownOpGenericAdaptor; ShutdownOpAdaptor(ShutdownOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ShutdownOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = ShutdownOpAdaptor; template using GenericAdaptor = ShutdownOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_deviceNum = 0; static constexpr int odsIndex_ifCond = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device_types"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDeviceTypesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDeviceTypesAttrName(::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("acc.shutdown"); } 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::TypedValue<::mlir::Type> getDeviceNum() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::MutableOperandRange getDeviceNumMutable(); ::mlir::MutableOperandRange getIfCondMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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 getDeviceTypesAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().device_types); } ::std::optional< ::mlir::ArrayAttr > getDeviceTypes(); void setDeviceTypesAttr(::mlir::ArrayAttr attr) { getProperties().device_types = attr; } ::mlir::Attribute removeDeviceTypesAttr() { auto attr = getProperties().device_types; getProperties().device_types = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static ShutdownOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static ShutdownOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static ShutdownOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static ShutdownOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::ArrayAttr device_types, /*optional*/::mlir::Value deviceNum, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ShutdownOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ShutdownOp 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 ShutdownOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ShutdownOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: /// Adds a device type to the list of device types for this directive. void addDeviceType(MLIRContext *, mlir::acc::DeviceType); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::ShutdownOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::ShutdownOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::TerminatorOp declarations //===----------------------------------------------------------------------===// namespace detail { class TerminatorOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: TerminatorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.terminator", odsAttrs.getContext()); } TerminatorOpGenericAdaptorBase(TerminatorOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class TerminatorOpGenericAdaptor : public detail::TerminatorOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::TerminatorOpGenericAdaptorBase; public: TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TerminatorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : TerminatorOpGenericAdaptor(values, attrs, Properties{}, {}) {} TerminatorOpGenericAdaptor(RangeT values, const TerminatorOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> TerminatorOpGenericAdaptor(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 getOperands() { return odsOperands; } private: RangeT odsOperands; }; class TerminatorOpAdaptor : public TerminatorOpGenericAdaptor<::mlir::ValueRange> { public: using TerminatorOpGenericAdaptor::TerminatorOpGenericAdaptor; TerminatorOpAdaptor(TerminatorOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class TerminatorOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = TerminatorOpAdaptor; template using GenericAdaptor = TerminatorOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchTerminatorOpInterface::Trait::getSuccessorRegions; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.terminator"); } 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)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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); static TerminatorOp create(::mlir::OpBuilder &builder, ::mlir::Location location); static TerminatorOp create(::mlir::ImplicitLocOpBuilder &builder); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); static TerminatorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes); static TerminatorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static TerminatorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static TerminatorOp 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 TerminatorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static TerminatorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionSuccessor point); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::TerminatorOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::UnwrapPrivateOp declarations //===----------------------------------------------------------------------===// namespace detail { class UnwrapPrivateOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: UnwrapPrivateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.unwrap_private", odsAttrs.getContext()); } UnwrapPrivateOpGenericAdaptorBase(UnwrapPrivateOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class UnwrapPrivateOpGenericAdaptor : public detail::UnwrapPrivateOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::UnwrapPrivateOpGenericAdaptorBase; static constexpr int odsIndex_handle = 0; public: UnwrapPrivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} UnwrapPrivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : UnwrapPrivateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} UnwrapPrivateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : UnwrapPrivateOpGenericAdaptor(values, attrs, Properties{}, {}) {} UnwrapPrivateOpGenericAdaptor(RangeT values, const UnwrapPrivateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> UnwrapPrivateOpGenericAdaptor(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 getHandle() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class UnwrapPrivateOpAdaptor : public UnwrapPrivateOpGenericAdaptor<::mlir::ValueRange> { public: using UnwrapPrivateOpGenericAdaptor::UnwrapPrivateOpGenericAdaptor; UnwrapPrivateOpAdaptor(UnwrapPrivateOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class UnwrapPrivateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::ViewLikeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = UnwrapPrivateOpAdaptor; template using GenericAdaptor = UnwrapPrivateOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_handle = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.unwrap_private"); } 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::acc::PrivateType> getHandle() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PrivateType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getHandleMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::acc::PointerLikeType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*getODSResults(0).begin()); } 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, ::mlir::Type result, ::mlir::Value handle); static UnwrapPrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value handle); static UnwrapPrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value handle); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); static UnwrapPrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value handle); static UnwrapPrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value handle); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UnwrapPrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UnwrapPrivateOp 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 UnwrapPrivateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static UnwrapPrivateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: ::mlir::Value getViewSource() { return getHandle(); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UnwrapPrivateOp) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::UpdateDeviceOp declarations //===----------------------------------------------------------------------===// namespace detail { class UpdateDeviceOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: UpdateDeviceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.update_device", odsAttrs.getContext()); } UpdateDeviceOpGenericAdaptorBase(UpdateDeviceOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class UpdateDeviceOpGenericAdaptor : public detail::UpdateDeviceOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::UpdateDeviceOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: UpdateDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} UpdateDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : UpdateDeviceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} UpdateDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : UpdateDeviceOpGenericAdaptor(values, attrs, Properties{}, {}) {} UpdateDeviceOpGenericAdaptor(RangeT values, const UpdateDeviceOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> UpdateDeviceOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class UpdateDeviceOpAdaptor : public UpdateDeviceOpGenericAdaptor<::mlir::ValueRange> { public: using UpdateDeviceOpGenericAdaptor::UpdateDeviceOpGenericAdaptor; UpdateDeviceOpAdaptor(UpdateDeviceOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class UpdateDeviceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = UpdateDeviceOpAdaptor; template using GenericAdaptor = UpdateDeviceOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.update_device"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UpdateDeviceOp 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 UpdateDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static UpdateDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateDeviceOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::UpdateDeviceOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::UpdateHostOp declarations //===----------------------------------------------------------------------===// namespace detail { class UpdateHostOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.structured == this->structured && rhs.varType == this->varType && 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: UpdateHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.update_host", odsAttrs.getContext()); } UpdateHostOpGenericAdaptorBase(UpdateHostOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); }; } // namespace detail template class UpdateHostOpGenericAdaptor : public detail::UpdateHostOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::UpdateHostOpGenericAdaptorBase; static constexpr int odsIndex_accVar = 0; static constexpr int odsIndex_var = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: UpdateHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} UpdateHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : UpdateHostOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} UpdateHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : UpdateHostOpGenericAdaptor(values, attrs, Properties{}, {}) {} UpdateHostOpGenericAdaptor(RangeT values, const UpdateHostOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> UpdateHostOpGenericAdaptor(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 getAccVar() { return (*getODSOperands(0).begin()); } ValueT getVar() { return (*getODSOperands(1).begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class UpdateHostOpAdaptor : public UpdateHostOpGenericAdaptor<::mlir::ValueRange> { public: using UpdateHostOpGenericAdaptor::UpdateHostOpGenericAdaptor; UpdateHostOpAdaptor(UpdateHostOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class UpdateHostOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = UpdateHostOpAdaptor; template using GenericAdaptor = UpdateHostOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_accVar = 0; static constexpr int odsIndex_var = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::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("acc.update_host"); } 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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getAccVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static UpdateHostOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static UpdateHostOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static UpdateHostOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static UpdateHostOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static UpdateHostOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::TypeAttr varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static UpdateHostOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static UpdateHostOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value accVar, ::mlir::Value var, ::mlir::Type varType, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UpdateHostOp 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 UpdateHostOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static UpdateHostOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 8 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } /// Check if this is an acc update self. bool isSelf() { return getDataClause() == acc::DataClause::acc_update_self; } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateHostOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::UpdateHostOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::UpdateOp declarations //===----------------------------------------------------------------------===// namespace detail { class UpdateOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using hasWaitDevnumTy = ::mlir::ArrayAttr; hasWaitDevnumTy hasWaitDevnum; auto getHasWaitDevnum() const { auto &propStorage = this->hasWaitDevnum; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setHasWaitDevnum(const ::mlir::ArrayAttr &propValue) { this->hasWaitDevnum = propValue; } using ifPresentTy = ::mlir::UnitAttr; ifPresentTy ifPresent; auto getIfPresent() const { auto &propStorage = this->ifPresent; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setIfPresent(const ::mlir::UnitAttr &propValue) { this->ifPresent = propValue; } using waitOnlyTy = ::mlir::ArrayAttr; waitOnlyTy waitOnly; auto getWaitOnly() const { auto &propStorage = this->waitOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOnly(const ::mlir::ArrayAttr &propValue) { this->waitOnly = propValue; } using waitOperandsDeviceTypeTy = ::mlir::ArrayAttr; waitOperandsDeviceTypeTy waitOperandsDeviceType; auto getWaitOperandsDeviceType() const { auto &propStorage = this->waitOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setWaitOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->waitOperandsDeviceType = propValue; } using waitOperandsSegmentsTy = ::mlir::DenseI32ArrayAttr; waitOperandsSegmentsTy waitOperandsSegments; auto getWaitOperandsSegments() const { auto &propStorage = this->waitOperandsSegments; return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(propStorage); } void setWaitOperandsSegments(const ::mlir::DenseI32ArrayAttr &propValue) { this->waitOperandsSegments = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.hasWaitDevnum == this->hasWaitDevnum && rhs.ifPresent == this->ifPresent && rhs.waitOnly == this->waitOnly && rhs.waitOperandsDeviceType == this->waitOperandsDeviceType && rhs.waitOperandsSegments == this->waitOperandsSegments && 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: UpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.update", odsAttrs.getContext()); } UpdateOpGenericAdaptorBase(UpdateOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); return attr; } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); return attr; } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::UnitAttr getIfPresentAttr(); bool getIfPresent(); }; } // namespace detail template class UpdateOpGenericAdaptor : public detail::UpdateOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::UpdateOpGenericAdaptorBase; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_asyncOperands = 1; static constexpr int odsIndex_waitOperands = 2; static constexpr int odsIndex_dataClauseOperands = 3; public: UpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} UpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : UpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} UpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : UpdateOpGenericAdaptor(values, attrs, Properties{}, {}) {} UpdateOpGenericAdaptor(RangeT values, const UpdateOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> UpdateOpGenericAdaptor(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 getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getAsyncOperands() { return getODSOperands(1); } RangeT getWaitOperands() { return getODSOperands(2); } RangeT getDataClauseOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class UpdateOpAdaptor : public UpdateOpGenericAdaptor<::mlir::ValueRange> { public: using UpdateOpGenericAdaptor::UpdateOpGenericAdaptor; UpdateOpAdaptor(UpdateOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class UpdateOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = UpdateOpAdaptor; template using GenericAdaptor = UpdateOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_ifCond = 0; static constexpr int odsIndex_asyncOperands = 1; static constexpr int odsIndex_waitOperands = 2; static constexpr int odsIndex_dataClauseOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("hasWaitDevnum"), ::llvm::StringRef("ifPresent"), ::llvm::StringRef("waitOnly"), ::llvm::StringRef("waitOperandsDeviceType"), ::llvm::StringRef("waitOperandsSegments"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getHasWaitDevnumAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getHasWaitDevnumAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getIfPresentAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getIfPresentAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getWaitOnlyAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getWaitOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getWaitOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getWaitOperandsSegmentsAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getWaitOperandsSegmentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::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("acc.update"); } 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::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(1); } ::mlir::Operation::operand_range getWaitOperands() { return getODSOperands(2); } ::mlir::Operation::operand_range getDataClauseOperands() { return getODSOperands(3); } ::mlir::MutableOperandRange getIfCondMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); ::mlir::MutableOperandRange getWaitOperandsMutable(); ::mlir::MutableOperandRange getDataClauseOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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 getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::DenseI32ArrayAttr getWaitOperandsSegmentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().waitOperandsSegments); } ::std::optional<::llvm::ArrayRef> getWaitOperandsSegments(); ::mlir::ArrayAttr getWaitOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getWaitOperandsDeviceType(); ::mlir::ArrayAttr getHasWaitDevnumAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().hasWaitDevnum); } ::std::optional< ::mlir::ArrayAttr > getHasWaitDevnum(); ::mlir::ArrayAttr getWaitOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().waitOnly); } ::std::optional< ::mlir::ArrayAttr > getWaitOnly(); ::mlir::UnitAttr getIfPresentAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().ifPresent); } bool getIfPresent(); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setWaitOperandsSegmentsAttr(::mlir::DenseI32ArrayAttr attr) { getProperties().waitOperandsSegments = attr; } void setWaitOperandsSegments(::std::optional<::llvm::ArrayRef> attrValue); void setWaitOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().waitOperandsDeviceType = attr; } void setHasWaitDevnumAttr(::mlir::ArrayAttr attr) { getProperties().hasWaitDevnum = attr; } void setWaitOnlyAttr(::mlir::ArrayAttr attr) { getProperties().waitOnly = attr; } void setIfPresentAttr(::mlir::UnitAttr attr) { getProperties().ifPresent = attr; } void setIfPresent(bool attrValue); ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeWaitOperandsSegmentsAttr() { auto attr = getProperties().waitOperandsSegments; getProperties().waitOperandsSegments = {}; return attr; } ::mlir::Attribute removeWaitOperandsDeviceTypeAttr() { auto attr = getProperties().waitOperandsDeviceType; getProperties().waitOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeHasWaitDevnumAttr() { auto attr = getProperties().hasWaitDevnum; getProperties().hasWaitDevnum = {}; return attr; } ::mlir::Attribute removeWaitOnlyAttr() { auto attr = getProperties().waitOnly; getProperties().waitOnly = {}; return attr; } ::mlir::Attribute removeIfPresentAttr() { auto attr = getProperties().ifPresent; getProperties().ifPresent = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static UpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static UpdateOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static UpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static UpdateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/::mlir::UnitAttr ifPresent); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static UpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static UpdateOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static UpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static UpdateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ifCond, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::ValueRange waitOperands, /*optional*/::mlir::DenseI32ArrayAttr waitOperandsSegments, /*optional*/::mlir::ArrayAttr waitOperandsDeviceType, /*optional*/::mlir::ArrayAttr hasWaitDevnum, /*optional*/::mlir::ArrayAttr waitOnly, ::mlir::ValueRange dataClauseOperands, /*optional*/bool ifPresent = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UpdateOp 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 UpdateOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static UpdateOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 7 && "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: /// The number of data operands. unsigned getNumDataOperands(); /// The i-th data operand passed. Value getDataOperand(unsigned i); /// Return true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly(); /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType); /// Return the value of the async clause if present. mlir::Value getAsyncValue(); /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType); /// Return true if the op has the wait attribute for the /// mlir::acc::DeviceType::None device_type. bool hasWaitOnly(); /// Return true if the op has the wait attribute for the given device_type. bool hasWaitOnly(mlir::acc::DeviceType deviceType); /// Return the values of the wait clause if present. mlir::Operation::operand_range getWaitValues(); /// Return the values of the wait clause for the given device_type if /// present. mlir::Operation::operand_range getWaitValues(mlir::acc::DeviceType deviceType); /// Return the wait devnum value clause if present; mlir::Value getWaitDevnum(); /// Return the wait devnum value clause for the given device_type if /// present. mlir::Value getWaitDevnum(mlir::acc::DeviceType deviceType); /// Add an entry to the 'async-only' attribute (clause spelled without /// arguments)for each of the additional device types (or a none if it is /// empty). void addAsyncOnly(MLIRContext *, llvm::ArrayRef); /// Add a value to the 'async' with the current list of device types. void addAsyncOperand(MLIRContext *, mlir::Value, llvm::ArrayRef); /// Add an entry to the 'wait-only' attribute (clause spelled without /// arguments)for each of the additional device types (or a none if it is /// empty). void addWaitOnly(MLIRContext *, llvm::ArrayRef); /// Add an array-like entry to the 'wait' with the current list of device /// types. void addWaitOperands(MLIRContext *, bool hasDevnum, mlir::ValueRange, llvm::ArrayRef); }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UpdateOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::UpdateOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::UseDeviceOp declarations //===----------------------------------------------------------------------===// namespace detail { class UseDeviceOpGenericAdaptorBase { public: struct Properties { using asyncOnlyTy = ::mlir::ArrayAttr; asyncOnlyTy asyncOnly; auto getAsyncOnly() const { auto &propStorage = this->asyncOnly; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOnly(const ::mlir::ArrayAttr &propValue) { this->asyncOnly = propValue; } using asyncOperandsDeviceTypeTy = ::mlir::ArrayAttr; asyncOperandsDeviceTypeTy asyncOperandsDeviceType; auto getAsyncOperandsDeviceType() const { auto &propStorage = this->asyncOperandsDeviceType; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setAsyncOperandsDeviceType(const ::mlir::ArrayAttr &propValue) { this->asyncOperandsDeviceType = propValue; } using dataClauseTy = ::mlir::acc::DataClauseAttr; dataClauseTy dataClause; auto getDataClause() const { auto &propStorage = this->dataClause; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(propStorage); } void setDataClause(const ::mlir::acc::DataClauseAttr &propValue) { this->dataClause = propValue; } using implicitTy = ::mlir::BoolAttr; implicitTy implicit; auto getImplicit() const { auto &propStorage = this->implicit; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setImplicit(const ::mlir::BoolAttr &propValue) { this->implicit = propValue; } using modifiersTy = ::mlir::acc::DataClauseModifierAttr; modifiersTy modifiers; auto getModifiers() const { auto &propStorage = this->modifiers; return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(propStorage); } void setModifiers(const ::mlir::acc::DataClauseModifierAttr &propValue) { this->modifiers = propValue; } using nameTy = ::mlir::StringAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setName(const ::mlir::StringAttr &propValue) { this->name = propValue; } using recipeTy = ::mlir::SymbolRefAttr; recipeTy recipe; auto getRecipe() const { auto &propStorage = this->recipe; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setRecipe(const ::mlir::SymbolRefAttr &propValue) { this->recipe = propValue; } using structuredTy = ::mlir::BoolAttr; structuredTy structured; auto getStructured() const { auto &propStorage = this->structured; return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); } void setStructured(const ::mlir::BoolAttr &propValue) { this->structured = propValue; } using varTypeTy = ::mlir::TypeAttr; varTypeTy varType; auto getVarType() const { auto &propStorage = this->varType; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setVarType(const ::mlir::TypeAttr &propValue) { this->varType = 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.asyncOnly == this->asyncOnly && rhs.asyncOperandsDeviceType == this->asyncOperandsDeviceType && rhs.dataClause == this->dataClause && rhs.implicit == this->implicit && rhs.modifiers == this->modifiers && rhs.name == this->name && rhs.recipe == this->recipe && rhs.structured == this->structured && rhs.varType == this->varType && 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: UseDeviceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.use_device", odsAttrs.getContext()); } UseDeviceOpGenericAdaptorBase(UseDeviceOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::TypeAttr getVarTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); return attr; } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); return attr; } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr(); ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr(); bool getStructured(); ::mlir::BoolAttr getImplicitAttr(); bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr(); ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); return attr; } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); }; } // namespace detail template class UseDeviceOpGenericAdaptor : public detail::UseDeviceOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::UseDeviceOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; public: UseDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} UseDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : UseDeviceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} UseDeviceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : UseDeviceOpGenericAdaptor(values, attrs, Properties{}, {}) {} UseDeviceOpGenericAdaptor(RangeT values, const UseDeviceOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> UseDeviceOpGenericAdaptor(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 getVar() { return (*getODSOperands(0).begin()); } ValueT getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getBounds() { return getODSOperands(2); } RangeT getAsyncOperands() { return getODSOperands(3); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class UseDeviceOpAdaptor : public UseDeviceOpGenericAdaptor<::mlir::ValueRange> { public: using UseDeviceOpGenericAdaptor::UseDeviceOpGenericAdaptor; UseDeviceOpAdaptor(UseDeviceOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class UseDeviceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = UseDeviceOpAdaptor; template using GenericAdaptor = UseDeviceOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_varPtrPtr = 1; static constexpr int odsIndex_bounds = 2; static constexpr int odsIndex_asyncOperands = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("asyncOnly"), ::llvm::StringRef("asyncOperandsDeviceType"), ::llvm::StringRef("dataClause"), ::llvm::StringRef("implicit"), ::llvm::StringRef("modifiers"), ::llvm::StringRef("name"), ::llvm::StringRef("recipe"), ::llvm::StringRef("structured"), ::llvm::StringRef("varType"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncOnlyAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncOnlyAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getAsyncOperandsDeviceTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getDataClauseAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getDataClauseAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getImplicitAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getImplicitAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getModifiersAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getModifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } ::mlir::StringAttr getRecipeAttrName() { return getAttributeNameForIndex(6); } static ::mlir::StringAttr getRecipeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 6); } ::mlir::StringAttr getStructuredAttrName() { return getAttributeNameForIndex(7); } static ::mlir::StringAttr getStructuredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 7); } ::mlir::StringAttr getVarTypeAttrName() { return getAttributeNameForIndex(8); } static ::mlir::StringAttr getVarTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 8); } ::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("acc.use_device"); } 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::TypedValue<::mlir::Type> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::acc::PointerLikeType> getVarPtrPtr() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::acc::PointerLikeType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::acc::PointerLikeType>>(*operands.begin()); } ::mlir::Operation::operand_range getBounds() { return getODSOperands(2); } ::mlir::Operation::operand_range getAsyncOperands() { return getODSOperands(3); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getVarPtrPtrMutable(); ::mlir::MutableOperandRange getBoundsMutable(); ::mlir::MutableOperandRange getAsyncOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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::TypedValue<::mlir::Type> getAccVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } 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::TypeAttr getVarTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().varType); } ::mlir::Type getVarType(); ::mlir::ArrayAttr getAsyncOperandsDeviceTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOperandsDeviceType); } ::std::optional< ::mlir::ArrayAttr > getAsyncOperandsDeviceType(); ::mlir::ArrayAttr getAsyncOnlyAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().asyncOnly); } ::std::optional< ::mlir::ArrayAttr > getAsyncOnly(); ::mlir::acc::DataClauseAttr getDataClauseAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseAttr>(getProperties().dataClause); } ::mlir::acc::DataClause getDataClause(); ::mlir::BoolAttr getStructuredAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().structured); } bool getStructured(); ::mlir::BoolAttr getImplicitAttr() { return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().implicit); } bool getImplicit(); ::mlir::acc::DataClauseModifierAttr getModifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::acc::DataClauseModifierAttr>(getProperties().modifiers); } ::mlir::acc::DataClauseModifier getModifiers(); ::mlir::StringAttr getNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().name); } ::std::optional< ::llvm::StringRef > getName(); ::mlir::SymbolRefAttr getRecipeAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().recipe); } ::std::optional< ::mlir::SymbolRefAttr > getRecipe(); void setVarTypeAttr(::mlir::TypeAttr attr) { getProperties().varType = attr; } void setVarType(::mlir::Type attrValue); void setAsyncOperandsDeviceTypeAttr(::mlir::ArrayAttr attr) { getProperties().asyncOperandsDeviceType = attr; } void setAsyncOnlyAttr(::mlir::ArrayAttr attr) { getProperties().asyncOnly = attr; } void setDataClauseAttr(::mlir::acc::DataClauseAttr attr) { getProperties().dataClause = attr; } void setDataClause(::mlir::acc::DataClause attrValue); void setStructuredAttr(::mlir::BoolAttr attr) { getProperties().structured = attr; } void setStructured(bool attrValue); void setImplicitAttr(::mlir::BoolAttr attr) { getProperties().implicit = attr; } void setImplicit(bool attrValue); void setModifiersAttr(::mlir::acc::DataClauseModifierAttr attr) { getProperties().modifiers = attr; } void setModifiers(::mlir::acc::DataClauseModifier attrValue); void setNameAttr(::mlir::StringAttr attr) { getProperties().name = attr; } void setName(::std::optional<::llvm::StringRef> attrValue); void setRecipeAttr(::mlir::SymbolRefAttr attr) { getProperties().recipe = attr; } ::mlir::Attribute removeAsyncOperandsDeviceTypeAttr() { auto attr = getProperties().asyncOperandsDeviceType; getProperties().asyncOperandsDeviceType = {}; return attr; } ::mlir::Attribute removeAsyncOnlyAttr() { auto attr = getProperties().asyncOnly; getProperties().asyncOnly = {}; return attr; } ::mlir::Attribute removeNameAttr() { auto attr = getProperties().name; getProperties().name = {}; return attr; } ::mlir::Attribute removeRecipeAttr() { auto attr = getProperties().recipe; getProperties().recipe = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, bool structured, bool implicit, const ::llvm::Twine &name, ::mlir::ValueRange bounds = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVarType, ::mlir::Value var, ::mlir::Type varType, ::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, ::mlir::ArrayAttr asyncOperandsDeviceType, ::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, ::mlir::StringAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::TypeAttr varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClauseAttr dataClause, ::mlir::BoolAttr structured, ::mlir::BoolAttr implicit, ::mlir::acc::DataClauseModifierAttr modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type accVar, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Type varType, /*optional*/::mlir::Value varPtrPtr, ::mlir::ValueRange bounds, ::mlir::ValueRange asyncOperands, /*optional*/::mlir::ArrayAttr asyncOperandsDeviceType, /*optional*/::mlir::ArrayAttr asyncOnly, ::mlir::acc::DataClause dataClause, bool structured, bool implicit, ::mlir::acc::DataClauseModifier modifiers, /*optional*/::mlir::StringAttr name, /*optional*/::mlir::SymbolRefAttr recipe); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UseDeviceOp 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 UseDeviceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static UseDeviceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 9 && "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 true if the op has the async attribute for the /// mlir::acc::DeviceType::None device_type. bool hasAsyncOnly() { return hasAsyncOnly(mlir::acc::DeviceType::None); } /// Return true if the op has the async attribute for the given device_type. bool hasAsyncOnly(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr asyncOnly = getAsyncOnlyAttr(); if (!asyncOnly) return false; for (auto attr : asyncOnly) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return true; } return false; } /// Return the value of the async clause if present. mlir::Value getAsyncValue() { return getAsyncValue(mlir::acc::DeviceType::None); } /// Return the value of the async clause for the given device_type if /// present. mlir::Value getAsyncValue(mlir::acc::DeviceType deviceType) { mlir::ArrayAttr deviceTypes = getAsyncOperandsDeviceTypeAttr(); if (!deviceTypes) return nullptr; for (auto [attr, asyncValue] : llvm::zip(deviceTypes, getAsyncOperands())) { auto deviceTypeAttr = mlir::dyn_cast(attr); if (deviceTypeAttr.getValue() == deviceType) return asyncValue; } return nullptr; } mlir::TypedValue getVarPtr() { return mlir::dyn_cast>(getVar()); } mlir::TypedValue getAccPtr() { return mlir::dyn_cast>(getAccVar()); } }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::UseDeviceOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::UseDeviceOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::WaitOp declarations //===----------------------------------------------------------------------===// namespace detail { class WaitOpGenericAdaptorBase { public: struct Properties { using asyncTy = ::mlir::UnitAttr; asyncTy async; auto getAsync() const { auto &propStorage = this->async; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setAsync(const ::mlir::UnitAttr &propValue) { this->async = 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.async == this->async && 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: WaitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.wait", odsAttrs.getContext()); } WaitOpGenericAdaptorBase(WaitOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::UnitAttr getAsyncAttr(); bool getAsync(); }; } // namespace detail template class WaitOpGenericAdaptor : public detail::WaitOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::WaitOpGenericAdaptorBase; static constexpr int odsIndex_waitOperands = 0; static constexpr int odsIndex_asyncOperand = 1; static constexpr int odsIndex_waitDevnum = 2; static constexpr int odsIndex_ifCond = 3; public: WaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} WaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : WaitOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} WaitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs) : WaitOpGenericAdaptor(values, attrs, Properties{}, {}) {} WaitOpGenericAdaptor(RangeT values, const WaitOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> WaitOpGenericAdaptor(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 getWaitOperands() { return getODSOperands(0); } ValueT getAsyncOperand() { auto operands = getODSOperands(1); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getWaitDevnum() { auto operands = getODSOperands(2); return operands.empty() ? ValueT{} : (*operands.begin()); } ValueT getIfCond() { auto operands = getODSOperands(3); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class WaitOpAdaptor : public WaitOpGenericAdaptor<::mlir::ValueRange> { public: using WaitOpGenericAdaptor::WaitOpGenericAdaptor; WaitOpAdaptor(WaitOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class WaitOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = WaitOpAdaptor; template using GenericAdaptor = WaitOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_waitOperands = 0; static constexpr int odsIndex_asyncOperand = 1; static constexpr int odsIndex_waitDevnum = 2; static constexpr int odsIndex_ifCond = 3; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("async"), ::llvm::StringRef("operandSegmentSizes")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAsyncAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAsyncAttrName(::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("acc.wait"); } 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 getWaitOperands() { return getODSOperands(0); } ::mlir::TypedValue<::mlir::Type> getAsyncOperand() { auto operands = getODSOperands(1); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::Type> getWaitDevnum() { auto operands = getODSOperands(2); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::TypedValue<::mlir::IntegerType> getIfCond() { auto operands = getODSOperands(3); return operands.empty() ? ::mlir::TypedValue<::mlir::IntegerType>{} : ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*operands.begin()); } ::mlir::MutableOperandRange getWaitOperandsMutable(); ::mlir::MutableOperandRange getAsyncOperandMutable(); ::mlir::MutableOperandRange getWaitDevnumMutable(); ::mlir::MutableOperandRange getIfCondMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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::UnitAttr getAsyncAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async); } bool getAsync(); void setAsyncAttr(::mlir::UnitAttr attr) { getProperties().async = attr; } void setAsync(bool attrValue); ::mlir::Attribute removeAsyncAttr() { auto attr = getProperties().async; getProperties().async = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond); static WaitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond); static WaitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond); static WaitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond); static WaitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/::mlir::UnitAttr async, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond); static WaitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond); static WaitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond); static WaitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond); static WaitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange waitOperands, /*optional*/::mlir::Value asyncOperand, /*optional*/::mlir::Value waitDevnum, /*optional*/bool async, /*optional*/::mlir::Value ifCond); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static WaitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static WaitOp 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 WaitOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static WaitOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); 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: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::WaitOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::detail::WaitOpGenericAdaptorBase::Properties) namespace mlir::acc { //===----------------------------------------------------------------------===// // ::mlir::acc::YieldOp declarations //===----------------------------------------------------------------------===// namespace detail { class YieldOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("acc.yield", odsAttrs.getContext()); } YieldOpGenericAdaptorBase(YieldOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::YieldOpGenericAdaptorBase; static constexpr int odsIndex_operands = 0; public: YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : YieldOpGenericAdaptor(values, attrs, Properties{}, {}) {} YieldOpGenericAdaptor(RangeT values, const YieldOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> YieldOpGenericAdaptor(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 getOperands() { return getODSOperands(0); } private: RangeT odsOperands; }; class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { public: using YieldOpGenericAdaptor::YieldOpGenericAdaptor; YieldOpAdaptor(YieldOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { public: using Op::Op; using Op::print; using Adaptor = YieldOpAdaptor; template using GenericAdaptor = YieldOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_operands = 0; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchTerminatorOpInterface::Trait::getMutableSuccessorOperands; using ::mlir::RegionBranchTerminatorOpInterface::Trait::getSuccessorRegions; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("acc.yield"); } 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 getOperands() { return getODSOperands(0); } ::mlir::MutableOperandRange getOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::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)}; } 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); static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location); static YieldOp create(::mlir::ImplicitLocOpBuilder &builder); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands); static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands); static YieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static YieldOp 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 YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static YieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::acc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::acc::YieldOp) #endif // GET_OP_CLASSES