[Openmp-commits] [PATCH] D119313: [OpenMP][CUDA] Set the hard team limit to 2^31-1

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 8 22:11:56 PST 2022


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, jhuber6, JonChesterfield.
Herald added subscribers: guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Currently it is set to 65536, which is way less than the actual hardware
limit. For example, my workstation has GTX2080, and the hardware limit of grid
size is 2147483647, which is exactly the largest number a `int32_t` can represent.
Similarly, in NVVM, those special registers to get those numbers are defined as
`i32`. It makes sense to change them to `int32_t` and set the number accordingly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119313

Files:
  openmp/libomptarget/plugins/cuda/src/rtl.cpp


Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -13,6 +13,7 @@
 #include <cassert>
 #include <cstddef>
 #include <cuda.h>
+#include <limits>
 #include <list>
 #include <memory>
 #include <mutex>
@@ -327,10 +328,11 @@
   // Number of initial streams for each device.
   int NumInitialStreams = 32;
 
-  static constexpr const int HardTeamLimit = 1U << 16U; // 64k
-  static constexpr const int HardThreadLimit = 1024;
-  static constexpr const int DefaultNumTeams = 128;
-  static constexpr const int DefaultNumThreads = 128;
+  static constexpr const int32_t HardTeamLimit =
+      std::numeric_limits<int32_t>::max(); // 2147483647
+  static constexpr const int32_t HardThreadLimit = 1024;
+  static constexpr const int32_t DefaultNumTeams = 128;
+  static constexpr const int32_t DefaultNumThreads = 128;
 
   using StreamPoolTy = ResourcePoolTy<CUstream>;
   std::vector<std::unique_ptr<StreamPoolTy>> StreamPool;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119313.407050.patch
Type: text/x-patch
Size: 1090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220209/5d0e9592/attachment.bin>


More information about the Openmp-commits mailing list