[Openmp-commits] [PATCH] D111369: [OpenMP][FIX] Data race in the SPMD execution of the new runtime
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Thu Oct 7 17:10:10 PDT 2021
jdoerfert created this revision.
jdoerfert added reviewers: jhuber6, ye-luo, tianshilei1992.
Herald added subscribers: guansong, bollu, yaxunl.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.
We need to synchronize the threads *before* we destroy the RAII objects
that hold the old values and not after to avoid threads executing the
parallel region but seeing an inconsistent state.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111369
Files:
openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
Index: openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
+++ openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
@@ -111,9 +111,10 @@
if (TId < NumThreads)
invokeMicrotask(TId, 0, fn, args, nargs);
+
+ // Synchronize all threads at the end of a parallel region.
+ synchronize::threadsAligned();
}
- // Synchronize all threads at the end of a parallel region.
- synchronize::threadsAligned();
ASSERT(state::ParallelTeamSize == 1u);
ASSERT(icv::ActiveLevel == 0u);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111369.378048.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211008/d4bf0d68/attachment.bin>
More information about the Openmp-commits
mailing list