[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
Wed Nov 2 09:51:47 PDT 2016

AndreyChurbanov added a comment.

Basically you are correct, but I'll try to re-phrase or detail your statement(s):

> until all new local tasks are finished.

I'd say until its queue is empty.  Its tasks can be stolen (not finished), or can wait for dependencies.

> all tasks in its local queue will be descendants of `B`'s current task when `B` does as `taskwait`, right?

Maybe, if `B` hasn't yet got anything to execute. Or, more likely, they will be descendants of one of ancestors of `B`'s current task, if `B` got some task for execution after generating the task stolen by `A`. E.g.

  #pragma omp task { // task T1 executed by `B`
    #pragma omp task // task T11 stolen by `A`
      {/* more tasks T11* generated */}
    #pragma omp task // task T12 may or may not be stolen
      {/* more tasks T12* */}
    #pragma omp taskwait

Tasks in `A`'s queue - T11* - will be descendants of T1 that can be current task of `B`, if `B` has not yet started to execute task T12. Then `B` may change its current task by executing T12 or later its descendants. And if both T11 and T12 were stolen, then `B` can steal some of T11* or T12* tasks, as they are all descendants of its current task T1.



More information about the Openmp-commits mailing list