Skip to content

Commit 41f6599

Browse files
authored
[NFC][Offload] Move variables to where they are used (#99956)
1 parent 0393653 commit 41f6599

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

offload/DeviceRTL/src/Parallelism.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr,
166166
// From this point forward we know that there is no thread state used.
167167
ASSERT(state::HasThreadState == false, nullptr);
168168

169-
uint32_t NumThreads = determineNumberOfThreads(num_threads);
170-
uint32_t MaxTeamThreads = mapping::getMaxTeamThreads();
171-
uint32_t PTeamSize = NumThreads == MaxTeamThreads ? 0 : NumThreads;
172169
if (mapping::isSPMDMode()) {
173170
// This was moved to its own routine so it could be called directly
174171
// in certain situations to avoid resource consumption of unused
@@ -178,6 +175,10 @@ __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr,
178175
return;
179176
}
180177

178+
uint32_t NumThreads = determineNumberOfThreads(num_threads);
179+
uint32_t MaxTeamThreads = mapping::getMaxTeamThreads();
180+
uint32_t PTeamSize = NumThreads == MaxTeamThreads ? 0 : NumThreads;
181+
181182
// We do *not* create a new data environment because all threads in the team
182183
// that are active are now running this parallel region. They share the
183184
// TeamState, which has an increase level-var and potentially active-level

0 commit comments

Comments
 (0)