Skip to content

Commit 42b669b

Browse files
committed
Add a Windows ROCm job to use tarball distribution of TheRock
This builds from ROCm release tarballs. In order to use it you must have ROCm installed in the operating system first. - Update GPU_TARGETS to match Linux job (7.11.0 targets) - Cache DLL's from extracted tarball directory instead of installer directory - Align Windows and Linux ROCm build configurations Also; rename the legacy ROCm task to clarify which artifacts come from which release.
1 parent 2c99772 commit 42b669b

1 file changed

Lines changed: 90 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,97 @@ concurrency:
4343
cancel-in-progress: true
4444

4545
jobs:
46+
windows-latest-rocm:
47+
runs-on: windows-2022
48+
49+
env:
50+
ROCM_VERSION: "7.11.0"
51+
GPU_TARGETS: "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1152;gfx1200;gfx1201"
52+
53+
steps:
54+
- uses: actions/checkout@v3
55+
with:
56+
submodules: recursive
57+
58+
- name: Cache ROCm Installation
59+
id: cache-rocm
60+
uses: actions/cache@v4
61+
with:
62+
path: C:\TheRock\build
63+
key: rocm-${{ env.ROCM_VERSION }}-gfx1151-${{ runner.os }}
64+
65+
- name: ccache
66+
uses: ggml-org/ccache-action@v1.2.16
67+
with:
68+
key: windows-latest-rocm-${{ env.ROCM_VERSION }}-x64
69+
evict-old-files: 1d
70+
71+
- name: Install ROCm
72+
if: steps.cache-rocm.outputs.cache-hit != 'true'
73+
run: |
74+
$ErrorActionPreference = "Stop"
75+
write-host "Downloading AMD ROCm ${{ env.ROCM_VERSION }} tarball"
76+
Invoke-WebRequest -Uri "https://repo.amd.com/rocm/tarball/therock-dist-windows-gfx1151-${{ env.ROCM_VERSION }}.tar.gz" -OutFile "${env:RUNNER_TEMP}\rocm.tar.gz"
77+
write-host "Extracting ROCm tarball"
78+
mkdir C:\TheRock\build -Force
79+
tar -xzf "${env:RUNNER_TEMP}\rocm.tar.gz" -C C:\TheRock\build --strip-components=1
80+
write-host "Completed ROCm extraction"
81+
82+
- name: Setup ROCm Environment
83+
run: |
84+
$rocmPath = "C:\TheRock\build"
85+
echo "HIP_PATH=$rocmPath" >> $env:GITHUB_ENV
86+
echo "HIP_DEVICE_LIB_PATH=$rocmPath\lib\llvm\amdgcn\bitcode" >> $env:GITHUB_ENV
87+
echo "HIP_PLATFORM=amd" >> $env:GITHUB_ENV
88+
echo "LLVM_PATH=$rocmPath\lib\llvm" >> $env:GITHUB_ENV
89+
echo "$rocmPath\bin" >> $env:GITHUB_PATH
90+
echo "$rocmPath\lib\llvm\bin" >> $env:GITHUB_PATH
91+
92+
- name: Build
93+
run: |
94+
mkdir build
95+
cd build
96+
cmake .. `
97+
-G "Unix Makefiles" `
98+
-DCMAKE_PREFIX_PATH="${env:HIP_PATH}" `
99+
-DSD_HIPBLAS=ON `
100+
-DSD_BUILD_SHARED_LIBS=ON `
101+
-DGGML_NATIVE=OFF `
102+
-DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
103+
-DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" `
104+
-DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
105+
-DHIP_PATH="${env:HIP_PATH}" `
106+
-DCMAKE_BUILD_TYPE=Release `
107+
-DGPU_TARGETS="${{ env.GPU_TARGETS }}"
108+
cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS}
109+
110+
- name: Get commit hash
111+
id: commit
112+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
113+
uses: pr-mpt/actions-commit-hash@v2
114+
115+
- name: Pack artifacts
116+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
117+
run: |
118+
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
119+
cp "${env:HIP_PATH}\bin\libhipblaslt.dll" "build\bin\"
120+
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
121+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
122+
123+
- name: Upload artifacts
124+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
128+
path: |
129+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
130+
46131
windows-latest-cmake-hip:
47132
runs-on: windows-2022
48133

49134
env:
50135
HIPSDK_INSTALLER_VERSION: "25.Q3"
136+
ROCM_VERSION: "6.4.2"
51137
GPU_TARGETS: "gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
52138

53139
steps:
@@ -131,15 +217,15 @@ jobs:
131217
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
132218
cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
133219
cp "${env:HIP_PATH}\bin\hipblaslt\library\*" "build\bin\hipblaslt\library\"
134-
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip .\build\bin\*
220+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
135221
136222
- name: Upload artifacts
137223
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
138224
uses: actions/upload-artifact@v4
139225
with:
140-
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
226+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
141227
path: |
142-
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
228+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
143229
144230
ubuntu-latest-rocm:
145231
runs-on: ubuntu-24.04
@@ -270,6 +356,7 @@ jobs:
270356
needs:
271357
- ubuntu-latest-rocm
272358
- windows-latest-cmake-hip
359+
- windows-latest-rocm
273360

274361
steps:
275362
- name: Clone

0 commit comments

Comments
 (0)