This is an archive of the discontinued LLVM Phabricator instance.

[Clang][OpenMP] Fixed an issue that `target team` is emitted incorrectly
AbandonedPublic

Authored by tianshilei1992 on Feb 11 2021, 9:08 AM.

Details

Summary

This patch is trying to fix the bug 47039 (https://bugs.llvm.org/show_bug.cgi?id=47039).
The root cause is, in clang, if NumTeams is not nullptr, it will emit call
to target teams, even if the value of NumTeams is 0. This is wrong, but at
least the team number is 0, so if the runtime can handle this correct, it should
still be fine. However, in the runtime, we only check the boolean variable
IsTeamConstruct, and don't check the team number. The last straw is, in CUDA
plugin, if the team number is 0, and the loop count is also 0, then it will set
the team number to a default value, which is 128 now.

In this patch, instead of emitting TeamNum of value 0, we emit nullptr
instead, which is spec conformant at least, aside from the discussion on the
weekly meeting that no team can also mean one team with one thread.

Failed tests will be fixed accordingly.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Feb 11 2021, 9:08 AM
tianshilei1992 requested review of this revision.Feb 11 2021, 9:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2021, 9:08 AM
tianshilei1992 abandoned this revision.Feb 23 2021, 1:38 PM

This patch is abandoned and will propose a new patch to unify interface of target and target teams.