Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hipcc disregards --cuda-gpu-arch from CMake when determining default_amdgpu_target #2181

Closed
MathiasMagnus opened this issue Oct 27, 2020 · 3 comments

Comments

@MathiasMagnus
Copy link
Contributor

MathiasMagnus commented Oct 27, 2020

We've come across an issue of hipcc always adding system device architectures to executable binaries even when not asked. This increases compile times for unaware users and causes a hurdle for those extracting GPU binaries, as there may always be some bloat.

This happens because the CMake cache variable AMDGPU_TARGETS gets turned into GPU_TARGETS internally by hip-config.cmake for the hip::device target, which then turns into compiler and linker flags with the name --cuda-gpu-arch. However hipcc was not updated to accomodate the change caused by moving from --amd-gpu-target to --cuda-gpu-arch and only checks for --amdgpu-target on the command line when determining whether to set default_amdgpu_target perl variable to 0. This variable controls whether the user asked for a GPU arch explicitly or should some default be embedded into the executable. That default is obtained by invoking rocminfo for GPUs inside the system. Currently trying to control binary archs explicitly via AMDGPU_TARGETS (alone) is not possible, because all system GPU archs are embedded into the executable.

Please search for --cuda-gpu-arch too on the CLI when deciding on defaulting to anything. Definition of opt to look for is here and usage is here.

Hotfix: hipcc not only looks for --amdgpu-target but also the HCC_AMDGPU_TARGET environment variable to determine whether to embed default targets. Setting them both makes arch selection explicit enough for hipcc. (Note: AMDGPU_TARGETS is a list in CMake format, so it is a semi-colon delimited list (may require extra hoops and defensive quotes around cli args, depending on your shell), while the HCC_AMDGPU_TARGET env var is just colon delimited.)

@yuanfang-chen
Copy link

yuanfang-chen commented Nov 3, 2023

Ran into this too when building rccl.

@yxsamliu
Copy link
Contributor

yxsamliu commented Nov 3, 2023

Ran into this too when building rccl.

this has been fixed in ROCm 5.7

https://github.com/ROCm-Developer-Tools/clr/blob/rocm-5.7.x/hipamd/hip-config-amd.cmake#L121

@yuanfang-chen
Copy link

Ran into this too when building rccl.

this has been fixed in ROCm 5.7

https://github.com/ROCm-Developer-Tools/clr/blob/rocm-5.7.x/hipamd/hip-config-amd.cmake#L121

Thank you, Sam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants