[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
+36 -2
View File
@@ -1,10 +1,22 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import shutil
import subprocess
import sys
from pathlib import Path
def _get_cmake_bin() -> str:
cmake = shutil.which("cmake")
if cmake:
return cmake
venv_cmake = Path(sys.executable).parent / "cmake"
if venv_cmake.is_file():
return str(venv_cmake)
return "cmake"
def test_exact_family_arch_precedes_generic_family_fallback(tmp_path: Path):
repo_root = Path(__file__).parents[1]
script = tmp_path / "test_cuda_archs.cmake"
@@ -20,7 +32,7 @@ endif()
"""
)
subprocess.run(["cmake", "-P", script], check=True)
subprocess.run([_get_cmake_bin(), "-P", script], check=True)
def test_extract_archs_prefers_sass_target_over_corrupted_virtual_arch(
@@ -45,4 +57,26 @@ endif()
"""
)
subprocess.run(["cmake", "-P", script], check=True)
subprocess.run([_get_cmake_bin(), "-P", script], check=True)
def test_clear_cuda_gencode_flags(tmp_path: Path):
repo_root = Path(__file__).parents[1]
script = tmp_path / "test_clear_flags.cmake"
script.write_text(
f"""
cmake_minimum_required(VERSION 3.26)
include("{repo_root / "cmake" / "utils.cmake"}")
set(CMAKE_CUDA_FLAGS "-Wall -gencode arch=compute_80,code=sm_80")
clear_cuda_gencode_flags(CUDA_ARCH_FLAGS)
if(NOT "${{CMAKE_CUDA_FLAGS}}" STREQUAL "-Wall ")
message(FATAL_ERROR "Expected '-Wall ', got '${{CMAKE_CUDA_FLAGS}}'")
endif()
if(NOT "${{CUDA_ARCH_FLAGS}}" STREQUAL "-gencode arch=compute_80,code=sm_80")
message(FATAL_ERROR "Expected '-gencode arch=compute_80,code=sm_80', "
"got '${{CUDA_ARCH_FLAGS}}'")
endif()
"""
)
subprocess.run([_get_cmake_bin(), "-P", script], check=True)