diff options
author | Zack Galbreath <zack.galbreath@kitware.com> | 2021-05-27 18:03:51 (GMT) |
---|---|---|
committer | Zack Galbreath <zack.galbreath@kitware.com> | 2021-06-07 19:25:34 (GMT) |
commit | 8514ee9b315b4ad02eed0e3cf11d8579f307fac0 (patch) | |
tree | df30dd3b7d79440fad1319bcbce9889de8686461 /Modules/CMakeDetermineHIPCompiler.cmake | |
parent | 20d086f1a2c320da59830682a19e006ec19dca94 (diff) | |
download | CMake-8514ee9b315b4ad02eed0e3cf11d8579f307fac0.zip CMake-8514ee9b315b4ad02eed0e3cf11d8579f307fac0.tar.gz CMake-8514ee9b315b4ad02eed0e3cf11d8579f307fac0.tar.bz2 |
HIP: analyze output of `hipcc` to determine default GPU architecture
Diffstat (limited to 'Modules/CMakeDetermineHIPCompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineHIPCompiler.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineHIPCompiler.cmake b/Modules/CMakeDetermineHIPCompiler.cmake index 87885c0..ed0110a 100644 --- a/Modules/CMakeDetermineHIPCompiler.cmake +++ b/Modules/CMakeDetermineHIPCompiler.cmake @@ -85,7 +85,12 @@ if(MSVC_HIP_ARCHITECTURE_ID) endif() if(NOT DEFINED CMAKE_HIP_ARCHITECTURES) - set(CMAKE_HIP_ARCHITECTURES "OFF" CACHE STRING "HIP architectures") + # Analyze output from hipcc to get the current GPU architecture. + if(CMAKE_HIP_COMPILER_PRODUCED_OUTPUT MATCHES " -target-cpu ([a-z0-9]+) ") + set(CMAKE_HIP_ARCHITECTURES "${CMAKE_MATCH_1}" CACHE STRING "HIP architectures") + else() + message(FATAL_ERROR "Failed to find a working HIP architecture.") + endif() endif() # configure variables set in this file for fast reload later on |