[Openmp-commits] [PATCH] D40722: Add missing memory barrier for queuing locks

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Dec 8 07:07:42 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL320150: Add missing memory barrier for queuing locks (authored by Hahnfeld).

Changed prior to commit:
  https://reviews.llvm.org/D40722?vs=125128&id=126144#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40722

Files:
  openmp/trunk/runtime/src/kmp_lock.cpp
  openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c


Index: openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c
===================================================================
--- openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c
+++ openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c
@@ -13,7 +13,7 @@
 
   result = 0;
   nr_iterations = 0;
-  #pragma omp parallel
+  #pragma omp parallel num_threads(4)
   {
     int i;
     for (i = 0; i < LOOPCOUNT; i++)
Index: openmp/trunk/runtime/src/kmp_lock.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_lock.cpp
+++ openmp/trunk/runtime/src/kmp_lock.cpp
@@ -1456,6 +1456,7 @@
       }
       dequeued = FALSE;
     } else {
+      KMP_MB();
       tail = *tail_id_p;
       if (head == tail) { /* only one thread on the queue */
 #ifdef DEBUG_QUEUING_LOCKS


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40722.126144.patch
Type: text/x-patch
Size: 867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20171208/fcc16080/attachment-0001.bin>


More information about the Openmp-commits mailing list