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

Option to build GFX9 ROCm support? #696

Closed
nikAizuddin opened this issue Feb 1, 2025 · 3 comments
Closed

Option to build GFX9 ROCm support? #696

nikAizuddin opened this issue Feb 1, 2025 · 3 comments

Comments

@nikAizuddin
Copy link

nikAizuddin commented Feb 1, 2025

Can we have a build option to support older GPUs such as GFX9? So that we don't have to patch scripts/build_llama_and_whisper.sh file in order to build for GFX9:

--- a/container-images/scripts/build_llama_and_whisper.sh
+++ b/container-images/scripts/build_llama_and_whisper.sh
@@ -62,7 +62,7 @@ configure_common_flags() {
   common_flags=("-DGGML_NATIVE=OFF")
   case "$containerfile" in
     rocm)
-      common_flags+=("-DGGML_HIP=ON" "-DAMDGPU_TARGETS=${AMDGPU_TARGETS:-gfx1010,gfx1030,gfx1032,gfx1100,gfx1101,gfx1102}")
+      common_flags+=("-DGGML_HIP=ON" "-DAMDGPU_TARGETS=${AMDGPU_TARGETS:-gfx1010,gfx1030,gfx1032,gfx1100,gfx1101,gfx1102,gfx900}")
       ;;
     cuda)
       common_flags+=("-DGGML_CUDA=ON" "-DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined")
@@ -120,7 +120,7 @@ main() {
 
   clone_and_build_llama_cpp
   dnf -y clean all
-  rm -rf /var/cache/*dnf* /opt/rocm-*/lib/*/library/*gfx9*
+  rm -rf /var/cache/*dnf*
   ldconfig # needed for libraries
 }
@rhatdan
Copy link
Member

rhatdan commented Feb 1, 2025

The issue is size I believe. You should be able to specify AMD_GPU_TARGETS=gfx900 to get it to build,
but we would need a way to not remove the gfx9 files.

@nikAizuddin
Copy link
Author

You should be able to specify AMD_GPU_TARGETS=gfx900

I just tried with make build IMAGE=rocm AMD_GPU_TARGETS=gfx900, it doesn't work. It seems AMD_GPU_TARGETS args from make is ignored because I see podman build --no-cache --platform linux/amd64 -t quay.io/ramalama/rocm -f rocm/Containerfile . command is used.

we would need a way to not remove the gfx9 files.

I think adding a simple regex check for gfx9** should be sufficient:

  if [[ ! "$AMDGPU_TARGETS" =~ gfx9[0-9a-z][0-9a-z] ]]; then
    rm -rf /opt/rocm-*/lib/*/library/*gfx9*
  fi

I can create a pull request for this

@nikAizuddin
Copy link
Author

nikAizuddin commented Feb 2, 2025

I think I'm no longer interested with ROCm build because I've found that Vulkan is faster than ROCm #705 (comment) at least on my Vega 56 GPU. So, I guess I'll close this issue.

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

2 participants