This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][FIX] Do check the level before return team size
ClosedPublic

Authored by jdoerfert on Oct 16 2021, 12:42 PM.

Details

Summary

The team size could/should be an ICV but since we know it is either 1 or
a value we can leave it in the team state for now. However, we still
need to determine if the current level is nested before we use it.

Diff Detail

Event Timeline

jdoerfert created this revision.Oct 16 2021, 12:42 PM
jdoerfert requested review of this revision.Oct 16 2021, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2021, 12:42 PM
Herald added a subscriber: sstefan1. · View Herald Transcript
This revision is now accepted and ready to land.Oct 16 2021, 12:50 PM
protze.joachim added inline comments.
openmp/libomptarget/DeviceRTL/src/State.cpp
448–451

is state::ParallelTeamSize = 1 for level=0? Probably change to checking for ActiveLevel?

jdoerfert added inline comments.Oct 27 2021, 2:44 PM
openmp/libomptarget/DeviceRTL/src/State.cpp
448–451

Yes, level == 0 ==> ParallelTeamSize = 1. Why active level? We sequentialize any nested region, regardless if it is active or not. So only for level == 1 there is a reason to for ParallelTeamSize to be effectively not 1. That said, we do not actually modify ParallelTeamSize as it is not an ICV right now. So when we are nested the value stays as it was before, which is why we need this check. If we make it an ICV we could avoid it.