Fix TORCH_CUDA_ARCH_LIST (#156667)

Before the fix, `TORCH_CUDA_ARCH_LIST` variable contains string `TORCH_CUDA_ARCH_LIST`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/156667
Approved by: https://github.com/ngimel
This commit is contained in:
cyy 2025-06-24 07:27:53 +00:00 committed by PyTorch MergeBot
parent 04178d347c
commit ce1a07570d

View File

@ -333,7 +333,11 @@ macro(torch_cuda_get_nvcc_gencode_flag store_var)
"CUDA_ARCH_NAME is no longer used. Use TORCH_CUDA_ARCH_LIST instead. "
"Right now, CUDA_ARCH_NAME is ${CUDA_ARCH_NAME} and "
"TORCH_CUDA_ARCH_LIST is ${TORCH_CUDA_ARCH_LIST}.")
set(TORCH_CUDA_ARCH_LIST TORCH_CUDA_ARCH_LIST ${CUDA_ARCH_NAME})
if(NOT TORCH_CUDA_ARCH_LIST)
set(TORCH_CUDA_ARCH_LIST ${CUDA_ARCH_NAME})
else()
list(APPEND TORCH_CUDA_ARCH_LIST ${CUDA_ARCH_NAME})
endif()
endif()
# Invoke cuda_select_nvcc_arch_flags from proper cmake FindCUDA.