diff options
author | Brad King <brad.king@kitware.com> | 2023-09-18 18:11:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-21 19:34:37 (GMT) |
commit | 127b6fa06bf53ad9f31d041a7d11434ca2856c8e (patch) | |
tree | 26f2bdb717a1592b9a31fb6bc1cdff37f42a1373 /Tests/HIP | |
parent | 90e23f40ee27c0990b30b3640731e89539cb3990 (diff) | |
download | CMake-127b6fa06bf53ad9f31d041a7d11434ca2856c8e.zip CMake-127b6fa06bf53ad9f31d041a7d11434ca2856c8e.tar.gz CMake-127b6fa06bf53ad9f31d041a7d11434ca2856c8e.tar.bz2 |
HIP: Add CMAKE_HIP_PLATFORM variable to specify GPU platform
For now, require the value to be `amd`, since that is the only
platform we currently support.
Diffstat (limited to 'Tests/HIP')
-rw-r--r-- | Tests/HIP/ArchitectureOff/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/HIP/CompileFlags/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/HIP/TryCompile/CMakeLists.txt | 5 |
3 files changed, 13 insertions, 3 deletions
diff --git a/Tests/HIP/ArchitectureOff/CMakeLists.txt b/Tests/HIP/ArchitectureOff/CMakeLists.txt index b40301a..9d0bf05 100644 --- a/Tests/HIP/ArchitectureOff/CMakeLists.txt +++ b/Tests/HIP/ArchitectureOff/CMakeLists.txt @@ -3,7 +3,11 @@ project(HIPArchitecture HIP) # Make sure CMake doesn't pass architectures if HIP_ARCHITECTURES is OFF. set(CMAKE_HIP_ARCHITECTURES OFF) -string(APPEND CMAKE_HIP_FLAGS " --offload-arch=gfx908") + +# Pass our own architecture flags instead. +if(CMAKE_HIP_PLATFORM STREQUAL "amd") + string(APPEND CMAKE_HIP_FLAGS " --offload-arch=gfx908") +endif() add_executable(HIPOnlyArchitectureOff main.hip) get_property(hip_archs TARGET HIPOnlyArchitectureOff PROPERTY HIP_ARCHITECTURES) diff --git a/Tests/HIP/CompileFlags/CMakeLists.txt b/Tests/HIP/CompileFlags/CMakeLists.txt index c808313..46a94a3 100644 --- a/Tests/HIP/CompileFlags/CMakeLists.txt +++ b/Tests/HIP/CompileFlags/CMakeLists.txt @@ -3,6 +3,9 @@ project(CompileFlags HIP) add_executable(HIPOnlyCompileFlags main.hip) -set_property(TARGET HIPOnlyCompileFlags PROPERTY HIP_ARCHITECTURES gfx803) +if(CMAKE_HIP_PLATFORM STREQUAL "amd") + set(hip_archs gfx803) +endif() +set_property(TARGET HIPOnlyCompileFlags PROPERTY HIP_ARCHITECTURES ${hip_archs}) target_compile_options(HIPOnlyCompileFlags PRIVATE -DALWAYS_DEFINE) diff --git a/Tests/HIP/TryCompile/CMakeLists.txt b/Tests/HIP/TryCompile/CMakeLists.txt index 92a834c..c98e59c 100644 --- a/Tests/HIP/TryCompile/CMakeLists.txt +++ b/Tests/HIP/TryCompile/CMakeLists.txt @@ -4,7 +4,10 @@ project (TryCompile HIP) #Goal for this example: # Verify try_compile with HIP language works set(CMAKE_HIP_STANDARD 14) -set(CMAKE_HIP_ARCHITECTURES gfx803 gfx900) + +if(CMAKE_HIP_PLATFORM STREQUAL "amd") + set(CMAKE_HIP_ARCHITECTURES gfx803 gfx900) +endif() set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) try_compile(result "${CMAKE_CURRENT_BINARY_DIR}" |