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

Conversation

@psychocoderHPC
Copy link

@psychocoderHPC psychocoderHPC commented Aug 6, 2021

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

  • Is keeps AMDGPU_TARGETS defines the variable deprecated and mark it as advanced to avoid confusing new users.
  • If the user is setting AMD_GPU_TARGETS in the initial cmake call e.g. cmake -DAMDGPU_TARGETS=gfx908;gfx906 a deprecation warning is thrown and the value of AMDGPU_TARGETS is assigned to GPU_TARGETS
  • GPU_TARGETS can be changed with ccmake by pressing enter, all supported architectures, without features, will be available.
  • 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+;gfx906

This PR is based on ROCm/hip#2289 which was closed due to the newly opened HIP develop branch.
In the original PR @pfultz2 noted that the drop-down list for GPU_TARGETS is not containing the architectures with features, due to the high number of combinations I have not added features to this PR.
The feature can always be selected by an expert user if needed by setting GPU_TARGETS instead of using ccmake.
Additionally, features are not in the current cmake, therefore this PR is not reducing any functionality.
If the features should be part of the drop-down list I suggest adding them in a follow-up PR by someone who knows which architectures can be combined with which feature.

@psychocoderHPC
Copy link
Author

set(AMDGPU_TARGETS "gfx900;gfx906;gfx908;gfx90a;gfx1030" CACHE STRING "AMD GPU targets to compile for")
set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "GPU targets to compile for")
set(GPU_DEFAULT_TARGETS "gfx900;gfx906;gfx908")
set(GPU_SUPPORTED_TARGETS "gfx701;gfx801;gfx802;gfx803;gfx900;gfx906;gfx908;gfx1010;gfx1011;gfx1012;gfx1030;gfx1031")
Copy link
Contributor

@pfultz2 pfultz2 Aug 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the complete list of supported targets as this is missing the target features which is part of the target name as well. Furthermore, iterating over all the target features and default feature is a pretty long list. I think it would be better to not have the variable at all.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove GPU_SUPPORTED_TARGETS but it helps beginners to select an architecture even if the feature will not be directly chooseable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed GPU_SUPPORTED_TARGETS

set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "GPU targets to compile for")
set(GPU_DEFAULT_TARGETS "gfx900;gfx906;gfx908")
set(GPU_SUPPORTED_TARGETS "gfx701;gfx801;gfx802;gfx803;gfx900;gfx906;gfx908;gfx1010;gfx1011;gfx1012;gfx1030;gfx1031")
set(AMDGPU_TARGETS "${GPU_DEFAULT_TARGETS}" CACHE STRING "[Deprecated: please use GPU_TARGETS] AMD GPU targets to compile for. Changing this variable after cmake was called once will have NO effect!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to not define the variable, and then just check if its defined:

if(NOT DEFINED AMDGPU_TARGETS)
    set(GPU_TARGETS "${GPU_DEFAULT_TARGETS}" CACHE STRING "GPU targets to compile for. Adding features is supported e.g. gfx908:xnack+")
else()
    message(WARNING "Variable AMDGPU_TARGETS is deprecated! Please use GPU_TARGETS to choose architectures.")
    set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "GPU targets to compile for. Adding features is supported e.g. gfx908:xnack+")
endif()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for the suggestion. I took your suggestion and added you as co-author.

@psychocoderHPC psychocoderHPC force-pushed the topic-cmakeSetGPUArchitecture branch from c1a0df8 to 1707c6c Compare August 12, 2021 08:27
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]>
@psychocoderHPC psychocoderHPC force-pushed the topic-cmakeSetGPUArchitecture branch from 1707c6c to 0e97622 Compare August 12, 2021 08:28
@psychocoderHPC
Copy link
Author

@pfultz2 Is there anything to do before this can be merged?

@psychocoderHPC
Copy link
Author

ping

@saadrahim
Copy link
Member

@gargrahul and @mangupta please take a look at this PR. There are two variable for the same functionality. GPU_TARGETS is the canonical variable. Let's take this advice and deprecate the AMDGPU_TARGETS variable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants