From e22e837ca3a59248c3fe114dad510998e2c57e7c Mon Sep 17 00:00:00 2001 From: Hao Li Date: Sat, 1 Nov 2025 15:04:24 +0800 Subject: [PATCH 1/4] add TheRock HIP backend build instructions Signed-off-by: Hao Li --- docs/build.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/build.md b/docs/build.md index b410c710e30d3..b5c3a4b178a09 100644 --- a/docs/build.md +++ b/docs/build.md @@ -294,9 +294,27 @@ You can download it from your Linux distro's package manager or from here: [ROCm cmake -S . -B build -G Ninja -DGPU_TARGETS=gfx1100 -DGGML_HIP=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release cmake --build build ``` + Since TheRock (The HIP Environment and ROCm Kit) has been released on https://github.com/ROCm/TheRock/, which is a lightweight open source build platform for HIP and ROCm. + There is nightly build from https://therock-nightly-tarball.s3.amazonaws.com/, like therock-dist-windows-gfx1151-7.10.0a20251031.tar.gz for AMD Ryzen AI MAX CPU. + Below is step for building with TheRock HIP backend for Windows. Download therock-dist-windows-gfx1151-xxx.tar.gz and uncompress it to C:\work\therock\. + Also Set RC COMPILER with https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ installation + + ```bash + set HIP_PATH=C:\work\therock + set HIP_PATH_70=%HIP_PATH% + set LLVM_PATH=%HIP_PATH% + set HIP_PLATFORM=amd + set CMAKE_C_COMPILER=%HIP_PATH%\lib\llvm\bin\amdclang.exe + set CMAKE_CXX_COMPILER=%HIP_PATH%\lib\llvm\bin\amdclang++.exe + set CMAKE_RC_COMPILER="C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/rc.exe" + set PATH=%HIP_PATH%\bin;%PATH% + cmake -S . -B build -G Ninja -DGPU_TARGETS=gfx1151 -DGGML_HIP=ON -DCMAKE_C_COMPILER=%CMAKE_C_COMPILER% -DCMAKE_CXX_COMPILER=%CMAKE_CXX_COMPILER% -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=OFF -DCMAKE_RC_COMPILER=%CMAKE_RC_COMPILER% + cmake --build build + ``` + If necessary, adapt `GPU_TARGETS` to the GPU arch you want to compile for. The above example uses `gfx1100` that corresponds to Radeon RX 7900XTX/XT/GRE. You can find a list of targets [here](https://llvm.org/docs/AMDGPUUsage.html#processors) Find your gpu version string by matching the most significant version information from `rocminfo | grep gfx | head -1 | awk '{print $2}'` with the list of processors, e.g. `gfx1035` maps to `gfx1030`. - + The environment variable [`HIP_VISIBLE_DEVICES`](https://rocm.docs.amd.com/en/latest/understand/gpu_isolation.html#hip-visible-devices) can be used to specify which GPU(s) will be used. If your GPU is not officially supported you can use the environment variable [`HSA_OVERRIDE_GFX_VERSION`] set to a similar GPU, for example 10.3.0 on RDNA2 (e.g. gfx1030, gfx1031, or gfx1035) or 11.0.0 on RDNA3. From d45f8c2b28726dac964e3876e7b7114be1396985 Mon Sep 17 00:00:00 2001 From: Hao Li Date: Sat, 1 Nov 2025 18:15:14 +0800 Subject: [PATCH 2/4] Update docs/build.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sigbjørn Skjæret --- docs/build.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/build.md b/docs/build.md index b5c3a4b178a09..c959d70d18005 100644 --- a/docs/build.md +++ b/docs/build.md @@ -314,7 +314,6 @@ You can download it from your Linux distro's package manager or from here: [ROCm If necessary, adapt `GPU_TARGETS` to the GPU arch you want to compile for. The above example uses `gfx1100` that corresponds to Radeon RX 7900XTX/XT/GRE. You can find a list of targets [here](https://llvm.org/docs/AMDGPUUsage.html#processors) Find your gpu version string by matching the most significant version information from `rocminfo | grep gfx | head -1 | awk '{print $2}'` with the list of processors, e.g. `gfx1035` maps to `gfx1030`. - The environment variable [`HIP_VISIBLE_DEVICES`](https://rocm.docs.amd.com/en/latest/understand/gpu_isolation.html#hip-visible-devices) can be used to specify which GPU(s) will be used. If your GPU is not officially supported you can use the environment variable [`HSA_OVERRIDE_GFX_VERSION`] set to a similar GPU, for example 10.3.0 on RDNA2 (e.g. gfx1030, gfx1031, or gfx1035) or 11.0.0 on RDNA3. From 9fdd966f7135fc713b29befb20be7529cc6bde9b Mon Sep 17 00:00:00 2001 From: Hao Li Date: Sun, 2 Nov 2025 21:13:33 +0800 Subject: [PATCH 3/4] update build instructions with theRock rocm installation and release link Signed-off-by: Hao Li --- docs/build.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/build.md b/docs/build.md index c959d70d18005..6fcb69c71fb94 100644 --- a/docs/build.md +++ b/docs/build.md @@ -294,13 +294,13 @@ You can download it from your Linux distro's package manager or from here: [ROCm cmake -S . -B build -G Ninja -DGPU_TARGETS=gfx1100 -DGGML_HIP=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release cmake --build build ``` - Since TheRock (The HIP Environment and ROCm Kit) has been released on https://github.com/ROCm/TheRock/, which is a lightweight open source build platform for HIP and ROCm. - There is nightly build from https://therock-nightly-tarball.s3.amazonaws.com/, like therock-dist-windows-gfx1151-7.10.0a20251031.tar.gz for AMD Ryzen AI MAX CPU. - Below is step for building with TheRock HIP backend for Windows. Download therock-dist-windows-gfx1151-xxx.tar.gz and uncompress it to C:\work\therock\. - Also Set RC COMPILER with https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ installation + TheRock (The HIP Environment and ROCm Kit) has been released on https://github.com/ROCm/TheRock/, which is a lightweight open source build platform for HIP and ROCm. + Below is step for building llama.cpp for HIP backend for Windows. + Download from https://github.com/ROCm/TheRock/releases and uncompress it to %HIP_PATH%. + Also Set RC COMPILER with https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ installation, like C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/rc.exe + Assuming a gfx1151-compatible AMD GPU from https://github.com/ROCm/TheRock/blob/main/RELEASES.md ```bash - set HIP_PATH=C:\work\therock set HIP_PATH_70=%HIP_PATH% set LLVM_PATH=%HIP_PATH% set HIP_PLATFORM=amd @@ -308,7 +308,7 @@ You can download it from your Linux distro's package manager or from here: [ROCm set CMAKE_CXX_COMPILER=%HIP_PATH%\lib\llvm\bin\amdclang++.exe set CMAKE_RC_COMPILER="C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/rc.exe" set PATH=%HIP_PATH%\bin;%PATH% - cmake -S . -B build -G Ninja -DGPU_TARGETS=gfx1151 -DGGML_HIP=ON -DCMAKE_C_COMPILER=%CMAKE_C_COMPILER% -DCMAKE_CXX_COMPILER=%CMAKE_CXX_COMPILER% -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=OFF -DCMAKE_RC_COMPILER=%CMAKE_RC_COMPILER% + cmake -S . -B build -G Ninja -DGPU_TARGETS=gfx1151 -DGGML_HIP=ON -DCMAKE_C_COMPILER=%CMAKE_C_COMPILER% -DCMAKE_CXX_COMPILER=%CMAKE_CXX_COMPILER% -DCMAKE_BUILD_TYPE=Release -DCMAKE_RC_COMPILER=%CMAKE_RC_COMPILER% cmake --build build ``` From 8ae5ffb5930170dfa8c81e37e6393017dad39ce1 Mon Sep 17 00:00:00 2001 From: Hao Li Date: Sun, 2 Nov 2025 21:16:13 +0800 Subject: [PATCH 4/4] update build instructions with theRock rocm installation and release link Signed-off-by: Hao Li --- docs/build.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/build.md b/docs/build.md index 6fcb69c71fb94..c9f98396328e1 100644 --- a/docs/build.md +++ b/docs/build.md @@ -296,8 +296,11 @@ You can download it from your Linux distro's package manager or from here: [ROCm ``` TheRock (The HIP Environment and ROCm Kit) has been released on https://github.com/ROCm/TheRock/, which is a lightweight open source build platform for HIP and ROCm. Below is step for building llama.cpp for HIP backend for Windows. + Download from https://github.com/ROCm/TheRock/releases and uncompress it to %HIP_PATH%. + Also Set RC COMPILER with https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ installation, like C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/rc.exe + Assuming a gfx1151-compatible AMD GPU from https://github.com/ROCm/TheRock/blob/main/RELEASES.md ```bash