[Openmp-commits] [PATCH] D55773: [OpenMP][libomptarget] Use shared memory variable for tracking parallel level

Alexey Bataev via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 8 12:33:44 PST 2019


ABataev added inline comments.


================
Comment at: libomptarget/deviceRTLs/nvptx/src/parallel.cu:343
+      parallelLevel++;
+    __syncthreads();
+
----------------
1. At first, you need to synchronize the threads, and only after that, you can increment the counter.
2. Use `__SYNCTHREADS()` instead of the `__syncthreads()`.
3. Use preincrement.


================
Comment at: libomptarget/deviceRTLs/nvptx/src/parallel.cu:383
             "Expected SPMD mode with uninitialized runtime.");
-    omptarget_nvptx_simpleThreadPrivateContext->DecParLevel();
+    if (GetThreadIdInBlock() == 0)
+      parallelLevel--;
----------------
1. Predecrement.
2. Synchronize at first, then decerement.
3. Use `__SYNCTHREADS()`


Repository:
  rOMP OpenMP

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

https://reviews.llvm.org/D55773





More information about the Openmp-commits mailing list