[llvm-branch-commits] [flang] [mlir] [OpenMP][MLIR] Set omp.composite attr for composite loop wrappers and add verifier checks (PR #102341)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 8 03:03:26 PDT 2024


================
@@ -1749,10 +1755,18 @@ LogicalResult WsloopOp::verify() {
     return emitOpError() << "must be a loop wrapper";
 
   if (LoopWrapperInterface nested = getNestedWrapper()) {
+    if (!llvm::cast<ComposableOpInterface>(getOperation()).isComposite())
+      return emitError()
+             << "'omp.composite' attribute missing from composite wrapper";
+
     // Check for the allowed leaf constructs that may appear in a composite
     // construct directly after DO/FOR.
     if (!isa<SimdOp>(nested))
       return emitError() << "only supported nested wrapper is 'omp.simd'";
+
+  } else if (llvm::cast<ComposableOpInterface>(getOperation()).isComposite()) {
----------------
skatrak wrote:

I think this check doesn't cover all cases. For example, `distribute parallel do` would result in `omp.wsloop` being the last wrapper representing the composite construct. The check in this `else` should be:
- If `isComposite()` and the parent op is not a loop wrapper: 'omp.composite' attribute present in non-composite wrapper.
- If `!isComposite()` and the parent op is a loop wrapper: 'omp.composite' attribute missing from composite wrapper.

https://github.com/llvm/llvm-project/pull/102341


More information about the llvm-branch-commits mailing list