diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp --- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp +++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp @@ -36,8 +36,6 @@ Error GenericKernelTy::init(GenericDeviceTy &GenericDevice, DeviceImageTy &Image) { PreferredNumThreads = getDefaultNumThreads(GenericDevice); - if (isGenericMode()) - PreferredNumThreads += GenericDevice.getWarpSize(); MaxNumThreads = GenericDevice.getThreadLimit(); @@ -92,6 +90,9 @@ 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); }