[flang-commits] [clang] [flang] [flang][OpenMP] Upstream `do concurrent` loop-nest detection. (PR #127595)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Fri Feb 21 00:45:19 PST 2025
ergawy wrote:
Thanks @skatrak and @bhandarkar-pranav for the approval.
@kiranchandramohan @clementval I think there is a pretty simple solution that enables us to mark multi-range loop nests. I think we can add an optional attribute to the `fir::DoLoopOp` to store the loop nest depth: `nest_depth(n)`. So for the following input:
```fortran
do concurrent (i=1:10, j=1:10)
end do
```
The MLIR would look like this:
```mlir
fir.do_loop %arg0 = %10 to %11 step %c1 unordered nest_depth(2) {
%14 = fir.convert %arg0 : (index) -> i32
fir.store %14 to %3#1 : !fir.ref<i32>
fir.do_loop %arg1 = %12 to %13 step %c1_2 unordered {
%15 = fir.convert %arg1 : (index) -> i32
fir.store %15 to %1#1 : !fir.ref<i32>
....
}
}
```
I think this is a non-distruptive change to the op that enables us to model loop nests more easily.
@clementval as for the locality specifiers, I am working on a PoC (based-on which I will write an RFC) to have a shared "Data Environemt" dialect that can be used across `do concurrent`, OpenMP, and OpenACC. I published what I have so far in https://github.com/llvm/llvm-project/pull/128148.
https://github.com/llvm/llvm-project/pull/127595
More information about the flang-commits
mailing list