Record why torch 2.12 on Blackwell needs the cu130 leaf

torch 2.12 ships on the cu126 and cu130 indexes only, and the gate added
here already restricts it to those two. What the gate cannot express is
that the two are not interchangeable on current hardware.

Measured on torch 2.12.1:

    cu126 arch list: sm_50 sm_60 sm_70 sm_75 sm_80 sm_86 sm_90
    cu130 arch list: sm_75 sm_80 sm_86 sm_90 sm_100 sm_120

A B200 is sm_100, so a cu126 build of 2.12 fails a plain matmul there
with "CUDA error: no kernel image is available for execution on the
device". Nothing in this repo causes that and nothing here can repair
it; the wheel simply carries no code for the arch.

The gate keys off the detected CUDA version rather than the GPU, which
stays correct: cu126 is the right leaf for a pre-Blackwell host on CUDA
12.6, and a Blackwell host needs CUDA 13 regardless. The comment records
the measurement so the cu126 leaf is not later mistaken for a
Blackwell-capable option.
This commit is contained in:
Daniel Han 2026-07-27 10:37:56 +00:00
commit c433254893

View file

@ -45,6 +45,11 @@ else: raise RuntimeError(f"Torch = {v} too new!")
if v > V('2.6.9') and cuda not in ("11.8", "12.6", "12.8", "13.0"): raise RuntimeError(f"CUDA = {cuda} not supported!")
if v >= V('2.10.0') and cuda not in ("12.6", "12.8", "13.0"): raise RuntimeError(f"Torch = {v} requires CUDA 12.6, 12.8, or 13.0! Got CUDA = {cuda}")
# torch 2.12 is published on the cu126 and cu130 indexes only, so there is no cu128 extra.
# Of those two, only cu130 covers Blackwell: measured on 2.12.1, the cu126 build's
# arch list ends at sm_90 while cu130 carries sm_100 and sm_120, so on a B200 a cu126
# 2.12 fails even a plain matmul with "no kernel image is available for execution on
# the device". This gate keys off the detected CUDA, not the GPU, so cu126 stays valid
# for pre-Blackwell; a Blackwell host needs CUDA 13.
if v >= V('2.12.0') and cuda not in ("12.6", "13.0"): raise RuntimeError(f"Torch = {v} requires CUDA 12.6 or 13.0! Got CUDA = {cuda}")
x = x.format(cuda.replace(".", ""), "-ampere" if False else "") # is_ampere is broken due to flash-attn
# torch2110 and later extras pin +cuNNN local builds that only resolve from the matching index.