Skip to content

Commit 0c1ca17

Browse files
authored
ci: update ROCm Windows builds (#1282)
1 parent 839f6a9 commit 0c1ca17

2 files changed

Lines changed: 107 additions & 17 deletions

File tree

.github/workflows/build.yml

Lines changed: 95 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,98 @@ jobs:
444444
path: |
445445
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
446446
447+
windows-latest-rocm:
448+
runs-on: windows-2022
449+
450+
env:
451+
ROCM_VERSION: "7.12.0"
452+
GPU_TARGETS: "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201"
453+
454+
steps:
455+
- uses: actions/checkout@v3
456+
with:
457+
submodules: recursive
458+
459+
- name: Cache ROCm Installation
460+
id: cache-rocm
461+
uses: actions/cache@v4
462+
with:
463+
path: C:\TheRock\build
464+
key: rocm-${{ env.ROCM_VERSION }}-gfx1151-${{ runner.os }}
465+
466+
- name: ccache
467+
uses: ggml-org/ccache-action@v1.2.16
468+
with:
469+
key: windows-latest-rocm-${{ env.ROCM_VERSION }}-x64
470+
evict-old-files: 1d
471+
472+
- name: Install ROCm
473+
if: steps.cache-rocm.outputs.cache-hit != 'true'
474+
run: |
475+
$ErrorActionPreference = "Stop"
476+
write-host "Downloading AMD ROCm ${{ env.ROCM_VERSION }} tarball"
477+
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"
478+
write-host "Extracting ROCm tarball"
479+
mkdir C:\TheRock\build -Force
480+
tar -xzf "${env:RUNNER_TEMP}\rocm.tar.gz" -C C:\TheRock\build --strip-components=1
481+
write-host "Completed ROCm extraction"
482+
483+
- name: Setup ROCm Environment
484+
run: |
485+
$rocmPath = "C:\TheRock\build"
486+
echo "HIP_PATH=$rocmPath" >> $env:GITHUB_ENV
487+
echo "HIP_DEVICE_LIB_PATH=$rocmPath\lib\llvm\amdgcn\bitcode" >> $env:GITHUB_ENV
488+
echo "HIP_PLATFORM=amd" >> $env:GITHUB_ENV
489+
echo "LLVM_PATH=$rocmPath\lib\llvm" >> $env:GITHUB_ENV
490+
echo "$rocmPath\bin" >> $env:GITHUB_PATH
491+
echo "$rocmPath\lib\llvm\bin" >> $env:GITHUB_PATH
492+
493+
- name: Build
494+
run: |
495+
mkdir build
496+
cd build
497+
cmake .. `
498+
-G "Unix Makefiles" `
499+
-DCMAKE_PREFIX_PATH="${env:HIP_PATH}" `
500+
-DSD_HIPBLAS=ON `
501+
-DSD_BUILD_SHARED_LIBS=ON `
502+
-DGGML_NATIVE=OFF `
503+
-DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
504+
-DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" `
505+
-DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
506+
-DHIP_PATH="${env:HIP_PATH}" `
507+
-DCMAKE_BUILD_TYPE=Release `
508+
-DGPU_TARGETS="${{ env.GPU_TARGETS }}"
509+
cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS}
510+
511+
- name: Get commit hash
512+
id: commit
513+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
514+
uses: pr-mpt/actions-commit-hash@v2
515+
516+
- name: Pack artifacts
517+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
518+
run: |
519+
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
520+
cp "${env:HIP_PATH}\bin\libhipblaslt.dll" "build\bin\"
521+
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
522+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
523+
524+
- name: Upload artifacts
525+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
526+
uses: actions/upload-artifact@v4
527+
with:
528+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
529+
path: |
530+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
531+
447532
windows-latest-cmake-hip:
448533
runs-on: windows-2022
449534

450535
env:
451-
HIPSDK_INSTALLER_VERSION: "25.Q3"
452-
GPU_TARGETS: "gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
536+
HIPSDK_INSTALLER_VERSION: "26.Q1"
537+
ROCM_VERSION: "7.1.1"
538+
GPU_TARGETS: "gfx1150;gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
453539

454540
steps:
455541
- uses: actions/checkout@v3
@@ -484,7 +570,7 @@ jobs:
484570
run: |
485571
$ErrorActionPreference = "Stop"
486572
write-host "Downloading AMD HIP SDK Installer"
487-
Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
573+
Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
488574
write-host "Installing AMD HIP SDK"
489575
$proc = Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -PassThru
490576
$completed = $proc.WaitForExit(600000)
@@ -537,20 +623,20 @@ jobs:
537623
run: |
538624
md "build\bin\rocblas\library\"
539625
md "build\bin\hipblaslt\library"
540-
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
541-
cp "${env:HIP_PATH}\bin\hipblaslt.dll" "build\bin\"
626+
cp "${env:HIP_PATH}\bin\libhipblas.dll" "build\bin\"
627+
cp "${env:HIP_PATH}\bin\libhipblaslt.dll" "build\bin\"
542628
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
543629
cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
544630
cp "${env:HIP_PATH}\bin\hipblaslt\library\*" "build\bin\hipblaslt\library\"
545-
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip .\build\bin\*
631+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
546632
547633
- name: Upload artifacts
548634
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
549635
uses: actions/upload-artifact@v4
550636
with:
551-
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
637+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
552638
path: |
553-
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
639+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
554640
555641
ubuntu-latest-rocm:
556642
runs-on: ubuntu-24.04
@@ -709,6 +795,7 @@ jobs:
709795
- macOS-latest-cmake
710796
- windows-latest-cmake
711797
- windows-latest-cmake-hip
798+
- windows-latest-rocm
712799

713800
steps:
714801
- name: Clone

docs/hipBLAS_on_Windows.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ Fortunately, `AMD` provides complete help documentation, you can use the help do
2626
2727
Then we must set `ROCM` as environment variables before running cmake.
2828

29-
Usually if you install according to the official tutorial and do not modify the ROCM path, then there is a high probability that it is here `C:\Program Files\AMD\ROCm\5.5\bin`
29+
Usually if you install according to the official tutorial and do not modify the ROCM path, then there is a high probability that it is here `C:\Program Files\AMD\ROCm\7.1.1\bin`
3030

3131
This is what I use to set the clang:
3232
```Commandline
33-
set CC=C:\Program Files\AMD\ROCm\5.5\bin\clang.exe
34-
set CXX=C:\Program Files\AMD\ROCm\5.5\bin\clang++.exe
33+
set CC=C:\Program Files\AMD\ROCm\7.1.1\bin\clang.exe
34+
set CXX=C:\Program Files\AMD\ROCm\7.1.1\bin\clang++.exe
3535
```
3636

3737
## Ninja
@@ -46,7 +46,7 @@ set ninja=C:\Program Files\ninja\ninja.exe
4646
## Building stable-diffusion.cpp
4747

4848
The thing different from the regular CPU build is `-DSD_HIPBLAS=ON` ,
49-
`-G "Ninja"`, `-DCMAKE_C_COMPILER=clang`, `-DCMAKE_CXX_COMPILER=clang++`, `-DAMDGPU_TARGETS=gfx1100`
49+
`-G "Ninja"`, `-DCMAKE_C_COMPILER=clang`, `-DCMAKE_CXX_COMPILER=clang++`, `-DAMDGPU_TARGETS=gfx1150;gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032`
5050

5151
>**Notice**: check the `clang` and `clang++` information:
5252
```Commandline
@@ -59,26 +59,29 @@ If you see like this, we can continue:
5959
clang version 17.0.0 (git@github.amd.com:Compute-Mirrors/llvm-project e3201662d21c48894f2156d302276eb1cf47c7be)
6060
Target: x86_64-pc-windows-msvc
6161
Thread model: posix
62-
InstalledDir: C:\Program Files\AMD\ROCm\5.5\bin
62+
InstalledDir: C:\Program Files\AMD\ROCm\7.1.1\bin
6363
```
6464

6565
```
6666
clang version 17.0.0 (git@github.amd.com:Compute-Mirrors/llvm-project e3201662d21c48894f2156d302276eb1cf47c7be)
6767
Target: x86_64-pc-windows-msvc
6868
Thread model: posix
69-
InstalledDir: C:\Program Files\AMD\ROCm\5.5\bin
69+
InstalledDir: C:\Program Files\AMD\ROCm\7.1.1\bin
7070
```
7171

72-
>**Notice** that the `gfx1100` is the GPU architecture of my GPU, you can change it to your GPU architecture. Click here to see your architecture [LLVM Target](https://rocm.docs.amd.com/en/latest/release/windows_support.html#windows-supported-gpus)
72+
>**Notice** that the GPU targets are now compatible with multiple GPU architectures (ROCm 7.1.1 targets). You can change them to match your GPU architecture. Click here to see your architecture [LLVM Target](https://rocm.docs.amd.com/en/latest/release/windows_support.html#windows-supported-gpus)
7373
74-
My GPU is AMD Radeon™ RX 7900 XTX Graphics, so I set it to `gfx1100`.
74+
Examples:
75+
- AMD Radeon™ RX 7900 XTX Graphics: `gfx1100`
76+
- AMD Radeon™ RX 7900 XT Graphics: `gfx1101`
77+
- AMD Radeon™ RX 7900 GRE Graphics: `gfx1102`
7578

7679
option:
7780

7881
```commandline
7982
mkdir build
8083
cd build
81-
cmake .. -G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSD_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS=gfx1100
84+
cmake .. -G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSD_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1150;gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
8285
cmake --build . --config Release
8386
```
8487

0 commit comments

Comments
 (0)