[Openmp-commits] [openmp] ee3d9ee - [OpenMP] Change the nextgen plugin kernel thread count scheme as old plugins'

Ye Luo via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 19 16:28:16 PST 2022


Author: Ye Luo
Date: 2022-12-19T18:27:02-06:00
New Revision: ee3d9ee49c2ea08ea40b95d2e6159a027740c1aa

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

LOG: [OpenMP] Change the nextgen plugin kernel thread count scheme as old plugins'

Reviewed By: jdoerfert

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

Added: 
    

Modified: 
    openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
index eb03e3befdaec..83b656acc8b9d 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
@@ -36,8 +36,6 @@ AsyncInfoWrapperTy::~AsyncInfoWrapperTy() {
 Error GenericKernelTy::init(GenericDeviceTy &GenericDevice,
                             DeviceImageTy &Image) {
   PreferredNumThreads = getDefaultNumThreads(GenericDevice);
-  if (isGenericMode())
-    PreferredNumThreads += GenericDevice.getWarpSize();
 
   MaxNumThreads = GenericDevice.getThreadLimit();
 
@@ -92,6 +90,9 @@ void *GenericKernelTy::prepareArgs(GenericDeviceTy &GenericDevice,
 
 uint32_t GenericKernelTy::getNumThreads(GenericDeviceTy &GenericDevice,
                                         uint32_t ThreadLimitClause) const {
+  if (ThreadLimitClause > 0 && isGenericMode())
+    ThreadLimitClause += GenericDevice.getWarpSize();
+
   return std::min(MaxNumThreads, (ThreadLimitClause > 0) ? ThreadLimitClause
                                                          : PreferredNumThreads);
 }


        


More information about the Openmp-commits mailing list