[Openmp-commits] [PATCH] D111949: [OpenMP][FIX] Do check the level before return team size
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Oct 27 14:44:56 PDT 2021
jdoerfert added inline comments.
================
Comment at: openmp/libomptarget/DeviceRTL/src/State.cpp:448-450
+int omp_get_num_threads(void) {
+ return omp_get_level() > 1 ? 1 : state::ParallelTeamSize;
+}
----------------
protze.joachim wrote:
> is state::ParallelTeamSize = 1 for level=0? Probably change to checking for ActiveLevel?
>
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111949/new/
https://reviews.llvm.org/D111949
More information about the Openmp-commits
mailing list