[Openmp-commits] [PATCH] D104418: [PoC][WIP][OpenMP][Offloading] Fixed data race in libomptarget caused by async data movement

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 17 18:43:42 PDT 2021


tianshilei1992 added a comment.

In D104418#2825536 <https://reviews.llvm.org/D104418#2825536>, @protze.joachim wrote:

> In D104418#2825481 <https://reviews.llvm.org/D104418#2825481>, @tianshilei1992 wrote:
>
>> Correct, but in the body of the task, `BlockA[0]` and `BlockB[0]` are only read. It's valid to mark them as `in` only.
>
> What I mean is the write to the corresponding variable implied by the map. 
> Do you agree that the following would be invalid and needs inout for target enter data?
>
>   #pragma omp target enter data nowait map(to: BlockA[:BS * BS]) depend(in: BlockA[0])
>   #pragma omp target nowait depend(in: BlockA[0])
>   {}

That is actually a very interesting question. Theoretically, the dependency setting here is not wrong, but it indeed doesn't work. But write/read variable cannot be implied by the map. We can definitely write to a variable in target region but don't transfer it back (`map(to)`), and we can also only read the variable and transfer it back (`map(tofrom)`). They are both valid.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104418/new/

https://reviews.llvm.org/D104418



More information about the Openmp-commits mailing list