[Openmp-commits] [openmp] r252486 - Fixes and improvements to tasking in barriers

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Mon Nov 9 08:28:32 PST 2015


Author: jlpeyton
Date: Mon Nov  9 10:28:32 2015
New Revision: 252486

URL: http://llvm.org/viewvc/llvm-project?rev=252486&view=rev
Log:
Fixes and improvements to tasking in barriers

1) When the number of threads in a team increases, new threads need to have all
   their barrier struct fields initialized. We were missing the parent_bar and
   team fields.
2) For non-forkjoin barriers, we now do the __kmp_task_team_setup before the
   gather. The setup now sets up the task_team that all the threads will switch
   to after the barrier, but it needs to be done before other threads do the
   switch.
3) Remove an unneeded assignment of tt_found_tasks in task team free function.

Differential Revision: http://reviews.llvm.org/D14456

Modified:
    openmp/trunk/runtime/src/kmp_barrier.cpp
    openmp/trunk/runtime/src/kmp_tasking.c

Modified: openmp/trunk/runtime/src/kmp_barrier.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_barrier.cpp?rev=252486&r1=252485&r2=252486&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_barrier.cpp (original)
+++ openmp/trunk/runtime/src/kmp_barrier.cpp Mon Nov  9 10:28:32 2015
@@ -706,6 +706,8 @@ __kmp_init_hierarchical_barrier_thread(e
         thr_bar->offset = 7-(tid-thr_bar->parent_tid-1);
         thr_bar->old_tid = tid;
         thr_bar->wait_flag = KMP_BARRIER_NOT_WAITING;
+        thr_bar->team = team;
+        thr_bar->parent_bar = &team->t.t_threads[thr_bar->parent_tid]->th.th_bar[bt].bb;
     }
     if (uninitialized || team_changed || tid_changed) {
         thr_bar->team = team;
@@ -1122,6 +1124,10 @@ __kmp_barrier(enum barrier_type bt, int
             //KMP_DEBUG_ASSERT( is_split == TRUE );  // #C69956
             this_thr->th.th_local.reduce_data = reduce_data;
         }
+
+        if (KMP_MASTER_TID(tid) && __kmp_tasking_mode != tskm_immediate_exec)
+            __kmp_task_team_setup(this_thr, team, 0); // use 0 to only setup the current team if nthreads > 1
+
         switch (__kmp_barrier_gather_pattern[bt]) {
         case bp_hyper_bar: {
             KMP_ASSERT(__kmp_barrier_gather_branch_bits[bt]); // don't set branch bits to 0; use linear
@@ -1153,7 +1159,6 @@ __kmp_barrier(enum barrier_type bt, int
             if (__kmp_tasking_mode != tskm_immediate_exec) {
                 __kmp_task_team_wait(this_thr, team
                                      USE_ITT_BUILD_ARG(itt_sync_obj) );
-                __kmp_task_team_setup(this_thr, team, 0); // use 0 to only setup the current team if nthreads > 1
             }
 #if USE_DEBUGGER
             // Let the debugger know: All threads are arrived and starting leaving the barrier.

Modified: openmp/trunk/runtime/src/kmp_tasking.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_tasking.c?rev=252486&r1=252485&r2=252486&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_tasking.c (original)
+++ openmp/trunk/runtime/src/kmp_tasking.c Mon Nov  9 10:28:32 2015
@@ -2403,7 +2403,6 @@ __kmp_free_task_team( kmp_info_t *thread
 
     KMP_DEBUG_ASSERT( task_team -> tt.tt_next == NULL );
     task_team -> tt.tt_next = __kmp_free_task_teams;
-    TCW_4(task_team -> tt.tt_found_tasks, FALSE);
     TCW_PTR(__kmp_free_task_teams, task_team);
 
     __kmp_release_bootstrap_lock( & __kmp_task_team_lock );




More information about the Openmp-commits mailing list