From 1068556b2ca6c136000fa48db7d62ce1b5250dea Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Fri, 23 May 2025 07:43:58 -0700 Subject: [PATCH] [Bugfix][Build/CI] Fixup CUDA compiler version check for CUDA_SUPPORTED_ARCHS (#18579) --- CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffb801d62..6a1ed5887 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,13 +29,6 @@ set(ignoreMe "${VLLM_PYTHON_PATH}") # set(PYTHON_SUPPORTED_VERSIONS "3.9" "3.10" "3.11" "3.12") -# Supported NVIDIA architectures. -if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL) - set(CUDA_SUPPORTED_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0;10.0;10.1;12.0") -else() - set(CUDA_SUPPORTED_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0") -endif() - # Supported AMD GPU architectures. set(HIP_SUPPORTED_ARCHS "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1200;gfx1201") @@ -83,6 +76,15 @@ endif() # find_package(Torch REQUIRED) +# Supported NVIDIA architectures. +# This check must happen after find_package(Torch) because that's when CMAKE_CUDA_COMPILER_VERSION gets defined +if(DEFINED CMAKE_CUDA_COMPILER_VERSION AND + CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) + set(CUDA_SUPPORTED_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0;10.0;10.1;12.0") +else() + set(CUDA_SUPPORTED_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0") +endif() + # # Forward the non-CUDA device extensions to external CMake scripts. #