Skip to content

Commit f75c4e8

Browse files
authored
Add a build target to generate ROCm artifacts using ROCm 7.2 (ggml-org#19433)
This builds the following targets: * gfx1151 * gfx1150 * gfx1200 * gfx1201 * gfx1100 * gfx1101 * gfx1030 * gfx908 * gfx90a * gfx942
1 parent 99156f3 commit f75c4e8

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,102 @@ jobs:
516516
path: llama-bin-win-sycl-x64.zip
517517
name: llama-bin-win-sycl-x64.zip
518518

519+
ubuntu-22-rocm:
520+
runs-on: ubuntu-22.04
521+
522+
strategy:
523+
matrix:
524+
include:
525+
- ROCM_VERSION: "7.2"
526+
gpu_targets: "gfx908;gfx90a;gfx942;gfx1030;gfx1100;gfx1101;gfx1151;gfx1150;gfx1200;gfx1201"
527+
build: 'x64'
528+
529+
steps:
530+
- name: Clone
531+
id: checkout
532+
uses: actions/checkout@v6
533+
with:
534+
fetch-depth: 0
535+
536+
- name: ccache
537+
uses: ggml-org/ccache-action@v1.2.16
538+
with:
539+
key: ubuntu-rocm-cmake-${{ matrix.ROCM_VERSION }}-${{ matrix.build }}
540+
evict-old-files: 1d
541+
542+
- name: Dependencies
543+
id: depends
544+
run: |
545+
sudo apt install -y build-essential git cmake wget
546+
547+
- name: Setup Legacy ROCm
548+
if: matrix.ROCM_VERSION == '7.2'
549+
id: legacy_env
550+
run: |
551+
sudo mkdir --parents --mode=0755 /etc/apt/keyrings
552+
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
553+
gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
554+
555+
sudo tee /etc/apt/sources.list.d/rocm.list << EOF
556+
deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/${{ matrix.ROCM_VERSION }} jammy main
557+
EOF
558+
559+
sudo tee /etc/apt/preferences.d/rocm-pin-600 << EOF
560+
Package: *
561+
Pin: release o=repo.radeon.com
562+
Pin-Priority: 600
563+
EOF
564+
565+
sudo apt update
566+
sudo apt-get install -y libssl-dev rocm-hip-sdk
567+
568+
- name: Setup TheRock
569+
if: matrix.ROCM_VERSION != '7.2'
570+
id: therock_env
571+
run: |
572+
wget https://repo.amd.com/rocm/tarball/therock-dist-linux-gfx1151-${{ matrix.ROCM_VERSION }}.tar.gz
573+
mkdir install
574+
tar -xf *.tar.gz -C install
575+
export ROCM_PATH=$(pwd)/install
576+
echo ROCM_PATH=$ROCM_PATH >> $GITHUB_ENV
577+
echo PATH=$PATH:$ROCM_PATH/bin >> $GITHUB_ENV
578+
echo LD_LIBRARY_PATH=$ROCM_PATH/lib:$ROCM_PATH/llvm/lib:$ROCM_PATH/lib/rocprofiler-systems >> $GITHUB_ENV
579+
580+
- name: Build with native CMake HIP support
581+
id: cmake_build
582+
run: |
583+
cmake -B build -S . \
584+
-DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
585+
-DCMAKE_HIP_FLAGS="-mllvm --amdgpu-unroll-threshold-local=600" \
586+
-DCMAKE_BUILD_TYPE=Release \
587+
-DGGML_BACKEND_DL=ON \
588+
-DGGML_NATIVE=OFF \
589+
-DCMAKE_INSTALL_RPATH='$ORIGIN' \
590+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
591+
-DGGML_CPU_ALL_VARIANTS=ON \
592+
-DGPU_TARGETS="${{ matrix.gpu_targets }}" \
593+
-DGGML_HIP=ON \
594+
-DHIP_PLATFORM=amd \
595+
-DGGML_HIP_ROCWMMA_FATTN=ON \
596+
${{ env.CMAKE_ARGS }}
597+
cmake --build build --config Release -j $(nproc)
598+
599+
- name: Determine tag name
600+
id: tag
601+
uses: ./.github/actions/get-tag-name
602+
603+
- name: Pack artifacts
604+
id: pack_artifacts
605+
run: |
606+
cp LICENSE ./build/bin/
607+
tar -czvf llama-bin-ubuntu-rocm-${{ matrix.ROCM_VERSION }}-${{ matrix.build }}.tar.gz --transform "s,./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin .
608+
609+
- name: Upload artifacts
610+
uses: actions/upload-artifact@v6
611+
with:
612+
path: llama-bin-ubuntu-rocm-${{ matrix.ROCM_VERSION }}-${{ matrix.build }}.tar.gz
613+
name: llama-bin-ubuntu-rocm-${{ matrix.ROCM_VERSION }}-${{ matrix.build }}.tar.gz
614+
519615
windows-hip:
520616
runs-on: windows-2022
521617

@@ -784,6 +880,7 @@ jobs:
784880
- windows-cuda
785881
- windows-sycl
786882
- windows-hip
883+
- ubuntu-22-rocm
787884
- ubuntu-22-cpu
788885
- ubuntu-22-vulkan
789886
- macOS-arm64
@@ -868,6 +965,7 @@ jobs:
868965
**Linux:**
869966
- [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)
870967
- [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)
968+
- [Ubuntu x64 (ROCm 7.2)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-x64.tar.gz)
871969
- [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)
872970
873971
**Windows:**

0 commit comments

Comments
 (0)