Skip to content

Commit 123fdcc

Browse files
committed
Fix CUDA 13.4 arch list: nvcc fatal 'Unsupported gpu architecture compute_50'
get_cuda_arch_list() matched "13.0" and "13.2" exactly, so 13.4 fell through to the legacy fallback list "5.0;6.0;7.0;7.5;8.0;8.6;9.0". CUDA 13 removed sm_50 and sm_60, so every CUDA translation unit failed: /usr/local/cuda-13.4/bin/nvcc ... nvcc fatal : Unsupported gpu architecture 'compute_50' subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1 RuntimeError: Error compiling objects for extension seen on pytorch/vision build-wheel-py3_10-cuda-aarch6413_4-aarch64. Match the whole 13.x series with startswith("13.") rather than adding 13.4 to the exact-match chain, so the next CUDA minor does not silently fall through to a list containing architectures the toolkit no longer supports. Add direct coverage for the arch list on 13.0/13.2/13.4 x linux/linux-aarch64: the existing tests compare get_cuda_variables() against get_cuda_arch_list() output, so they cannot catch a wrong list.
1 parent cdc9e43 commit 123fdcc

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

tools/pkg-helpers/pytorch_pkg_helpers/cuda.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ def get_cuda_arch_list(
1616
# however we would like to keep sm_70 architecture see: https://github.com/pytorch/pytorch/issues/157517
1717
if sanitized_version == "12.8":
1818
return "7.0;7.5;8.0;8.6;9.0;10.0;12.0"
19-
elif sanitized_version == "13.0" or sanitized_version == "13.2":
19+
elif sanitized_version.startswith("13."):
20+
# CUDA 13 removed sm_50/sm_60 outright, so the fallback list above makes
21+
# nvcc fail with "Unsupported gpu architecture 'compute_50'". Match the
22+
# whole 13.x series so a new minor does not silently fall through.
2023
arch_list = "7.5;8.0;8.6;9.0;10.0;12.0+PTX"
2124
# Add sm_110 for aarch64
2225
if "aarch64" in platform:

tools/pkg-helpers/tests/test_cuda.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,25 @@ def test_cuda_variables_cuda_windows_wheels(gpu_arch_version):
7272
f'export PATH="{cuda_home}/bin:${{PATH}}"',
7373
"export FORCE_CUDA=1",
7474
]
75+
76+
77+
@pytest.mark.parametrize("sanitized_version", ["13.0", "13.2", "13.4"])
78+
@pytest.mark.parametrize("platform", ["linux", "linux-aarch64"])
79+
def test_cuda_arch_list_cuda13_excludes_removed_arches(sanitized_version, platform):
80+
# CUDA 13 removed sm_50/sm_60; requesting them makes nvcc fail with
81+
# "Unsupported gpu architecture 'compute_50'".
82+
arch_list = get_cuda_arch_list(sanitized_version, platform=platform)
83+
assert "5.0" not in arch_list
84+
assert "6.0" not in arch_list
85+
86+
87+
@pytest.mark.parametrize("sanitized_version", ["13.0", "13.2", "13.4"])
88+
def test_cuda_arch_list_cuda13(sanitized_version):
89+
assert (
90+
get_cuda_arch_list(sanitized_version, platform="linux")
91+
== "7.5;8.0;8.6;9.0;10.0;12.0+PTX"
92+
)
93+
assert (
94+
get_cuda_arch_list(sanitized_version, platform="linux-aarch64")
95+
== "8.0;9.0;10.0;11.0;12.0+PTX"
96+
)

0 commit comments

Comments
 (0)