[libc-commits] [libc] [mlir][OpenMP] Added `omp.structured_region` operation (PR #68825)
Kiran Chandramohan via libc-commits
libc-commits at lists.llvm.org
Thu Oct 12 04:53:57 PDT 2023
================
@@ -1987,4 +1987,40 @@ def ClauseRequiresAttr :
EnumAttr<OpenMP_Dialect, ClauseRequires, "clause_requires"> {
}
+
+def StructuredRegionOp : OpenMP_Op<"structured_region"> {
+ let summary = "Encapsulates a region in an OpenMP construct.";
+ let description = [{
+ Encapsulates a region surrounded by an OpenMP Construct. The intended use
+ of this operation is that within an OpenMP operation's region, there would
+ be a single `omp.structured_region` operation and a terminator operation as
+ shown below.
+
+ ```
+ // Example with `omp.sections`
+ omp.sections {
+ %x = omp.structured_region {
+ %t = call @foo : () -> (i32)
+ omp.yield(%t : i32)
+ }
+ omp.terminator
+ }
+ ```
+
+ This operation is especially more useful in operations that use `omp.yield`
+ as a terminator. For example, in the proposed canonical loop operation,
+ this operation would help fix the arguments of the yield operation and it
+ is not affected by branches in the region assosciated with the canonical
+ loop. In cases where the yielded value has to be a compile time constant,
+ this provides a mechanism to avoid complex static analysis for the constant
+ value.
----------------
kiranchandramohan wrote:
You can skip the section for now. Maybe just say that this is a useful operation to model OpenMP structured regions, where there can be branches inside the OpenMP region, but no branches outside. If we proceed with using this for Canonical Loop then we can update here.
https://github.com/llvm/llvm-project/pull/68825
More information about the libc-commits
mailing list