[Mlir-commits] [mlir] [mlir][OpenMP] inscan reduction modifier and scan op mlir support (PR #114737)
Kiran Chandramohan
llvmlistbot at llvm.org
Wed Dec 11 03:11:00 PST 2024
================
@@ -1560,6 +1560,26 @@ def CancellationPointOp : OpenMP_Op<"cancellation_point", clauses = [
let hasVerifier = 1;
}
+def ScanOp : OpenMP_Op<"scan", [
----------------
kiranchandramohan wrote:
The 2-region option proposed by @skatrak would be easier to interface with the OpenMPIRBuilder during translation.
The 1-region option might be easier for the lowering in Flang (parse-tree to MLIR).
But just want to understand whether the no-region option will definitely lead to an issue.
> However, MLIR transformation passes are able to move operations within a region in a way that would potentially break scan.
Are these Operations moving across the scan operation? Would these be only constants or something else? Assuming the scan operation is side-effecting will operations cross it?
Generally, from a flang point of view, we typically have loading and storing from memory/variables. Since all variables are from outside the loop region these will be visible in both `pre` and `post`. This will change if we have performed load-store forwarding or mem2reg. Also, I wonder about the case where all the contents of the block are inside a block construct. In this case the alloca for `j` will not be visible in the `post` region and would need yielding.
```
program mn
do i=1,10
block
integer :: j
scan directive
= j
end block
end do
end program
```
https://github.com/llvm/llvm-project/pull/114737
More information about the Mlir-commits
mailing list