[Openmp-commits] [openmp] r274369 - Improve performance of #pragma omp single
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Fri Jul 1 10:37:50 PDT 2016
Author: jlpeyton
Date: Fri Jul 1 12:37:49 2016
New Revision: 274369
URL: http://llvm.org/viewvc/llvm-project?rev=274369&view=rev
Log:
Improve performance of #pragma omp single
EPCC Performance of single is considerably worse than plain barrier.
Adding a read-only check to the code before the atomic compare-and-store
helps considerably.
Patch by Terry Wilmarth.
Differential Revision: http://reviews.llvm.org/D21893
Modified:
openmp/trunk/runtime/src/kmp_runtime.c
Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=274369&r1=274368&r2=274369&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Fri Jul 1 12:37:49 2016
@@ -777,8 +777,10 @@ __kmp_enter_single( int gtid, ident_t *i
single block
*/
/* TODO: Should this be acquire or release? */
- status = KMP_COMPARE_AND_STORE_ACQ32(&team->t.t_construct, old_this,
- th->th.th_local.this_construct);
+ if (team->t.t_construct == old_this) {
+ status = KMP_COMPARE_AND_STORE_ACQ32(&team->t.t_construct, old_this,
+ th->th.th_local.this_construct);
+ }
#if USE_ITT_BUILD
if ( __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 && KMP_MASTER_GTID(gtid) &&
#if OMP_40_ENABLED
More information about the Openmp-commits
mailing list