[Openmp-commits] [PATCH] Task Team Synchronization Fix

Jonathan Peyton jonathan.l.peyton at intel.com
Wed May 20 15:45:29 PDT 2015


Hi hfinkel,

    The fix syncs up the new threads to have the same task_state and
    task_team as the old threads.  The master thread is skipped,
    because it shouldn't at this point have the team's task_team value yet
    -- it should still have parent_team's task_team.  It gets pointed at
    the new team's task_team later, after __kmp_allocate_team returns, and
    the master has stored a memo of it's old task_state.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9897

Files:
  runtime/src/kmp_runtime.c

Index: runtime/src/kmp_runtime.c
===================================================================
--- runtime/src/kmp_runtime.c
+++ runtime/src/kmp_runtime.c
@@ -5059,8 +5059,13 @@
                 int old_state = team->t.t_threads[0]->th.th_task_state;
                 for (f=0;  f < team->t.t_nproc; ++f) {
                     __kmp_initialize_info( team->t.t_threads[ f ], team, f, __kmp_gtid_from_tid( f, team ) );
-                    team->t.t_threads[f]->th.th_task_state = old_state;
                 }
+		// Old threads (except for master) and new threads need task_state and task_team reinitialized.
+		// Master thread will make a memo of old task_state later, then it will update task_state and task_team
+		for( f = 1 ;  f < new_nproc  ;  f++ ) {
+		    team->t.t_threads[f]->th.th_task_state = old_state;
+		    team->t.t_threads[f]->th.th_task_team = team->t.t_task_team[team->t.t_threads[f]->th.th_task_state];
+		}
             }
 
 #ifdef KMP_DEBUG

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9897.26188.patch
Type: text/x-patch
Size: 972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20150520/506fa594/attachment.bin>


More information about the Openmp-commits mailing list