Skip to content

Commit 4c88341

Browse files
committed
[OpenMP][FIX] Do check the level before return team size
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. Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D111949
1 parent dc72960 commit 4c88341

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

openmp/libomptarget/DeviceRTL/src/State.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,9 @@ int omp_get_team_size(int Level) {
445445
return returnValIfLevelIsActive(Level, state::ParallelTeamSize, 1);
446446
}
447447

448-
int omp_get_num_threads(void) { return state::ParallelTeamSize; }
448+
int omp_get_num_threads(void) {
449+
return omp_get_level() > 1 ? 1 : state::ParallelTeamSize;
450+
}
449451

450452
int omp_get_thread_limit(void) { return mapping::getKernelSize(); }
451453

0 commit comments

Comments
 (0)