diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1914c08489..b4f353bf2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -516,6 +516,118 @@ 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: '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 + 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 +896,7 @@ jobs: - windows-cuda - windows-sycl - windows-hip + - ubuntu-22-rocm - ubuntu-22-cpu - ubuntu-22-vulkan - macOS-arm64 @@ -868,6 +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 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:**