summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorAndrey Churbanov <Andrey.Churbanov@intel.com>2016-11-02 16:45:25 +0000
committerAndrey Churbanov <Andrey.Churbanov@intel.com>2016-11-02 16:45:25 +0000
commit753fa0468cb7844127a088806305c63c9de8991f (patch)
treecfdb452b4bb3017071bf3f371d9841906177ec20 /openmp/runtime/src
parent06ac79c2102249be1f8b5c3f230009b207723111 (diff)
downloadbcm5719-llvm-753fa0468cb7844127a088806305c63c9de8991f.tar.gz
bcm5719-llvm-753fa0468cb7844127a088806305c63c9de8991f.zip
Change task stealing to always get task from head of victim's deque.
Differential Revision: https://reviews.llvm.org/D26187 llvm-svn: 285833
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp_tasking.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/openmp/runtime/src/kmp_tasking.c b/openmp/runtime/src/kmp_tasking.c
index e0079177642..a6658ade00a 100644
--- a/openmp/runtime/src/kmp_tasking.c
+++ b/openmp/runtime/src/kmp_tasking.c
@@ -1782,18 +1782,10 @@ __kmp_steal_task( kmp_info_t *victim, kmp_int32 gtid, kmp_task_team_t *task_team
KMP_DEBUG_ASSERT( victim_td -> td.td_deque != NULL );
- if ( !is_constrained ) {
- taskdata = victim_td -> td.td_deque[ victim_td -> td.td_deque_head ];
- KMP_ASSERT(taskdata);
- // Bump head pointer and Wrap.
- victim_td -> td.td_deque_head = ( victim_td -> td.td_deque_head + 1 ) & TASK_DEQUE_MASK(victim_td->td);
- } else {
- // While we have postponed tasks let's steal from tail of the deque (smaller tasks)
- kmp_int32 tail = ( victim_td -> td.td_deque_tail - 1 ) & TASK_DEQUE_MASK(victim_td->td); // Wrap index.
- taskdata = victim_td -> td.td_deque[ tail ];
- KMP_ASSERT(taskdata);
+ taskdata = victim_td->td.td_deque[victim_td->td.td_deque_head];
+ if ( is_constrained ) {
// we need to check if the candidate obeys task scheduling constraint:
- // only child of current task can be scheduled
+ // only descendant of current task can be scheduled
kmp_taskdata_t * current = __kmp_threads[ gtid ]->th.th_current_task;
kmp_int32 level = current->td_level;
kmp_taskdata_t * parent = taskdata->td_parent;
@@ -1802,7 +1794,9 @@ __kmp_steal_task( kmp_info_t *victim, kmp_int32 gtid, kmp_task_team_t *task_team
KMP_DEBUG_ASSERT(parent != NULL);
}
if ( parent != current ) {
- // If the tail task is not a descendant of the current task then do not steal it.
+ // If the head task is not a descendant of the current task then do not
+ // steal it. No other task in victim's deque can be a descendant of the
+ // current task.
__kmp_release_bootstrap_lock( & victim_td -> td.td_deque_lock );
KA_TRACE(10, ("__kmp_steal_task(exit #2): T#%d could not steal from T#%d: task_team=%p "
"ntasks=%d head=%u tail=%u\n",
@@ -1811,8 +1805,9 @@ __kmp_steal_task( kmp_info_t *victim, kmp_int32 gtid, kmp_task_team_t *task_team
victim_td->td.td_deque_head, victim_td->td.td_deque_tail) );
return NULL;
}
- victim_td -> td.td_deque_tail = tail;
}
+ // Bump head pointer and Wrap.
+ victim_td->td.td_deque_head = (victim_td->td.td_deque_head + 1) & TASK_DEQUE_MASK(victim_td->td);
if (*thread_finished) {
// We need to un-mark this victim as a finished victim. This must be done before
// releasing the lock, or else other threads (starting with the master victim)
OpenPOWER on IntegriCloud