[Openmp-commits] [openmp] 0153ab6 - [OpenMP] Remove restriction on the thread count for parallel regions

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 21 19:17:11 PDT 2023


Author: Johannes Doerfert
Date: 2023-03-21T19:16:13-07:00
New Revision: 0153ab6dbc33ae27b033e0dcf2c46e6de13f8521

URL: https://github.com/llvm/llvm-project/commit/0153ab6dbc33ae27b033e0dcf2c46e6de13f8521
DIFF: https://github.com/llvm/llvm-project/commit/0153ab6dbc33ae27b033e0dcf2c46e6de13f8521.diff

LOG: [OpenMP] Remove restriction on the thread count for parallel regions

Differential Revision: https://reviews.llvm.org/D112194

Added: 
    

Modified: 
    openmp/libomptarget/DeviceRTL/src/Parallelism.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/DeviceRTL/src/Parallelism.cpp b/openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
index 1fec2e37b2ca5..d2fee11236302 100644
--- a/openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
@@ -54,7 +54,11 @@ uint32_t determineNumberOfThreads(int32_t NumThreadsClause) {
   if (NThreadsICV != 0 && NThreadsICV < NumThreads)
     NumThreads = NThreadsICV;
 
-  // Round down to a multiple of WARPSIZE since it is legal to do so in OpenMP.
+  // SPMD mode allows any number of threads, for generic mode we round down to a
+  // multiple of WARPSIZE since it is legal to do so in OpenMP.
+  if (mapping::isSPMDMode())
+    return NumThreads;
+
   if (NumThreads < mapping::getWarpSize())
     NumThreads = 1;
   else


        


More information about the Openmp-commits mailing list