Skip to content

Commit ec1e0db

Browse files
committed
Merge branch 'superm1/windows-artifacts'
2 parents 62a9d71 + 5f8d89a commit ec1e0db

File tree

2 files changed

+107
-17
lines changed

2 files changed

+107
-17
lines changed

.github/workflows/build.yml

Lines changed: 95 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,98 @@ jobs:
387387
path: |
388388
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
389389
390+
windows-latest-rocm:
391+
runs-on: windows-2022
392+
393+
env:
394+
ROCM_VERSION: "7.11.0"
395+
GPU_TARGETS: "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201"
396+
397+
steps:
398+
- uses: actions/checkout@v3
399+
with:
400+
submodules: recursive
401+
402+
- name: Cache ROCm Installation
403+
id: cache-rocm
404+
uses: actions/cache@v4
405+
with:
406+
path: C:\TheRock\build
407+
key: rocm-${{ env.ROCM_VERSION }}-gfx1151-${{ runner.os }}
408+
409+
- name: ccache
410+
uses: ggml-org/ccache-action@v1.2.16
411+
with:
412+
key: windows-latest-rocm-${{ env.ROCM_VERSION }}-x64
413+
evict-old-files: 1d
414+
415+
- name: Install ROCm
416+
if: steps.cache-rocm.outputs.cache-hit != 'true'
417+
run: |
418+
$ErrorActionPreference = "Stop"
419+
write-host "Downloading AMD ROCm ${{ env.ROCM_VERSION }} tarball"
420+
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"
421+
write-host "Extracting ROCm tarball"
422+
mkdir C:\TheRock\build -Force
423+
tar -xzf "${env:RUNNER_TEMP}\rocm.tar.gz" -C C:\TheRock\build --strip-components=1
424+
write-host "Completed ROCm extraction"
425+
426+
- name: Setup ROCm Environment
427+
run: |
428+
$rocmPath = "C:\TheRock\build"
429+
echo "HIP_PATH=$rocmPath" >> $env:GITHUB_ENV
430+
echo "HIP_DEVICE_LIB_PATH=$rocmPath\lib\llvm\amdgcn\bitcode" >> $env:GITHUB_ENV
431+
echo "HIP_PLATFORM=amd" >> $env:GITHUB_ENV
432+
echo "LLVM_PATH=$rocmPath\lib\llvm" >> $env:GITHUB_ENV
433+
echo "$rocmPath\bin" >> $env:GITHUB_PATH
434+
echo "$rocmPath\lib\llvm\bin" >> $env:GITHUB_PATH
435+
436+
- name: Build
437+
run: |
438+
mkdir build
439+
cd build
440+
cmake .. `
441+
-G "Unix Makefiles" `
442+
-DCMAKE_PREFIX_PATH="${env:HIP_PATH}" `
443+
-DSD_HIPBLAS=ON `
444+
-DSD_BUILD_SHARED_LIBS=ON `
445+
-DGGML_NATIVE=OFF `
446+
-DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
447+
-DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" `
448+
-DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `
449+
-DHIP_PATH="${env:HIP_PATH}" `
450+
-DCMAKE_BUILD_TYPE=Release `
451+
-DGPU_TARGETS="${{ env.GPU_TARGETS }}"
452+
cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS}
453+
454+
- name: Get commit hash
455+
id: commit
456+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
457+
uses: pr-mpt/actions-commit-hash@v2
458+
459+
- name: Pack artifacts
460+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
461+
run: |
462+
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
463+
cp "${env:HIP_PATH}\bin\libhipblaslt.dll" "build\bin\"
464+
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
465+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
466+
467+
- name: Upload artifacts
468+
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
469+
uses: actions/upload-artifact@v4
470+
with:
471+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
472+
path: |
473+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
474+
390475
windows-latest-cmake-hip:
391476
runs-on: windows-2022
392477

393478
env:
394-
HIPSDK_INSTALLER_VERSION: "25.Q3"
395-
GPU_TARGETS: "gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
479+
HIPSDK_INSTALLER_VERSION: "26.Q1"
480+
ROCM_VERSION: "7.1.1"
481+
GPU_TARGETS: "gfx1150;gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
396482

397483
steps:
398484
- uses: actions/checkout@v3
@@ -417,7 +503,7 @@ jobs:
417503
run: |
418504
$ErrorActionPreference = "Stop"
419505
write-host "Downloading AMD HIP SDK Installer"
420-
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"
506+
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"
421507
write-host "Installing AMD HIP SDK"
422508
$proc = Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -PassThru
423509
$completed = $proc.WaitForExit(600000)
@@ -470,20 +556,20 @@ jobs:
470556
run: |
471557
md "build\bin\rocblas\library\"
472558
md "build\bin\hipblaslt\library"
473-
cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
474-
cp "${env:HIP_PATH}\bin\hipblaslt.dll" "build\bin\"
559+
cp "${env:HIP_PATH}\bin\libhipblas.dll" "build\bin\"
560+
cp "${env:HIP_PATH}\bin\libhipblaslt.dll" "build\bin\"
475561
cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
476562
cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
477563
cp "${env:HIP_PATH}\bin\hipblaslt\library\*" "build\bin\hipblaslt\library\"
478-
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip .\build\bin\*
564+
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\*
479565
480566
- name: Upload artifacts
481567
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
482568
uses: actions/upload-artifact@v4
483569
with:
484-
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
570+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
485571
path: |
486-
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-x64.zip
572+
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip
487573
488574
ubuntu-latest-rocm:
489575
runs-on: ubuntu-24.04
@@ -619,6 +705,7 @@ jobs:
619705
- macOS-latest-cmake
620706
- windows-latest-cmake
621707
- windows-latest-cmake-hip
708+
- windows-latest-rocm
622709

623710
steps:
624711
- 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)