CMake/Tests/HIP/ArchitectureOff/CMakeLists.txt
Brad King 127b6fa06b 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.
2023-09-21 15:34:37 -04:00

17 lines
579 B
CMake

cmake_minimum_required(VERSION 3.18)
project(HIPArchitecture HIP)
# Make sure CMake doesn't pass architectures if HIP_ARCHITECTURES is OFF.
set(CMAKE_HIP_ARCHITECTURES OFF)
# 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)
if(NOT hip_archs STREQUAL "OFF")
message(FATAL_ERROR "CMAKE_HIP_ARCHITECTURES did not initialize HIP_ARCHITECTURES")
endif()