Skip to content

Commit 5ac18e1

Browse files
committed
[kernel] Address review: guard sm_121a on CUDA>=13, downgrade main arch, wheel+README
- Gemini(high): the main extension (fastvideo_kernel_ops) used the raw TORCH_CUDA_ARCH_LIST, so a CUDA<13 build with 12.1a in the list would fail to compile. Downgrade 121a->120a for the main archs too on CUDA<13 (sm_120a PTX forward-JITs to sm_121); mirrors the fp4* guard. - Copilot: gate sm_121a on CUDA>=13.0 (not 12.9) to match the doc/comment text; fix the "[per-arch]" status message to not always claim sm_121a. - Copilot: make the "sm_120a-only" claim true, not just reworded — update fastvideo-kernel/README.md support matrix, and add 12.1a to the aarch64 cu130 wheel arch list so the published Spark wheel actually includes sm_121a FP4.
1 parent 146e347 commit 5ac18e1

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/publish-kernel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
# the main extension for the full arch list. CMAKE_BUILD_PARALLEL_LEVEL caps
175175
# Ninja so heavy CUTLASS/TK template TUs don't OOM the 16 GB runner (exit 143).
176176
if [ "${{ matrix.platform.arch }}" = "aarch64" ]; then
177-
export TORCH_CUDA_ARCH_LIST="10.0a;12.0a"
177+
export TORCH_CUDA_ARCH_LIST="10.0a;12.0a;12.1a"
178178
export CMAKE_ARGS="${CMAKE_ARGS:-} -DFASTVIDEO_KERNEL_BUILD_TK=OFF -DFASTVIDEO_KERNEL_BUILD_ATTN_QAT_INFER=ON"
179179
export CMAKE_BUILD_PARALLEL_LEVEL=1
180180
elif [ "${{ matrix.torch-cuda.torch-cuda-short }}" = "cu130" ]; then

fastvideo-kernel/CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,15 @@ if(ENABLE_ATTN_QAT_INFER AND TORCH_CUDA_ARCH_LIST)
273273
set(FASTVIDEO_MAIN_CUDA_ARCHS "${TORCH_CUDA_ARCH_LIST}")
274274
string(REPLACE "sm_" "" FASTVIDEO_MAIN_CUDA_ARCHS "${FASTVIDEO_MAIN_CUDA_ARCHS}")
275275
string(REPLACE "." "" FASTVIDEO_MAIN_CUDA_ARCHS "${FASTVIDEO_MAIN_CUDA_ARCHS}")
276-
message(STATUS "[per-arch] main extension archs=${FASTVIDEO_MAIN_CUDA_ARCHS}, fp4* archs=sm_120a/sm_121a")
276+
# sm_121a needs CUDA 13's ptxas. On older toolchains, downgrade any requested
277+
# 121a to 120a for the *main* extension too (not just the fp4* targets below),
278+
# so a CUDA-12.x build with 12.1a in the arch list doesn't fail to compile —
279+
# sm_120a PTX forward-JITs to sm_121 at runtime.
280+
if(CUDAToolkit_VERSION VERSION_LESS 13.0)
281+
string(REPLACE "121a" "120a" FASTVIDEO_MAIN_CUDA_ARCHS "${FASTVIDEO_MAIN_CUDA_ARCHS}")
282+
list(REMOVE_DUPLICATES FASTVIDEO_MAIN_CUDA_ARCHS)
283+
endif()
284+
message(STATUS "[per-arch] main extension archs=${FASTVIDEO_MAIN_CUDA_ARCHS}, fp4* archs set per-target below")
277285
endif()
278286

279287
# Compiler flags
@@ -415,11 +423,11 @@ if(ENABLE_ATTN_QAT_INFER)
415423
)
416424
# FP4 kernels target consumer/workstation Blackwell: sm_120a (RTX 5090 /
417425
# PRO 6000) and sm_121a (DGX Spark GB10). sm_121a needs CUDA 13's ptxas
418-
# (12.8 lacks it), so it is added only on CUDA >= 12.9pre-13 toolchains
419-
# keep the original sm_120a-only build unchanged. sm_121a GB10-verified
420-
# (cos ~0.98 vs bf16).
426+
# (CUDA 12.x lacks it), so it is added only on CUDA >= 13.0older
427+
# toolchains keep the original sm_120a-only build unchanged. sm_121a
428+
# GB10-verified (cos ~0.98 vs bf16).
421429
set(FASTVIDEO_FP4_CUDA_ARCHS "120a")
422-
if(NOT CUDAToolkit_VERSION VERSION_LESS 12.9)
430+
if(NOT CUDAToolkit_VERSION VERSION_LESS 13.0)
423431
list(APPEND FASTVIDEO_FP4_CUDA_ARCHS "121a")
424432
endif()
425433
message(STATUS "fp4* CUDA architectures: ${FASTVIDEO_FP4_CUDA_ARCHS}")

fastvideo-kernel/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Compiled CUDA extensions (CMake, see the build summary printed at the end of eve
1010
|---|---|---|---|---|
1111
| `fastvideo_kernel._C.fastvideo_kernel_ops` | TurboDiffusion INT8 GEMM, quant, RMSNorm, LayerNorm | `csrc/turbodiffusion/` | every arch in `TORCH_CUDA_ARCH_LIST` | always built |
1212
| same extension, optional part | ThunderKittens sliding-tile attention (`sta_fwd`) and VSA block-sparse (`block_sparse_fwd/bwd`) | `csrc/attention/*_h100.cu` | Hopper `sm_90a` only | `FASTVIDEO_KERNEL_BUILD_TK` (AUTO = ON iff `9.0a` is in the arch list; always OFF on aarch64 hosts — TK headers don't compile there) |
13-
| `fp4attn_cuda`, `fp4quant_cuda` | FP4 attention + quantization ("attn_qat_infer", modified SageAttention3) | `attn_qat_infer/` | consumer Blackwell `sm_120a` only, CUDA ≥ 12.8 | `FASTVIDEO_KERNEL_BUILD_ATTN_QAT_INFER` (AUTO = ON iff `12.0a` is in the arch list) |
13+
| `fp4attn_cuda`, `fp4quant_cuda` | FP4 attention + quantization ("attn_qat_infer", modified SageAttention3) | `attn_qat_infer/` | consumer/workstation Blackwell `sm_120a` (CUDA ≥ 12.8) + `sm_121a` (DGX Spark GB10; CUDA ≥ 13) | `FASTVIDEO_KERNEL_BUILD_ATTN_QAT_INFER` (AUTO = ON iff `12.0a` or `12.1a` is in the arch list) |
1414

1515
Runtime-JIT kernels (no build step, ship in every wheel/image):
1616

@@ -26,7 +26,7 @@ Runtime-JIT kernels (no build step, ship in every wheel/image):
2626
|---|---|---|---|---|---|
2727
| PyPI wheels (`.github/workflows/publish-kernel.yml`) | version bump in `fastvideo-kernel/pyproject.toml` on main, or manual dispatch | x86_64 cu126 | `9.0a` | ON | — (CUDA < 12.8) |
2828
| | | x86_64 cu130 | `9.0a;12.0a` | ON | ON |
29-
| | | aarch64 cu130 | `10.0a;12.0a` || ON |
29+
| | | aarch64 cu130 | `10.0a;12.0a;12.1a` || ON |
3030
| Docker images `ghcr.io/hao-ai-lab/fastvideo/fastvideo-dev` (`.github/workflows/infra-build-image.yml`) | `docker/Dockerfile` changes on main, or manual dispatch | amd64 cuda12.6.3 + cuda13.0.0 | `9.0a` | ON ||
3131
| | | arm64 cuda12.6.3 (GH200) | `9.0a` | — (aarch64) ||
3232
| | | arm64 cuda13.0.0 (GB10 / DGX Spark) | `12.1` |||

0 commit comments

Comments
 (0)