[flang-commits] [flang] [flang][OpenMP] Add `hostIsSource` paramemter to `copyHostAssociateVar` (PR #123162)

KAWASHIMA Takahiro via flang-commits flang-commits at lists.llvm.org
Mon Feb 3 04:00:25 PST 2025


kawashima-fj wrote:

@ergawy Thanks for taking a look.

Actually, I'm not so familiar with OpenMP. I wrote my understaingding below but it may be incorrect.

I agree that `ido3` is `lastprivate` **for the `simd` construct** in the program.

However, `print *, ido3` is outside of the `parallel` construct. So the attribute of `ido3` **for the `parallel` construct** is important.

According to OpenMP 5.2 sec 5.1.1:

> - Loop iteration variables inside `parallel`, `teams`, or task generating constructs are private in the innermost such construct that encloses the loop.

`ido3` is used as a loop iteration variable inside `do` construct with `collapse(2)`. So `ido3` is `private` **for the `parallel` construct**.

OpenMP 6.0 sec 7.1.1 has similar sentences.

> - The loop-iteration variable in any affected loop of a loop or simd construct is lastprivate.
>
> - Loop-iteration variables inside parallel, teams, taskgraph, or task-generating constructs are private in the innermost such construct that encloses the loop.

Again, I'm not so familiar with OpenMP. I'd like to hear from someone who is familiar.


https://github.com/llvm/llvm-project/pull/123162


More information about the flang-commits mailing list