'acc' Dialect
The acc
dialect is an MLIR dialect for representing the OpenACC
programming model. OpenACC is a standardized directive-based model which
is used with C, C++, and Fortran to enable programmers to expose
parallelism in their code. The descriptive approach used by OpenACC
allows targeting of parallel multicore and accelerator targets like GPUs
by giving the compiler the freedom of how to parallelize for specific
architectures. OpenACC also provides the ability to optimize the
parallelism through increasingly more prescriptive clauses.
This dialect models the constructs from the OpenACC 3.3 specification
This document describes the design of the OpenACC dialect in MLIR. It lists and explains design goals and design choices along with their rationale. It also describes specifics with regards to acc dialect operations, types, and attributes.
Dialect Design Goals ¶
- Needs to have complete representation of the OpenACC language.
- A frontend requires this in order to properly generate a
representation of possible
acc
pragmas in MLIR. Additionally, this dialect is expected to be further lowered when materializing its semantics. Without a complete representation, a frontend might choose a lower abstraction (such as direct runtime call) - but this would impact the ability to do analysis and optimizations on the dialect.
- A frontend requires this in order to properly generate a
representation of possible
- Allow representation at the same semantic level as the OpenACC
language while having capability to represent nuances of the source
language semantics (such as Fortran descriptors) in an agnostic manner.
- Using abstractions that closely model the OpenACC language
simplifies frontend implementation. It also allows for easier
debugging of the IR. However, sometimes source language specific
behavior is needed when materializing OpenACC. In these cases, such
as privatization of C++ objects with default constructor, the
frontend fills in the
recipe
along with theprivate
operation which can be packaged neatly with theacc
dialect operations.
- Using abstractions that closely model the OpenACC language
simplifies frontend implementation. It also allows for easier
debugging of the IR. However, sometimes source language specific
behavior is needed when materializing OpenACC. In these cases, such
as privatization of C++ objects with default constructor, the
frontend fills in the
- Be able to regenerate the semantic equivalent of the user pragmas from
the dialect (including bounds, names, clauses, modifiers, etc).
- This is a strong measure of making sure that the dialect is not lossy in semantics. It also allows capability to generate appropriate and useful debug information outside of the frontend.
- Be dialect agnostic so that it can be used and coexist with other
dialects including but not limited to
hlfir
,fir
,llvm
,cir
.- Directive-based models such as OpenACC are always used with a
source language, so the
acc
dialect coexisting with other dialect(s) is necessary by construction. Through proper abstractions, neither theacc
dialect nor the source language dialect should have dependencies on each other; where needed, interfaces should be used to ensureacc
dialect can verify expected properties.
- Directive-based models such as OpenACC are always used with a
source language, so the
- The dialect must allow dataflow to be modeled accurately and
performantly using MLIR’s existing facilities.
- Appropriate dataflow modeling is important for analyses and IR
reasoning - even something as simple as walking the uses. Therefore
operations, like data operations, are expected to generate results
which can be used in modeling behavior. For example, consider an
acc copyin
clause. After theacc.copyin
operation, a pointer which lives on devices should be distinguishable from one that lives in host memory.
- Appropriate dataflow modeling is important for analyses and IR
reasoning - even something as simple as walking the uses. Therefore
operations, like data operations, are expected to generate results
which can be used in modeling behavior. For example, consider an
- Be friendly to MLIR optimization passes by implementing common
interfaces.
- Interfaces, such as
MemoryEffects
, are the key way MLIR transformations and analyses are designed to interact with the IR. In order for the operations in theacc
dialect to be optimizable (either directly or even indirectly by not blocking optimizations of nested IR), implementing relevant common interfaces is needed.
- Interfaces, such as
The design philosophy of the acc dialect is one where the design goals are adhered to. Current and planned operations, attributes, types must adhere to the design goals.
Operation Categories ¶
The OpenACC dialect includes both high-level operations (which retain the same semantic meaning as their OpenACC language equivalent), intermediate-level operations (which are used to decompose clauses from constructs), and low-level operations (to encode specifics associated with source language in a generic way).
The high-level operations list contains the following OpenACC language constructs and their corresponding operations:
acc parallel
→acc.parallel
acc kernels
→acc.kernels
acc serial
→acc.serial
acc data
→acc.data
acc loop
→acc.loop
acc enter data
→acc.enter_data
acc exit data
→acc.exit_data
acc host_data
→acc.host_data
acc init
→acc.init
acc shutdown
→acc.shutdown
acc update
→acc.update
acc set
→acc.set
acc wait
→acc.wait
acc atomic read
→acc.atomic.read
acc atomic write
→acc.atomic.write
acc atomic update
→acc.atomic.update
acc atomic capture
→acc.atomic.capture
This second group contains operations which are used to represent either decomposed constructs or clauses for more accurate modeling:
acc routine
→acc.routine
+acc.routine_info
attributeacc declare
→acc.declare_enter
+acc.declare_exit
oracc.declare
acc {construct} copyin
→acc.copyin
(before region) +acc.delete
(after region)acc {construct} copy
→acc.copyin
(before region) +acc.copyout
(after region)acc {construct} copyout
→acc.create
(before region) +acc.copyout
(after region)acc {construct} attach
→acc.attach
(before region) +acc.detach
(after region)acc {construct} create
→acc.create
(before region) +acc.delete
(after region)acc {construct} present
→acc.present
(before region) +acc.delete
(after region)acc {construct} no_create
→acc.nocreate
(before region) +acc.delete
(after region)acc {construct} deviceptr
→acc.deviceptr
acc {construct} private
→acc.private
acc {construct} firstprivate
→acc.firstprivate
acc {construct} reduction
→acc.reduction
acc cache
→acc.cache
acc update device
→acc.update_device
acc update host
→acc.update_host
acc host_data use_device
→acc.use_device
acc declare device_resident
→acc.declare_device_resident
acc declare link
→acc.declare_link
acc exit data delete
→acc.delete
(withstructured
flag as false)acc exit data detach
→acc.detach
(withstructured
flag as false)acc {construct} {data_clause}(var[lb:ub])
→acc.bounds
The low-level operations are:
acc.private.recipe
acc.reduction.recipe
acc.firstprivate.recipe
acc.global_ctor
acc.global_dtor
acc.yield
acc.terminator
The low-level operations semantics and reasoning are further explained in sections below.
Data Operations ¶
Data Clause Decomposition ¶
The data clauses are decomposed from their constructs for better dataflow modeling in MLIR. There are multiple reasons for this which are consistent with the dialect goals:
- Correctly represents dataflow. Data clauses have different effects at entry to region and at exit from region.
- Friendlier to add attributes such as
MemoryEffects
to a single operation. This can better reflect semantics (like the fact that anacc.copyin
operation only reads host memory) - Operations can be moved or optimized individually (eg
CSE
). - Easier to keep track of debug information. Line location can point to the text representing the data clause instead of the construct. Additionally, attributes can be used to keep track of variable names in clauses without having to walk the IR tree in attempt to recover the information (this makes acc dialect more agnostic with regards to what other dialect it is used with).
- Clear operation ordering since all data operations are on same list.
Each of the acc
dialect data operations represents either the
entry or the exit portion of the data action specification. Thus,
acc.copyin
represents the semantics defined in section
2.7.7 copyin clause
whose wording starts with
At entry to a region
. The decomposed exit operation acc.delete
represents the second part of that section, whose wording starts with
At exit from the region
. The delete
action may be performed
after checking and updating of the relevant reference counters noted.
The acc
data operations, even when decomposed, retain their original
data clause in an operation operand dataClause
for possibility to
recover this information during debugging. For example, acc copy
,
does not translate to acc.copy
operation, but instead to acc.copyin
for entry and acc.copyout
for exit. Both the decomposed operations
hold a dataClause
field that specifies this was an acc copy
.
The link between the decomposed entry and exit operations is the ssa
value produced by the entry operation. Namely, it is the accPtr
result
which is used both in the dataOperands
of the operation used for the
construct and in the accPtr
operand of the exit operation.
Bounds ¶
OpenACC data clauses allow the use of bounds specifiers as per
2.7.1 Data Specification in Data Clauses
. However, array dimensions
for the data are not always required in the clause if the source
language’s type system captures this information - the user can just
specify the variable name in the data clause. So the acc.bounds
operation is an important piece to ensure uniform representation of both
explicit user set dimensions and implicit type-based dimensions. It
contains several key features to allow properly encoding sizes in a
manner flexible and agnostic to the source language’s dialect:
- Multi-dimensional arrays can be represented by using multiple ordered
acc.bounds
operations. - Bounds are required to be zero-normalized. 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. This requirement also works well in ensuring theacc
dialect is agnostic to source language dialect since it prevents ambiguity such as the case of Fortran arrays where the lower bound is not a fixed value. - If the source dialect does not encode the dimensions in the type (eg
!fir.array<?x?xi32>
) but instead encodes it in some other way (such as through descriptors), then the frontend must fill in theacc.bounds
operands with appropriate information (such as loads from descriptor). Theacc.bounds
operation also permits lossy source dialect, such as if the frontend uses aggressive pointer decay and cannot represent the dimensions in the type system (eg using!llvm.ptr
for arrays). Both of these aspects showacc.bounds
’ operation’s flexibility to allow the representation to be agnostic since theacc
dialect is not expected to be able to understand how to extract dimension information from the types of the source dialect. - The OpenACC specification allows either extent or upperbound in the
data clause depending on whether it is Fortran or C and C++. The
acc.bounds
operation is rich enough to accept either or both - for convenience in lowering to the dialect and for ability to precisely capture the meaning from the clause. - The stride, either in units or bytes, can be also captured in the
acc.bounds
operation. This is also an important part to be able to accept a source language’s arrays without forcing the frontend to normalize them in some way. For example, consider a case where in a parent function, a whole array is mapped to device. Then only a view of a non-1 stride is passed to child function (eg Fortran array slice with non-1 stride). Acopy
operation of this data in child should be able to avoid remapping this array. If instead the operation required normalizing the array (such as making it contiguous), then unexpected disjoint mapping of the same host data would be error-prone since it would result in multiple mappings to device.
Counters ¶
The data operations also maintain semantics described in the OpenACC
specification related to runtime counters. More specifically, consider
the specification of the entry portion of acc copyin
in section 2.7.7:
At entry to a region, the structured reference counter is used. On an
enter data directive, the dynamic reference counter is used.
- If var is present and is not a null pointer, a present increment
action with the appropriate reference counter is performed.
- If var is not present, a copyin action with the appropriate reference
counter is performed.
- If var is a pointer reference, an attach action is performed.
The acc.copyin
operation includes these semantics, including those
related to attach, which is specified through the varPtrPtr
operand.
The structured
flag on the operation is important since the
structured reference counter
should be used when the flag is true; and
the dynamic reference counter
should be used when it is false.
At exit from structured regions (acc data
, acc kernels
), the
acc copyin
operation is decomposed to acc.delete
(with the
structured
flag as true). The semantics of the acc.delete
are
also consistent with the OpenACC specification noted for the exit
portion of the acc copyin
clause:
At exit from the region:
- If the structured reference counter for var is zero, no action is
taken.
- Otherwise, a detach action is performed if var is a pointer reference,
and a present decrement action with the structured reference counter is
performed if var is not a null pointer. If both structured and dynamic
reference counters are zero, a delete action is performed.
Types ¶
There are a few acc dialect type categories to describe:
- type of acc data clause operation input
varPtr
- The type of
varPtr
must be pointer-like. This is done by attaching thePointerLikeType
interface to the appropriate MLIR type. Although memory/storage concept is a lower level abstraction, it is useful because the OpenACC model distinguishes between host and device memory explicitly - and the mapping between the two is done through pointers. Thus, by explicitly requiring it in the dialect, the appropriate language frontend must create storage or use type that satisfies the mapping constraint.
- The type of
- type of result of acc data clause operations
- The type of the acc data clause operation is exactly the same as
varPtr
. This was done intentionally instead of introducing anacc.ref/ptr
type so that IR compatibility and the dialect’s existing strong type checking can be maintained. This is needed since theacc
dialect must live within another dialect whose type system is unknown to it. The only constraint is that the appropriate dialect type must use thePointerLikeType
interface.
- The type of the acc data clause operation is exactly the same as
- type of decomposed clauses
- Decomposed clauses, such as
acc.bounds
andacc.declare_enter
produce types to allow their results to be used only in specific operations.
- Decomposed clauses, such as
Recipes ¶
Recipes are a generic way to express source language specific semantics.
There are currently two categories of recipes, but the recipe concept can be extended for any additional low-level information that needs to be captured for successful lowering of OpenACC. The two categories are:
- recipes used in the context of privatization associated with a construct
- recipes used in the context of additional specification of data semantics
The intention of the recipes is to specify how materialization of action, such as privatization, should be done when the semantics of the action needs interpreted and lowered, such as before generating LLVM dialect.
The recipes used for privatization provide a source-language independent
way of specifying the creation of a local variable of that type. This
means using the appropriate alloca
instruction and being able to
specify default initialization or default constructor.
Routine ¶
The routine directive is used to note that a procedure should be made available for the accelerator in a way that is consistent with its modifiers, such as those that describe the parallelism. In the acc dialect, an acc routine is represented through two joint pieces - an attribute and an operation:
- The
acc.routine
operation is simply a specifier which notes which symbol (or string) the acc routine is needed for, along with parallelism associated. This defines a symbol that can be referenced in attribute. - The
acc.routine_info
attribute is an attribute used on the source dialect specific operation which specifies one or multipleacc.routine
symbols. Typically, this is attached tofunc.func
which either provides the declaration (in case of externals) or provides the actual body of the acc routine in the dialect that the source language was translated to.
Declare ¶
OpenACC declare
is a mechanism which declares a definition of a global
or a local to be accessible to accelerator with an implicit lifetime
as that of the scope where it was declared in. Thus, declare
semantics
are represented through multiple operations and attributes:
acc.declare
- This is a structured operation which contains an MLIR region and can be used in similar manner as acc.data to specify an implicit data region with specific procedure lifetime. This is typically used insidefunc.func
after variable declarations.acc.declare_enter
- This is an unstructured operation which is used as a decomposed form ofacc declare
. It effectively allows the entry operation to exist in a scope different than the exit operation. It can also be used alongacc.declare_exit
which consumes its token to define a scoped region without using MLIR region. This operation is also used inacc.global_ctor
.acc.declare_exit
- The matching equivalent ofacc.declare_enter
except that it specifies exit semantics. This operation is typically used inside afunc.func
at the exit points or withacc.global_dtor
.acc.global_ctor
- Lives at the same level as source dialect globals and is used to specify data actions to be done at program entry. This is used in conjunction with source dialect globals whose lifetime is not just a single procedure.acc.global_dtor
- Defines the exit data actions that should be done at program exit. Typically used to revert the actions ofacc.global_ctor
.
The attributes:
acc.declare
- This is a facility for easier determination of variables which areacc declare
’d. This attribute is used on operations producing globals and on operations producing locals such as dialect specificalloca
’s. Having this attribute is required in order to appear in a data mapping operation associated with any of theacc.declare*
operations.acc.declare_action
- Since the OpenACC specification allows declaration of variables that have yet to be allocated, this attribute is used at the allocation and deallocation points. More specifically, this attribute captures symbols of functions to be called to perform an action either pre-allocate, post-allocate, pre-deallocate, or post-deallocate. Calls to these functions should be materialized when lowering OpenACC semantics to ensure proper data actions are done after the allocation/deallocation.
OpenACC Transforms and Analyses ¶
The design goal for the acc
dialect is to be friendly to MLIR
optimization passes including CSE and LICM. Additionally, since it is
designed to recover original clauses, it makes late verification and
analysis possible in the MLIR framework outside of the frontend.
This section describes a few MLIR-level passes for which the acc
dialect design should be friendly for. This section is currently
solely outlining the possibilities intended by the design and not
necessarily existing passes.
Verification ¶
Since the OpenACC dialect is not lossy with regards to its representation, it is possible to do OpenACC language semantic checking at the MLIR-level. What follows is a list of various semantic checks needed.
This first list is required to be done in the frontend because the acc
dialect operations must be valid when constructed:
- Ensure that only listed clauses are allowed for each directive.
- Ensure that only listed modifiers are allowed for each clause.
However, the following are semantic checks that can be done at the MLIR-level (either in a separate pass or as part of the operation verifier):
- Specify the validity checks that each modifier needs. (eg num_gangs may need a positive integer).
- Ensure valid clause nesting.
- Validate clause restrictions which cannot appear with others.
- Validate that no conflicting clauses are used on variables.
Note that some of these checks can be even more precise when done at the MLIR level because optimizations like inlining and constant propagation expose detail that wouldn’t have been visible in the frontend.
Implicit Data Attributes ¶
The OpenACC specification includes a section on 2.6.2 Variables with Implicitly Determined Data Attributes
. What this section describes are
the data actions that should be applied to a variable for which
user did not specify a data action for. The action depends on the
construct being used and also on the default clause. However, the point
to note here is that variables which are live-in into the acc region
must employ some data mapping so the data can be passed to accelerator.
One possible optimizations that affects data attributes needed is
Scalar Replacement of Aggregates (SROA)
. The acc
dialect should
not prevent this from happening on the source dialect.
Because it is intended to be possible to apply optimizations across an
acc
region, the analysis/transformation pass that applies the implicit
data attributes should be run as late as possible - ideally right before
any outlining process which uses the acc
region body to create an
accelerator procedure. It is expected that existing MLIR facilities,
such as mlir::Liveness
will work for the acc
region and thus can be
used to perform this analysis.
Redundant Clause Elimination ¶
The data operations are modeled in a way where data entry operations look like loads and data exit operations look like stores. Thus these operations are intended to be optimized in the following ways:
- Be able to eliminate redundant operations such as when an
acc.copyin
dominates another. - Be able to hoist/sink such operations out of loops.
Operations TOC ¶
Operations ¶
acc.atomic.capture
(acc::AtomicCaptureOp) ¶
Performs an atomic capture
Syntax:
operation ::= `acc.atomic.capture` $region attr-dict
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
}
Traits: RecursiveMemoryEffects
, SingleBlockImplicitTerminator<TerminatorOp>
, SingleBlock
Interfaces: AtomicCaptureOpInterface
acc.atomic.read
(acc::AtomicReadOp) ¶
Performs an atomic read
Syntax:
operation ::= `acc.atomic.read` $v `=` $x
`:` type($v) `,` type($x) `,` $element_type attr-dict
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.
Interfaces: AtomicReadOpInterface
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
element_type | ::mlir::TypeAttr | any type attribute |
Operands: ¶
Operand | Description |
---|---|
x | pointer-like type |
v | pointer-like type |
acc.atomic.update
(acc::AtomicUpdateOp) ¶
Performs an atomic update
Syntax:
operation ::= `acc.atomic.update` $x `:` type($x) $region attr-dict
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.
Traits: RecursiveMemoryEffects
, SingleBlockImplicitTerminator<YieldOp>
, SingleBlock
Interfaces: AtomicUpdateOpInterface
Operands: ¶
Operand | Description |
---|---|
x | pointer-like type |
acc.atomic.write
(acc::AtomicWriteOp) ¶
Performs an atomic write
Syntax:
operation ::= `acc.atomic.write` $x `=` $expr
`:` type($x) `,` type($expr)
attr-dict
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).
Interfaces: AtomicWriteOpInterface
Operands: ¶
Operand | Description |
---|---|
x | pointer-like type |
expr | any type |
acc.attach
(acc::AttachOp) ¶
Represents acc attach semantics which updates a pointer in device memory with the corresponding device address of the pointee.
Syntax:
operation ::= `acc.attach` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.bounds
(acc::DataBoundsOp) ¶
Represents normalized bounds information for acc data clause.
Syntax:
operation ::= `acc.bounds` oilist(
`lowerbound` `(` $lowerbound `:` type($lowerbound) `)`
| `upperbound` `(` $upperbound `:` type($upperbound) `)`
| `extent` `(` $extent `:` type($extent) `)`
| `stride` `(` $stride `:` type($stride) `)`
| `startIdx` `(` $startIdx `:` type($startIdx) `)`
) attr-dict
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.
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])
=>
acc.bounds lb(1) ub(9) extent(9) startIdx(0)
Fortran:
integer :: array(1:10)
!$acc copy(array(2:10))
=>
acc.bounds lb(1) ub(9) extent(9) startIdx(1)
Traits: AttrSizedOperandSegments
Interfaces: NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
strideInBytes | ::mlir::BoolAttr | bool attribute |
Operands: ¶
Operand | Description |
---|---|
lowerbound | integer or index |
upperbound | integer or index |
extent | integer or index |
stride | integer or index |
startIdx | integer or index |
Results: ¶
Result | Description |
---|---|
result | Type for representing acc data clause bounds information |
acc.cache
(acc::CacheOp) ¶
Represents the cache directive that is associated with a loop.
Syntax:
operation ::= `acc.cache` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.copyin
(acc::CopyinOp) ¶
Represents copyin semantics for acc data clauses like acc copyin and acc copy.
Syntax:
operation ::= `acc.copyin` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.copyout
(acc::CopyoutOp) ¶
Represents acc copyout semantics - reverse of copyin.
Syntax:
operation ::= `acc.copyout` `accPtr` `(` $accPtr `:` type($accPtr) `)`
(`bounds` `(` $bounds^ `)` )?
(`async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType)^ `)`)?
`to` `varPtr` `(` $varPtr `:` type($varPtr) `)`
attr-dict
varPtr
: The address of variable to copy back to.accPtr
: The acc address of 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
accPtr | PointerLikeType instance |
varPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
acc.create
(acc::CreateOp) ¶
Represents create semantics for acc data clauses like acc create and acc copyout.
Syntax:
operation ::= `acc.create` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.data
(acc::DataOp) ¶
Data construct
Syntax:
operation ::= `acc.data` oilist(
`if` `(` $ifCond `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
| `dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
| `wait` `` custom<WaitClause>($waitOperands, type($waitOperands),
$waitOperandsDeviceType, $waitOperandsSegments, $hasWaitDevnum,
$waitOnly)
)
$region attr-dict-with-keyword
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:
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.
Traits: AttrSizedOperandSegments
, RecursiveMemoryEffects
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
waitOperandsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
waitOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
hasWaitDevnum | ::mlir::ArrayAttr | 1-bit boolean array attribute |
waitOnly | ::mlir::ArrayAttr | device type array attribute |
defaultAttr | ::mlir::acc::ClauseDefaultValueAttr | DefaultValue ClauseEnum cases:
|
Operands: ¶
Operand | Description |
---|---|
ifCond | 1-bit signless integer |
asyncOperands | variadic of integer or index |
waitOperands | variadic of integer or index |
dataClauseOperands | variadic of PointerLikeType instance |
acc.declare
(acc::DeclareOp) ¶
Declare implicit region
Syntax:
operation ::= `acc.declare` `dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
$region attr-dict-with-keyword
The “acc.declare” operation represents an implicit declare region in function (and subroutine in Fortran).
Example:
%pa = acc.present varPtr(%a : memref<10x10xf32>) -> memref<10x10xf32>
acc.declare dataOperands(%pa: memref<10x10xf32>) {
// implicit region
}
Traits: RecursiveMemoryEffects
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource}
Operands: ¶
Operand | Description |
---|---|
dataClauseOperands | variadic of PointerLikeType instance |
acc.declare_device_resident
(acc::DeclareDeviceResidentOp) ¶
Represents acc declare device_resident semantics.
Syntax:
operation ::= `acc.declare_device_resident` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.declare_enter
(acc::DeclareEnterOp) ¶
Declare directive - entry to implicit data region
Syntax:
operation ::= `acc.declare_enter` oilist(
`dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
)
attr-dict-with-keyword
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)
:
%0 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr
acc.declare_enter dataOperands(%0 : !llvm.ptr)
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Operands: ¶
Operand | Description |
---|---|
dataClauseOperands | variadic of PointerLikeType instance |
Results: ¶
Result | Description |
---|---|
token | declare token type |
acc.declare_exit
(acc::DeclareExitOp) ¶
Declare directive - exit from implicit data region
Syntax:
operation ::= `acc.declare_exit` oilist(
`token` `(` $token `)` |
`dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
)
attr-dict-with-keyword
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)
:
%0 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr {dataClause = #acc<data_clause declare_device_resident>}
acc.declare_exit dataOperands(%0 : !llvm.ptr)
acc.delete accPtr(%0 : !llvm.ptr) {dataClause = #acc<data_clause declare_device_resident>}
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Operands: ¶
Operand | Description |
---|---|
token | declare token type |
dataClauseOperands | variadic of PointerLikeType instance |
acc.declare_link
(acc::DeclareLinkOp) ¶
Represents acc declare link semantics.
Syntax:
operation ::= `acc.declare_link` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.delete
(acc::DeleteOp) ¶
Represents acc delete semantics - reverse of create.
Syntax:
operation ::= `acc.delete` `accPtr` `(` $accPtr `:` type($accPtr) `)`
(`bounds` `(` $bounds^ `)` )?
(`async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType)^ `)`)?
attr-dict
accPtr
: The acc address of 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
accPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
acc.detach
(acc::DetachOp) ¶
Represents acc detach semantics - reverse of attach.
Syntax:
operation ::= `acc.detach` `accPtr` `(` $accPtr `:` type($accPtr) `)`
(`bounds` `(` $bounds^ `)` )?
(`async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType)^ `)`)?
attr-dict
accPtr
: The acc address of 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
accPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
acc.deviceptr
(acc::DevicePtrOp) ¶
Specifies that the variable pointer is a device pointer.
Syntax:
operation ::= `acc.deviceptr` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.enter_data
(acc::EnterDataOp) ¶
Enter data operation
Syntax:
operation ::= `acc.enter_data` oilist(
`if` `(` $ifCond `)`
| `async` `(` $asyncOperand `:` type($asyncOperand) `)`
| `wait_devnum` `(` $waitDevnum `:` type($waitDevnum) `)`
| `wait` `(` $waitOperands `:` type($waitOperands) `)`
| `dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
)
attr-dict-with-keyword
The “acc.enter_data” operation represents the OpenACC enter data directive.
Example:
acc.enter_data create(%d1 : memref<10xf32>) attributes {async}
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
async | ::mlir::UnitAttr | unit attribute |
wait | ::mlir::UnitAttr | unit attribute |
Operands: ¶
Operand | Description |
---|---|
ifCond | 1-bit signless integer |
asyncOperand | integer or index |
waitDevnum | integer or index |
waitOperands | variadic of integer or index |
dataClauseOperands | variadic of PointerLikeType instance |
acc.exit_data
(acc::ExitDataOp) ¶
Exit data operation
Syntax:
operation ::= `acc.exit_data` oilist(
`if` `(` $ifCond `)`
| `async` `(` $asyncOperand `:` type($asyncOperand) `)`
| `wait_devnum` `(` $waitDevnum `:` type($waitDevnum) `)`
| `wait` `(` $waitOperands `:` type($waitOperands) `)`
| `dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
)
attr-dict-with-keyword
The “acc.exit_data” operation represents the OpenACC exit data directive.
Example:
acc.exit_data delete(%d1 : memref<10xf32>) attributes {async}
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
async | ::mlir::UnitAttr | unit attribute |
wait | ::mlir::UnitAttr | unit attribute |
finalize | ::mlir::UnitAttr | unit attribute |
Operands: ¶
Operand | Description |
---|---|
ifCond | 1-bit signless integer |
asyncOperand | integer or index |
waitDevnum | integer or index |
waitOperands | variadic of integer or index |
dataClauseOperands | variadic of PointerLikeType instance |
acc.firstprivate
(acc::FirstprivateOp) ¶
Represents firstprivate semantic for the acc firstprivate clause.
Syntax:
operation ::= `acc.firstprivate` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.firstprivate.recipe
(acc::FirstprivateRecipeOp) ¶
Privatization recipe
Syntax:
operation ::= `acc.firstprivate.recipe` $sym_name `:` $type attr-dict-with-keyword `init` $initRegion
`copy` $copyRegion
(`destroy` $destroyRegion^)?
Declares an OpenACC privatization recipe with copy of the initial value. The operation requires two mandatory regions and one optional.
- 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 value that need to be privatized. This is useful if the type is not known at compile time and the private value is needed to create its copy.
- The copy region specifies how to copy the initial value to the newly created private value. It takes the initial value and the privatized value as arguments.
- The destroy region specifies how to destruct the value when it reaches its end of life. It takes the privatized value as argument. 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:
acc.firstprivate.recipe @privatization_f32 : f32 init {
^bb0(%0: f32):
// init region contains a sequence of operations to create and
// initialize the copy if needed. It yields the create copy.
} copy {
^bb0(%0: f32, %1: !llvm.ptr):
// copy region contains a sequence of operations to copy the initial value
// of the firstprivate value to the newly created value.
} destroy {
^bb0(%0: f32)
// destroy region contains a sequences of operations to destruct the
// created copy.
}
// The privatization symbol is then used in the corresponding operation.
acc.parallel firstprivate(@privatization_f32 -> %a : f32) {
}
Traits: IsolatedFromAbove
Interfaces: RecipeInterface
, Symbol
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
type | ::mlir::TypeAttr | any type attribute |
acc.getdeviceptr
(acc::GetDevicePtrOp) ¶
Gets device address if variable exists on device.
Syntax:
operation ::= `acc.getdeviceptr` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
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:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.global_ctor
(acc::GlobalConstructorOp) ¶
Used to hold construction operations associated with globals such as declare
Syntax:
operation ::= `acc.global_ctor` $sym_name $region attr-dict-with-keyword
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:
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)
}
Traits: IsolatedFromAbove
Interfaces: Symbol
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
acc.global_dtor
(acc::GlobalDestructorOp) ¶
Used to hold destruction operations associated with globals such as declare
Syntax:
operation ::= `acc.global_dtor` $sym_name $region attr-dict-with-keyword
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:
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<data_clause create>}
acc.declare_exit dataOperands(%1 : !llvm.ptr)
acc.delete accPtr(%1 : !llvm.ptr) {dataClause = #acc<data_clause create>}
}
Traits: IsolatedFromAbove
Interfaces: Symbol
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
acc.host_data
(acc::HostDataOp) ¶
Host_data construct
Syntax:
operation ::= `acc.host_data` oilist(
`if` `(` $ifCond `)`
| `dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
)
$region attr-dict-with-keyword
The “acc.host_data” operation represents the OpenACC host_data construct.
Example:
%0 = acc.use_device varPtr(%a : !llvm.ptr) -> !llvm.ptr
acc.host_data dataOperands(%0 : !llvm.ptr) {
}
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
ifPresent | ::mlir::UnitAttr | unit attribute |
Operands: ¶
Operand | Description |
---|---|
ifCond | 1-bit signless integer |
dataClauseOperands | variadic of PointerLikeType instance |
acc.init
(acc::InitOp) ¶
Init operation
Syntax:
operation ::= `acc.init` oilist(`device_num` `(` $deviceNumOperand `:` type($deviceNumOperand) `)`
| `if` `(` $ifCond `)`
) attr-dict-with-keyword
The “acc.init” operation represents the OpenACC init executable directive.
Example:
acc.init
acc.init device_num(%dev1 : i32)
Traits: AttrSizedOperandSegments
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
device_types | ::mlir::ArrayAttr | Device type attributes |
Operands: ¶
Operand | Description |
---|---|
deviceNumOperand | integer or index |
ifCond | 1-bit signless integer |
acc.kernels
(acc::KernelsOp) ¶
Kernels construct
Syntax:
operation ::= `acc.kernels` ( `combined` `(` `loop` `)` $combined^)?
oilist(
`dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
| `num_gangs` `(` custom<NumGangs>($numGangs,
type($numGangs), $numGangsDeviceType, $numGangsSegments) `)`
| `num_workers` `(` custom<DeviceTypeOperands>($numWorkers,
type($numWorkers), $numWorkersDeviceType) `)`
| `vector_length` `(` custom<DeviceTypeOperands>($vectorLength,
type($vectorLength), $vectorLengthDeviceType) `)`
| `wait` `` custom<WaitClause>($waitOperands, type($waitOperands),
$waitOperandsDeviceType, $waitOperandsSegments, $hasWaitDevnum,
$waitOnly)
| `self` `(` $selfCond `)`
| `if` `(` $ifCond `)`
)
$region attr-dict-with-keyword
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:
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.
Traits: AttrSizedOperandSegments
, AutomaticAllocationScope
, RecursiveMemoryEffects
Interfaces: ComputeRegionOpInterface
, MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
waitOperandsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
waitOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
hasWaitDevnum | ::mlir::ArrayAttr | 1-bit boolean array attribute |
waitOnly | ::mlir::ArrayAttr | device type array attribute |
numGangsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
numGangsDeviceType | ::mlir::ArrayAttr | device type array attribute |
numWorkersDeviceType | ::mlir::ArrayAttr | device type array attribute |
vectorLengthDeviceType | ::mlir::ArrayAttr | device type array attribute |
selfAttr | ::mlir::UnitAttr | unit attribute |
defaultAttr | ::mlir::acc::ClauseDefaultValueAttr | DefaultValue ClauseEnum cases:
|
combined | ::mlir::UnitAttr | unit attribute |
Operands: ¶
Operand | Description |
---|---|
asyncOperands | variadic of integer or index |
waitOperands | variadic of integer or index |
numGangs | variadic of integer or index |
numWorkers | variadic of integer or index |
vectorLength | variadic of integer or index |
ifCond | 1-bit signless integer |
selfCond | 1-bit signless integer |
dataClauseOperands | variadic of PointerLikeType instance |
acc.loop
(acc::LoopOp) ¶
Loop construct
Syntax:
operation ::= `acc.loop` custom<CombinedConstructsLoop>($combined)
oilist(
`gang` `` custom<GangClause>($gangOperands, type($gangOperands),
$gangOperandsArgType, $gangOperandsDeviceType,
$gangOperandsSegments, $gang)
| `worker` `` custom<DeviceTypeOperandsWithKeywordOnly>(
$workerNumOperands, type($workerNumOperands),
$workerNumOperandsDeviceType, $worker)
| `vector` `` custom<DeviceTypeOperandsWithKeywordOnly>($vectorOperands,
type($vectorOperands), $vectorOperandsDeviceType, $vector)
| `private` `(` custom<SymOperandList>(
$privateOperands, type($privateOperands), $privatizations) `)`
| `tile` `(` custom<DeviceTypeOperandsWithSegment>($tileOperands,
type($tileOperands), $tileOperandsDeviceType, $tileOperandsSegments)
`)`
| `reduction` `(` custom<SymOperandList>(
$reductionOperands, type($reductionOperands), $reductionRecipes)
`)`
| `cache` `(` $cacheOperands `:` type($cacheOperands) `)`
)
custom<LoopControl>($region, $lowerbound, type($lowerbound), $upperbound,
type($upperbound), $step, type($step))
( `(` type($results)^ `)` )?
attr-dict-with-keyword
The “acc.loop” operation represents the OpenACC loop construct. 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.
Example:
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
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.
Traits: AttrSizedOperandSegments
, AutomaticAllocationScope
, RecursiveMemoryEffects
Interfaces: ComputeRegionOpInterface
, LoopLikeOpInterface
, MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
inclusiveUpperbound | ::mlir::DenseBoolArrayAttr | i1 dense array attribute |
collapse | ::mlir::ArrayAttr | 64-bit integer array attribute |
collapseDeviceType | ::mlir::ArrayAttr | device type array attribute |
gangOperandsArgType | ::mlir::ArrayAttr | gang arg type array attribute |
gangOperandsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
gangOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
workerNumOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
vectorOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
seq | ::mlir::ArrayAttr | device type array attribute |
independent | ::mlir::ArrayAttr | device type array attribute |
auto_ | ::mlir::ArrayAttr | device type array attribute |
gang | ::mlir::ArrayAttr | device type array attribute |
worker | ::mlir::ArrayAttr | device type array attribute |
vector | ::mlir::ArrayAttr | device type array attribute |
tileOperandsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
tileOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
privatizations | ::mlir::ArrayAttr | symbol ref array attribute |
reductionRecipes | ::mlir::ArrayAttr | symbol ref array attribute |
combined | ::mlir::acc::CombinedConstructsTypeAttr | Differentiate between combined constructsEnum cases:
|
Operands: ¶
Operand | Description |
---|---|
lowerbound | variadic of integer or index |
upperbound | variadic of integer or index |
step | variadic of integer or index |
gangOperands | variadic of integer or index |
workerNumOperands | variadic of integer or index |
vectorOperands | variadic of integer or index |
tileOperands | variadic of integer or index |
cacheOperands | variadic of PointerLikeType instance |
privateOperands | variadic of PointerLikeType instance |
reductionOperands | variadic of any type |
Results: ¶
Result | Description |
---|---|
results | variadic of any type |
acc.nocreate
(acc::NoCreateOp) ¶
Represents acc no_create semantics.
Syntax:
operation ::= `acc.nocreate` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.parallel
(acc::ParallelOp) ¶
Parallel construct
Syntax:
operation ::= `acc.parallel` ( `combined` `(` `loop` `)` $combined^)?
oilist(
`dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
| `firstprivate` `(` custom<SymOperandList>($firstprivateOperands,
type($firstprivateOperands), $firstprivatizations)
`)`
| `num_gangs` `(` custom<NumGangs>($numGangs,
type($numGangs), $numGangsDeviceType, $numGangsSegments) `)`
| `num_workers` `(` custom<DeviceTypeOperands>($numWorkers,
type($numWorkers), $numWorkersDeviceType) `)`
| `private` `(` custom<SymOperandList>(
$privateOperands, type($privateOperands), $privatizations)
`)`
| `vector_length` `(` custom<DeviceTypeOperands>($vectorLength,
type($vectorLength), $vectorLengthDeviceType) `)`
| `wait` `` custom<WaitClause>($waitOperands, type($waitOperands),
$waitOperandsDeviceType, $waitOperandsSegments, $hasWaitDevnum,
$waitOnly)
| `self` `(` $selfCond `)`
| `if` `(` $ifCond `)`
| `reduction` `(` custom<SymOperandList>(
$reductionOperands, type($reductionOperands), $reductionRecipes)
`)`
)
$region attr-dict-with-keyword
The “acc.parallel” operation represents a parallel construct block. It has one region to be executed in parallel on the current device.
Example:
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.
Traits: AttrSizedOperandSegments
, AutomaticAllocationScope
, RecursiveMemoryEffects
Interfaces: ComputeRegionOpInterface
, MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
waitOperandsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
waitOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
hasWaitDevnum | ::mlir::ArrayAttr | 1-bit boolean array attribute |
waitOnly | ::mlir::ArrayAttr | device type array attribute |
numGangsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
numGangsDeviceType | ::mlir::ArrayAttr | device type array attribute |
numWorkersDeviceType | ::mlir::ArrayAttr | device type array attribute |
vectorLengthDeviceType | ::mlir::ArrayAttr | device type array attribute |
selfAttr | ::mlir::UnitAttr | unit attribute |
reductionRecipes | ::mlir::ArrayAttr | symbol ref array attribute |
privatizations | ::mlir::ArrayAttr | symbol ref array attribute |
firstprivatizations | ::mlir::ArrayAttr | symbol ref array attribute |
defaultAttr | ::mlir::acc::ClauseDefaultValueAttr | DefaultValue ClauseEnum cases:
|
combined | ::mlir::UnitAttr | unit attribute |
Operands: ¶
Operand | Description |
---|---|
asyncOperands | variadic of integer or index |
waitOperands | variadic of integer or index |
numGangs | variadic of integer or index |
numWorkers | variadic of integer or index |
vectorLength | variadic of integer or index |
ifCond | 1-bit signless integer |
selfCond | 1-bit signless integer |
reductionOperands | variadic of any type |
privateOperands | variadic of PointerLikeType instance |
firstprivateOperands | variadic of PointerLikeType instance |
dataClauseOperands | variadic of PointerLikeType instance |
acc.present
(acc::PresentOp) ¶
Specifies that the variable is already present on device.
Syntax:
operation ::= `acc.present` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.private
(acc::PrivateOp) ¶
Represents private semantics for acc private clause.
Syntax:
operation ::= `acc.private` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.private.recipe
(acc::PrivateRecipeOp) ¶
Privatization recipe
Syntax:
operation ::= `acc.private.recipe` $sym_name `:` $type attr-dict-with-keyword `init` $initRegion
(`destroy` $destroyRegion^)?
Declares an OpenACC privatization recipe. The operation requires one mandatory and one optional region.
- 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 value that need to be privatized. This is useful if the type is not known at compile time and the private value is needed to create its copy.
- The destroy region specifies how to destruct the value when it reaches its end of life. It takes the privatized value as argument.
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:
acc.private.recipe @privatization_f32 : f32 init {
^bb0(%0: f32):
// init region contains a sequence of operations to create and
// initialize the copy if needed. It yields the create copy.
} destroy {
^bb0(%0: f32)
// destroy region contains a sequences of operations to destruct the
// created copy.
}
// The privatization symbol is then used in the corresponding operation.
acc.parallel private(@privatization_f32 -> %a : f32) {
}
Traits: IsolatedFromAbove
Interfaces: RecipeInterface
, Symbol
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
type | ::mlir::TypeAttr | any type attribute |
acc.reduction
(acc::ReductionOp) ¶
Represents reduction semantics for acc reduction clause.
Syntax:
operation ::= `acc.reduction` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.reduction.recipe
(acc::ReductionRecipeOp) ¶
Reduction recipe
Syntax:
operation ::= `acc.reduction.recipe` $sym_name `:` $type attr-dict-with-keyword
`reduction_operator` $reductionOperator
`init` $initRegion `combiner` $combinerRegion
Declares an OpenACC reduction recipe. The operation requires two mandatory regions.
- The initializer region specifies how to initialize the local reduction
value. The region has a first argument that contains the value of the
reduction accumulator at the start of the reduction. It is expected to
acc.yield
the new value. Extra arguments can be added to deal with dynamic arrays. - The reduction region contains a sequences of operations to combine two
values of the reduction type into one. It has at least two arguments
and it is expected to
acc.yield
the combined value. Extra arguments can be added to deal with dynamic arrays.
Example:
acc.reduction.recipe @reduction_add_i64 : i64 reduction_operator<add> init {
^bb0(%0: i64):
// init region contains a sequence of operations to initialize the local
// reduction value as specified in 2.5.15
%c0 = arith.constant 0 : i64
acc.yield %c0 : i64
} combiner {
^bb0(%0: i64, %1: i64)
// combiner region contains a sequence of operations to combine
// two values into one.
%2 = arith.addi %0, %1 : i64
acc.yield %2 : i64
}
// The reduction symbol is then used in the corresponding operation.
acc.parallel reduction(@reduction_add_i64 -> %a : i64) {
}
The following table lists the valid operators and the initialization values according to OpenACC 3.3:
|————————————————|
C/C++ | Fortran |
---|---|
operator | init value |
+ | 0 |
* | 1 |
max | least |
min | largest |
& | ~0 |
^ | 0 |
&& | 1 |
————————————————- |
Traits: IsolatedFromAbove
Interfaces: RecipeInterface
, Symbol
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
type | ::mlir::TypeAttr | any type attribute |
reductionOperator | ::mlir::acc::ReductionOperatorAttr | built-in reduction operations supported by OpenACCEnum cases:
|
acc.routine
(acc::RoutineOp) ¶
Acc routine operation
Syntax:
operation ::= `acc.routine` $sym_name `func` `(` $func_name `)`
oilist (
`bind` `(` custom<BindName>($bindName, $bindNameDeviceType) `)`
| `gang` `` custom<RoutineGangClause>($gang, $gangDim, $gangDimDeviceType)
| `worker` custom<DeviceTypeArrayAttr>($worker)
| `vector` custom<DeviceTypeArrayAttr>($vector)
| `seq` custom<DeviceTypeArrayAttr>($seq)
| `nohost` $nohost
| `implicit` $implicit
) attr-dict-with-keyword
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:
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.
Traits: IsolatedFromAbove
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
func_name | ::mlir::StringAttr | string attribute |
bindName | ::mlir::ArrayAttr | string array attribute |
bindNameDeviceType | ::mlir::ArrayAttr | device type array attribute |
worker | ::mlir::ArrayAttr | device type array attribute |
vector | ::mlir::ArrayAttr | device type array attribute |
seq | ::mlir::ArrayAttr | device type array attribute |
nohost | ::mlir::UnitAttr | unit attribute |
implicit | ::mlir::UnitAttr | unit attribute |
gang | ::mlir::ArrayAttr | device type array attribute |
gangDim | ::mlir::ArrayAttr | 64-bit integer array attribute |
gangDimDeviceType | ::mlir::ArrayAttr | device type array attribute |
acc.serial
(acc::SerialOp) ¶
Serial construct
Syntax:
operation ::= `acc.serial` ( `combined` `(` `loop` `)` $combined^)?
oilist(
`dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
| `firstprivate` `(` custom<SymOperandList>($firstprivateOperands,
type($firstprivateOperands), $firstprivatizations)
`)`
| `private` `(` custom<SymOperandList>(
$privateOperands, type($privateOperands), $privatizations)
`)`
| `wait` `` custom<WaitClause>($waitOperands, type($waitOperands),
$waitOperandsDeviceType, $waitOperandsSegments, $hasWaitDevnum,
$waitOnly)
| `self` `(` $selfCond `)`
| `if` `(` $ifCond `)`
| `reduction` `(` custom<SymOperandList>(
$reductionOperands, type($reductionOperands), $reductionRecipes)
`)`
)
$region attr-dict-with-keyword
The “acc.serial” operation represents a serial construct block. It has one region to be executed in serial on the current device.
Example:
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.
Traits: AttrSizedOperandSegments
, AutomaticAllocationScope
, RecursiveMemoryEffects
Interfaces: ComputeRegionOpInterface
, MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
waitOperandsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
waitOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
hasWaitDevnum | ::mlir::ArrayAttr | 1-bit boolean array attribute |
waitOnly | ::mlir::ArrayAttr | device type array attribute |
selfAttr | ::mlir::UnitAttr | unit attribute |
reductionRecipes | ::mlir::ArrayAttr | symbol ref array attribute |
privatizations | ::mlir::ArrayAttr | symbol ref array attribute |
firstprivatizations | ::mlir::ArrayAttr | symbol ref array attribute |
defaultAttr | ::mlir::acc::ClauseDefaultValueAttr | DefaultValue ClauseEnum cases:
|
combined | ::mlir::UnitAttr | unit attribute |
Operands: ¶
Operand | Description |
---|---|
asyncOperands | variadic of integer or index |
waitOperands | variadic of integer or index |
ifCond | 1-bit signless integer |
selfCond | 1-bit signless integer |
reductionOperands | variadic of any type |
privateOperands | variadic of PointerLikeType instance |
firstprivateOperands | variadic of PointerLikeType instance |
dataClauseOperands | variadic of PointerLikeType instance |
acc.set
(acc::SetOp) ¶
Set operation
Syntax:
operation ::= `acc.set` oilist(`default_async` `(` $defaultAsync `:` type($defaultAsync) `)`
| `device_num` `(` $deviceNum `:` type($deviceNum) `)`
| `if` `(` $ifCond `)`
) attr-dict-with-keyword
The “acc.set” operation represents the OpenACC set directive.
Example:
acc.set device_num(%dev1 : i32)
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
device_type | ::mlir::acc::DeviceTypeAttr | built-in device type supported by OpenACCEnum cases:
|
Operands: ¶
Operand | Description |
---|---|
defaultAsync | integer or index |
deviceNum | integer or index |
ifCond | 1-bit signless integer |
acc.shutdown
(acc::ShutdownOp) ¶
Shutdown operation
Syntax:
operation ::= `acc.shutdown` oilist(`device_num` `(` $deviceNumOperand `:` type($deviceNumOperand) `)`
|`if` `(` $ifCond `)`
) attr-dict-with-keyword
The “acc.shutdown” operation represents the OpenACC shutdown executable directive.
Example:
acc.shutdown
acc.shutdown device_num(%dev1 : i32)
Traits: AttrSizedOperandSegments
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
device_types | ::mlir::ArrayAttr | Device type attributes |
Operands: ¶
Operand | Description |
---|---|
deviceNumOperand | integer or index |
ifCond | 1-bit signless integer |
acc.terminator
(acc::TerminatorOp) ¶
Generic terminator for OpenACC regions
Syntax:
operation ::= `acc.terminator` attr-dict
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.
Traits: AlwaysSpeculatableImplTrait
, Terminator
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
acc.update
(acc::UpdateOp) ¶
Update operation
Syntax:
operation ::= `acc.update` oilist(
`if` `(` $ifCond `)`
| `async` `` custom<DeviceTypeOperandsWithKeywordOnly>(
$asyncOperands, type($asyncOperands),
$asyncOperandsDeviceType, $async)
| `wait` `` custom<WaitClause>($waitOperands, type($waitOperands),
$waitOperandsDeviceType, $waitOperandsSegments, $hasWaitDevnum,
$waitOnly)
| `dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
)
attr-dict-with-keyword
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:
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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::acc::ConstructResource, MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
async | ::mlir::ArrayAttr | device type array attribute |
waitOperandsSegments | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
waitOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
hasWaitDevnum | ::mlir::ArrayAttr | 1-bit boolean array attribute |
waitOnly | ::mlir::ArrayAttr | device type array attribute |
ifPresent | ::mlir::UnitAttr | unit attribute |
Operands: ¶
Operand | Description |
---|---|
ifCond | 1-bit signless integer |
asyncOperands | variadic of integer or index |
waitOperands | variadic of integer or index |
dataClauseOperands | variadic of PointerLikeType instance |
acc.update_device
(acc::UpdateDeviceOp) ¶
Represents acc update device semantics.
Syntax:
operation ::= `acc.update_device` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.update_host
(acc::UpdateHostOp) ¶
Represents acc update host semantics.
Syntax:
operation ::= `acc.update_host` `accPtr` `(` $accPtr `:` type($accPtr) `)`
(`bounds` `(` $bounds^ `)` )?
(`async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType)^ `)`)?
`to` `varPtr` `(` $varPtr `:` type($varPtr) `)`
attr-dict
varPtr
: The address of variable to copy back to.accPtr
: The acc address of 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters, MemoryEffects::Write on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
accPtr | PointerLikeType instance |
varPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
acc.use_device
(acc::UseDeviceOp) ¶
Represents acc use_device semantics.
Syntax:
operation ::= `acc.use_device` `varPtr` `(` $varPtr `:` type($varPtr) `)`
oilist(
`varPtrPtr` `(` $varPtrPtr `:` type($varPtrPtr) `)`
| `bounds` `(` $bounds `)`
| `async` `(` custom<DeviceTypeOperands>($asyncOperands,
type($asyncOperands), $asyncOperandsDeviceType) `)`
) `->` type($accPtr) attr-dict
Description of arguments:
varPtr
: The address of variable to copy.varPtrPtr
: Specifies the address of varPtr - 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
andasyncOperandsDeviceType
: 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 bothacc.copyin
andacc.copyout
operations, but both have dataClause that specifiesacc_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.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.
Traits: AttrSizedOperandSegments
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::CurrentDeviceIdResource}
, MemoryEffects::Effect{MemoryEffects::Read on ::mlir::acc::RuntimeCounters}
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
asyncOperandsDeviceType | ::mlir::ArrayAttr | device type array attribute |
asyncOnly | ::mlir::ArrayAttr | device type array attribute |
dataClause | ::mlir::acc::DataClauseAttr | data clauses supported by OpenACCEnum cases:
|
structured | ::mlir::BoolAttr | bool attribute |
implicit | ::mlir::BoolAttr | bool attribute |
name | ::mlir::StringAttr | string attribute |
Operands: ¶
Operand | Description |
---|---|
varPtr | PointerLikeType instance |
varPtrPtr | PointerLikeType instance |
bounds | variadic of Type for representing acc data clause bounds information |
asyncOperands | variadic of integer or index |
Results: ¶
Result | Description |
---|---|
accPtr | PointerLikeType instance |
acc.wait
(acc::WaitOp) ¶
Wait operation
Syntax:
operation ::= `acc.wait` ( `(` $waitOperands^ `:` type($waitOperands) `)` )?
oilist(`async` `(` $asyncOperand `:` type($asyncOperand) `)`
|`wait_devnum` `(` $waitDevnum `:` type($waitDevnum) `)`
|`if` `(` $ifCond `)`
) attr-dict-with-keyword
The “acc.wait” operation represents the OpenACC wait executable directive.
Example:
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.
Traits: AttrSizedOperandSegments
Attributes: ¶
Attribute | MLIR Type | Description |
---|---|---|
async | ::mlir::UnitAttr | unit attribute |
Operands: ¶
Operand | Description |
---|---|
waitOperands | variadic of integer or index |
asyncOperand | integer or index |
waitDevnum | integer or index |
ifCond | 1-bit signless integer |
acc.yield
(acc::YieldOp) ¶
Acc yield and termination operation
Syntax:
operation ::= `acc.yield` attr-dict ($operands^ `:` type($operands))?
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.
Traits: AlwaysSpeculatableImplTrait
, HasParent<FirstprivateRecipeOp, LoopOp, ParallelOp, PrivateRecipeOp,ReductionRecipeOp, SerialOp, AtomicUpdateOp>
, ReturnLike
, Terminator
Interfaces: ConditionallySpeculatable
, NoMemoryEffect (MemoryEffectOpInterface)
, RegionBranchTerminatorOpInterface
Effects: MemoryEffects::Effect{}
Operands: ¶
Operand | Description |
---|---|
operands | variadic of any type |
Attributes ¶
DeclareActionAttr ¶
Syntax:
#acc.declare_action<
SymbolRefAttr, # preAlloc
SymbolRefAttr, # postAlloc
SymbolRefAttr, # preDealloc
SymbolRefAttr # postDealloc
>
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
preAlloc | SymbolRefAttr | |
postAlloc | SymbolRefAttr | |
preDealloc | SymbolRefAttr | |
postDealloc | SymbolRefAttr |
DeclareAttr ¶
Syntax:
#acc.declare<
DataClauseAttr, # dataClause
bool # implicit
>
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
dataClause | DataClauseAttr | |
implicit | bool |
ClauseDefaultValueAttr ¶
DefaultValue Clause
Syntax:
#acc.defaultvalue<
::mlir::acc::ClauseDefaultValue # value
>
Enum cases:
- present (
Present
) - none (
None
)
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
value | ::mlir::acc::ClauseDefaultValue | an enum of type ClauseDefaultValue |
CombinedConstructsTypeAttr ¶
Differentiate between combined constructs
Syntax:
#acc.combined_constructs<
::mlir::acc::CombinedConstructsType # value
>
Enum cases:
- kernels_loop (
KernelsLoop
) - parallel_loop (
ParallelLoop
) - serial_loop (
SerialLoop
)
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
value | ::mlir::acc::CombinedConstructsType | an enum of type CombinedConstructsType |
ConstructAttr ¶
constructs supported by OpenACC
Syntax:
#acc.construct<
::mlir::acc::Construct # value
>
Enum cases:
- acc_construct_parallel (
acc_construct_parallel
) - acc_construct_kernels (
acc_construct_kernels
) - acc_construct_loop (
acc_construct_loop
) - acc_construct_data (
acc_construct_data
) - acc_construct_enter_data (
acc_construct_enter_data
) - acc_construct_exit_data (
acc_construct_exit_data
) - acc_construct_host_data (
acc_construct_host_data
) - acc_construct_atomic (
acc_construct_atomic
) - acc_construct_declare (
acc_construct_declare
) - acc_construct_init (
acc_construct_init
) - acc_construct_shutdown (
acc_construct_shutdown
) - acc_construct_set (
acc_construct_set
) - acc_construct_update (
acc_construct_update
) - acc_construct_routine (
acc_construct_routine
) - acc_construct_wait (
acc_construct_wait
) - acc_construct_runtime_api (
acc_construct_runtime_api
) - acc_construct_serial (
acc_construct_serial
)
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
value | ::mlir::acc::Construct | an enum of type Construct |
DataClauseAttr ¶
data clauses supported by OpenACC
Syntax:
#acc.data_clause<
::mlir::acc::DataClause # value
>
Enum cases:
- acc_copyin (
acc_copyin
) - acc_copyin_readonly (
acc_copyin_readonly
) - acc_copy (
acc_copy
) - acc_copyout (
acc_copyout
) - acc_copyout_zero (
acc_copyout_zero
) - acc_present (
acc_present
) - acc_create (
acc_create
) - acc_create_zero (
acc_create_zero
) - acc_delete (
acc_delete
) - acc_attach (
acc_attach
) - acc_detach (
acc_detach
) - acc_no_create (
acc_no_create
) - acc_private (
acc_private
) - acc_firstprivate (
acc_firstprivate
) - acc_deviceptr (
acc_deviceptr
) - acc_getdeviceptr (
acc_getdeviceptr
) - acc_update_host (
acc_update_host
) - acc_update_self (
acc_update_self
) - acc_update_device (
acc_update_device
) - acc_use_device (
acc_use_device
) - acc_reduction (
acc_reduction
) - acc_declare_device_resident (
acc_declare_device_resident
) - acc_declare_link (
acc_declare_link
) - acc_cache (
acc_cache
) - acc_cache_readonly (
acc_cache_readonly
)
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
value | ::mlir::acc::DataClause | an enum of type DataClause |
DeviceTypeAttr ¶
built-in device type supported by OpenACC
Syntax:
#acc.device_type<
::mlir::acc::DeviceType # value
>
Enum cases:
- none (
None
) - star (
Star
) - default (
Default
) - host (
Host
) - multicore (
Multicore
) - nvidia (
Nvidia
) - radeon (
Radeon
)
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
value | ::mlir::acc::DeviceType | an enum of type DeviceType |
GangArgTypeAttr ¶
Differentiate the different gang arg values
Syntax:
#acc.gang_arg_type<
::mlir::acc::GangArgType # value
>
Enum cases:
- Num (
Num
) - Dim (
Dim
) - Static (
Static
)
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
value | ::mlir::acc::GangArgType | an enum of type GangArgType |
ReductionOperatorAttr ¶
built-in reduction operations supported by OpenACC
Syntax:
#acc.reduction_operator<
::mlir::acc::ReductionOperator # value
>
Enum cases:
- add (
AccAdd
) - mul (
AccMul
) - max (
AccMax
) - min (
AccMin
) - iand (
AccIand
) - ior (
AccIor
) - xor (
AccXor
) - eqv (
AccEqv
) - neqv (
AccNeqv
) - land (
AccLand
) - lor (
AccLor
)
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
value | ::mlir::acc::ReductionOperator | an enum of type ReductionOperator |
RoutineInfoAttr ¶
Keeps track of associated acc routine information
Syntax:
#acc.routine_info<
::llvm::ArrayRef<SymbolRefAttr> # accRoutines
>
This attribute is used to create the association between a function and
its acc.routine
operation. A func.func
uses this if its name
was referenced in an acc routine
directive.
Parameters: ¶
Parameter | C++ type | Description |
---|---|---|
accRoutines | ::llvm::ArrayRef<SymbolRefAttr> |
Types ¶
DataBoundsType ¶
Type for representing acc data clause bounds information
Syntax: !acc.data_bounds_ty
DeclareTokenType ¶
declare token type
Syntax: !acc.declare_token
acc.declare_token
is a type returned by a declare_enter
operation and
can be passed to a declare_exit
operation to represent an implicit
data region.
Enums ¶
ClauseDefaultValue ¶
DefaultValue Clause
Cases: ¶
Symbol | Value | String |
---|---|---|
Present | 0 | present |
None | 1 | none |
CombinedConstructsType ¶
Differentiate between combined constructs
Cases: ¶
Symbol | Value | String |
---|---|---|
KernelsLoop | 1 | kernels_loop |
ParallelLoop | 2 | parallel_loop |
SerialLoop | 3 | serial_loop |
Construct ¶
constructs supported by OpenACC
Cases: ¶
Symbol | Value | String |
---|---|---|
acc_construct_parallel | 0 | acc_construct_parallel |
acc_construct_kernels | 1 | acc_construct_kernels |
acc_construct_loop | 2 | acc_construct_loop |
acc_construct_data | 3 | acc_construct_data |
acc_construct_enter_data | 4 | acc_construct_enter_data |
acc_construct_exit_data | 5 | acc_construct_exit_data |
acc_construct_host_data | 6 | acc_construct_host_data |
acc_construct_atomic | 7 | acc_construct_atomic |
acc_construct_declare | 8 | acc_construct_declare |
acc_construct_init | 9 | acc_construct_init |
acc_construct_shutdown | 10 | acc_construct_shutdown |
acc_construct_set | 11 | acc_construct_set |
acc_construct_update | 12 | acc_construct_update |
acc_construct_routine | 13 | acc_construct_routine |
acc_construct_wait | 14 | acc_construct_wait |
acc_construct_runtime_api | 15 | acc_construct_runtime_api |
acc_construct_serial | 16 | acc_construct_serial |
DataClause ¶
data clauses supported by OpenACC
Cases: ¶
Symbol | Value | String |
---|---|---|
acc_copyin | 1 | acc_copyin |
acc_copyin_readonly | 2 | acc_copyin_readonly |
acc_copy | 3 | acc_copy |
acc_copyout | 4 | acc_copyout |
acc_copyout_zero | 5 | acc_copyout_zero |
acc_present | 6 | acc_present |
acc_create | 7 | acc_create |
acc_create_zero | 8 | acc_create_zero |
acc_delete | 9 | acc_delete |
acc_attach | 10 | acc_attach |
acc_detach | 11 | acc_detach |
acc_no_create | 12 | acc_no_create |
acc_private | 13 | acc_private |
acc_firstprivate | 14 | acc_firstprivate |
acc_deviceptr | 15 | acc_deviceptr |
acc_getdeviceptr | 16 | acc_getdeviceptr |
acc_update_host | 17 | acc_update_host |
acc_update_self | 18 | acc_update_self |
acc_update_device | 19 | acc_update_device |
acc_use_device | 20 | acc_use_device |
acc_reduction | 21 | acc_reduction |
acc_declare_device_resident | 22 | acc_declare_device_resident |
acc_declare_link | 23 | acc_declare_link |
acc_cache | 24 | acc_cache |
acc_cache_readonly | 25 | acc_cache_readonly |
DeviceType ¶
built-in device type supported by OpenACC
Cases: ¶
Symbol | Value | String |
---|---|---|
None | 0 | none |
Star | 1 | star |
Default | 2 | default |
Host | 3 | host |
Multicore | 4 | multicore |
Nvidia | 5 | nvidia |
Radeon | 6 | radeon |
GangArgType ¶
Differentiate the different gang arg values
Cases: ¶
Symbol | Value | String |
---|---|---|
Num | 0 | Num |
Dim | 1 | Dim |
Static | 2 | Static |
ReductionOperator ¶
built-in reduction operations supported by OpenACC
Cases: ¶
Symbol | Value | String |
---|---|---|
AccAdd | 0 | add |
AccMul | 1 | mul |
AccMax | 2 | max |
AccMin | 3 | min |
AccIand | 4 | iand |
AccIor | 5 | ior |
AccXor | 6 | xor |
AccEqv | 7 | eqv |
AccNeqv | 8 | neqv |
AccLand | 9 | land |
AccLor | 10 | lor |