[Openmp-commits] [PATCH] D62397: [OPENMP][NVPTX]Relax flush	directive.
    Johannes Doerfert via Phabricator via Openmp-commits 
    openmp-commits at lists.llvm.org
       
    Fri May 31 17:06:28 PDT 2019
    
    
  
jdoerfert 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)
----------------
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.
================
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);
+    }
----------------
Couldn't we copy data to a new variable and check it on the host. Relying on `printf` here seems brittle.
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