Skip to content

Commit 800e401

Browse files
committed
feat: min and max compute capabilities for CUDA 12.8 & 13.0
1 parent 2d3c7f9 commit 800e401

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) 2020-2025, NVIDIA CORPORATION. All rights reserved.
2-
#
2+
#
33
# Redistribution and use in source and binary forms, with or without modification, are permitted
44
# provided that the following conditions are met:
55
# * Redistributions of source code must retain the above copyright notice, this list of
@@ -10,7 +10,7 @@
1010
# * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
1111
# to endorse or promote products derived from this software without specific prior written
1212
# permission.
13-
#
13+
#
1414
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
1515
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1616
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
@@ -165,7 +165,9 @@ else()
165165
set(LATEST_SUPPORTED_CUDA_ARCHITECTURE 120)
166166
endif()
167167

168-
if (CUDA_VERSION VERSION_GREATER_EQUAL 12.0)
168+
if (CUDA_VERSION VERSION_GREATER_EQUAL 13.0)
169+
set(EARLIEST_SUPPORTED_CUDA_ARCHITECTURE 75)
170+
elseif (CUDA_VERSION VERSION_GREATER_EQUAL 12.0)
169171
set(EARLIEST_SUPPORTED_CUDA_ARCHITECTURE 50)
170172
else()
171173
set(EARLIEST_SUPPORTED_CUDA_ARCHITECTURE 20)

bindings/torch/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
ROOT_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR))
1515

1616
def min_supported_compute_capability(cuda_version):
17-
if cuda_version >= parse_version("12.0"):
17+
if cuda_version >= parse_version("13.0"):
18+
return 75
19+
elif cuda_version >= parse_version("12.0"):
1820
return 50
1921
else:
2022
return 20

src/common_host.cu

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@
4141

4242
namespace tcnn {
4343

44-
static_assert(
45-
__CUDACC_VER_MAJOR__ > 10 || (__CUDACC_VER_MAJOR__ == 10 && __CUDACC_VER_MINOR__ >= 2),
46-
"tiny-cuda-nn requires at least CUDA 10.2"
47-
);
44+
static_assert(__CUDACC_VER_MAJOR__ > 10 || (__CUDACC_VER_MAJOR__ == 10 && __CUDACC_VER_MINOR__ >= 2), "tiny-cuda-nn requires at least CUDA 10.2");
4845

4946
std::function<void(LogSeverity, const std::string&)> g_log_callback = [](LogSeverity severity, const std::string& msg) {
5047
switch (severity) {
@@ -214,9 +211,7 @@ int cuda_device() {
214211
return device;
215212
}
216213

217-
void set_cuda_device(int device) {
218-
CUDA_CHECK_THROW(cudaSetDevice(device));
219-
}
214+
void set_cuda_device(int device) { CUDA_CHECK_THROW(cudaSetDevice(device)); }
220215

221216
int cuda_device_count() {
222217
int device_count;
@@ -244,9 +239,7 @@ const cudaDeviceProp& cuda_get_device_properties(int device) {
244239
return cuda_device_properties().at(device);
245240
}
246241

247-
std::string cuda_device_name(int device) {
248-
return cuda_get_device_properties(device).name;
249-
}
242+
std::string cuda_device_name(int device) { return cuda_get_device_properties(device).name; }
250243

251244
uint32_t cuda_compute_capability(int device) {
252245
const auto& props = cuda_get_device_properties(device);
@@ -261,22 +254,20 @@ uint32_t cuda_max_supported_compute_capability() {
261254
return 80;
262255
} else if (cuda_version < 11080) {
263256
return 86;
264-
} else {
257+
} else if (cuda_version < 12080) {
265258
return 90;
259+
} else {
260+
return 120;
266261
}
267262
}
268263

269264
uint32_t cuda_supported_compute_capability(int device) {
270265
return std::min(cuda_compute_capability(device), cuda_max_supported_compute_capability());
271266
}
272267

273-
size_t cuda_max_shmem(int device) {
274-
return cuda_get_device_properties(device).sharedMemPerBlockOptin;
275-
}
268+
size_t cuda_max_shmem(int device) { return cuda_get_device_properties(device).sharedMemPerBlockOptin; }
276269

277-
uint32_t cuda_max_registers(int device) {
278-
return (uint32_t)cuda_get_device_properties(device).regsPerBlock;
279-
}
270+
uint32_t cuda_max_registers(int device) { return (uint32_t)cuda_get_device_properties(device).regsPerBlock; }
280271

281272
size_t cuda_memory_granularity(int device) {
282273
size_t granularity;
@@ -358,4 +349,4 @@ template <> std::string type_to_string<double>() { return "double"; }
358349
template <> std::string type_to_string<float>() { return "float"; }
359350
template <> std::string type_to_string<__half>() { return "__half"; }
360351

361-
}
352+
} // namespace tcnn

0 commit comments

Comments
 (0)