[Openmp-commits] [PATCH] D21893: Improve performance of #pragma omp single

Terry Wilmarth via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 30 07:51:48 PDT 2016


tlwilmar created this revision.
tlwilmar added reviewers: AndreyChurbanov, hbae.
tlwilmar added a subscriber: openmp-commits.
tlwilmar set the repository for this revision to rL LLVM.

Performance of single was considerably worse than plain barrier.
Adding a check to the code before the atomic compare and store helped
considerably.

Patch by Terry Wilmarth.


Repository:
  rL LLVM

http://reviews.llvm.org/D21893

Files:
  runtime/src/kmp_runtime.c

Index: runtime/src/kmp_runtime.c
===================================================================
--- runtime/src/kmp_runtime.c
+++ runtime/src/kmp_runtime.c
@@ -777,8 +777,10 @@
            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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21893.62360.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160630/0da8cdaf/attachment.bin>


More information about the Openmp-commits mailing list