Skip to content

Commit

Permalink
maximum number of threads per block for sm_86 is 1536 (#45889)
Browse files Browse the repository at this point in the history
Summary:
according to https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#features-and-technical-specifications

Pull Request resolved: #45889

Reviewed By: albanD

Differential Revision: D24131188

Pulled By: ngimel

fbshipit-source-id: 31d3038f7b1bc403751448c62b19609573c67a49
  • Loading branch information
xwang233 authored and facebook-github-bot committed Oct 6, 2020
1 parent ba642d3 commit fcc7f27
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions c10/macros/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,14 @@ namespace at { namespace cuda { using namespace c10::hip; }}
#define C10_DEVICE __device__
#define C10_HOST __host__
// constants from (https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#features-and-technical-specifications)
// The maximum number of threads per multiprocessor is 1024 for Turing architecture (7.5)
// but 2048 for previous architectures. You'll get warnings if you exceed these constants.
// The maximum number of threads per multiprocessor is 1024 for Turing architecture (7.5),
// 1536 for Geforce Ampere (8.6),
// and 2048 for all other architectures. You'll get warnings if you exceed these constants.
// Hence, the following macros adjust the input values from the user to resolve potential warnings.
#if __CUDA_ARCH__ == 750
constexpr uint32_t CUDA_MAX_THREADS_PER_SM = 1024;
#elif __CUDA_ARCH__ == 860
constexpr uint32_t CUDA_MAX_THREADS_PER_SM = 1536;
#else
constexpr uint32_t CUDA_MAX_THREADS_PER_SM = 2048;
#endif
Expand Down

0 comments on commit fcc7f27

Please sign in to comment.