[Openmp-commits] [PATCH] D26187: Change task stealing to always get task from head of victim's deque.

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Tue Nov 1 07:01:14 PDT 2016


AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: jlpeyton, jcownie, tlwilmar.
AndreyChurbanov added a subscriber: openmp-commits.
AndreyChurbanov set the repository for this revision to rL LLVM.

Stealing bigger tasks is preferable strategy in theory.  Testing showed some improvements in such tasking tests as kdtree, floorplan, fibonacci.
No performance regressions detected.


Repository:
  rL LLVM

https://reviews.llvm.org/D26187

Files:
  runtime/src/kmp_tasking.c


Index: runtime/src/kmp_tasking.c
===================================================================
--- runtime/src/kmp_tasking.c
+++ runtime/src/kmp_tasking.c
@@ -1782,18 +1782,10 @@
 
     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;
@@ -1811,8 +1803,9 @@
                           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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26187.76549.patch
Type: text/x-patch
Size: 1878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20161101/b6634f58/attachment.bin>


More information about the Openmp-commits mailing list