MLIR

Multi-Level IR Compiler Framework

ODS Documentation

Operations 

source

omp.atomic.capture (omp::AtomicCaptureOp) 

Performs an atomic capture

Syntax:

operation ::= `omp.atomic.capture` oilist(
              `hint` `(` custom<SynchronizationHint>($hint) `)`
              |
              `memory_order` `(` custom<ClauseAttr>($memory_order) `)`
              ) $region attr-dict

This operation performs an atomic capture.

The region has the following allowed forms:

  omp.atomic.capture {
    omp.atomic.update ...
    omp.atomic.read ...
    omp.terminator
  }

  omp.atomic.capture {
    omp.atomic.read ...
    omp.atomic.update ...
    omp.terminator
  }

  omp.atomic.capture {
    omp.atomic.read ...
    omp.atomic.write ...
    omp.terminator
  }

hint is the value of hint (as specified in the hint clause). It is a compile time constant. As the name suggests, this is just a hint for optimization.

memory_order indicates the memory ordering behavior of the construct. It can be one of seq_cst, acq_rel, release, acquire or relaxed.

Traits: RecursiveMemoryEffects, SingleBlockImplicitTerminator<TerminatorOp>, SingleBlock

Interfaces: AtomicCaptureOpInterface

Attributes: 

AttributeMLIR TypeDescription
hint::mlir::IntegerAttr64-bit signless integer attribute
memory_order::mlir::omp::ClauseMemoryOrderKindAttr
MemoryOrderKind Clause

Enum cases:

  • seq_cst (Seq_cst)
  • acq_rel (Acq_rel)
  • acquire (Acquire)
  • release (Release)
  • relaxed (Relaxed)

omp.atomic.read (omp::AtomicReadOp) 

Performs an atomic read

Syntax:

operation ::= `omp.atomic.read` $v `=` $x oilist(
              `hint` `(` custom<SynchronizationHint>($hint) `)`
              |
              `memory_order` `(` custom<ClauseAttr>($memory_order) `)`
              ) `:` 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.

hint is the value of hint (as specified in the hint clause). It is a compile time constant. As the name suggests, this is just a hint for optimization.

memory_order indicates the memory ordering behavior of the construct. It can be one of seq_cst, acq_rel, release, acquire or relaxed.

Interfaces: AtomicReadOpInterface

Attributes: 

AttributeMLIR TypeDescription
element_type::mlir::TypeAttrany type attribute
hint::mlir::IntegerAttr64-bit signless integer attribute
memory_order::mlir::omp::ClauseMemoryOrderKindAttr
MemoryOrderKind Clause

Enum cases:

  • seq_cst (Seq_cst)
  • acq_rel (Acq_rel)
  • acquire (Acquire)
  • release (Release)
  • relaxed (Relaxed)

Operands: 

OperandDescription
xOpenMP-compatible variable type
vOpenMP-compatible variable type

omp.atomic.update (omp::AtomicUpdateOp) 

Performs an atomic update

Syntax:

operation ::= `omp.atomic.update` oilist(
              `hint` `(` custom<SynchronizationHint>($hint) `)`
              |
              `memory_order` `(` custom<ClauseAttr>($memory_order) `)`
              )$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 OpenMP Standard (OpenMP 5.0, section 2.17.7). 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.

hint is the value of hint (as specified in the hint clause). It is a compile time constant. As the name suggests, this is just a hint for optimization.

memory_order indicates the memory ordering behavior of the construct. It can be one of seq_cst, acq_rel, release, acquire or relaxed.

Traits: RecursiveMemoryEffects, SingleBlockImplicitTerminator<YieldOp>, SingleBlock

Interfaces: AtomicUpdateOpInterface

Attributes: 

AttributeMLIR TypeDescription
hint::mlir::IntegerAttr64-bit signless integer attribute
memory_order::mlir::omp::ClauseMemoryOrderKindAttr
MemoryOrderKind Clause

Enum cases:

  • seq_cst (Seq_cst)
  • acq_rel (Acq_rel)
  • acquire (Acquire)
  • release (Release)
  • relaxed (Relaxed)

Operands: 

OperandDescription
xOpenMP-compatible variable type

omp.atomic.write (omp::AtomicWriteOp) 

Performs an atomic write

Syntax:

operation ::= `omp.atomic.write` $x `=` $expr oilist(
              `hint` `(` custom<SynchronizationHint>($hint) `)`
              |
              `memory_order` `(` custom<ClauseAttr>($memory_order) `)`
              ) `:` 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).

hint is the value of hint (as specified in the hint clause). It is a compile time constant. As the name suggests, this is just a hint for optimization.

memory_order indicates the memory ordering behavior of the construct. It can be one of seq_cst, acq_rel, release, acquire or relaxed.

Interfaces: AtomicWriteOpInterface

Attributes: 

AttributeMLIR TypeDescription
hint::mlir::IntegerAttr64-bit signless integer attribute
memory_order::mlir::omp::ClauseMemoryOrderKindAttr
MemoryOrderKind Clause

Enum cases:

  • seq_cst (Seq_cst)
  • acq_rel (Acq_rel)
  • acquire (Acquire)
  • release (Release)
  • relaxed (Relaxed)

Operands: 

OperandDescription
xOpenMP-compatible variable type
exprany type

omp.barrier (omp::BarrierOp) 

Barrier construct

Syntax:

operation ::= `omp.barrier` attr-dict

The barrier construct specifies an explicit barrier at the point at which the construct appears.

omp.cancel (omp::CancelOp) 

Cancel directive

Syntax:

operation ::= `omp.cancel` `cancellation_construct_type` `(`
              custom<ClauseAttr>($cancel_directive) `)`
              oilist(
              `if` `(` $if_expr `)`
              ) attr-dict

The cancel construct activates cancellation of the innermost enclosing region of the type specified.

Attributes: 

AttributeMLIR TypeDescription
cancel_directive::mlir::omp::ClauseCancellationConstructTypeAttr
CancellationConstructType Clause

Enum cases:

  • parallel (Parallel)
  • loop (Loop)
  • sections (Sections)
  • taskgroup (Taskgroup)

Operands: 

OperandDescription
if_expr1-bit signless integer

omp.cancellation_point (omp::CancellationPointOp) 

Cancellation point directive

Syntax:

operation ::= `omp.cancellation_point` `cancellation_construct_type` `(`
              custom<ClauseAttr>($cancel_directive) `)`
              attr-dict

The cancellation point construct introduces a user-defined cancellation point at which implicit or explicit tasks check if cancellation of the innermost enclosing region of the type specified has been activated.

Attributes: 

AttributeMLIR TypeDescription
cancel_directive::mlir::omp::ClauseCancellationConstructTypeAttr
CancellationConstructType Clause

Enum cases:

  • parallel (Parallel)
  • loop (Loop)
  • sections (Sections)
  • taskgroup (Taskgroup)

omp.critical (omp::CriticalOp) 

Critical construct

Syntax:

operation ::= `omp.critical` (`(` $name^ `)`)? $region attr-dict

The critical construct imposes a restriction on the associated structured block (region) to be executed by only a single thread at a time.

The optional name argument of critical constructs is used to identify them. Unnamed critical constructs behave as though an identical name was specified.

Interfaces: SymbolUserOpInterface

Attributes: 

AttributeMLIR TypeDescription
name::mlir::FlatSymbolRefAttrflat symbol reference attribute

omp.critical.declare (omp::CriticalDeclareOp) 

Declares a named critical section.

Syntax:

operation ::= `omp.critical.declare` $sym_name oilist(
              `hint` `(` custom<SynchronizationHint>($hint) `)`
              ) attr-dict

Declares a named critical section.

The sym_name can be used in omp.critical constructs in the dialect.

hint is the value of hint (as specified in the hint clause). It is a compile time constant. As the name suggests, this is just a hint for optimization.

Interfaces: Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
hint::mlir::IntegerAttr64-bit signless integer attribute

omp.declare_reduction (omp::DeclareReductionOp) 

Declares a reduction kind

Syntax:

operation ::= `omp.declare_reduction` $sym_name `:` $type attr-dict-with-keyword ( `alloc` $allocRegion^ )? `init` $initializerRegion `combiner` $reductionRegion ( `atomic` $atomicReductionRegion^ )? ( `cleanup` $cleanupRegion^ )?

Declares an OpenMP reduction kind. This requires two mandatory and three optional regions.

  1. The optional alloc region specifies how to allocate the thread-local reduction value. This region should not contain control flow and all IR should be suitable for inlining straight into an entry block. In the common case this is expected to contain only allocas. It is expected to omp.yield the allocated value on all control paths. If allocation is conditional (e.g. only allocate if the mold is allocated), this should be done in the initilizer region and this region not included. The alloc region is not used for by-value reductions (where allocation is implicit).
  2. The initializer region specifies how to initialize the thread-local reduction value. This is usually the neutral element of the reduction. For convenience, the region has an argument that contains the value of the reduction accumulator at the start of the reduction. If an alloc region is specified, there is a second block argument containing the address of the allocated memory. The initializer region is expected to omp.yield the new value on all control flow paths.
  3. The reduction region specifies how to combine two values into one, i.e. the reduction operator. It accepts the two values as arguments and is expected to omp.yield the combined value on all control flow paths.
  4. The atomic reduction region is optional and specifies how two values can be combined atomically given local accumulator variables. It is expected to store the combined value in the first accumulator variable.
  5. The cleanup region is optional and specifies how to clean up any memory allocated by the initializer region. The region has an argument that contains the value of the thread-local reduction accumulator. This will be executed after the reduction has completed.

Note that the MLIR type system does not allow for type-polymorphic reductions. Separate reduction declarations should be created for different element and accumulator types.

For initializer and reduction regions, the operand to omp.yield must match the parent operation’s results.

Traits: IsolatedFromAbove

Interfaces: RecipeInterface, Symbol

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
type::mlir::TypeAttrany type attribute

omp.distribute (omp::DistributeOp) 

Distribute construct

Syntax:

operation ::= `omp.distribute` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `dist_schedule_static` $dist_schedule_static
              | `dist_schedule_chunk_size` `(` $dist_schedule_chunk_size `:`
              type($dist_schedule_chunk_size) `)`
              |
              `order` `(` custom<OrderClause>($order, $order_mod) `)`
              )
              custom<PrivateRegion>($region, $private_vars, type($private_vars),
              $private_syms) attr-dict

The distribute construct specifies that the iterations of one or more loops (optionally specified using collapse clause) will be executed by the initial teams in the context of their implicit tasks. The loops that the distribute op is associated with starts with the outermost loop enclosed by the distribute op region and going down the loop nest toward the innermost loop. The iterations are distributed across the initial threads of all initial teams that execute the teams region to which the distribute region binds.

The distribute loop construct specifies that the iterations of the loop(s) will be executed in parallel by threads in the current context. These iterations are spread across threads that already exist in the enclosing region.

The body region can only contain a single block which must contain a single operation. This operation must be another compatible loop wrapper or an omp.loop_nest.

omp.distribute <clauses> {
  omp.loop_nest (%i1, %i2) : index = (%c0, %c0) to (%c10, %c10) step (%c1, %c1) {
    %a = load %arrA[%i1, %i2] : memref<?x?xf32>
    %b = load %arrB[%i1, %i2] : memref<?x?xf32>
    %sum = arith.addf %a, %b : f32
    store %sum, %arrC[%i1, %i2] : memref<?x?xf32>
    omp.yield
  }
}

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

The dist_schedule_static attribute specifies the schedule for this loop, determining how the loop is distributed across the various teams. The optional dist_schedule_chunk_size associated with this determines further controls this distribution.

The optional order attribute specifies which order the iterations of the associated loops are executed in. Currently the only option for this attribute is “concurrent”.

Traits: AttrSizedOperandSegments, NoTerminator, RecursiveMemoryEffects, SingleBlock

Interfaces: BlockArgOpenMPOpInterface, ComposableOpInterface, LoopWrapperInterface

Attributes: 

AttributeMLIR TypeDescription
dist_schedule_static::mlir::UnitAttrunit attribute
order::mlir::omp::ClauseOrderKindAttr
OrderKind Clause

Enum cases:

  • concurrent (Concurrent)
order_mod::mlir::omp::OrderModifierAttr
OpenMP Order Modifier

Enum cases:

  • reproducible (reproducible)
  • unconstrained (unconstrained)
private_syms::mlir::ArrayAttrsymbol ref array attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
dist_schedule_chunk_sizeinteger or index
private_varsvariadic of any type

omp.flush (omp::FlushOp) 

Flush construct

Syntax:

operation ::= `omp.flush` ( `(` $varList^ `:` type($varList) `)` )? attr-dict

The flush construct executes the OpenMP flush operation. This operation makes a thread’s temporary view of memory consistent with memory and enforces an order on the memory operations of the variables explicitly specified or implied.

Operands: 

OperandDescription
varListvariadic of OpenMP-compatible variable type

omp.loop (omp::LoopOp) 

Loop construct

Syntax:

operation ::= `omp.loop` oilist(
              `bind` `(` custom<ClauseAttr>($bind_kind) `)`
              |
              `order` `(` custom<OrderClause>($order, $order_mod) `)`
              )
              custom<PrivateReductionRegion>($region, $private_vars, type($private_vars),
              $private_syms, $reduction_vars, type($reduction_vars), $reduction_byref,
              $reduction_syms) attr-dict

A loop construct specifies that the logical iterations of the associated loops may execute concurrently and permits the encountering threads to execute the loop accordingly. A loop construct can have 3 different types of binding:

  1. teams: in which case the binding region is the innermost enclosing teams region.
  2. parallel: in which case the binding region is the innermost enclosing parallel region.
  3. thread: in which case the binding region is not defined.

The body region can only contain a single block which must contain a single operation, this operation must be an omp.loop_nest.

omp.loop <clauses> {
  omp.loop_nest (%i1, %i2) : index = (%c0, %c0) to (%c10, %c10) step (%c1, %c1) {
    %a = load %arrA[%i1, %i2] : memref<?x?xf32>
    %b = load %arrB[%i1, %i2] : memref<?x?xf32>
    %sum = arith.addf %a, %b : f32
    store %sum, %arrC[%i1, %i2] : memref<?x?xf32>
    omp.yield
  }
}

The bind clause specifies the binding region of the construct on which it appears.

The optional order attribute specifies which order the iterations of the associated loops are executed in. Currently the only option for this attribute is “concurrent”.

Reductions can be performed by specifying reduction accumulator variables in reduction_vars, symbols referring to reduction declarations in the reduction_syms attribute, and whether the reduction variable should be passed into the reduction region by value or by reference in reduction_byref. Each reduction is identified by the accumulator it uses and accumulators must not be repeated in the same reduction. A private variable corresponding to the accumulator is used in place of the accumulator inside the body of the operation. The reduction declaration specifies how to combine the values from each iteration, section, team, thread or simd lane defined by the operation’s region into the final value, which is available in the accumulator after they all complete.

Traits: AttrSizedOperandSegments, NoTerminator, SingleBlock

Interfaces: BlockArgOpenMPOpInterface, LoopWrapperInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
bind_kind::mlir::omp::ClauseBindKindAttr
BindKind Clause

Enum cases:

  • parallel (Parallel)
  • teams (Teams)
  • thread (Thread)
private_syms::mlir::ArrayAttrsymbol ref array attribute
order::mlir::omp::ClauseOrderKindAttr
OrderKind Clause

Enum cases:

  • concurrent (Concurrent)
order_mod::mlir::omp::OrderModifierAttr
OpenMP Order Modifier

Enum cases:

  • reproducible (reproducible)
  • unconstrained (unconstrained)
reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
reduction_syms::mlir::ArrayAttrsymbol ref array attribute

Operands: 

OperandDescription
private_varsvariadic of any type
reduction_varsvariadic of OpenMP-compatible variable type

omp.loop_nest (omp::LoopNestOp) 

Rectangular loop nest

This operation represents a collapsed rectangular loop nest. For each rectangular loop of the nest represented by an instance of this operation, lower and upper bounds, as well as a step variable, must be defined.

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 loop_inclusive attribute is specified then the upper bound is also included.

The body region can contain any number of blocks. The region is terminated by an omp.yield instruction without operands. The induction variables, represented as entry block arguments to the loop nest operation’s single region, match the types of the loop_lower_bounds, loop_upper_bounds and loop_steps arguments.

omp.loop_nest (%i1, %i2) : i32 = (%c0, %c0) to (%c10, %c10) step (%c1, %c1) {
  %a = load %arrA[%i1, %i2] : memref<?x?xf32>
  %b = load %arrB[%i1, %i2] : memref<?x?xf32>
  %sum = arith.addf %a, %b : f32
  store %sum, %arrC[%i1, %i2] : memref<?x?xf32>
  omp.yield
}

This is a temporary simplified definition of a loop based on existing OpenMP loop operations intended to serve as a stopgap solution until the long-term representation of canonical loops is defined. Specifically, this operation is intended to serve as a unique source for loop information during the transition to making omp.distribute, omp.simd, omp.taskloop and omp.wsloop wrapper operations. It is not intended to help with the addition of support for loop transformations, non-rectangular loops and non-perfectly nested loops.

Traits: RecursiveMemoryEffects, SameVariadicOperandSize

Attributes: 

AttributeMLIR TypeDescription
loop_inclusive::mlir::UnitAttrunit attribute

Operands: 

OperandDescription
loop_lower_boundsvariadic of integer or index
loop_upper_boundsvariadic of integer or index
loop_stepsvariadic of integer or index

omp.map.bounds (omp::MapBoundsOp) 

Represents normalized bounds information for map clauses.

Syntax:

operation ::= `omp.map.bounds` oilist(
              `lower_bound` `(` $lower_bound `:` type($lower_bound) `)`
              | `upper_bound` `(` $upper_bound `:` type($upper_bound) `)`
              | `extent` `(` $extent `:` type($extent) `)`
              | `stride` `(` $stride `:` type($stride) `)`
              | `start_idx` `(` $start_idx `:` type($start_idx) `)`
              ) attr-dict

This operation is a variation on the OpenACC dialects DataBoundsOp. Within the OpenMP dialect it stores the bounds/range of data to be mapped to a device specified by map clauses on target directives. Within the OpenMP dialect, the MapBoundsOp is associated with MapInfoOp, helping to store bounds information for the mapped variable.

It is used to support OpenMP array sectioning, Fortran pointer and allocatable mapping and pointer/allocatable member of derived types. In all cases the MapBoundsOp holds information on the section of data to be mapped. Such as the upper bound and lower bound of the section of data to be mapped. This information is currently utilised by the LLVM-IR lowering to help generate instructions to copy data to and from the device when processing target operations.

The example below copys a section of a 10-element array; all except the first element, utilising OpenMP array sectioning syntax where array subscripts are provided to specify the bounds to be mapped to device. To simplify the examples, the constants are used directly, in reality they will be MLIR SSA values.

C++:

int array[10];
#pragma target map(array[1:9])

=>

omp.map.bounds lower_bound(1) upper_bound(9) extent(9) start_idx(0)

Fortran:

integer :: array(1:10)
!$target map(array(2:10))

=>

omp.map.bounds lower_bound(1) upper_bound(9) extent(9) start_idx(1)

For Fortran pointers and allocatables (as well as those that are members of derived types) the bounds information is provided by the Fortran compiler and runtime through descriptor information.

A basic pointer example can be found below (constants again provided for simplicity, where in reality SSA values will be used, in this case that point to data yielded by Fortran’s descriptors):

Fortran:

integer, pointer :: ptr(:)
allocate(ptr(10))
!$target map(ptr)

=>

omp.map.bounds lower_bound(0) upper_bound(9) extent(10) start_idx(1)

This operation records the bounds information in a normalized fashion (zero-based). This works well with the PointerLikeType requirement in data clauses - since a lower_bound of 0 means looking at data at the zero offset from pointer.

This operation must have an upper_bound or extent (or both are allowed - but not checked for consistency). When the source language’s arrays are not zero-based, the start_idx must specify the zero-position index.

Traits: AttrSizedOperandSegments

Interfaces: NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes: 

AttributeMLIR TypeDescription
stride_in_bytes::mlir::BoolAttrbool attribute

Operands: 

OperandDescription
lower_boundinteger or index
upper_boundinteger or index
extentinteger or index
strideinteger or index
start_idxinteger or index

Results: 

ResultDescription
resultType for representing omp map clause bounds information

omp.map.info (omp::MapInfoOp) 

Syntax:

operation ::= `omp.map.info` `var_ptr` `(` $var_ptr `:` type($var_ptr) `,` $var_type `)`
              oilist(
              `var_ptr_ptr` `(` $var_ptr_ptr `:` type($var_ptr_ptr) `)`
              | `map_clauses` `(` custom<MapClause>($map_type) `)`
              | `capture` `(` custom<CaptureType>($map_capture_type) `)`
              | `members` `(` $members `:` custom<MembersIndex>($members_index) `:` type($members) `)`
              | `bounds` `(` $bounds `)`
              ) `->` type($omp_ptr) attr-dict

The MapInfoOp captures information relating to individual OpenMP map clauses that are applied to certain OpenMP directives such as Target and Target Data.

For example, the map type modifier; such as from, tofrom and to, the variable being captured or the bounds of an array section being mapped.

It can be used to capture both implicit and explicit map information, where explicit is an argument directly specified to an OpenMP map clause or implicit where a variable is utilised in a target region but is defined externally to the target region.

This map information is later used to aid the lowering of the target operations they are attached to providing argument input and output context for kernels generated or the target data mapping environment.

Example (Fortran):

integer :: index
!$target map(to: index)

=>

omp.map.info var_ptr(%index_ssa) map_type(to) map_capture_type(ByRef)
  name(index)

Description of arguments:

  • var_ptr: The address of variable to copy.
  • var_type: The type of the variable to copy.
  • var_ptr_ptr: Used when the variable copied is a member of a class, structure or derived type and refers to the originating struct.
  • members: Used to indicate mapped child members for the current MapInfoOp, represented as other MapInfoOp’s, utilised in cases where a parent structure type and members of the structure type are being mapped at the same time. For example: map(to: parent, parent->member, parent->member2[:10])
  • members_index: Used to indicate the ordering of members within the containing parent (generally a record type such as a structure, class or derived type), e.g. struct {int x, float y, double z}, x would be 0, y would be 1, and z would be 2. This aids the mapping.
  • bounds: Used when copying slices of array’s, pointers or pointer members of objects (e.g. derived types or classes), indicates the bounds to be copied of the variable. When it’s an array slice it is in rank order where rank 0 is the inner-most dimension.
  • ‘map_type’: OpenMP map type for this map capture, for example: from, to and always. It’s a bitfield composed of the OpenMP runtime flags stored in OpenMPOffloadMappingFlags.
  • ‘map_capture_type’: Capture type for the variable e.g. this, byref, byvalue, byvla this can affect how the variable is lowered.
  • name: Holds the name of variable as specified in user clause (including bounds).
  • partial_map: The record type being mapped will not be mapped in its entirety, it may be used however, in a mapping to bind it’s mapped components together.

Traits: AttrSizedOperandSegments

Attributes: 

AttributeMLIR TypeDescription
var_type::mlir::TypeAttrany type attribute
members_index::mlir::ArrayAttrArray of 64-bit integer array attributes
map_type::mlir::IntegerAttr64-bit unsigned integer attribute
map_capture_type::mlir::omp::VariableCaptureKindAttr
variable capture kind

Enum cases:

  • This (This)
  • ByRef (ByRef)
  • ByCopy (ByCopy)
  • VLAType (VLAType)
name::mlir::StringAttrstring attribute
partial_map::mlir::BoolAttrbool attribute

Operands: 

OperandDescription
var_ptrOpenMP-compatible variable type
var_ptr_ptrOpenMP-compatible variable type
membersvariadic of OpenMP-compatible variable type
boundsvariadic of Type for representing omp map clause bounds information

Results: 

ResultDescription
omp_ptrOpenMP-compatible variable type

omp.masked (omp::MaskedOp) 

Masked construct

Syntax:

operation ::= `omp.masked` oilist(
              `filter` `(` $filtered_thread_id `:` type($filtered_thread_id) `)`
              ) $region attr-dict

Masked construct allows to specify a structured block to be executed by a subset of threads of the current team.

If filter is specified, the masked construct masks the execution of the region to only the thread id filtered. Other threads executing the parallel region are not expected to execute the region specified within the masked directive. If filter is not specified, master thread is expected to execute the region enclosed within masked directive.

Operands: 

OperandDescription
filtered_thread_idinteger or index

omp.master (omp::MasterOp) 

Master construct

Syntax:

operation ::= `omp.master` $region attr-dict

The master construct specifies a structured block that is executed by the master thread of the team.

omp.ordered (omp::OrderedOp) 

Ordered construct without region

Syntax:

operation ::= `omp.ordered` ( `depend_type` `` $doacross_depend_type^ )?
              ( `depend_vec` `(` $doacross_depend_vars^ `:` type($doacross_depend_vars)
              `)` )?
              attr-dict

The ordered construct without region is a stand-alone directive that specifies cross-iteration dependencies in a doacross loop nest.

The doacross_depend_type attribute refers to either the DEPEND(SOURCE) clause or the DEPEND(SINK: vec) clause.

The doacross_num_loops attribute specifies the number of loops in the doacross nest.

The doacross_depend_vars is a variadic list of operands that specifies the index of the loop iterator in the doacross nest for the DEPEND(SOURCE) clause or the index of the element of “vec” for the DEPEND(SINK: vec) clause. It contains the operands in multiple “vec” when multiple DEPEND(SINK: vec) clauses exist in one ORDERED directive.

Attributes: 

AttributeMLIR TypeDescription
doacross_depend_type::mlir::omp::ClauseDependAttr
depend clause

Enum cases:

  • dependsource (dependsource)
  • dependsink (dependsink)
doacross_num_loops::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 0

Operands: 

OperandDescription
doacross_depend_varsvariadic of any type

omp.ordered.region (omp::OrderedRegionOp) 

Ordered construct with region

Syntax:

operation ::= `omp.ordered.region` oilist(
              `par_level_simd` $par_level_simd
              ) $region attr-dict

The ordered construct with region specifies a structured block in a worksharing-loop, SIMD, or worksharing-loop SIMD region that is executed in the order of the loop iterations.

The par_level_simd attribute corresponds to the simd clause specified. If it is not present, it behaves as if the threads clause is specified or no clause is specified.

Attributes: 

AttributeMLIR TypeDescription
par_level_simd::mlir::UnitAttrunit attribute

omp.parallel (omp::ParallelOp) 

Parallel construct

Syntax:

operation ::= `omp.parallel` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `if` `(` $if_expr `)`
              |
              `num_threads` `(` $num_threads `:` type($num_threads) `)`
              |
              `proc_bind` `(` custom<ClauseAttr>($proc_bind_kind) `)`
              )
              custom<PrivateReductionRegion>($region, $private_vars, type($private_vars),
              $private_syms, $reduction_vars, type($reduction_vars), $reduction_byref,
              $reduction_syms) attr-dict

The parallel construct includes a region of code which is to be executed by a team of threads.

The optional if_expr parameter specifies a boolean result of a conditional check. If this value is 1 or is not provided then the parallel region runs as normal, if it is 0 then the parallel region is executed with one thread.

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

The optional num_threads parameter specifies the number of threads which should be used to execute the parallel region.

The optional proc_bind_kind attribute controls the thread affinity for the execution of the parallel region.

Reductions can be performed by specifying reduction accumulator variables in reduction_vars, symbols referring to reduction declarations in the reduction_syms attribute, and whether the reduction variable should be passed into the reduction region by value or by reference in reduction_byref. Each reduction is identified by the accumulator it uses and accumulators must not be repeated in the same reduction. A private variable corresponding to the accumulator is used in place of the accumulator inside the body of the operation. The reduction declaration specifies how to combine the values from each iteration, section, team, thread or simd lane defined by the operation’s region into the final value, which is available in the accumulator after they all complete.

Traits: AttrSizedOperandSegments, AutomaticAllocationScope, RecursiveMemoryEffects

Interfaces: BlockArgOpenMPOpInterface, ComposableOpInterface, OutlineableOpenMPOpInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
private_syms::mlir::ArrayAttrsymbol ref array attribute
proc_bind_kind::mlir::omp::ClauseProcBindKindAttr
ProcBindKind Clause

Enum cases:

  • primary (Primary)
  • master (Master)
  • close (Close)
  • spread (Spread)
reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
reduction_syms::mlir::ArrayAttrsymbol ref array attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
if_expr1-bit signless integer
num_threadsinteger or index
private_varsvariadic of any type
reduction_varsvariadic of OpenMP-compatible variable type

omp.private (omp::PrivateClauseOp) 

Provides declaration of [first]private logic.

Syntax:

operation ::= `omp.private` $data_sharing_type $sym_name `:` $type
              `alloc` $alloc_region
              (`copy` $copy_region^)?
              (`dealloc` $dealloc_region^)?
              attr-dict

This operation provides a declaration of how to implement the [first]privatization of a variable. The dialect users should provide information about how to create an instance of the type in the alloc region, how to initialize the copy from the original item in the copy region, and if needed, how to deallocate allocated memory in the dealloc region.

Examples:

  • private(x) would be emitted as:
omp.private {type = private} @x.privatizer : !fir.ref<i32> alloc {
^bb0(%arg0: !fir.ref<i32>):
%0 = ... allocate proper memory for the private clone ...
omp.yield(%0 : !fir.ref<i32>)
}
  • firstprivate(x) would be emitted as:
omp.private {type = firstprivate} @x.privatizer : !fir.ref<i32> alloc {
^bb0(%arg0: !fir.ref<i32>):
%0 = ... allocate proper memory for the private clone ...
omp.yield(%0 : !fir.ref<i32>)
} copy {
^bb0(%arg0: !fir.ref<i32>, %arg1: !fir.ref<i32>):
// %arg0 is the original host variable. Same as for `alloc`.
// %arg1 represents the memory allocated in `alloc`.
... copy from host to the privatized clone ....
omp.yield(%arg1 : !fir.ref<i32>)
}
  • private(x) for “allocatables” would be emitted as:
omp.private {type = private} @x.privatizer : !some.type alloc {
^bb0(%arg0: !some.type):
%0 = ... allocate proper memory for the private clone ...
omp.yield(%0 : !fir.ref<i32>)
} dealloc {
^bb0(%arg0: !some.type):
... deallocate allocated memory ...
omp.yield
}

There are no restrictions on the body except for:

  • The alloc & dealloc regions have a single argument.
  • The copy region has 2 arguments.
  • All three regions are terminated by omp.yield ops. The above restrictions and other obvious restrictions (e.g. verifying the type of yielded values) are verified by the custom op verifier. The actual contents of the blocks inside all regions are not verified.

Instances of this op would then be used by ops that model directives that accept data-sharing attribute clauses.

The $sym_name attribute provides a symbol by which the privatizer op can be referenced by other dialect ops.

The $type attribute is the type of the value being privatized.

The $data_sharing_type attribute specifies whether privatizer corresponds to a private or a firstprivate clause.

Traits: IsolatedFromAbove

Interfaces: RecipeInterface

Attributes: 

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
type::mlir::TypeAttrtype attribute of any type
data_sharing_type::mlir::omp::DataSharingClauseTypeAttr
Type of a data-sharing clause

Enum cases:

  • private (Private)
  • firstprivate (FirstPrivate)

omp.section (omp::SectionOp) 

Section directive

Syntax:

operation ::= `omp.section` $region attr-dict

A section operation encloses a region which represents one section in a sections construct. A section op should always be surrounded by an omp.sections operation. The section operation may have block args which corespond to the block arguments of the surrounding omp.sections operation. This is done to reflect situations where these block arguments represent variables private to each section.

Traits: HasParent<SectionsOp>

Interfaces: BlockArgOpenMPOpInterface

omp.sections (omp::SectionsOp) 

Sections construct

Syntax:

operation ::= `omp.sections` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `nowait` $nowait
              )
              custom<PrivateReductionRegion>($region, $private_vars, type($private_vars),
              $private_syms, $reduction_vars, type($reduction_vars), $reduction_byref,
              $reduction_syms) attr-dict

The sections construct is a non-iterative worksharing construct that contains omp.section operations. The omp.section operations are to be distributed among and executed by the threads in a team. Each omp.section is executed once by one of the threads in the team in the context of its implicit task. Block arguments for reduction variables should be mirrored in enclosed omp.section operations.

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

Reductions can be performed by specifying reduction accumulator variables in reduction_vars, symbols referring to reduction declarations in the reduction_syms attribute, and whether the reduction variable should be passed into the reduction region by value or by reference in reduction_byref. Each reduction is identified by the accumulator it uses and accumulators must not be repeated in the same reduction. A private variable corresponding to the accumulator is used in place of the accumulator inside the body of the operation. The reduction declaration specifies how to combine the values from each iteration, section, team, thread or simd lane defined by the operation’s region into the final value, which is available in the accumulator after they all complete.

Traits: AttrSizedOperandSegments

Interfaces: BlockArgOpenMPOpInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
nowait::mlir::UnitAttrunit attribute
private_syms::mlir::ArrayAttrsymbol ref array attribute
reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
reduction_syms::mlir::ArrayAttrsymbol ref array attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
private_varsvariadic of any type
reduction_varsvariadic of OpenMP-compatible variable type

omp.simd (omp::SimdOp) 

Simd construct

Syntax:

operation ::= `omp.simd` oilist(
              `aligned` `(` custom<AlignedClause>($aligned_vars, type($aligned_vars),
              $alignments) `)`
              |
              `if` `(` $if_expr `)`
              |
              `linear` `(`
              custom<LinearClause>($linear_vars, type($linear_vars),
              $linear_step_vars) `)`
              |
              `nontemporal` `(`  $nontemporal_vars `:` type($nontemporal_vars) `)`
              |
              `order` `(` custom<OrderClause>($order, $order_mod) `)`
              |
              `safelen` `(` $safelen  `)`
              |
              `simdlen` `(` $simdlen  `)`
              )
              custom<PrivateReductionRegion>($region, $private_vars, type($private_vars),
              $private_syms, $reduction_vars, type($reduction_vars), $reduction_byref,
              $reduction_syms) attr-dict

The simd construct can be applied to a loop to indicate that the loop can be transformed into a SIMD loop (that is, multiple iterations of the loop can be executed concurrently using SIMD instructions).

The body region can only contain a single block which must contain a single operation. This operation must be another compatible loop wrapper or an omp.loop_nest.

omp.simd <clauses> {
  omp.loop_nest (%i1, %i2) : index = (%c0, %c0) to (%c10, %c10) step (%c1, %c1) {
    %a = load %arrA[%i1, %i2] : memref<?x?xf32>
    %b = load %arrB[%i1, %i2] : memref<?x?xf32>
    %sum = arith.addf %a, %b : f32
    store %sum, %arrC[%i1, %i2] : memref<?x?xf32>
    omp.yield
  }
}

When an if clause is present and evaluates to false, the preferred number of iterations to be executed concurrently is one, regardless of whether a simdlen clause is specified.

The alignments attribute additionally specifies alignment of each corresponding aligned operand. Note that aligned_vars and alignments must contain the same number of elements.

The linear_step_vars operand additionally specifies the step for each associated linear operand. Note that the linear_vars and linear_step_vars variadic lists should contain the same number of elements.

The optional nontemporal attribute specifies variables which have low temporal locality across the iterations where they are accessed.

The optional order attribute specifies which order the iterations of the associated loops are executed in. Currently the only option for this attribute is “concurrent”.

Reductions can be performed by specifying reduction accumulator variables in reduction_vars, symbols referring to reduction declarations in the reduction_syms attribute, and whether the reduction variable should be passed into the reduction region by value or by reference in reduction_byref. Each reduction is identified by the accumulator it uses and accumulators must not be repeated in the same reduction. A private variable corresponding to the accumulator is used in place of the accumulator inside the body of the operation. The reduction declaration specifies how to combine the values from each iteration, section, team, thread or simd lane defined by the operation’s region into the final value, which is available in the accumulator after they all complete.

The safelen clause specifies that no two concurrent iterations within a SIMD chunk can have a distance in the logical iteration space that is greater than or equal to the value given in the clause.

When a simdlen clause is present, the preferred number of iterations to be executed concurrently is the value provided to the simdlen clause.

Traits: AttrSizedOperandSegments, NoTerminator, RecursiveMemoryEffects, SingleBlock

Interfaces: BlockArgOpenMPOpInterface, ComposableOpInterface, LoopWrapperInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
alignments::mlir::ArrayAttr64-bit integer array attribute
order::mlir::omp::ClauseOrderKindAttr
OrderKind Clause

Enum cases:

  • concurrent (Concurrent)
order_mod::mlir::omp::OrderModifierAttr
OpenMP Order Modifier

Enum cases:

  • reproducible (reproducible)
  • unconstrained (unconstrained)
private_syms::mlir::ArrayAttrsymbol ref array attribute
reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
reduction_syms::mlir::ArrayAttrsymbol ref array attribute
safelen::mlir::IntegerAttr64-bit signless integer attribute whose value is positive
simdlen::mlir::IntegerAttr64-bit signless integer attribute whose value is positive

Operands: 

OperandDescription
aligned_varsvariadic of OpenMP-compatible variable type
if_expr1-bit signless integer
linear_varsvariadic of any type
linear_step_varsvariadic of 32-bit signless integer
nontemporal_varsvariadic of OpenMP-compatible variable type
private_varsvariadic of any type
reduction_varsvariadic of OpenMP-compatible variable type

omp.single (omp::SingleOp) 

Single directive

Syntax:

operation ::= `omp.single` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `copyprivate` `(`
              custom<Copyprivate>($copyprivate_vars, type($copyprivate_vars),
              $copyprivate_syms) `)`
              |
              `nowait` $nowait
              )
              custom<PrivateRegion>($region, $private_vars, type($private_vars),
              $private_syms) attr-dict

The single construct specifies that the associated structured block is executed by only one of the threads in the team (not necessarily the master thread), in the context of its implicit task. The other threads in the team, which do not execute the block, wait at an implicit barrier at the end of the single construct.

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

If copyprivate variables and functions are specified, then each thread variable is updated with the variable value of the thread that executed the single region, using the specified copy functions.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

Traits: AttrSizedOperandSegments

Interfaces: BlockArgOpenMPOpInterface

Attributes: 

AttributeMLIR TypeDescription
copyprivate_syms::mlir::ArrayAttrsymbol ref array attribute
nowait::mlir::UnitAttrunit attribute
private_syms::mlir::ArrayAttrsymbol ref array attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
copyprivate_varsvariadic of OpenMP-compatible variable type
private_varsvariadic of any type

omp.target (omp::TargetOp) 

Target construct

Syntax:

operation ::= `omp.target` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `ompx_bare` $bare
              |
              `depend` `(`
              custom<DependVarList>($depend_vars, type($depend_vars), $depend_kinds) `)`
              |
              `device` `(` $device `:` type($device) `)`
              |
              `has_device_addr` `(` $has_device_addr_vars `:` type($has_device_addr_vars)
              `)`
              |
              `if` `(` $if_expr `)`
              |
              `is_device_ptr` `(` $is_device_ptr_vars `:` type($is_device_ptr_vars) `)`
              |
              `nowait` $nowait
              |
              `thread_limit` `(` $thread_limit `:` type($thread_limit) `)`
              )
              custom<InReductionMapPrivateRegion>(
              $region, $in_reduction_vars, type($in_reduction_vars),
              $in_reduction_byref, $in_reduction_syms, $map_vars, type($map_vars),
              $private_vars, type($private_vars), $private_syms, $private_maps)
              attr-dict

The target construct includes a region of code which is to be executed on a device.

The optional if_expr parameter specifies a boolean result of a conditional check. If this value is 1 or is not provided then the target region runs on a device, if it is 0 then the target region is executed on the host device.

The private_maps attribute connects private operands to their corresponding map operands. For private operands that require a map, the value of the corresponding element in the attribute is the index of the map operand (relative to other map operands not the whole operands of the operation). For private opernads that do not require a map, this value is -1 (which is omitted from the assembly foramt printing).

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

ompx_bare allows omp target teams to be executed on a GPU with an explicit number of teams and threads. This clause also allows the teams and threads sizes to have up to 3 dimensions.

The depend_kinds and depend_vars arguments are variadic lists of values that specify the dependencies of this particular task in relation to other tasks.

The optional device parameter specifies the device number for the target region.

The optional has_device_addr_vars indicates that list items already have device addresses, so they may be directly accessed from the target device. This includes array sections.

The optional is_device_ptr_vars indicates list items are device pointers.

The optional map_vars maps data from the current task’s data environment to the device data environment.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

The optional thread_limit specifies the limit on the number of threads.

Traits: AttrSizedOperandSegments, IsolatedFromAbove

Interfaces: BlockArgOpenMPOpInterface, MapClauseOwningOpInterface, OutlineableOpenMPOpInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
bare::mlir::UnitAttrunit attribute
depend_kinds::mlir::ArrayAttrdepend clause in a target or task construct array
in_reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
in_reduction_syms::mlir::ArrayAttrsymbol ref array attribute
nowait::mlir::UnitAttrunit attribute
private_syms::mlir::ArrayAttrsymbol ref array attribute
private_maps::mlir::DenseI64ArrayAttri64 dense array attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
depend_varsvariadic of OpenMP-compatible variable type
deviceinteger
has_device_addr_varsvariadic of OpenMP-compatible variable type
if_expr1-bit signless integer
in_reduction_varsvariadic of OpenMP-compatible variable type
is_device_ptr_varsvariadic of OpenMP-compatible variable type
map_varsvariadic of OpenMP-compatible variable type
private_varsvariadic of any type
thread_limitinteger

omp.target_data (omp::TargetDataOp) 

Target data construct

Syntax:

operation ::= `omp.target_data` oilist(
              `device` `(` $device `:` type($device) `)`
              |
              `if` `(` $if_expr `)`
              |
              `map_entries` `(` $map_vars `:` type($map_vars) `)`
              )
              custom<UseDeviceAddrUseDevicePtrRegion>(
              $region, $use_device_addr_vars, type($use_device_addr_vars),
              $use_device_ptr_vars, type($use_device_ptr_vars)) attr-dict

Map variables to a device data environment for the extent of the region.

The omp target data directive maps variables to a device data environment, and defines the lexical scope of the data environment that is created. The omp target data directive can reduce data copies to and from the offloading device when multiple target regions are using the same data.

The optional if_expr parameter specifies a boolean result of a conditional check. If this value is 1 or is not provided then the target region runs on a device, if it is 0 then the target region is executed on the host device.

The optional device parameter specifies the device number for the target region.

The optional map_vars maps data from the current task’s data environment to the device data environment.

The optional use_device_addr_vars specifies the address of the objects in the device data environment.

The optional use_device_ptr_vars specifies the device pointers to the corresponding list items in the device data environment.

Traits: AttrSizedOperandSegments

Interfaces: BlockArgOpenMPOpInterface, MapClauseOwningOpInterface

Operands: 

OperandDescription
deviceinteger
if_expr1-bit signless integer
map_varsvariadic of OpenMP-compatible variable type
use_device_addr_varsvariadic of OpenMP-compatible variable type
use_device_ptr_varsvariadic of OpenMP-compatible variable type

omp.target_enter_data (omp::TargetEnterDataOp) 

Target enter data construct

Syntax:

operation ::= `omp.target_enter_data` oilist(
              `depend` `(`
              custom<DependVarList>($depend_vars, type($depend_vars), $depend_kinds) `)`
              |
              `device` `(` $device `:` type($device) `)`
              |
              `if` `(` $if_expr `)`
              |
              `map_entries` `(` $map_vars `:` type($map_vars) `)`
              |
              `nowait` $nowait
              ) attr-dict

The target enter data directive specifies that variables are mapped to a device data environment. The target enter data directive is a stand-alone directive.

The optional if_expr parameter specifies a boolean result of a conditional check. If this value is 1 or is not provided then the target region runs on a device, if it is 0 then the target region is executed on the host device.

The depend_kinds and depend_vars arguments are variadic lists of values that specify the dependencies of this particular task in relation to other tasks.

The optional device parameter specifies the device number for the target region.

The optional map_vars maps data from the current task’s data environment to the device data environment.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

Traits: AttrSizedOperandSegments

Interfaces: MapClauseOwningOpInterface

Attributes: 

AttributeMLIR TypeDescription
depend_kinds::mlir::ArrayAttrdepend clause in a target or task construct array
nowait::mlir::UnitAttrunit attribute

Operands: 

OperandDescription
depend_varsvariadic of OpenMP-compatible variable type
deviceinteger
if_expr1-bit signless integer
map_varsvariadic of OpenMP-compatible variable type

omp.target_exit_data (omp::TargetExitDataOp) 

Target exit data construct

Syntax:

operation ::= `omp.target_exit_data` oilist(
              `depend` `(`
              custom<DependVarList>($depend_vars, type($depend_vars), $depend_kinds) `)`
              |
              `device` `(` $device `:` type($device) `)`
              |
              `if` `(` $if_expr `)`
              |
              `map_entries` `(` $map_vars `:` type($map_vars) `)`
              |
              `nowait` $nowait
              ) attr-dict

The target exit data directive specifies that variables are mapped to a device data environment. The target exit data directive is a stand-alone directive.

The optional if_expr parameter specifies a boolean result of a conditional check. If this value is 1 or is not provided then the target region runs on a device, if it is 0 then the target region is executed on the host device.

The depend_kinds and depend_vars arguments are variadic lists of values that specify the dependencies of this particular task in relation to other tasks.

The optional device parameter specifies the device number for the target region.

The optional map_vars maps data from the current task’s data environment to the device data environment.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

Traits: AttrSizedOperandSegments

Interfaces: MapClauseOwningOpInterface

Attributes: 

AttributeMLIR TypeDescription
depend_kinds::mlir::ArrayAttrdepend clause in a target or task construct array
nowait::mlir::UnitAttrunit attribute

Operands: 

OperandDescription
depend_varsvariadic of OpenMP-compatible variable type
deviceinteger
if_expr1-bit signless integer
map_varsvariadic of OpenMP-compatible variable type

omp.target_update (omp::TargetUpdateOp) 

Target update construct

Syntax:

operation ::= `omp.target_update` oilist(
              `depend` `(`
              custom<DependVarList>($depend_vars, type($depend_vars), $depend_kinds) `)`
              |
              `device` `(` $device `:` type($device) `)`
              |
              `if` `(` $if_expr `)`
              |
              `map_entries` `(` $map_vars `:` type($map_vars) `)`
              |
              `nowait` $nowait
              ) attr-dict

The target update directive makes the corresponding list items in the device data environment consistent with their original list items, according to the specified motion clauses. The target update construct is a stand-alone directive.

The optional if_expr parameter specifies a boolean result of a conditional check. If this value is 1 or is not provided then the target region runs on a device, if it is 0 then the target region is executed on the host device.

We use MapInfoOp to model the motion clauses and their modifiers. Even though the spec differentiates between map-types & map-type-modifiers vs. motion-clauses & motion-modifiers, the motion clauses and their modifiers are a subset of map types and their modifiers. The subset relation is handled in during verification to make sure the restrictions for target update are respected.

The depend_kinds and depend_vars arguments are variadic lists of values that specify the dependencies of this particular task in relation to other tasks.

The optional device parameter specifies the device number for the target region.

The optional map_vars maps data from the current task’s data environment to the device data environment.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

Traits: AttrSizedOperandSegments

Interfaces: MapClauseOwningOpInterface

Attributes: 

AttributeMLIR TypeDescription
depend_kinds::mlir::ArrayAttrdepend clause in a target or task construct array
nowait::mlir::UnitAttrunit attribute

Operands: 

OperandDescription
depend_varsvariadic of OpenMP-compatible variable type
deviceinteger
if_expr1-bit signless integer
map_varsvariadic of OpenMP-compatible variable type

omp.task (omp::TaskOp) 

Task construct

Syntax:

operation ::= `omp.task` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `depend` `(`
              custom<DependVarList>($depend_vars, type($depend_vars), $depend_kinds) `)`
              |
              `final` `(` $final `)`
              |
              `if` `(` $if_expr `)`
              |
              `mergeable` $mergeable
              |
              `priority` `(` $priority `:` type($priority) `)`
              |
              `untied` $untied
              |
              `detach` `(` $event_handle `:` type($event_handle) `)`
              )
              custom<InReductionPrivateRegion>(
              $region, $in_reduction_vars, type($in_reduction_vars),
              $in_reduction_byref, $in_reduction_syms, $private_vars,
              type($private_vars), $private_syms) attr-dict

The task construct defines an explicit task.

For definitions of “undeferred task”, “included task”, “final task” and “mergeable task”, please check OpenMP Specification.

When an if clause is present on a task construct, and the value of if_expr evaluates to false, an “undeferred task” is generated, and the encountering thread must suspend the current task region, for which execution cannot be resumed until execution of the structured block that is associated with the generated task is completed.

The in_reduction clause specifies that this particular task (among all the tasks in current taskgroup, if any) participates in a reduction. in_reduction_byref indicates whether each reduction variable should be passed by value or by reference.

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

The depend_kinds and depend_vars arguments are variadic lists of values that specify the dependencies of this particular task in relation to other tasks.

When a final clause is present and the final clause expression evaluates to true, the generated tasks will be final tasks. All task constructs encountered during execution of a final task will generate final and included tasks. The use of a variable in a final clause expression causes an implicit reference to the variable in all enclosing constructs.

When the mergeable clause is present, the tasks generated by the construct are “mergeable tasks”.

The priority clause is a hint for the priority of the generated tasks. The priority is a non-negative integer expression that provides a hint for task execution order. Among all tasks ready to be executed, higher priority tasks (those with a higher numerical value in the priority clause expression) are recommended to execute before lower priority ones. The default priority-value when no priority clause is specified should be assumed to be zero (the lowest priority).

If the untied clause is present on a task construct, any thread in the team can resume the task region after a suspension. The untied clause is ignored if a final clause is present on the same task construct and the final expression evaluates to true, or if a task is an included task.

The detach clause specifies that the task generated by the construct on which it appears is a

detachable task. A new allow-completion event is created and connected to the completion of the associated task region. The original event-handle is updated to represent that allow-completion event before the task data environment is created.

Traits: AttrSizedOperandSegments, AutomaticAllocationScope

Interfaces: BlockArgOpenMPOpInterface, OutlineableOpenMPOpInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
depend_kinds::mlir::ArrayAttrdepend clause in a target or task construct array
in_reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
in_reduction_syms::mlir::ArrayAttrsymbol ref array attribute
mergeable::mlir::UnitAttrunit attribute
private_syms::mlir::ArrayAttrsymbol ref array attribute
untied::mlir::UnitAttrunit attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
depend_varsvariadic of OpenMP-compatible variable type
final1-bit signless integer
if_expr1-bit signless integer
in_reduction_varsvariadic of OpenMP-compatible variable type
priorityinteger
private_varsvariadic of any type
event_handleOpenMP-compatible variable type

omp.taskgroup (omp::TaskgroupOp) 

Taskgroup construct

Syntax:

operation ::= `omp.taskgroup` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              )
              custom<TaskReductionRegion>(
              $region, $task_reduction_vars, type($task_reduction_vars),
              $task_reduction_byref, $task_reduction_syms) attr-dict

The taskgroup construct specifies a wait on completion of child tasks of the current task and their descendent tasks.

When a thread encounters a taskgroup construct, it starts executing the region. All child tasks generated in the taskgroup region and all of their descendants that bind to the same parallel region as the taskgroup region are part of the taskgroup set associated with the taskgroup region. There is an implicit task scheduling point at the end of the taskgroup region. The current task is suspended at the task scheduling point until all tasks in the taskgroup set complete execution.

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

The task_reduction clause specifies a reduction among tasks. For each list item, the number of copies is unspecified. Any copies associated with the reduction are initialized before they are accessed by the tasks participating in the reduction. After the end of the region, the original list item contains the result of the reduction. Similarly to the reduction clause, accumulator variables must be passed in task_reduction_vars, symbols referring to reduction declarations in the task_reduction_syms attribute, and whether the reduction variable should be passed into the reduction region by value or by reference in task_reduction_byref.

Traits: AttrSizedOperandSegments, AutomaticAllocationScope

Interfaces: BlockArgOpenMPOpInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
task_reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
task_reduction_syms::mlir::ArrayAttrsymbol ref array attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
task_reduction_varsvariadic of OpenMP-compatible variable type

omp.taskloop (omp::TaskloopOp) 

Taskloop construct

Syntax:

operation ::= `omp.taskloop` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `final` `(` $final `)`
              |
              `grainsize` `(` $grainsize `:` type($grainsize) `)`
              |
              `if` `(` $if_expr `)`
              |
              `mergeable` $mergeable
              |
              `nogroup` $nogroup
              |
              `num_tasks` `(` $num_tasks `:` type($num_tasks) `)`
              |
              `priority` `(` $priority `:` type($priority) `)`
              |
              `untied` $untied
              )
              custom<InReductionPrivateReductionRegion>(
              $region, $in_reduction_vars, type($in_reduction_vars),
              $in_reduction_byref, $in_reduction_syms, $private_vars,
              type($private_vars), $private_syms, $reduction_vars,
              type($reduction_vars), $reduction_byref, $reduction_syms) attr-dict

The taskloop construct specifies that the iterations of one or more associated loops will be executed in parallel using explicit tasks. The iterations are distributed across tasks generated by the construct and scheduled to be executed.

The body region can only contain a single block which must contain a single operation. This operation must be another compatible loop wrapper or an omp.loop_nest.

omp.taskloop <clauses> {
  omp.loop_nest (%i1, %i2) : index = (%c0, %c0) to (%c10, %c10) step (%c1, %c1) {
    %a = load %arrA[%i1, %i2] : memref<?x?xf32>
    %b = load %arrB[%i1, %i2] : memref<?x?xf32>
    %sum = arith.addf %a, %b : f32
    store %sum, %arrC[%i1, %i2] : memref<?x?xf32>
    omp.yield
  }
}

For definitions of “undeferred task”, “included task”, “final task” and “mergeable task”, please check OpenMP Specification.

When an if clause is present on a taskloop construct, and if the if clause expression evaluates to false, undeferred tasks are generated. The use of a variable in an if clause expression of a taskloop construct causes an implicit reference to the variable in all enclosing constructs.

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

When a final clause is present and the final clause expression evaluates to true, the generated tasks will be final tasks. All task constructs encountered during execution of a final task will generate final and included tasks. The use of a variable in a final clause expression causes an implicit reference to the variable in all enclosing constructs.

If a grainsize clause is present, the number of logical loop iterations assigned to each generated task is greater than or equal to the minimum of the value of the grain-size expression and the number of logical loop iterations, but less than two times the value of the grain-size expression.

When the mergeable clause is present, the tasks generated by the construct are “mergeable tasks”.

By default, the taskloop construct executes as if it was enclosed in a taskgroup construct with no statements or directives outside of the taskloop construct. Thus, the taskloop construct creates an implicit taskgroup region. If the nogroup clause is present, no implicit taskgroup region is created.

If num_tasks is specified, the taskloop construct creates as many tasks as the minimum of the num-tasks expression and the number of logical loop iterations. Each task must have at least one logical loop iteration.

The priority clause is a hint for the priority of the generated tasks. The priority is a non-negative integer expression that provides a hint for task execution order. Among all tasks ready to be executed, higher priority tasks (those with a higher numerical value in the priority clause expression) are recommended to execute before lower priority ones. The default priority-value when no priority clause is specified should be assumed to be zero (the lowest priority).

Reductions can be performed by specifying reduction accumulator variables in reduction_vars, symbols referring to reduction declarations in the reduction_syms attribute, and whether the reduction variable should be passed into the reduction region by value or by reference in reduction_byref. Each reduction is identified by the accumulator it uses and accumulators must not be repeated in the same reduction. A private variable corresponding to the accumulator is used in place of the accumulator inside the body of the operation. The reduction declaration specifies how to combine the values from each iteration, section, team, thread or simd lane defined by the operation’s region into the final value, which is available in the accumulator after they all complete.

If the untied clause is present on a task construct, any thread in the team can resume the task region after a suspension. The untied clause is ignored if a final clause is present on the same task construct and the final expression evaluates to true, or if a task is an included task.

If an in_reduction clause is present on the taskloop construct, the behavior is as if each generated task was defined by a task construct on which an in_reduction clause with the same reduction operator and list items is present. Thus, the generated tasks are participants of a reduction previously defined by a reduction scoping clause. In this case, accumulator variables are specified in in_reduction_vars, symbols referring to reduction declarations in in_reduction_syms and in_reduction_byref indicate for each reduction variable whether it should be passed by value or by reference.

If a reduction clause is present on the taskloop construct, the behavior is as if a task_reduction clause with the same reduction operator and list items was applied to the implicit taskgroup construct enclosing the taskloop construct. The taskloop construct executes as if each generated task was defined by a task construct on which an in_reduction clause with the same reduction operator and list items is present. Thus, the generated tasks are participants of the reduction defined by the task_reduction clause that was applied to the implicit taskgroup construct.

Traits: AttrSizedOperandSegments, AutomaticAllocationScope, NoTerminator, RecursiveMemoryEffects, SingleBlock

Interfaces: BlockArgOpenMPOpInterface, ComposableOpInterface, LoopWrapperInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
in_reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
in_reduction_syms::mlir::ArrayAttrsymbol ref array attribute
mergeable::mlir::UnitAttrunit attribute
nogroup::mlir::UnitAttrunit attribute
private_syms::mlir::ArrayAttrsymbol ref array attribute
reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
reduction_syms::mlir::ArrayAttrsymbol ref array attribute
untied::mlir::UnitAttrunit attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
final1-bit signless integer
grainsizeinteger or index
if_expr1-bit signless integer
in_reduction_varsvariadic of OpenMP-compatible variable type
num_tasksinteger or index
priorityinteger
private_varsvariadic of any type
reduction_varsvariadic of OpenMP-compatible variable type

omp.taskwait (omp::TaskwaitOp) 

Taskwait construct

Syntax:

operation ::= `omp.taskwait` oilist(
              `depend` `(`
              custom<DependVarList>($depend_vars, type($depend_vars), $depend_kinds) `)`
              |
              `nowait` $nowait
              ) attr-dict

The taskwait construct specifies a wait on the completion of child tasks of the current task.

The depend_kinds and depend_vars arguments are variadic lists of values that specify the dependencies of this particular task in relation to other tasks.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

Attributes: 

AttributeMLIR TypeDescription
depend_kinds::mlir::ArrayAttrdepend clause in a target or task construct array
nowait::mlir::UnitAttrunit attribute

Operands: 

OperandDescription
depend_varsvariadic of OpenMP-compatible variable type

omp.taskyield (omp::TaskyieldOp) 

Taskyield construct

Syntax:

operation ::= `omp.taskyield` attr-dict

The taskyield construct specifies that the current task can be suspended in favor of execution of a different task.

omp.teams (omp::TeamsOp) 

Teams construct

Syntax:

operation ::= `omp.teams` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `if` `(` $if_expr `)`
              |
              `num_teams` `(` ( $num_teams_lower^ `:` type($num_teams_lower) )? `to`
              $num_teams_upper `:` type($num_teams_upper) `)`
              |
              `thread_limit` `(` $thread_limit `:` type($thread_limit) `)`
              )
              custom<PrivateReductionRegion>($region, $private_vars, type($private_vars),
              $private_syms, $reduction_vars, type($reduction_vars), $reduction_byref,
              $reduction_syms) attr-dict

The teams construct defines a region of code that triggers the creation of a league of teams. Once created, the number of teams remains constant for the duration of its code region.

If the if_expr is present and it evaluates to false, the number of teams created is one.

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

The optional num_teams_upper and num_teams_lower arguments specify the limit on the number of teams to be created. If only the upper bound is specified, it acts as if the lower bound was set to the same value. It is not allowed to set num_teams_lower if num_teams_upper is not specified. They define a closed range, where both the lower and upper bounds are included.

Reductions can be performed by specifying reduction accumulator variables in reduction_vars, symbols referring to reduction declarations in the reduction_syms attribute, and whether the reduction variable should be passed into the reduction region by value or by reference in reduction_byref. Each reduction is identified by the accumulator it uses and accumulators must not be repeated in the same reduction. A private variable corresponding to the accumulator is used in place of the accumulator inside the body of the operation. The reduction declaration specifies how to combine the values from each iteration, section, team, thread or simd lane defined by the operation’s region into the final value, which is available in the accumulator after they all complete.

The optional thread_limit specifies the limit on the number of threads.

Traits: AttrSizedOperandSegments, RecursiveMemoryEffects

Interfaces: BlockArgOpenMPOpInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
private_syms::mlir::ArrayAttrsymbol ref array attribute
reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
reduction_syms::mlir::ArrayAttrsymbol ref array attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
if_expr1-bit signless integer
num_teams_lowerinteger
num_teams_upperinteger
private_varsvariadic of any type
reduction_varsvariadic of OpenMP-compatible variable type
thread_limitinteger

omp.terminator (omp::TerminatorOp) 

Terminator for OpenMP regions

Syntax:

operation ::= `omp.terminator` attr-dict

A terminator operation for regions that appear in the body of OpenMP operation. These 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{}

omp.threadprivate (omp::ThreadprivateOp) 

Threadprivate directive

Syntax:

operation ::= `omp.threadprivate` $sym_addr `:` type($sym_addr) `->` type($tls_addr) attr-dict

The threadprivate directive specifies that variables are replicated, with each thread having its own copy.

The current implementation uses the OpenMP runtime to provide thread-local storage (TLS). Using the TLS feature of the LLVM IR will be supported in future.

This operation takes in the address of a symbol that represents the original variable and returns the address of its TLS. All occurrences of threadprivate variables in a parallel region should use the TLS returned by this operation.

The sym_addr refers to the address of the symbol, which is a pointer to the original variable.

Operands: 

OperandDescription
sym_addrOpenMP-compatible variable type

Results: 

ResultDescription
tls_addrOpenMP-compatible variable type

omp.workshare (omp::WorkshareOp) 

Workshare directive

Syntax:

operation ::= `omp.workshare` oilist(
              `nowait` $nowait
              ) $region attr-dict

The workshare construct divides the execution of the enclosed structured block into separate units of work, and causes the threads of the team to share the work such that each unit is executed only once by one thread, in the context of its implicit task

This operation is used for the intermediate representation of the workshare block before the work gets divided between the threads. See the flang LowerWorkshare pass for details.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

Traits: RecursiveMemoryEffects

Attributes: 

AttributeMLIR TypeDescription
nowait::mlir::UnitAttrunit attribute

omp.workshare.loop_wrapper (omp::WorkshareLoopWrapperOp) 

Contains loop nests to be parallelized by workshare

Syntax:

operation ::= `omp.workshare.loop_wrapper` $region attr-dict

This operation wraps a loop nest that is marked for dividing into units of work by an encompassing omp.workshare operation.

Traits: NoTerminator, RecursiveMemoryEffects, SingleBlock

Interfaces: LoopWrapperInterface

omp.wsloop (omp::WsloopOp) 

Worksharing-loop construct

Syntax:

operation ::= `omp.wsloop` oilist(
              `allocate` `(`
              custom<AllocateAndAllocator>($allocate_vars, type($allocate_vars),
              $allocator_vars, type($allocator_vars)) `)`
              |
              `linear` `(`
              custom<LinearClause>($linear_vars, type($linear_vars),
              $linear_step_vars) `)`
              |
              `nowait` $nowait
              |
              `order` `(` custom<OrderClause>($order, $order_mod) `)`
              |
              `ordered` `(` $ordered `)`
              |
              `schedule` `(`
              custom<ScheduleClause>($schedule_kind, $schedule_mod, $schedule_simd,
              $schedule_chunk, type($schedule_chunk)) `)`
              )
              custom<PrivateReductionRegion>($region, $private_vars, type($private_vars),
              $private_syms, $reduction_vars, type($reduction_vars), $reduction_byref,
              $reduction_syms) attr-dict

The worksharing-loop construct specifies that the iterations of the loop(s) will be executed in parallel by threads in the current context. These iterations are spread across threads that already exist in the enclosing parallel region.

The body region can only contain a single block which must contain a single operation. This operation must be another compatible loop wrapper or an omp.loop_nest.

omp.wsloop <clauses> {
  omp.loop_nest (%i1, %i2) : index = (%c0, %c0) to (%c10, %c10) step (%c1, %c1) {
    %a = load %arrA[%i1, %i2] : memref<?x?xf32>
    %b = load %arrB[%i1, %i2] : memref<?x?xf32>
    %sum = arith.addf %a, %b : f32
    store %sum, %arrC[%i1, %i2] : memref<?x?xf32>
    omp.yield
  }
}

The allocator_vars and allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values.

The linear_step_vars operand additionally specifies the step for each associated linear operand. Note that the linear_vars and linear_step_vars variadic lists should contain the same number of elements.

The optional nowait attribute, when present, eliminates the implicit barrier at the end of the construct, so the parent operation can make progress even if the child operation has not completed yet.

The optional order attribute specifies which order the iterations of the associated loops are executed in. Currently the only option for this attribute is “concurrent”.

The optional ordered attribute specifies how many loops are associated with the worksharing-loop construct. The value of zero refers to the ordered clause specified without parameter.

Reductions can be performed by specifying reduction accumulator variables in reduction_vars, symbols referring to reduction declarations in the reduction_syms attribute, and whether the reduction variable should be passed into the reduction region by value or by reference in reduction_byref. Each reduction is identified by the accumulator it uses and accumulators must not be repeated in the same reduction. A private variable corresponding to the accumulator is used in place of the accumulator inside the body of the operation. The reduction declaration specifies how to combine the values from each iteration, section, team, thread or simd lane defined by the operation’s region into the final value, which is available in the accumulator after they all complete.

The optional schedule_kind attribute specifies the loop schedule for this loop, determining how the loop is distributed across the parallel threads. The optional schedule_chunk associated with this determines further controls this distribution.

Traits: AttrSizedOperandSegments, NoTerminator, RecursiveMemoryEffects, SingleBlock

Interfaces: BlockArgOpenMPOpInterface, ComposableOpInterface, LoopWrapperInterface, ReductionClauseInterface

Attributes: 

AttributeMLIR TypeDescription
nowait::mlir::UnitAttrunit attribute
order::mlir::omp::ClauseOrderKindAttr
OrderKind Clause

Enum cases:

  • concurrent (Concurrent)
order_mod::mlir::omp::OrderModifierAttr
OpenMP Order Modifier

Enum cases:

  • reproducible (reproducible)
  • unconstrained (unconstrained)
ordered::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 0
private_syms::mlir::ArrayAttrsymbol ref array attribute
reduction_byref::mlir::DenseBoolArrayAttri1 dense array attribute
reduction_syms::mlir::ArrayAttrsymbol ref array attribute
schedule_kind::mlir::omp::ClauseScheduleKindAttr
ScheduleKind Clause

Enum cases:

  • static (Static)
  • dynamic (Dynamic)
  • guided (Guided)
  • auto (Auto)
  • runtime (Runtime)
schedule_mod::mlir::omp::ScheduleModifierAttr
OpenMP Schedule Modifier

Enum cases:

  • none (none)
  • monotonic (monotonic)
  • nonmonotonic (nonmonotonic)
  • simd (simd)
schedule_simd::mlir::UnitAttrunit attribute

Operands: 

OperandDescription
allocate_varsvariadic of any type
allocator_varsvariadic of any type
linear_varsvariadic of any type
linear_step_varsvariadic of 32-bit signless integer
private_varsvariadic of any type
reduction_varsvariadic of OpenMP-compatible variable type
schedule_chunkany type

omp.yield (omp::YieldOp) 

Loop yield and termination operation

Syntax:

operation ::= `omp.yield` ( `(` $results^ `:` type($results) `)` )? attr-dict

“omp.yield” yields SSA values from the OpenMP dialect op region and terminates the region. The semantics of how the values are yielded is defined by the parent operation.

Traits: AlwaysSpeculatableImplTrait, HasParent<AtomicUpdateOp, DeclareReductionOp, LoopNestOp, PrivateClauseOp>, ReturnLike, Terminator

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), RegionBranchTerminatorOpInterface

Effects: MemoryEffects::Effect{}

Operands: 

OperandDescription
resultsvariadic of any type

Attributes 

ClauseBindKindAttr 

BindKind Clause

Syntax:

#omp.bindkind<
  ::mlir::omp::ClauseBindKind   # value
>

Enum cases:

  • parallel (Parallel)
  • teams (Teams)
  • thread (Thread)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseBindKindan enum of type ClauseBindKind

ClauseCancellationConstructTypeAttr 

CancellationConstructType Clause

Syntax:

#omp.cancellationconstructtype<
  ::mlir::omp::ClauseCancellationConstructType   # value
>

Enum cases:

  • parallel (Parallel)
  • loop (Loop)
  • sections (Sections)
  • taskgroup (Taskgroup)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseCancellationConstructTypean enum of type ClauseCancellationConstructType

ClauseDependAttr 

depend clause

Syntax:

#omp.clause_depend<
  ::mlir::omp::ClauseDepend   # value
>

Enum cases:

  • dependsource (dependsource)
  • dependsink (dependsink)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseDependan enum of type ClauseDepend

ClauseRequiresAttr 

requires clauses

Syntax:

#omp.clause_requires<
  ::mlir::omp::ClauseRequires   # value
>

Enum cases:

  • none (none)
  • reverse_offload (reverse_offload)
  • unified_address (unified_address)
  • unified_shared_memory (unified_shared_memory)
  • dynamic_allocators (dynamic_allocators)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseRequiresan enum of type ClauseRequires

ClauseTaskDependAttr 

depend clause in a target or task construct

Syntax:

#omp.clause_task_depend<
  ::mlir::omp::ClauseTaskDepend   # value
>

Enum cases:

  • taskdependin (taskdependin)
  • taskdependout (taskdependout)
  • taskdependinout (taskdependinout)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseTaskDependan enum of type ClauseTaskDepend

DataSharingClauseTypeAttr 

Type of a data-sharing clause

Syntax:

#omp.data_sharing_type<
  ::mlir::omp::DataSharingClauseType   # value
>

Enum cases:

  • private (Private)
  • firstprivate (FirstPrivate)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::DataSharingClauseTypean enum of type DataSharingClauseType

DeclareTargetAttr 

Syntax:

#omp.declaretarget<
  DeclareTargetDeviceTypeAttr,   # device_type
  DeclareTargetCaptureClauseAttr   # capture_clause
>

Parameters: 

ParameterC++ typeDescription
device_typeDeclareTargetDeviceTypeAttr
capture_clauseDeclareTargetCaptureClauseAttr

DeclareTargetCaptureClauseAttr 

capture clause

Syntax:

#omp.capture_clause<
  ::mlir::omp::DeclareTargetCaptureClause   # value
>

Enum cases:

  • to (to)
  • link (link)
  • enter (enter)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::DeclareTargetCaptureClausean enum of type DeclareTargetCaptureClause

DeclareTargetDeviceTypeAttr 

device_type clause

Syntax:

#omp.device_type<
  ::mlir::omp::DeclareTargetDeviceType   # value
>

Enum cases:

  • any (any)
  • host (host)
  • nohost (nohost)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::DeclareTargetDeviceTypean enum of type DeclareTargetDeviceType

FlagsAttr 

Syntax:

#omp.flags<
  uint32_t,   # debug_kind
  bool,   # assume_teams_oversubscription
  bool,   # assume_threads_oversubscription
  bool,   # assume_no_thread_state
  bool,   # assume_no_nested_parallelism
  bool,   # no_gpu_lib
  uint32_t   # openmp_device_version
>

Parameters: 

ParameterC++ typeDescription
debug_kinduint32_t
assume_teams_oversubscriptionbool
assume_threads_oversubscriptionbool
assume_no_thread_statebool
assume_no_nested_parallelismbool
no_gpu_libbool
openmp_device_versionuint32_t

ClauseGrainsizeTypeAttr 

GrainsizeType Clause

Syntax:

#omp.grainsizetype<
  ::mlir::omp::ClauseGrainsizeType   # value
>

Enum cases:

  • strict (Strict)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseGrainsizeTypean enum of type ClauseGrainsizeType

ClauseMemoryOrderKindAttr 

MemoryOrderKind Clause

Syntax:

#omp.memoryorderkind<
  ::mlir::omp::ClauseMemoryOrderKind   # value
>

Enum cases:

  • seq_cst (Seq_cst)
  • acq_rel (Acq_rel)
  • acquire (Acquire)
  • release (Release)
  • relaxed (Relaxed)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseMemoryOrderKindan enum of type ClauseMemoryOrderKind

ClauseNumTasksTypeAttr 

NumTasksType Clause

Syntax:

#omp.numtaskstype<
  ::mlir::omp::ClauseNumTasksType   # value
>

Enum cases:

  • strict (Strict)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseNumTasksTypean enum of type ClauseNumTasksType

ClauseOrderKindAttr 

OrderKind Clause

Syntax:

#omp.orderkind<
  ::mlir::omp::ClauseOrderKind   # value
>

Enum cases:

  • concurrent (Concurrent)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseOrderKindan enum of type ClauseOrderKind

OrderModifierAttr 

OpenMP Order Modifier

Syntax:

#omp.order_mod<
  ::mlir::omp::OrderModifier   # value
>

Enum cases:

  • reproducible (reproducible)
  • unconstrained (unconstrained)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::OrderModifieran enum of type OrderModifier

ClauseProcBindKindAttr 

ProcBindKind Clause

Syntax:

#omp.procbindkind<
  ::mlir::omp::ClauseProcBindKind   # value
>

Enum cases:

  • primary (Primary)
  • master (Master)
  • close (Close)
  • spread (Spread)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseProcBindKindan enum of type ClauseProcBindKind

ClauseScheduleKindAttr 

ScheduleKind Clause

Syntax:

#omp.schedulekind<
  ::mlir::omp::ClauseScheduleKind   # value
>

Enum cases:

  • static (Static)
  • dynamic (Dynamic)
  • guided (Guided)
  • auto (Auto)
  • runtime (Runtime)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ClauseScheduleKindan enum of type ClauseScheduleKind

ScheduleModifierAttr 

OpenMP Schedule Modifier

Syntax:

#omp.sched_mod<
  ::mlir::omp::ScheduleModifier   # value
>

Enum cases:

  • none (none)
  • monotonic (monotonic)
  • nonmonotonic (nonmonotonic)
  • simd (simd)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::ScheduleModifieran enum of type ScheduleModifier

VariableCaptureKindAttr 

variable capture kind

Syntax:

#omp.variable_capture_kind<
  ::mlir::omp::VariableCaptureKind   # value
>

Enum cases:

  • This (This)
  • ByRef (ByRef)
  • ByCopy (ByCopy)
  • VLAType (VLAType)

Parameters: 

ParameterC++ typeDescription
value::mlir::omp::VariableCaptureKindan enum of type VariableCaptureKind

VersionAttr 

Syntax:

#omp.version<
  uint32_t   # version
>

Parameters: 

ParameterC++ typeDescription
versionuint32_t

Types 

MapBoundsType 

Type for representing omp map clause bounds information

Syntax: !omp.map_bounds_ty

Enums 

ClauseBindKind 

BindKind Clause

Cases: 

SymbolValueString
Parallel0parallel
Teams1teams
Thread2thread

ClauseCancellationConstructType 

CancellationConstructType Clause

Cases: 

SymbolValueString
Parallel0parallel
Loop1loop
Sections2sections
Taskgroup3taskgroup

ClauseDepend 

depend clause

Cases: 

SymbolValueString
dependsource0dependsource
dependsink1dependsink

ClauseRequires 

requires clauses

Cases: 

SymbolValueString
none0none
reverse_offload1reverse_offload
unified_address2unified_address
unified_shared_memory4unified_shared_memory
dynamic_allocators8dynamic_allocators

ClauseTaskDepend 

depend clause in a target or task construct

Cases: 

SymbolValueString
taskdependin0taskdependin
taskdependout1taskdependout
taskdependinout2taskdependinout

DataSharingClauseType 

Type of a data-sharing clause

Cases: 

SymbolValueString
Private0private
FirstPrivate1firstprivate

DeclareTargetCaptureClause 

capture clause

Cases: 

SymbolValueString
to0to
link1link
enter2enter

DeclareTargetDeviceType 

device_type clause

Cases: 

SymbolValueString
any0any
host1host
nohost2nohost

ClauseGrainsizeType 

GrainsizeType Clause

Cases: 

SymbolValueString
Strict0strict

ClauseMemoryOrderKind 

MemoryOrderKind Clause

Cases: 

SymbolValueString
Seq_cst0seq_cst
Acq_rel1acq_rel
Acquire2acquire
Release3release
Relaxed4relaxed

ClauseNumTasksType 

NumTasksType Clause

Cases: 

SymbolValueString
Strict0strict

ClauseOrderKind 

OrderKind Clause

Cases: 

SymbolValueString
Concurrent1concurrent

OrderModifier 

OpenMP Order Modifier

Cases: 

SymbolValueString
reproducible0reproducible
unconstrained1unconstrained

ClauseProcBindKind 

ProcBindKind Clause

Cases: 

SymbolValueString
Primary0primary
Master1master
Close2close
Spread3spread

ClauseScheduleKind 

ScheduleKind Clause

Cases: 

SymbolValueString
Static0static
Dynamic1dynamic
Guided2guided
Auto3auto
Runtime4runtime

ScheduleModifier 

OpenMP Schedule Modifier

Cases: 

SymbolValueString
none0none
monotonic1monotonic
nonmonotonic2nonmonotonic
simd3simd

VariableCaptureKind 

variable capture kind

Cases: 

SymbolValueString
This0This
ByRef1ByRef
ByCopy2ByCopy
VLAType3VLAType