[NFC][Offload] Move variables to where they are used (#99956)

This commit is contained in:
Shilei Tian 2024-07-22 19:52:16 -04:00 committed by GitHub
parent 03936534b5
commit 41f6599ae1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -166,9 +166,6 @@ __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr,
// From this point forward we know that there is no thread state used.
ASSERT(state::HasThreadState == false, nullptr);
uint32_t NumThreads = determineNumberOfThreads(num_threads);
uint32_t MaxTeamThreads = mapping::getMaxTeamThreads();
uint32_t PTeamSize = NumThreads == MaxTeamThreads ? 0 : NumThreads;
if (mapping::isSPMDMode()) {
// This was moved to its own routine so it could be called directly
// in certain situations to avoid resource consumption of unused
@ -178,6 +175,10 @@ __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr,
return;
}
uint32_t NumThreads = determineNumberOfThreads(num_threads);
uint32_t MaxTeamThreads = mapping::getMaxTeamThreads();
uint32_t PTeamSize = NumThreads == MaxTeamThreads ? 0 : NumThreads;
// We do *not* create a new data environment because all threads in the team
// that are active are now running this parallel region. They share the
// TeamState, which has an increase level-var and potentially active-level