This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix for smaller team sizes inside teams construct
ClosedPublic

Authored by tlwilmar on Dec 13 2022, 11:26 AM.

Details

Summary

When a team nested inside a teams construct is allocated, it is allocated to a size specified by the teams thread_limit. In the case where any mechanism that might not grant the full thread_limit is in use, we may get a smaller team. This possibility was not reflected in the code when using the th_teams_size.nth value stored on the master thread for the team. This value was never updated even when t_nproc on the team itself was different. I added a line to update it shortly before the team is forked.

Added a simple teams test that uses KMP_DYNAMIC_MODE=random to mimic allocating teams with sizes <= thread_limit. Eventually, this will segfault without the fix in this commit.

Diff Detail

Event Timeline

tlwilmar created this revision.Dec 13 2022, 11:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 13 2022, 11:26 AM
tlwilmar requested review of this revision.Dec 13 2022, 11:26 AM
This revision is now accepted and ready to land.Jan 10 2023, 7:58 AM