[Openmp-commits] [PATCH] D23175: Fixes for hierarchical barrier

Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Aug 11 06:11:56 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL278332: Fixes for hierarchical barrier (possible hang if team size changed). (authored by achurbanov).

Changed prior to commit:
  https://reviews.llvm.org/D23175?vs=66848&id=67681#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23175

Files:
  openmp/trunk/runtime/src/kmp_runtime.c

Index: openmp/trunk/runtime/src/kmp_runtime.c
===================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c
+++ openmp/trunk/runtime/src/kmp_runtime.c
@@ -4848,6 +4848,19 @@
                 }
 #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; f<team->t.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; b<bs_last_barrier; ++b) {
+                        if (balign[b].bb.wait_flag == KMP_BARRIER_PARENT_FLAG) {
+                            balign[b].bb.wait_flag = KMP_BARRIER_SWITCH_TO_OWN_FLAG;
+                        }
+                        KMP_CHECK_UPDATE(balign[b].bb.leaf_kids, 0);
+                    }
+                }
+            }
 #endif // KMP_NESTED_HOT_TEAMS
             team->t.t_nproc =  new_nproc;
             // TODO???: team->t.t_max_active_levels = new_max_active_levels;
@@ -5331,6 +5344,7 @@
         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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23175.67681.patch
Type: text/x-patch
Size: 1438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160811/e9439583/attachment-0001.bin>


More information about the Openmp-commits mailing list