Remove outdated CMAKE_CUDA_COMPILER_VERSION branch (#160075)

Remove the condition `if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)` in cmake/Codegen.cmake, because we are now default to CUDA >=12.0
Pull Request resolved: https://github.com/pytorch/pytorch/pull/160075
Approved by: https://github.com/Skylion007
This commit is contained in:
cyy
2025-08-09 14:23:17 +00:00
committed by PyTorch MergeBot
parent 2f4c222617
commit 01f66d08d9

View File

@ -91,30 +91,28 @@ if(INTERN_BUILD_ATEN_OPS)
torch_cuda_get_nvcc_gencode_flag(_existing_arch_flags)
set(_file_compile_flags "")
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)
foreach(_arch ${archs})
if("${_arch}" STREQUAL "89")
if(_existing_arch_flags MATCHES ".*compute_86.*")
list(APPEND _file_compile_flags "-gencode;arch=compute_89,code=sm_89")
endif()
foreach(_arch ${archs})
if("${_arch}" STREQUAL "89")
if(_existing_arch_flags MATCHES ".*compute_86.*")
list(APPEND _file_compile_flags "-gencode;arch=compute_89,code=sm_89")
endif()
if("${_arch}" STREQUAL "90a")
if(_existing_arch_flags MATCHES ".*compute_90.*")
list(APPEND _file_compile_flags "-gencode;arch=compute_90a,code=sm_90a")
endif()
endif()
if("${_arch}" STREQUAL "90a")
if(_existing_arch_flags MATCHES ".*compute_90.*")
list(APPEND _file_compile_flags "-gencode;arch=compute_90a,code=sm_90a")
endif()
if("${_arch}" STREQUAL "100a")
if(_existing_arch_flags MATCHES ".*compute_100.*")
list(APPEND _file_compile_flags "-gencode;arch=compute_100a,code=sm_100a")
endif()
endif()
if("${_arch}" STREQUAL "100a")
if(_existing_arch_flags MATCHES ".*compute_100.*")
list(APPEND _file_compile_flags "-gencode;arch=compute_100a,code=sm_100a")
endif()
if("${_arch}" STREQUAL "120a")
if(_existing_arch_flags MATCHES ".*compute_120.*")
list(APPEND _file_compile_flags "-gencode;arch=compute_120a,code=sm_120a")
endif()
endif()
if("${_arch}" STREQUAL "120a")
if(_existing_arch_flags MATCHES ".*compute_120.*")
list(APPEND _file_compile_flags "-gencode;arch=compute_120a,code=sm_120a")
endif()
endforeach()
endif()
endif()
endforeach()
list(JOIN _file_compile_flags " " _file_compile_flags)
set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "${_file_compile_flags}")