This is an archive of the discontinued LLVM Phabricator instance.

Fixes for hierarchical barrier
ClosedPublic

Authored by tlwilmar on Aug 4 2016, 1:14 PM.

Details

Summary

The problem was a hang when reducing a hot team's size and then increasing it again when KMP_HOT_TEAMS_MODE=1.
Threads that were removed but kept in the team for later re-use, and then added back later, were not properly set to wait on their own b_go flag. This was properly handled for the case when threads are returned to the pool, but not when kept in the team. However, this did not completely fix the hang.

The second problem was that a thread that was made active in the team again still thought it knew about its related leaf threads in the hierarchy, and tried to release them by setting it's own flag, as opposed to the leaves' flags. The leaves, however, were also recently made active again, and were thus waiting on their own b_go flags. The fix was easy: simply reset the known leaves to zero, via the "leaf_kids" field whenever threads in a team go inactive. The same problem would have existed for threads picked up from the pool, so this fix was made there as well.

Diff Detail

Repository
rL LLVM

Event Timeline

tlwilmar updated this revision to Diff 66848.Aug 4 2016, 1:14 PM
tlwilmar retitled this revision from to Fixes for hierarchical barrier.
tlwilmar updated this object.
tlwilmar added a reviewer: AndreyChurbanov.
tlwilmar set the repository for this revision to rL LLVM.
tlwilmar added a subscriber: openmp-commits.
AndreyChurbanov accepted this revision.Aug 5 2016, 8:58 AM
AndreyChurbanov edited edge metadata.

LGTM

This revision is now accepted and ready to land.Aug 5 2016, 8:58 AM
This revision was automatically updated to reflect the committed changes.