[flang-commits] [flang] [flang][MLIR][OpenMP] Extend delayed privatization for scalar allocatables (PR #84740)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Tue Mar 12 01:36:54 PDT 2024
ergawy wrote:
> Would pointers come in a separate patch?
@kiranchandramohan, I just tried delayed privatization with pointers and there is a difference between the copy logic in eager privatization vs. the delayed case:
Eager privatization:
```
%6 = fir.load %3#0 : !fir.ref<!fir.box<!fir.ptr<i32>>>
fir.store %6 to %5#0 : !fir.ref<!fir.box<!fir.ptr<i32>>>
```
Delayed privatization:
```
copy {
^bb0(%arg0: !fir.ref<!fir.box<!fir.ptr<i32>>>, %arg1: !fir.ref<!fir.box<!fir.ptr<i32>>>):
%0 = fir.load %arg0 : !fir.ref<!fir.box<!fir.ptr<i32>>>
%1 = fir.box_addr %0 : (!fir.box<!fir.ptr<i32>>) -> !fir.ptr<i32>
%2 = fir.load %1 : !fir.ptr<i32>
hlfir.assign %2 to %arg1 temporary_lhs : i32, !fir.ref<!fir.box<!fir.ptr<i32>>>
omp.yield(%arg1 : !fir.ref<!fir.box<!fir.ptr<i32>>>)
}
```
So this will need proper handling which I think makes sense to defer to a follow-up PR.
As far as I understand, `firstprivate` should initialize the clone to the same target of the original value which does not happen now with delayed privatization (it changes the value of the target).
https://github.com/llvm/llvm-project/pull/84740
More information about the flang-commits
mailing list