[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 =
----------------
skatrak wrote:

Nit: We're already in the `mlir::omp` namespace (and there's a `using mlir::omp` at the top of the file). There are a few more instances in this function.
```suggestion
  if (WsloopOp parentWsLoopOp =
```

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


More information about the Mlir-commits mailing list