[Openmp-commits] [PATCH] D107656: [OpenMP] Use events and taskyield in target nowait task to unblock host threads

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 6 10:17:02 PDT 2021

AndreyChurbanov added a comment.

In D107656#2931474 <https://reviews.llvm.org/D107656#2931474>, @ye-luo wrote:

> Q: for @AndreyChurbanov
> Do you know that is the the constraint exactly?

In short: newly scheduled task should be a descendant of current task if the current task is explicit and tied.

Details from specification:

Task Scheduling Constraints are as follows:

1. Scheduling of new tied tasks is constrained by the set of task regions that are currently tied to the thread and that are not suspended in a barrier region. If this set is empty, any new tied task may be scheduled. Otherwise, a new tied task may be scheduled only if it is a descendant task of every task in the set.
2. A dependent task shall not start its execution until its task dependences are fulfilled.
3. A task shall not be scheduled while any task with which it is mutually exclusive has been scheduled but has not yet completed.
4. When an explicit task is generated by a construct that contains an if clause for which the expression evaluated to false, and the previous constraints are already met, the task is executed immediately after generation of the task.

A program that relies on any other assumption about task scheduling is non-conforming.

> I need to set KMP_TASK_STEALING_CONSTRAINT to make __kmp_task_is_allowed() return true.

Haven't got this. If KMP_TASK_STEALING_CONSTRAINT=0 then __kmp_task_is_allowed() should always return true
(if there is no mutexinoutset dependency on a task).
Otherwise it can return true or false. 
But with KMP_TASK_STEALING_CONSTRAINT=0 some tests may hang because of deadlock.



More information about the Openmp-commits mailing list