Skip to content

Commit 9b8d66a

Browse files
ivanradanovskc7
authored andcommitted
Add omp.coexecute op
1 parent 8b1b36f commit 9b8d66a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,41 @@ def SectionsOp : OpenMP_Op<"sections", traits = [
325325
let hasRegionVerifier = 1;
326326
}
327327

328+
//===----------------------------------------------------------------------===//
329+
// Coexecute Construct
330+
//===----------------------------------------------------------------------===//
331+
332+
def CoexecuteOp : OpenMP_Op<"coexecute"> {
333+
let summary = "coexecute directive";
334+
let description = [{
335+
The coexecute construct specifies that the teams from the teams directive
336+
this is nested in shall cooperate to execute the computation in this region.
337+
There is no implicit barrier at the end as specified in the standard.
338+
339+
TODO
340+
We should probably change the defaut behaviour to have a barrier unless
341+
nowait is specified, see below snippet.
342+
343+
```
344+
!$omp target teams
345+
!$omp coexecute
346+
tmp = matmul(x, y)
347+
!$omp end coexecute
348+
a = tmp(0, 0) ! there is no implicit barrier! the matmul hasnt completed!
349+
!$omp end target teams coexecute
350+
```
351+
352+
}];
353+
354+
let arguments = (ins UnitAttr:$nowait);
355+
356+
let regions = (region AnyRegion:$region);
357+
358+
let assemblyFormat = [{
359+
oilist(`nowait` $nowait) $region attr-dict
360+
}];
361+
}
362+
328363
//===----------------------------------------------------------------------===//
329364
// 2.8.2 Single Construct
330365
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)