Skip to content

Suggest setting AMDGPU_TARGETS #4011

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

Closed
wants to merge 1 commit into from

Conversation

ardfork
Copy link
Contributor

@ardfork ardfork commented Nov 9, 2023

Currently, when building llama.cpp with CMake and hipBLAS option, it will build for gfx900, gfx906, gfx908, gfx90a, gfx1030 if using 5.6.1 or older. And, build for gfx906 if using ROCm 5.7.0 or 5.7.1 (it is set to empty, but that will result in it building only for gfx906.

The former raised multiple issues that CMake build wasn't working for RDNA3 cards, and once ROCm 5.7.0 or 5.7.1 is available in popular linux distributions, it will surely raise issues for most AMD cards owner.

This issue was fixed upstream 3 days ago, it will do something similar to this suggestion.

It might be better to implement AMD GPU targets selection in CMakeLists.txt, using devices present in computer by default with an option to set GPU targets for package maintainers.

Also, I noticed that in Makefile, the way it select GPU targets probably doesn't work on a computer with multiple GPU that use different ISA.

@ardfork
Copy link
Contributor Author

ardfork commented Nov 9, 2023

I also discovered that you can pass native to AMDGPU_TARGETS or --offload-arch, but I'm not sure if it works with multiple GPU using different ISA. That would be cleaner than using amdgpu-arch binary and could also be applied to Makefile.

Edit: After looking at it further, the implementation check for multiple GPU, it basically call the same binary. Also, I was wrong about the Makefile, it correctly handle multiple ISA. Tested by replacing amdgpu-arch binary to something simply returning gfx1030 and gfx1100; CMake with -DAMDGPU_TARGETS=native and current Makefile correctly build binaries for gfx1030 and gfx1100.

Currently, when building llama.cpp with CMake and hipBLAS option, it
will build for gfx900, gfx906, gfx908, gfx90a, gfx1030 if using 5.6.1 or
older. And, build for gfx906 if using ROCm 5.7.0 or 5.7.1.

The former raised multiple issues that CMake build wasn't working for
RDNA3 cards, and once ROCm 5.7.0 or 5.7.1 is available in popular linux
distributions, it will surely raise issues for most AMD cards owner.

This issue was fixed upstream 3 days ago, it will do something similar
to this suggestion.
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

Successfully merging this pull request may close these issues.

2 participants