[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 16:19:02 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4c88341d17f8: [OpenMP][FIX] Do check the level before return team size (authored by jdoerfert).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111949/new/

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.382843.patch
Type: text/x-patch
Size: 548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211027/683b1d46/attachment.bin>


More information about the Openmp-commits mailing list