[Openmp-commits] [openmp] r320150 - Add missing memory barrier for queuing locks
Jonas Hahnfeld via Openmp-commits
openmp-commits at lists.llvm.org
Fri Dec 8 07:07:03 PST 2017
Author: hahnfeld
Date: Fri Dec 8 07:07:02 2017
New Revision: 320150
URL: http://llvm.org/viewvc/llvm-project?rev=320150&view=rev
Log:
Add missing memory barrier for queuing locks
Otherwise I see hangs in the omp_single_copyprivate test when
compiling in release mode. With the debug assertions, I get a
failure `head > 0 && tail > 0`.
Differential Revision: https://reviews.llvm.org/D40722
Modified:
openmp/trunk/runtime/src/kmp_lock.cpp
openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c
Modified: openmp/trunk/runtime/src/kmp_lock.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_lock.cpp?rev=320150&r1=320149&r2=320150&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_lock.cpp (original)
+++ openmp/trunk/runtime/src/kmp_lock.cpp Fri Dec 8 07:07:02 2017
@@ -1456,6 +1456,7 @@ int __kmp_release_queuing_lock(kmp_queui
}
dequeued = FALSE;
} else {
+ KMP_MB();
tail = *tail_id_p;
if (head == tail) { /* only one thread on the queue */
#ifdef DEBUG_QUEUING_LOCKS
Modified: openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c?rev=320150&r1=320149&r2=320150&view=diff
==============================================================================
--- openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c (original)
+++ openmp/trunk/runtime/test/worksharing/single/omp_single_copyprivate.c Fri Dec 8 07:07:02 2017
@@ -13,7 +13,7 @@ int test_omp_single_copyprivate()
result = 0;
nr_iterations = 0;
- #pragma omp parallel
+ #pragma omp parallel num_threads(4)
{
int i;
for (i = 0; i < LOOPCOUNT; i++)
More information about the Openmp-commits
mailing list