[Openmp-commits] [PATCH] D76780: [OpenMP] Added memory barrier to solve data race

Bryan Chan via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Mar 27 13:44:03 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG236ac68fa5b1: [OpenMP] Add memory barrier to solve data race (authored by hkao13, committed by bryanpkc).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76780

Files:
  openmp/runtime/src/kmp_lock.cpp


Index: openmp/runtime/src/kmp_lock.cpp
===================================================================
--- openmp/runtime/src/kmp_lock.cpp
+++ openmp/runtime/src/kmp_lock.cpp
@@ -1239,6 +1239,9 @@
       KMP_MB();
       // ToDo: Use __kmp_wait_sleep or similar when blocktime != inf
       KMP_WAIT(spin_here_p, FALSE, KMP_EQ, lck);
+      // Synchronize writes to both runtime thread structures
+      // and writes in user code.
+      KMP_MB();
 
 #ifdef DEBUG_QUEUING_LOCKS
       TRACE_LOCK(gtid + 1, "acq spin");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76780.253211.patch
Type: text/x-patch
Size: 524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200327/58b94eec/attachment.bin>


More information about the Openmp-commits mailing list