Fix: deterministically honor TORCH_CUDA_ARCH_LIST for the vLLM GPU arch. Deriving CUDA_ARCHS from the torch wheel arch list is unreliable for a DGX Spark build: the stock cu130 torch advertises sm_120, and the sm_121a-only FP4 instruction cvt.e2m1x2.f32 then fails in ptxas. When TORCH_CUDA_ARCH_LIST is set (e.g. 12.1a), take the numeric arch (12.1) directly so the CUDA>=13 family mapping rebuilds for sm_121a. Note: this is one of two adjacent changes; see 0001-cuda13-supported-archs-add-12.1.patch. --- --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,6 +221,16 @@ # clear_cuda_arches(CUDA_ARCH_FLAGS) extract_unique_cuda_archs_ascending(CUDA_ARCHS "${CUDA_ARCH_FLAGS}") + # Deterministically honor TORCH_CUDA_ARCH_LIST (e.g. "12.1a" -> 12.1) + # instead of deriving from the torch wheel arch list. Required so a + # DGX Spark (GB10/sm_121a) build targets the 12.1 family; otherwise the + # sm_120 FP4 cvt.e2m1x2.f32 path fails in ptxas. + if(DEFINED ENV{TORCH_CUDA_ARCH_LIST} AND NOT "$ENV{TORCH_CUDA_ARCH_LIST}" STREQUAL "") + string(REGEX MATCH "[0-9]+\.[0-9]+" _forced_arch "$ENV{TORCH_CUDA_ARCH_LIST}") + if(NOT _forced_arch STREQUAL "") + set(CUDA_ARCHS "${_forced_arch}") + endif() + endif() message(STATUS "CUDA target architectures: ${CUDA_ARCHS}") # Filter the target architectures by the supported supported archs # since for some files we will build for all CUDA_ARCHS.