[Openmp-commits] [PATCH] D106310: [Libomptarget] Remove volatile from NVPTX work function

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 20 05:32:54 PDT 2021


jhuber6 added a comment.

In D106310#2889970 <https://reviews.llvm.org/D106310#2889970>, @JonChesterfield wrote:

> This seems hazardous.
>
> The value is written from one warp and then read from another. It should be atomic qualified, but isn't, because cuda doesn't do that.
>
> Previously it was volatile, which happens to get treated in broadly similar fashion to atomic.
>
> So before it was a data race, but one that the compiler was unlikely to miscompile. Now it's a non-volatile data race. That is indeed more likely to be transformed.
>
> I don't think we can reasonably assume this change is safe. Making it a relaxed atomic instead would be better.

What prevents us from just doing an atomic write to it in parallel.cu:79? Might slow it down though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106310



More information about the Openmp-commits mailing list