From 6b2aaa62f18d0f4e3d518dbf607dea0ef046ec50 Mon Sep 17 00:00:00 2001 From: Jonathan Peyton Date: Mon, 21 Nov 2016 18:42:31 +0000 Subject: [PATCH] Merging r278332: ------------------------------------------------------------------------ r278332 | achurbanov | 2016-08-11 08:04:00 -0500 (Thu, 11 Aug 2016) | 3 lines Fixes for hierarchical barrier (possible hang if team size changed). Differential Revision: http://reviews.llvm.org/D23175 ------------------------------------------------------------------------ llvm-svn: 287557 --- openmp/runtime/src/kmp_runtime.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openmp/runtime/src/kmp_runtime.c b/openmp/runtime/src/kmp_runtime.c index 180c5339c28e8..7b2ef06444a7e 100644 --- a/openmp/runtime/src/kmp_runtime.c +++ b/openmp/runtime/src/kmp_runtime.c @@ -4848,6 +4848,19 @@ __kmp_allocate_team( kmp_root_t *root, int new_nproc, int max_nproc, } #if KMP_NESTED_HOT_TEAMS } // (__kmp_hot_teams_mode == 0) + else { + // When keeping extra threads in team, switch threads to wait on own b_go flag + for (f=new_nproc; ft.t_nproc; ++f) { + KMP_DEBUG_ASSERT(team->t.t_threads[f]); + kmp_balign_t *balign = team->t.t_threads[f]->th.th_bar; + for (int b=0; bt.t_nproc = new_nproc; // TODO???: team->t.t_max_active_levels = new_max_active_levels; @@ -5331,6 +5344,7 @@ __kmp_free_thread( kmp_info_t *this_th ) if (balign[b].bb.wait_flag == KMP_BARRIER_PARENT_FLAG) balign[b].bb.wait_flag = KMP_BARRIER_SWITCH_TO_OWN_FLAG; balign[b].bb.team = NULL; + balign[b].bb.leaf_kids = 0; } this_th->th.th_task_state = 0;