llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-mlir-openmp Author: Sergio Afonso (skatrak) <details> <summary>Changes</summary> This patch updates verifiers for `omp.ordered.region`, `omp.cancel` and `omp.cancellation_point`, which check for a parent `omp.wsloop`. After transitioning to a loop wrapper-based approach, the expected direct parent will become `omp.loop_nest` instead, so verifiers need to take this into account. This PR on its own will not pass premerge tests. All patches in the stack are needed before it can be compiled and passes tests. --- Full diff: https://github.com/llvm/llvm-project/pull/89211.diff 1 Files Affected: - (modified) mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp (+14-9) ``````````diff diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index d66186effc31d6..d014c27e1ee157 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -1977,9 +1977,10 @@ LogicalResult OrderedRegionOp::verify() { if (getSimd()) return failure(); - if (auto container = (*this)->getParentOfType<WsloopOp>()) { - if (!container.getOrderedValAttr() || - container.getOrderedValAttr().getInt() != 0) + if (auto loopOp = dyn_cast<LoopNestOp>((*this)->getParentOp())) { + auto wsloopOp = llvm::dyn_cast_if_present<WsloopOp>(loopOp->getParentOp()); + if (!wsloopOp || !wsloopOp.getOrderedValAttr() || + wsloopOp.getOrderedValAttr().getInt() != 0) return emitOpError() << "ordered region must be closely nested inside " << "a worksharing-loop region with an ordered " << "clause without parameter present"; @@ -2130,15 +2131,19 @@ LogicalResult CancelOp::verify() { << "inside a parallel region"; } if (cct == ClauseCancellationConstructType::Loop) { - if (!isa<WsloopOp>(parentOp)) { - return emitOpError() << "cancel loop must appear " - << "inside a worksharing-loop region"; + auto loopOp = dyn_cast<LoopNestOp>(parentOp); + auto wsloopOp = llvm::dyn_cast_if_present<WsloopOp>( + loopOp ? loopOp->getParentOp() : nullptr); + + if (!wsloopOp) { + return emitOpError() + << "cancel loop must appear inside a worksharing-loop region"; } - if (cast<WsloopOp>(parentOp).getNowaitAttr()) { + if (wsloopOp.getNowaitAttr()) { return emitError() << "A worksharing construct that is canceled " << "must not have a nowait clause"; } - if (cast<WsloopOp>(parentOp).getOrderedValAttr()) { + if (wsloopOp.getOrderedValAttr()) { return emitError() << "A worksharing construct that is canceled " << "must not have an ordered clause"; } @@ -2176,7 +2181,7 @@ LogicalResult CancellationPointOp::verify() { << "inside a parallel region"; } if ((cct == ClauseCancellationConstructType::Loop) && - !isa<WsloopOp>(parentOp)) { + (!isa<LoopNestOp>(parentOp) || !isa<WsloopOp>(parentOp->getParentOp()))) { return emitOpError() << "cancellation point loop must appear " << "inside a worksharing-loop region"; } `````````` </details> https://github.com/llvm/llvm-project/pull/89211 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits