[CI/Build] Add warning for unsupported global PTX architecture requests in... (#51901)

This commit is contained in:
Shane Widanagama
2026-08-15 07:01:52 -07:00
committed by GitHub
parent 97388c44f9
commit d4801990a4
4 changed files with 63 additions and 5 deletions
+22 -2
View File
@@ -220,11 +220,11 @@ endmacro()
#
# Example:
# CMAKE_CUDA_FLAGS="-Wall -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75"
# clear_cuda_arches(CUDA_ARCH_FLAGS)
# clear_cuda_gencode_flags(CUDA_ARCH_FLAGS)
# CUDA_ARCH_FLAGS="-gencode arch=compute_70,code=sm_70;-gencode arch=compute_75,code=sm_75"
# CMAKE_CUDA_FLAGS="-Wall"
#
macro(clear_cuda_arches CUDA_ARCH_FLAGS)
macro(clear_cuda_gencode_flags CUDA_ARCH_FLAGS)
# Extract all `-gencode` flags from `CMAKE_CUDA_FLAGS`
string(REGEX MATCHALL "-gencode arch=[^ ]+" CUDA_ARCH_FLAGS
${CMAKE_CUDA_FLAGS})
@@ -235,6 +235,26 @@ macro(clear_cuda_arches CUDA_ARCH_FLAGS)
${CMAKE_CUDA_FLAGS})
endmacro()
#
# Warn when a caller requested PTX code generation through global CUDA arch
# flags. vLLM removes those flags and reapplies per-source gencode flags, so the
# user's global PTX request will not be preserved.
#
function(warn_if_ptx_arch_requested CUDA_ARCH_FLAGS)
foreach(_ARCH_FLAG ${CUDA_ARCH_FLAGS})
if(_ARCH_FLAG MATCHES "code=.*compute_[0-9]+[af]?")
message(WARNING
"PTX code generation requested in CUDA architecture flags "
"(${_ARCH_FLAG}), but vLLM does not preserve global PTX requests "
"when normalizing per-source CUDA architectures. Remove '+PTX' from "
"TORCH_CUDA_ARCH_LIST or rely on vLLM's built-in per-kernel PTX "
"selection.")
return()
endif()
endforeach()
endfunction()
#
# Extract unique CUDA architectures from a list of compute capabilities codes in
# the form `<major><minor>[<letter>]`, convert them to the form sort