diff options
author | Brad King <brad.king@kitware.com> | 2022-05-04 15:18:21 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-05-04 15:18:28 (GMT) |
commit | 2045e1eee093e5125f6ade53ebe490a498bb99b4 (patch) | |
tree | 9d6b912f4c8eddf997d6940828a7af3c1a9404dc | |
parent | 16e0ccd70f106b2bac93a66cea2f15218fa5998d (diff) | |
parent | e8591f1516edffe9fc2ef138e5933a1c9914e9e5 (diff) | |
download | CMake-2045e1eee093e5125f6ade53ebe490a498bb99b4.zip CMake-2045e1eee093e5125f6ade53ebe490a498bb99b4.tar.gz CMake-2045e1eee093e5125f6ade53ebe490a498bb99b4.tar.bz2 |
Merge topic 'less_ptx_for_all_all-major_native'
e8591f1516 CUDA: native/all/all-major generates minimal set of ptx code
Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !7216
7 files changed, 25 insertions, 12 deletions
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index ea07482..853d655 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -52,6 +52,7 @@ if(CMAKE_CUDA_ABI_COMPILED) set(CMAKE_CUDA_ARCHITECTURES_NATIVE "${_CUDA_ARCHS_OUTPUT}") endif() list(REMOVE_DUPLICATES CMAKE_CUDA_ARCHITECTURES_NATIVE) + list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_NATIVE APPEND "-real") else() if(NOT _CUDA_ARCHS_RESULT MATCHES "[0-9]+") set(_CUDA_ARCHS_STATUS " (${_CUDA_ARCHS_RESULT})") diff --git a/Modules/CUDA/architectures.cmake b/Modules/CUDA/architectures.cmake index fa3a5a1..79c1252 100644 --- a/Modules/CUDA/architectures.cmake +++ b/Modules/CUDA/architectures.cmake @@ -44,3 +44,14 @@ if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.4 AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")) list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 87) endif() + +# only generate jit code for the newest arch for all/all-major +list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL _latest_arch) +list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL APPEND "-real") +list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL ${_latest_arch}) + +list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR _latest_arch) +list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR APPEND "-real") +list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR ${_latest_arch}) + +unset(_latest_arch) diff --git a/Tests/CudaOnly/ArchSpecial/CMakeLists.txt b/Tests/CudaOnly/ArchSpecial/CMakeLists.txt index 46f4ada..88eff8a 100644 --- a/Tests/CudaOnly/ArchSpecial/CMakeLists.txt +++ b/Tests/CudaOnly/ArchSpecial/CMakeLists.txt @@ -10,6 +10,7 @@ function(verify_output flag) string(REPLACE "-" "_" architectures "${flag}") string(TOUPPER "${architectures}" architectures) set(architectures "${CMAKE_CUDA_ARCHITECTURES_${architectures}}") + list(TRANSFORM architectures REPLACE "-real" "") if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") set(match_regex "-target-cpu sm_([0-9]+)") diff --git a/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt index ee0a5f7..4153699 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt @@ -1,4 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='all-major' --- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='([0-9]+-real;)*[0-9]+-real' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt index fd738e4..32c61de0 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt @@ -1,4 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='all' --- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='([0-9]+-real;)*[0-9]+-real' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt index af49e00..7f6f19e 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt @@ -1,4 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='native' --- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='([0-9]+-real;)*[0-9]+-real' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stdout.txt index 22ed7f6..90b3552 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-suffix-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-suffix-stdout.txt @@ -1,4 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='[0-9]+-real;[0-9]+-virtual;' --- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' --- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='([0-9]+-real;)+[0-9]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='([0-9]+-real;)*[0-9]+-real' |