This is an archive of the discontinued LLVM Phabricator instance.

Exclude untied tasks from checking of task scheduling constraint (TSC)
ClosedPublic

Authored by AndreyChurbanov on Nov 3 2017, 1:05 PM.

Details

Summary

This is second attempt to exclude untied tasks from TSC, the first one was rejected because of kastors/trassen-task-dep benchmark hang.
This change works for the benchmark, because task stealing algorithm re-implemented so that the stealing of any task of the victim thread queue allowed, as opposed to only try to steal the head task.

Also added the check if the thief thread spins on a barrier - then any task allowed to be stolen.

Diff Detail

Repository
rL LLVM

Event Timeline

AndreyChurbanov created this revision.Nov 3 2017, 1:05 PM
Hahnfeld added inline comments.
runtime/src/kmp_global.cpp
318 ↗(On Diff #121527)

Does this need to be global variable? If I understand the current patch correctly, __kmp_task_untied_encountered will be set to true once the first untied task has been encountered, However, it is never reset to zero, potentially degrading performance for later parallel regions in a program that only use tied tasks, right?

Wouldn't it make sense to have this as a property of the current parallel region? (maybe in kmp_taskteam_t?) Or does this cause problems because of the current implementation of barriers where the teams may not be valid anymore for the workers that are in the fork barrier?

runtime/src/kmp_global.cpp
318 ↗(On Diff #121527)

Thanks for the comment, I will think of making the flag local for a task team. The task team is valid while threads execute tasks, it is the regular team that cannot be accessed safely by worker threads on fork barrier, so this is not a problem.

The flag indicating the presence of untied task in the region made task team local (was global initially).

Thus the presence of untied tasks in one region (part of parallel between barriers) won't affect other regions, that can potentially speed up execution making task stealing a bit faster.

The flag indicating the presence of untied task in the region made task team local (was global initially).

Thus the presence of untied tasks in one region (part of parallel between barriers) won't affect other regions, that can potentially speed up execution making task stealing a bit faster.

Thanks for doing that change! The changes look good to me, but I'll let the others do a proper review.

This revision is now accepted and ready to land.Nov 15 2017, 10:18 AM
This revision was automatically updated to reflect the committed changes.