[Openmp-commits] [PATCH] D90412: Fix hierarchical barrier deadlock for infinite blocktime

Nawrin Sultana via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Oct 29 11:28:34 PDT 2020


Nawrin created this revision.
Nawrin added a reviewer: jlpeyton.
Nawrin added a project: OpenMP.
Nawrin requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

This patch fixes the deadlock in hierarchical barrier for infinite blocktime by adjusting the offset value of leaf kids to match the value of leaf state.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90412

Files:
  openmp/runtime/src/kmp_barrier.cpp


Index: openmp/runtime/src/kmp_barrier.cpp
===================================================================
--- openmp/runtime/src/kmp_barrier.cpp
+++ openmp/runtime/src/kmp_barrier.cpp
@@ -1030,7 +1030,8 @@
     } else {
       // Leaf does special release on "offset" bits of parent's b_arrived flag
       thr_bar->b_arrived = team->t.t_bar[bt].b_arrived + KMP_BARRIER_STATE_BUMP;
-      kmp_flag_oncore flag(&thr_bar->parent_bar->b_arrived, thr_bar->offset);
+      kmp_flag_oncore flag(&thr_bar->parent_bar->b_arrived,
+                           thr_bar->offset + 1);
       flag.set_waiter(other_threads[thr_bar->parent_tid]);
       flag.release();
     }
@@ -1079,7 +1080,7 @@
       // Wait on my "offset" bits on parent's b_go flag
       thr_bar->wait_flag = KMP_BARRIER_PARENT_FLAG;
       kmp_flag_oncore flag(&thr_bar->parent_bar->b_go, KMP_BARRIER_STATE_BUMP,
-                           thr_bar->offset, bt,
+                           thr_bar->offset + 1, bt,
                            this_thr USE_ITT_BUILD_ARG(itt_sync_obj));
       flag.wait(this_thr, TRUE);
       if (thr_bar->wait_flag ==
@@ -1088,7 +1089,7 @@
               KMP_INIT_BARRIER_STATE); // Reset my b_go flag for next time
       } else { // Reset my bits on parent's b_go flag
         (RCAST(volatile char *,
-               &(thr_bar->parent_bar->b_go)))[thr_bar->offset] = 0;
+               &(thr_bar->parent_bar->b_go)))[thr_bar->offset + 1] = 0;
       }
     }
     thr_bar->wait_flag = KMP_BARRIER_NOT_WAITING;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90412.301698.patch
Type: text/x-patch
Size: 1513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201029/58d65947/attachment.bin>


More information about the Openmp-commits mailing list