Skip to content

Commit e948a7d

Browse files
authored
CI: Provide prebuilt windows binary for hip (#9467)
1 parent 6335114 commit e948a7d

File tree

1 file changed

+68
-2
lines changed

1 file changed

+68
-2
lines changed

.github/workflows/build.yml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@ jobs:
967967
name: llama-bin-win-sycl-x64.zip
968968

969969
windows-latest-cmake-hip:
970+
if: ${{ github.event.inputs.create_release != 'true' }}
970971
runs-on: windows-latest
971972

972973
steps:
@@ -994,8 +995,72 @@ jobs:
994995
run: |
995996
$env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
996997
$env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
997-
cmake -G "Unix Makefiles" -B build -S . -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" -DGGML_HIPBLAS=ON
998-
cmake --build build --config Release
998+
cmake -G "Unix Makefiles" -B build -S . -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" -DGGML_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DGGML_RPC=ON
999+
cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
1000+
1001+
windows-latest-cmake-hip-release:
1002+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1003+
runs-on: windows-latest
1004+
1005+
strategy:
1006+
matrix:
1007+
gpu_target: [gfx1100, gfx1101, gfx1030]
1008+
1009+
steps:
1010+
- name: Clone
1011+
id: checkout
1012+
uses: actions/checkout@v4
1013+
1014+
- name: Install
1015+
id: depends
1016+
run: |
1017+
$ErrorActionPreference = "Stop"
1018+
write-host "Downloading AMD HIP SDK Installer"
1019+
Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q3-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
1020+
write-host "Installing AMD HIP SDK"
1021+
Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
1022+
write-host "Completed AMD HIP SDK installation"
1023+
1024+
- name: Verify ROCm
1025+
id: verify
1026+
run: |
1027+
& 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
1028+
1029+
- name: Build
1030+
id: cmake_build
1031+
run: |
1032+
$env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
1033+
$env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
1034+
cmake -G "Unix Makefiles" -B build -S . -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" -DGGML_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DGPU_TARGETS=${{ matrix.gpu_target }} -DGGML_RPC=ON
1035+
cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
1036+
md "build\bin\rocblas\library\"
1037+
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
1038+
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
1039+
cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
1040+
1041+
- name: Determine tag name
1042+
id: tag
1043+
shell: bash
1044+
run: |
1045+
BUILD_NUMBER="$(git rev-list --count HEAD)"
1046+
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
1047+
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
1048+
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
1049+
else
1050+
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
1051+
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
1052+
fi
1053+
1054+
- name: Pack artifacts
1055+
id: pack_artifacts
1056+
run: |
1057+
7z a llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip .\build\bin\*
1058+
1059+
- name: Upload artifacts
1060+
uses: actions/upload-artifact@v4
1061+
with:
1062+
path: llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
1063+
name: llama-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
9991064

10001065
ios-xcode-build:
10011066
runs-on: macos-latest
@@ -1060,6 +1125,7 @@ jobs:
10601125
- macOS-latest-cmake
10611126
- windows-latest-cmake
10621127
- windows-latest-cmake-cuda
1128+
- windows-latest-cmake-hip-release
10631129
- macOS-latest-cmake-arm64
10641130
- macOS-latest-cmake-x64
10651131

0 commit comments

Comments
 (0)