[Mlir-commits] [mlir] [MLIR][omp] Add omp.workshare op (PR #101443)
Sergio Afonso
llvmlistbot at llvm.org
Wed Aug 21 08:55:45 PDT 2024
================
@@ -287,6 +287,49 @@ def SingleOp : OpenMP_Op<"single", traits = [
let hasVerifier = 1;
}
+//===----------------------------------------------------------------------===//
+// 2.8.3 Workshare Construct
+//===----------------------------------------------------------------------===//
+
+def WorkshareOp : OpenMP_Op<"workshare", traits = [
+ RecursiveMemoryEffects,
+ ], clauses = [
+ OpenMP_NowaitClause,
+ ], singleRegion = true> {
+ let summary = "workshare directive";
+ let description = [{
+ 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.
+ }] # clausesDescription;
+
+ let builders = [
+ OpBuilder<(ins CArg<"const WorkshareOperands &">:$clauses)>
+ ];
+}
+
+def WorkshareLoopWrapperOp : OpenMP_Op<"workshare_loop_wrapper", traits = [
----------------
skatrak wrote:
Nit: According to the discussion in [this RFC](https://discourse.llvm.org/t/rfc-uniformize-openmp-dialect-operation-names/77715), I think something along these lines should be preferred:
```suggestion
def WorkshareLoopWrapperOp : OpenMP_Op<"workshare.loop_wrapper", traits = [
```
https://github.com/llvm/llvm-project/pull/101443
More information about the Mlir-commits
mailing list