Skip to content

Commit 6cb4121

Browse files
authored
Merge pull request #41 from DarthAffe/Backends
Updated build-pipeline for new version
2 parents 16d60ac + 9c7561e commit 6cb4121

File tree

3 files changed

+60
-46
lines changed

3 files changed

+60
-46
lines changed

.github/workflows/backends.yml

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,15 @@ jobs:
2323
matrix:
2424
include:
2525
- build: 'noavx'
26-
defines: '-DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON'
26+
defines: 'DGGML_NATIVE=OFF -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON'
2727
- build: 'avx'
28-
defines: '-DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON'
28+
defines: 'DGGML_NATIVE=OFF -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON'
2929
- build: 'avx2'
30-
defines: '-DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON'
30+
defines: 'DGGML_NATIVE=OFF -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON'
3131
- build: 'avx512'
32-
defines: '-DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON'
32+
defines: 'DGGML_NATIVE=OFF -DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON'
3333
- build: 'cuda12'
34-
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
35-
- build: 'rocm5'
36-
defines: '-G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSD_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1030" -DSD_BUILD_SHARED_LIBS=ON'
34+
defines: '-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON'
3735
- build: 'vulkan'
3836
defines: "-DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON"
3937

@@ -49,27 +47,11 @@ jobs:
4947
- name: Install cuda-toolkit
5048
id: cuda-toolkit-12
5149
if: ${{ matrix.build == 'cuda12' }}
52-
uses: Jimver/[email protected].16
50+
uses: Jimver/[email protected].19
5351
with:
54-
cuda: '12.5.0'
52+
cuda: '12.6.2'
5553
method: network
5654
sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
57-
use-github-cache: false
58-
use-local-cache: false
59-
60-
- name: Install rocm-toolkit
61-
id: rocm-toolkit
62-
if: ${{ matrix.build == 'rocm5' }}
63-
uses: Cyberhan123/[email protected]
64-
with:
65-
rocm: '5.5.0'
66-
67-
- name: Install Ninja
68-
id: install-ninja
69-
if: ${{ matrix.build == 'rocm5' }}
70-
uses: urkle/action-get-ninja@v1
71-
with:
72-
version: 1.11.1
7355

7456
- name: Install Vulkan SDK
7557
id: get_vulkan
@@ -90,28 +72,19 @@ jobs:
9072
9173
- name: Upload artifact
9274
id: upload_artifact
93-
if: ${{ matrix.build != 'rocm5' }}
9475
uses: actions/[email protected]
9576
with:
9677
name: windows-${{ matrix.build }}
9778
path: .\build\bin\Release\stable-diffusion.dll
9879

99-
- name: Upload artifact Rocm
100-
id: upload_artifact_rocm
101-
if: ${{ matrix.build == 'rocm5' }}
102-
uses: actions/[email protected]
103-
with:
104-
name: windows-${{ matrix.build }}
105-
path: .\build\bin\stable-diffusion.dll
106-
10780
windows-2019:
10881
runs-on: windows-2019
10982

11083
strategy:
11184
matrix:
11285
include:
11386
- build: 'cuda11'
114-
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_FLAGS="-allow-unsupported-compiler"'
87+
defines: '-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_FLAGS="-allow-unsupported-compiler"'
11588

11689
steps:
11790
- name: Checkout
@@ -157,8 +130,9 @@ jobs:
157130
shell: bash
158131

159132
env:
160-
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe
161-
WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel
133+
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/b380d914-366b-4b77-a74a-05e3c38b3514/intel-oneapi-base-toolkit-2025.0.0.882_offline.exe
134+
WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
135+
ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
162136

163137
steps:
164138
- name: Checkout
@@ -194,6 +168,49 @@ jobs:
194168
name: windows-sycl
195169
path: .\build\bin\stable-diffusion.dll
196170

171+
windows-hip:
172+
runs-on: windows-latest
173+
174+
steps:
175+
- name: Install
176+
id: depends
177+
run: |
178+
$ErrorActionPreference = "Stop"
179+
write-host "Downloading AMD HIP SDK Installer"
180+
Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q4-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
181+
write-host "Installing AMD HIP SDK"
182+
Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
183+
write-host "Completed AMD HIP SDK installation"
184+
- name: Verify ROCm
185+
id: verify
186+
run: |
187+
& 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
188+
189+
- name: Checkout
190+
id: checkout
191+
uses: actions/[email protected]
192+
with:
193+
repository: 'leejet/stable-diffusion.cpp'
194+
ref: '${{ github.event.inputs.commit }}'
195+
submodules: recursive
196+
197+
- name: Build
198+
id: cmake_build
199+
run: |
200+
$env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
201+
$env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
202+
mkdir build
203+
cd build
204+
cmake -G "Unix Makefiles" .. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" -DGGML_HIP=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1101;gfx1030" -DGGML_RPC=ON -DSD_BUILD_SHARED_LIBS=ON
205+
cmake --build . --config Release
206+
207+
- name: Upload artifact
208+
id: upload_artifact
209+
uses: actions/[email protected]
210+
with:
211+
name: windows-rocm6
212+
path: .\build\bin\stable-diffusion.dll
213+
197214
linux:
198215
runs-on: ubuntu-latest
199216
strategy:
@@ -208,9 +225,9 @@ jobs:
208225
- build: 'avx512'
209226
defines: '-DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON'
210227
- build: 'cuda11'
211-
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
228+
defines: '-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON'
212229
- build: 'cuda12'
213-
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
230+
defines: '-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON'
214231
- build: 'sycl'
215232
defines: '-DSD_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DSD_BUILD_SHARED_LIBS=ON'
216233

@@ -307,7 +324,7 @@ jobs:
307324
run: |
308325
mkdir build
309326
cd build
310-
cmake .. -DCMAKE_C_COMPILER=hipcc -DCMAKE_CXX_COMPILER=hipcc -DSD_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1030" -DSD_BUILD_SHARED_LIBS=ON
327+
cmake .. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" -DGGML_HIP=ON -DSD_BUILD_SHARED_LIBS=ON
311328
cmake --build . --config Release
312329
313330
- name: Upload artifact Rocm
@@ -361,6 +378,7 @@ jobs:
361378

362379
needs:
363380
- windows
381+
- windows-hip
364382
- windows-sycl
365383
- linux
366384
- linux-hip

Backends/StableDiffusion.NET.Backend.Rocm.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<files>
1919
<file src="StableDiffusion.NET.Backend.props" target="build/net8.0/StableDiffusion.NET.Backend.Rocm.props" />
2020

21-
<file src="windows-rocm5/stable-diffusion.dll" target="runtimes\win-x64\native\rocm5\stable-diffusion.dll" />
21+
<file src="windows-rocm6/stable-diffusion.dll" target="runtimes\win-x64\native\rocm6\stable-diffusion.dll" />
2222

2323
<file src="linux-rocm6/libstable-diffusion.so" target="runtimes\linux-x64\native\rocm6\libstable-diffusion.so" />
2424

StableDiffusion.NET/Backends/RocmBackend.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ public partial class RocmBackend : IBackend
1414

1515
public int Priority { get; set; } = 10;
1616

17-
public bool IsAvailable => ((RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
18-
&& RocmVersion is 5)
19-
|| (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
20-
&& RocmVersion is 6))
21-
&& (RuntimeInformation.OSArchitecture == Architecture.X64);
17+
public bool IsAvailable => (RocmVersion == 6) && (RuntimeInformation.OSArchitecture == Architecture.X64);
2218

2319
public string PathPart => RocmVersion switch
2420
{

0 commit comments

Comments
 (0)