This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix inconsistent task state if hot team is not used
ClosedPublic

Authored by tianshilei1992 on Jan 17 2023, 4:53 PM.

Details

Summary

This patch fixes the inconsistent task state when hot team is not used.
When the primary thread executes __kmp_join_call, it calls __kmp_free_team,
where worker threads will get destroyed if not using hot team. The destroy of
worker threads also reset their task state. However, the primary thread's is not
reset. When the next parallel region is encountered, in __kmp_task_team_sync,
the task state of thread will be flipped. Since the state of primary thread is not
reset, it is still 1, but all the worker threads will be 0, this leads to the
inconsistent task state, causing those threads are using completely different
task team.

Fix #59190.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Jan 17 2023, 4:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 4:53 PM
tianshilei1992 requested review of this revision.Jan 17 2023, 4:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 4:53 PM
tlwilmar accepted this revision.Jan 18 2023, 2:21 PM
tlwilmar added a subscriber: tlwilmar.

LGTM

This revision is now accepted and ready to land.Jan 18 2023, 2:21 PM