0002-honor-torch-cuda-arch-list.patch 1.4 KB

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