From d56823eefaaf3a4d9c73fbfa6e738da90caa3e62 Mon Sep 17 00:00:00 2001 From: "Mario Limonciello (AMD)" Date: Sat, 7 Feb 2026 09:42:12 -0600 Subject: [PATCH 1/2] Add a build target to generate ROCm artifacts using ROCm 7.2 This builds the following targets: * gfx1151 * gfx1150 * gfx1200 * gfx1201 * gfx1100 * gfx1101 * gfx1102 * gfx1030 * gfx1031 * gfx1032 * gfx908 * gfx90a * gfx942 --- .github/workflows/release.yml | 101 ++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1914c08489..1d77adb05c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -516,6 +516,105 @@ jobs: path: llama-bin-win-sycl-x64.zip name: llama-bin-win-sycl-x64.zip + ubuntu-22-rocm: + runs-on: ubuntu-22.04 + container: rocm/dev-ubuntu-22.04:7.2 + + env: + ROCM_VERSION: "7.2" + + strategy: + matrix: + include: + - build: 'x64' + name: "rocm" + gpu_targets: "gfx1151;gfx1150;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032;gfx908;gfx90a;gfx942" + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Dependencies + id: depends + run: | + sudo apt-get update + sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev libssl-dev rocwmma-dev + + - name: Free disk space + run: | + # Remove preinstalled SDKs and caches not needed for this job + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /opt/hostedtoolcache || true + + # Build regex pattern from ${{ matrix.gpu_targets }} (match target as substring) + TARGET_REGEX="($(printf '%s' "${{ matrix.gpu_targets }}" | sed 's/;/|/g'))" + + # Remove library files for architectures we're not building for to save disk space + echo "Cleaning up unneeded architecture files..." + cd /opt/rocm/lib/rocblas/library + # Keep only our target architectures + for file in *; do + if printf '%s' "$file" | grep -q 'gfx'; then + if ! printf '%s' "$file" | grep -Eq "$TARGET_REGEX"; then + echo "Removing $file" && + sudo rm -f "$file"; + fi + fi + done + + cd /opt/rocm/lib/hipblaslt/library + for file in *; do + if printf '%s' "$file" | grep -q 'gfx'; then + if ! printf '%s' "$file" | grep -Eq "$TARGET_REGEX"; then + echo "Removing $file" && + sudo rm -f "$file"; + fi + fi + done + + # Remove old package lists and caches + sudo rm -rf /var/lib/apt/lists/* || true + sudo apt clean + + - name: Build with native CMake HIP support + id: cmake_build + run: | + cmake -B build -S . \ + -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \ + -DCMAKE_HIP_FLAGS="-mllvm --amdgpu-unroll-threshold-local=600" \ + -DCMAKE_BUILD_TYPE=Release \ + -DGGML_BACKEND_DL=ON \ + -DGGML_NATIVE=OFF \ + -DGGML_CPU=OFF \ + -DAMDGPU_TARGETS="${{ matrix.gpu_targets }}" \ + -DGGML_HIP_ROCWMMA_FATTN=ON \ + -DGGML_HIP=ON \ + -DLLAMA_BUILD_BORINGSSL=ON + cmake --build build --config Release -j $(nproc) + + # Move ROCm runtime libraries (to avoid double space consumption) + sudo mv /opt/rocm/lib/lib*.so* ./build/bin/ + sudo mv /opt/rocm/lib/rocblas/ ./build/bin/ + sudo mv /opt/rocm/lib/hipblaslt/ ./build/bin/ + sudo mv /opt/rocm/lib/llvm/lib/libomp.so* ./build/bin/ + + - name: Pack artifacts + id: pack_artifacts + run: | + tar -czvf llama-bin-ubuntu-rocm-${{ matrix.build }}.tar.gz -C ./build/bin . + + - name: Upload artifacts + uses: actions/upload-artifact@v6 + with: + path: llama-bin-ubuntu-rocm-${{ matrix.build }}.tar.gz + name: llama-bin-ubuntu-rocm-${{ matrix.build }}.tar.gz + windows-hip: runs-on: windows-2022 @@ -784,6 +883,7 @@ jobs: - windows-cuda - windows-sycl - windows-hip + - ubuntu-22-rocm - ubuntu-22-cpu - ubuntu-22-vulkan - macOS-arm64 @@ -868,6 +968,7 @@ jobs: **Linux:** - [Ubuntu x64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.tar.gz) - [Ubuntu x64 (Vulkan)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-vulkan-x64.tar.gz) + - [Ubuntu x64 (ROCm)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-x64.tar.gz) - [Ubuntu s390x (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-s390x.tar.gz) **Windows:** From 170f2f907947162d5d0022afb2c2646f28435622 Mon Sep 17 00:00:00 2001 From: "Mario Limonciello (AMD)" Date: Mon, 9 Feb 2026 19:36:00 -0600 Subject: [PATCH 2/2] Split up ROCm targets to match TheRock TheRock splits up builds along logical families. Adjust the llama.cpp artifacts to match what TheRock does. --- .github/workflows/release.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d77adb05c..b4f353bf2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -526,10 +526,23 @@ jobs: strategy: matrix: include: - - build: 'x64' - name: "rocm" - gpu_targets: "gfx1151;gfx1150;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032;gfx908;gfx90a;gfx942" - + - build: 'gfx90X-x64' + gpu_targets: "gfx906;gfx908;gfx90a" + - build: 'gfx94X-x64' + gpu_targets: "gfx942" + # - build: 'gfx101X-x64' + # gpu_targets: "gfx1010;gfx1011;gfx1012" + - build: 'gfx103X-x64' + # missing: gfx1032, gfx1035, gfx1036 + gpu_targets: "gfx1030" + - build: 'gfx110X-x64' + # missing: gfx1103 + gpu_targets: "gfx1100;gfx1101;gfx1102" + - build: 'gfx115X-x64' + # missing: gfx1152, gfx1153 + gpu_targets: "gfx1150;gfx1151" + - build: 'gfx120X-x64' + gpu_targets: "gfx1200;gfx1201" steps: - name: Clone id: checkout @@ -968,7 +981,12 @@ jobs: **Linux:** - [Ubuntu x64 (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.tar.gz) - [Ubuntu x64 (Vulkan)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-vulkan-x64.tar.gz) - - [Ubuntu x64 (ROCm)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-x64.tar.gz) + - [Ubuntu x64 (ROCm gfx90X)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-gfx90X-x64.tar.gz) + - [Ubuntu x64 (ROCm gfx94X)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-gfx94X-x64.tar.gz) + - [Ubuntu x64 (ROCm gfx103X)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-gfx103X-x64.tar.gz) + - [Ubuntu x64 (ROCm gfx110X)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-gfx110X-x64.tar.gz) + - [Ubuntu x64 (ROCm gfx115X)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-gfx115X-x64.tar.gz) + - [Ubuntu x64 (ROCm gfx120X)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-gfx120X-x64.tar.gz) - [Ubuntu s390x (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-s390x.tar.gz) **Windows:**