Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 1707c6c

Browse files
cmake: use property list for GPU_TARGETS
This PR deprecates the variable `AMDGPU_TARGETS`. To choose architectures it is required to set `GPU_TARGETS`. Before this PR `GPU_TARGETS` was set to `AMDGPU_TARGETS`. Calling `cmake` again with a new value for `AMDGPU_TARGETS` is not propagated to `GPU_TARGETS` therefore the user is building against the initially selected architecture which is not obvious. This PR - If the user is setting `AMD_GPU_TARGETS` in the **initial cmake call** e.g. `cmake -DAMDGPU_TARGETS=gfx908` a deprecation warning is thrown and the value of `AMDGPU_TARGETS` is assigned to `GPU_TARGETS` - `GPU_TARGETS` can be any time overwritten by a user-defined value which allows an expert user to select architecture features too, e.g. `cmake -DGPU_TARGETS=gfx908:xnack+` Co-authored-by: Paul Fultz II <[email protected]>
1 parent dfeb962 commit 1707c6c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

hip-config.cmake.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,14 @@ if(HIP_COMPILER STREQUAL "clang")
159159
if(NOT WIN32)
160160
find_dependency(AMDDeviceLibs)
161161
endif()
162-
set(AMDGPU_TARGETS "gfx900;gfx906;gfx908;gfx90a;gfx1030" CACHE STRING "AMD GPU targets to compile for")
163-
set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "GPU targets to compile for")
162+
set(GPU_DEFAULT_TARGETS "gfx900;gfx906;gfx908")
163+
164+
if(NOT DEFINED AMDGPU_TARGETS)
165+
set(GPU_TARGETS "${GPU_DEFAULT_TARGETS}" CACHE STRING "GPU targets to compile for. Adding features is supported e.g. gfx908:xnack+")
166+
else()
167+
message(WARNING "Variable AMDGPU_TARGETS is deprecated! Please use GPU_TARGETS to choose architectures.")
168+
set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "GPU targets to compile for. Adding features is supported e.g. gfx908:xnack+")
169+
endif()
164170
endif()
165171

166172
if(NOT WIN32)

0 commit comments

Comments
 (0)