Skip to content

Commit d353d9d

Browse files
Add a description for openmp-task-based-target pass
1 parent 4198741 commit d353d9d

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

mlir/include/mlir/Dialect/OpenMP/Passes.td

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,37 @@ def OpenMPTaskBasedTarget : Pass<"openmp-task-based-target", "func::FuncOp"> {
1616

1717
let constructor = "mlir::createOpenMPTaskBasedTargetPass()";
1818

19-
let description = [{ First pass attempt}];
19+
let description = [{
20+
This pass transforms `omp.target`, `omp.target_enter_data`,
21+
`omp.target_update_data` and `omp.target_exit_data` whenever these operations
22+
have the `depend` clause on them.
23+
24+
These operations are transformed by enclosing them inside a new `omp.task`
25+
operation. The `depend` clause related arguments are moved to the new `omp.task`
26+
operation from the original 'target' operation.
27+
28+
Example:
29+
Input:
30+
```mlir
31+
omp.target map_entries(%map_a -> %arg0, %map_c_from -> %arg1 : memref<?xi32>, memref<?xi32>) depend(taskdependout -> %c : memref<?xi32>) {
32+
^bb0(%arg0 : memref<?xi32>, %arg1 : memref<?xi32>) :
33+
"test.foobar"() : ()->()
34+
omp.terminator
35+
}
36+
```
37+
Output:
38+
```mlir
39+
omp.task depend(taskdependout -> %c : memref<?xi32>) {
40+
omp.target map_entries(%map_a -> %arg0, %map_c_from -> %arg1 : memref<?xi32>, memref<?xi32>) {
41+
^bb0(%arg0 : memref<?xi32>, %arg1 : memref<?xi32>) :
42+
"test.foobar"() : ()->()
43+
omp.terminator
44+
}
45+
}
46+
```
47+
The intent is to make it easier to translate to LLVMIR by avoiding the
48+
creation of such tasks in the OMPIRBuilder
49+
}];
2050

2151
let dependentDialects = ["omp::OpenMPDialect"];
2252
}

0 commit comments

Comments
 (0)