[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
Sat Oct 16 12:42:05 PDT 2021
jdoerfert created this revision.
jdoerfert added reviewers: tianshilei1992, jhuber6.
Herald added subscribers: guansong, bollu, yaxunl.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111949
Files:
openmp/libomptarget/DeviceRTL/src/State.cpp
Index: openmp/libomptarget/DeviceRTL/src/State.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/State.cpp
+++ openmp/libomptarget/DeviceRTL/src/State.cpp
@@ -445,7 +445,9 @@
return returnValIfLevelIsActive(Level, state::ParallelTeamSize, 1);
}
-int omp_get_num_threads(void) { return state::ParallelTeamSize; }
+int omp_get_num_threads(void) {
+ return omp_get_level() > 1 ? 1 : state::ParallelTeamSize;
+}
int omp_get_thread_limit(void) { return mapping::getKernelSize(); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111949.380208.patch
Type: text/x-patch
Size: 548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211016/70b49cc3/attachment.bin>
More information about the Openmp-commits
mailing list