[Mlir-commits] [mlir] [mlir][OpenMP] inscan reduction modifier and scan op mlir support (PR #114737)

Anchu Rajendran S llvmlistbot at llvm.org
Tue Jan 7 15:04:08 PST 2025


================
@@ -1560,6 +1560,26 @@ def CancellationPointOp : OpenMP_Op<"cancellation_point", clauses = [
   let hasVerifier = 1;
 }
 
+def ScanOp : OpenMP_Op<"scan", [
----------------
anchuraj wrote:

Thank you for your suggestions @tblah, @skatrak and @kiranchandramohan. 
Looking at the standard, following is a restriction on scan directive. 
```
Intra-iteration dependences from a statement in the structured block sequence that precede a scan directive to a statement in the structured block sequence that follows a scan directive must not exist, except for dependences for the list items specified in an inclusive or exclusive clause.
```
The above restriction makes the examples like the one using `block` construct mentioned by @kiranchandramohan  invalid.
>From  the example @skatrak used, it transforms program to a way where yielding would be required. It transforms program to a structure which is not compliant with the above OpenMP restriction ( which need not be hold at the MLIR transformation stage) 

Circling back on @kiranchandramohan's question, is there a way to prevent such optimizations inside `WsloopOp` with `inscan` modifier, considering `scan` as side-effecting?  Please  let me know @skatrak  and @tblah your thoughts.


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


More information about the Mlir-commits mailing list