[flang-commits] [flang] [flang][OpenMP] Add `hostIsSource` paramemter to `copyHostAssociateVar` (PR #123162)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Mon Feb 3 00:47:20 PST 2025
ergawy wrote:
This seems to have uncovered an already existing bug in handling `lastprivate` (before the PR). However, before discussing the bug, I wanted to verify the expected result of `ido3`.
According to the spec (ver 5.2, sec 5.1.1):
```
Certain variables and objects have predetermined data-sharing attributes for the construct in which
they are referenced. The first matching rule from the following list of predetermined data-sharing
attribute rules applies for variables and objects that are referenced in a construct.
....
• The loop iteration variable in the associated loop of a simd construct with just one associated
loop is linear with a linear-step that is the increment of the associated loop.
• The loop iteration variables in the associated loops of a simd construct with multiple associated
loops are lastprivate.
• The loop iteration variable in any associated loop of a loop construct is lastprivate.
• The loop iteration variable in any associated loop of a loop-associated construct is otherwise
private.
```
According to the above (2nd bullet point), if we have a `simd` construction with `collapse(3)` as in the example above, all of `ido1`, `ido2`, and `ido3` are `lastprivate` (which is what flang does). Therefore, their values **after** executing the `parallel` region should all be `11`.
@kawashima-fj is my understanding correct or did I miss something?
https://github.com/llvm/llvm-project/pull/123162
More information about the flang-commits
mailing list