[flang-commits] [clang] [flang] [flang][OpenMP] Upstream `do concurrent` loop-nest detection. (PR #127595)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Thu Feb 20 08:06:52 PST 2025
clementval wrote:
> @clementval @jeanPerier can you please take a look at the PR and @kiranchandramohan's comment above? 🙏
Yes, I think we should add a proper operations to represent the do concurrent. It would also allow use to carry the locality mapping into the IR representation and apply different semantic based on the target.
Without a proper representation, how do you differentiate a do concurrent loop nest to an array notation like:
```
subroutine sub1(a)
integer :: a(10,10,10)
a = 1
end subroutine
```
```
func.func @_QPsub1(%arg0: !fir.ref<!fir.array<10x10x10xi32>> {fir.bindc_name = "a"}) {
%c1 = arith.constant 1 : index
%c1_i32 = arith.constant 1 : i32
%c10 = arith.constant 10 : index
%0 = fir.dummy_scope : !fir.dscope
%1 = fir.shape %c10, %c10, %c10 : (index, index, index) -> !fir.shape<3>
%2 = fir.declare %arg0(%1) dummy_scope %0 {uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.array<10x10x10xi32>>, !fir.shape<3>, !fir.dscope) -> !fir.ref<!fir.array<10x10x10xi32>>
fir.do_loop %arg1 = %c1 to %c10 step %c1 unordered {
fir.do_loop %arg2 = %c1 to %c10 step %c1 unordered {
fir.do_loop %arg3 = %c1 to %c10 step %c1 unordered {
%3 = fir.array_coor %2(%1) %arg3, %arg2, %arg1 : (!fir.ref<!fir.array<10x10x10xi32>>, !fir.shape<3>, index, index, index) -> !fir.ref<i32>
fir.store %c1_i32 to %3 : !fir.ref<i32>
}
}
}
return
}
```
https://github.com/llvm/llvm-project/pull/127595
More information about the flang-commits
mailing list