MLIR

Multi-Level IR Compiler Framework

'omp' Dialect

Operation definition 

omp.barrier (::mlir::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.flush (::mlir::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
varListany type

omp.master (::mlir::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.parallel (::mlir::omp::ParallelOp) 

parallel construct

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

The optional $if_expr_var 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 optional $num_threads_var parameter specifies the number of threads which should be used to execute the parallel region.

The optional $default_val attribute specifies the default data sharing attribute of values used in the parallel region that are not passed explicitly as parameters to the operation.

The $private_vars, $firstprivate_vars, $shared_vars and $copyin_vars parameters are a variadic list of values that specify the data sharing attribute of those values.

The $allocators_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 $proc_bind_val attribute controls the thread affinity for the execution of the parallel region.

Attributes: 

AttributeMLIR TypeDescription
default_val::mlir::StringAttrdefault clause
proc_bind_val::mlir::StringAttrProcBindKind Clause

Operands: 

OperandDescription
if_expr_varany type
num_threads_varany type
private_varsany type
firstprivate_varsany type
shared_varsany type
copyin_varsany type
allocate_varsany type
allocators_varsany type

omp.taskwait (::mlir::omp::TaskwaitOp) 

taskwait construct

Syntax:

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

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

omp.taskyield (::mlir::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.terminator (::mlir::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.

omp.wsloop (::mlir::omp::WsLoopOp) 

workshare loop construct

The workshare 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 contain any number of blocks. The region is terminated by “omp.yield” instruction without operands.

  omp.wsloop (%i1, %i2) = (%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 = addf %a, %b : f32
    store %sum, %arrC[%i1, %i2] : memref<?x?xf32>
    omp.yield
  }

private_vars, firstprivate_vars, lastprivate_vars and linear_vars arguments are variadic list of operands that specify the data sharing attributes of the list of 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 schedule_val attribute specifies the loop schedule for this loop, determining how the loop is distributed across the parallel threads. The optional schedule_chunk_var associated with this determines further controls this distribution.

The optional collapse_val attribute specifies the number of loops which are collapsed to form the worksharing loop.

The nowait attribute, when present, signifies that there should be no implicit barrier at the end of the loop.

The optional ordered_val attribute specifies how many loops are associated with the do loop construct.

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

Attributes: 

AttributeMLIR TypeDescription
schedule_val::mlir::StringAttrScheduleKind Clause
collapse_val::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 0
nowait::mlir::UnitAttrunit attribute
ordered_val::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 0
order_val::mlir::StringAttrOrderKind Clause

Operands: 

OperandDescription
lowerBoundinteger or index or LLVM integer type
upperBoundinteger or index or LLVM integer type
stepinteger or index or LLVM integer type
private_varsany type
firstprivate_varsany type
lastprivate_varsany type
linear_varsany type
linear_step_varsany type
schedule_chunk_varany type

omp.yield (::mlir::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. If “omp.yield” has any operands, the operands must match the parent operation’s results.

Operands: 

OperandDescription
resultsany type