[Openmp-commits] [PATCH] D62397: [OPENMP][NVPTX]Relax flush directive.
Alexey Bataev via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Jun 19 08:08:57 PDT 2019
ABataev marked 2 inline comments as done.
ABataev added inline comments.
================
Comment at: libomptarget/deviceRTLs/nvptx/test/parallel/flush.c:23
+#pragma omp flush(flag, data)
+ while (flag < 1) {
+#pragma omp flush(flag, data)
----------------
grokos wrote:
> jdoerfert wrote:
> > There is a race in this program.
> >
> > After the flush in thread 0 happened, and after the flush prior to the while happened, both thread 0 and 32 will access flag without proper synchronization.
> I thinks that's the purpose of this test: to make sure that, despite the race on `flag`, memory fencing is enforced for `data`.
Exactly, just like I said before this is slightly reworked example for flush directive from OpenMP examples.
================
Comment at: libomptarget/deviceRTLs/nvptx/test/parallel/flush.c:29
+ /* Values data will be 42, value of flag still undefined */
+ printf("data=%d.\n", data);
+ }
----------------
jdoerfert wrote:
> Couldn't we copy data to a new variable and check it on the host. Relying on `printf` here seems brittle.
Ok
Repository:
rOMP OpenMP
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62397/new/
https://reviews.llvm.org/D62397
More information about the Openmp-commits
mailing list