[Mlir-commits] [mlir] [mlir][OpenMP] inscan reduction modifier and scan op mlir support (PR #114737)
Sergio Afonso
llvmlistbot at llvm.org
Tue Jan 21 04:21:52 PST 2025
================
@@ -3125,6 +3153,41 @@ void MaskedOp::build(OpBuilder &builder, OperationState &state,
MaskedOp::build(builder, state, clauses.filteredThreadId);
}
+//===----------------------------------------------------------------------===//
+// Spec 5.2: Scan construct (5.6)
+//===----------------------------------------------------------------------===//
+
+void ScanOp::build(OpBuilder &builder, OperationState &state,
+ const ScanOperands &clauses) {
+ ScanOp::build(builder, state, clauses.inclusiveVars, clauses.exclusiveVars);
+}
+
+LogicalResult ScanOp::verify() {
+ if (hasExclusiveVars() && hasInclusiveVars()) {
+ return emitError(
+ "Exactly one of EXCLUSIVE or INCLUSIVE clause is expected");
+ }
+ if (mlir::omp::WsloopOp parentWsLoopOp =
+ (*this)->getParentOfType<mlir::omp::WsloopOp>()) {
+ if (parentWsLoopOp.getReductionModAttr() &&
+ parentWsLoopOp.getReductionModAttr().getValue() ==
+ mlir::omp::ReductionModifier::inscan) {
+ return success();
+ }
+ }
+ if (mlir::omp::SimdOp parentSimdOp =
+ (*this)->getParentOfType<mlir::omp::SimdOp>()) {
+ if (parentSimdOp.getReductionModAttr() &&
+ parentSimdOp.getReductionModAttr().getValue() ==
+ mlir::omp::ReductionModifier::inscan) {
----------------
skatrak wrote:
Nit: Braces.
https://github.com/llvm/llvm-project/pull/114737
More information about the Mlir-commits
mailing list