[Openmp-commits] [openmp] 4c58e5a - [OpenMP] Fix for distributed barrier.

Terry Wilmarth via Openmp-commits openmp-commits at lists.llvm.org
Fri Jan 20 11:54:38 PST 2023


Author: Terry Wilmarth
Date: 2023-01-20T13:54:25-06:00
New Revision: 4c58e5a28f36e214144c4c76754cca666093adf3

URL: https://github.com/llvm/llvm-project/commit/4c58e5a28f36e214144c4c76754cca666093adf3
DIFF: https://github.com/llvm/llvm-project/commit/4c58e5a28f36e214144c4c76754cca666093adf3.diff

LOG: [OpenMP] Fix for distributed barrier.

Distributed barrier was found to cause hangs in some test cases. Found
that a section updating the barrier size was improperly shifted to a
different code section during patching.  Restored to original
location, all tests run to completion.

Differential Revision: https://reviews.llvm.org/D141618

Added: 
    

Modified: 
    openmp/runtime/src/kmp_runtime.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp
index be0f15fff4355..58b5542b9da4e 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -1011,6 +1011,12 @@ static void __kmp_fork_team_threads(kmp_root_t *root, kmp_team_t *team,
       __kmp_partition_places(team);
     }
 #endif
+
+    if (team->t.t_nproc > 1 &&
+        __kmp_barrier_gather_pattern[bs_forkjoin_barrier] == bp_dist_bar) {
+      team->t.b->update_num_threads(team->t.t_nproc);
+      __kmp_add_threads_to_team(team, team->t.t_nproc);
+    }
   }
 
   if (__kmp_display_affinity && team->t.t_display_affinity != 1) {
@@ -2479,12 +2485,6 @@ void __kmp_join_call(ident_t *loc, int gtid
       parent_team->t.t_stack_id = NULL;
     }
 #endif
-
-    if (team->t.t_nproc > 1 &&
-        __kmp_barrier_gather_pattern[bs_forkjoin_barrier] == bp_dist_bar) {
-      team->t.b->update_num_threads(team->t.t_nproc);
-      __kmp_add_threads_to_team(team, team->t.t_nproc);
-    }
   }
 
   KMP_MB();


        


More information about the Openmp-commits mailing list