summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2016-02-11 23:07:30 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2016-02-11 23:07:30 +0000
commit134f90d59fd19d5ab34f055177acada4da3d9485 (patch)
treef1595bb937c78c1b39d911d37ee214c0e7dc7602 /openmp/runtime/src
parenta4e43c5b519222bfbc2590d753b488f1c13a4ed6 (diff)
downloadbcm5719-llvm-134f90d59fd19d5ab34f055177acada4da3d9485.tar.gz
bcm5719-llvm-134f90d59fd19d5ab34f055177acada4da3d9485.zip
Fix incorrect task_team in __kmp_give_task
When a target task finishes and it tries to access the th_task_team from the threads in the team where it was created, th_task_team can be NULL or point to a different place when that thread started a nested region that is still running. Finding the exact task_team that the threads were using is difficult as it would require to unwind the task_state_memo_stack. So a new field was added in the taskdata structure to point to the active task_team when the task was created. llvm-svn: 260615
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp.h3
-rw-r--r--openmp/runtime/src/kmp_tasking.c10
2 files changed, 9 insertions, 4 deletions
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 8ba85e80096..31bada0c41b 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -2140,6 +2140,9 @@ struct kmp_taskdata { /* aligned during dynamic
#if OMPT_SUPPORT
ompt_task_info_t ompt_task_info;
#endif
+#if OMP_41_ENABLED
+ kmp_task_team_t * td_task_team;
+#endif
#if KMP_HAVE_QUAD
_Quad td_dummy; // Align structure 16-byte size since allocated just before kmp_task_t
#else
diff --git a/openmp/runtime/src/kmp_tasking.c b/openmp/runtime/src/kmp_tasking.c
index 337c98ca28e..9aaef8b2f00 100644
--- a/openmp/runtime/src/kmp_tasking.c
+++ b/openmp/runtime/src/kmp_tasking.c
@@ -999,6 +999,7 @@ __kmp_task_alloc( ident_t *loc_ref, kmp_int32 gtid, kmp_tasking_flags_t *flags,
#endif // OMP_40_ENABLED
#if OMP_41_ENABLED
taskdata->td_flags.proxy = flags->proxy;
+ taskdata->td_task_team = thread->th.th_task_team;
#endif
taskdata->td_flags.tasktype = TASK_EXPLICIT;
@@ -2711,16 +2712,17 @@ __kmp_tasking_barrier( kmp_team_t *team, kmp_info_t *thread, int gtid )
*/
static bool __kmp_give_task ( kmp_info_t *thread, kmp_int32 tid, kmp_task_t * task )
{
- kmp_task_team_t * task_team = thread->th.th_task_team;
- kmp_thread_data_t * thread_data = & task_team -> tt.tt_threads_data[ tid ];
kmp_taskdata_t * taskdata = KMP_TASK_TO_TASKDATA(task);
- bool result = false;
+ kmp_task_team_t * task_team = taskdata->td_task_team;
KA_TRACE(20, ("__kmp_give_task: trying to give task %p to thread %d.\n", taskdata, tid ) );
- // assert tasking is enabled? what if not?
+ // If task_team is NULL something went really bad...
KMP_DEBUG_ASSERT( task_team != NULL );
+ bool result = false;
+ kmp_thread_data_t * thread_data = & task_team -> tt.tt_threads_data[ tid ];
+
if (thread_data -> td.td_deque == NULL ) {
// There's no queue in this thread, go find another one
// We're guaranteed that at least one thread has a queue
OpenPOWER on IntegriCloud