@@ -2,15 +2,9 @@ name: CI
2
2
3
3
on :
4
4
workflow_dispatch : # allows manual triggering
5
- inputs :
6
- create_release :
7
- description : " Create new release"
8
- required : true
9
- type : boolean
10
5
push :
11
6
branches :
12
7
- master
13
- - ci
14
8
paths :
15
9
[
16
10
" .github/workflows/**" ,
@@ -39,293 +33,105 @@ env:
39
33
BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
40
34
41
35
jobs :
42
- ubuntu-latest-cmake :
43
- runs-on : ubuntu-latest
44
-
45
- steps :
46
- - name : Clone
47
- id : checkout
48
- uses : actions/checkout@v3
49
- with :
50
- submodules : recursive
51
-
52
- - name : Dependencies
53
- id : depends
54
- run : |
55
- sudo apt-get update
56
- sudo apt-get install build-essential
57
-
58
- - name : Build
59
- id : cmake_build
60
- run : |
61
- mkdir build
62
- cd build
63
- cmake .. -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON
64
- cmake --build . --config Release
65
-
66
- - name : Get commit hash
67
- id : commit
68
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }}
69
- uses : pr-mpt/actions-commit-hash@v2
70
-
71
- - name : Fetch system info
72
- id : system-info
73
- run : |
74
- echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT"
75
- echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT"
76
- echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT"
77
- echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT"
78
-
79
- - name : Pack artifacts
80
- id : pack_artifacts
81
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
82
- run : |
83
- cp ggml/LICENSE ./build/bin/ggml.txt
84
- cp LICENSE ./build/bin/stable-diffusion.cpp.txt
85
- zip -j sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/bin/*
86
-
87
- - name : Upload artifacts
88
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
89
- uses : actions/upload-artifact@v4
90
- with :
91
- name : sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip
92
- path : |
93
- sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip
94
-
95
- macOS-latest-cmake :
96
- runs-on : macos-latest
97
-
98
- steps :
99
- - name : Clone
100
- id : checkout
101
- uses : actions/checkout@v3
102
- with :
103
- submodules : recursive
104
-
105
- - name : Dependencies
106
- id : depends
107
- run : |
108
- brew install zip
109
-
110
- - name : Build
111
- id : cmake_build
112
- run : |
113
- sysctl -a
114
- mkdir build
115
- cd build
116
- cmake .. -DGGML_AVX2=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DSD_BUILD_SHARED_LIBS=ON
117
- cmake --build . --config Release
118
-
119
- - name : Get commit hash
120
- id : commit
121
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }}
122
- uses : pr-mpt/actions-commit-hash@v2
123
-
124
- - name : Fetch system info
125
- id : system-info
126
- run : |
127
- echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT"
128
- echo "OS_NAME=`sw_vers -productName`" >> "$GITHUB_OUTPUT"
129
- echo "OS_VERSION=`sw_vers -productVersion`" >> "$GITHUB_OUTPUT"
130
- echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT"
131
-
132
- - name : Pack artifacts
133
- id : pack_artifacts
134
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
135
- run : |
136
- cp ggml/LICENSE ./build/bin/ggml.txt
137
- cp LICENSE ./build/bin/stable-diffusion.cpp.txt
138
- zip -j sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/bin/*
139
-
140
- - name : Upload artifacts
141
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
142
- uses : actions/upload-artifact@v4
143
- with :
144
- name : sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip
145
- path : |
146
- sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip
147
-
148
36
windows-latest-cmake :
149
- runs-on : windows-2019
37
+ runs-on : windows-latest
150
38
151
39
env :
152
40
VULKAN_VERSION : 1.3.261.1
41
+ 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
42
+ WINDOWS_DPCPP_MKL : intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
43
+ ONEAPI_ROOT : " C:/Program Files (x86)/Intel/oneAPI"
153
44
154
45
strategy :
155
46
matrix :
156
47
include :
157
- - build : " noavx"
158
- defines : " -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON"
159
48
- build : " avx2"
160
- defines : " -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON"
161
- - build : " avx"
162
- defines : " -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON"
163
- - build : " avx512"
164
- defines : " -DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON"
165
- - build : " cuda12"
166
- defines : " -DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON"
167
- # - build: "rocm5.5"
168
- # 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'
49
+ defines : " -DGGML_AVX2=ON"
169
50
- build : ' vulkan'
170
- defines : " -DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON"
51
+ defines : " -DSD_VULKAN=ON"
52
+ - build : ' sycl'
53
+ defines : " -DSD_SYCL=ON build -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx -DCMAKE_BUILD_TYPE=Release"
171
54
steps :
172
55
- name : Clone
173
56
id : checkout
174
- uses : actions/checkout@v3
57
+ uses : actions/checkout@v4
175
58
with :
176
59
submodules : recursive
177
60
178
- - name : Install cuda-toolkit
179
- id : cuda-toolkit
180
- if : ${{ matrix.build == 'cuda12' }}
181
- uses : Jimver/cuda-toolkit@v0.2.11
182
- with :
183
- cuda : " 12.2.0"
184
- method : " network"
185
- sub-packages : ' ["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
186
-
187
- - name : Install rocm-toolkit
188
- id : rocm-toolkit
189
- if : ${{ matrix.build == 'rocm5.5' }}
190
- uses : Cyberhan123/rocm-toolkit@v0.1.0
191
- with :
192
- rocm : " 5.5.0"
61
+ - name : Install dependencies
62
+ uses : seanmiddleditch/gha-setup-ninja@v4
63
+
64
+ - name : Install oneapi
65
+ if : matrix.build == 'sycl'
66
+ shell : cmd
67
+ run : |
68
+ set URL=${{ env.WINDOWS_BASEKIT_URL }}
69
+ set COMPONENTS=${{ env.WINDOWS_DPCPP_MKL }}
70
+
71
+ curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5
72
+ start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log
73
+ del %TEMP%\webimage.exe
74
+ if "%COMPONENTS%"=="" (
75
+ webimage_extracted\bootstrapper.exe -s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=.
76
+ ) else (
77
+ webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=.
78
+ )
79
+ set installer_exit_code=%ERRORLEVEL%
80
+ rd /s/q "webimage_extracted"
81
+ exit /b %installer_exit_code%
193
82
194
- - name : Install Ninja
195
- id : install-ninja
196
- if : ${{ matrix.build == 'rocm5.5' }}
197
- uses : urkle/action-get-ninja@v1
198
- with :
199
- version : 1.11.1
200
83
- name : Install Vulkan SDK
201
84
id : get_vulkan
202
- if : ${{ matrix.build == 'vulkan' }}
203
- run : |
204
- curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"
205
- & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
206
- Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
207
- Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
85
+ if : matrix.build == 'vulkan'
86
+ uses : humbletim/install-vulkan-sdk@main
87
+ with :
88
+ version : ${{ env.VULKAN_VERSION }}
89
+ cache : true
208
90
209
91
- name : Build
210
92
id : cmake_build
93
+ shell : cmd
211
94
run : |
95
+ if "${{ matrix.build }}" == "sycl" (
96
+ @call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 --force
97
+ )
212
98
mkdir build
213
99
cd build
214
- cmake .. ${{ matrix.defines }}
215
- cmake --build . --config Release
216
-
217
- - name : Check AVX512F support
218
- id : check_avx512f
219
- if : ${{ matrix.build == 'avx512' }}
220
- continue-on-error : true
221
- run : |
222
- cd build
223
- $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
224
- $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
225
- $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe')
226
- echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c
227
- & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
228
- .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
100
+ cmake .. -G "Ninja" ${{ matrix.defines }}
101
+ cmake --build . --config Release -j
229
102
230
103
- name : Get commit hash
231
104
id : commit
232
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
233
105
uses : pr-mpt/actions-commit-hash@v2
234
106
235
- - name : Pack artifacts
107
+ - name : Build the release package
108
+ if : matrix.build == 'sycl'
236
109
id : pack_artifacts
237
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
110
+ shell : bash
238
111
run : |
239
- $filePath = ".\build\bin\Release\*"
240
- if (Test-Path $filePath) {
241
- echo "Exists at path $filePath"
242
- Copy-Item ggml/LICENSE .\build\bin\Release\ggml.txt
243
- Copy-Item LICENSE .\build\bin\Release\stable-diffusion.cpp.txt
244
- } elseif (Test-Path ".\build\bin\stable-diffusion.dll") {
245
- $filePath = ".\build\bin\*"
246
- echo "Exists at path $filePath"
247
- Copy-Item ggml/LICENSE .\build\bin\ggml.txt
248
- Copy-Item LICENSE .\build\bin\stable-diffusion.cpp.txt
249
- } else {
250
- ls .\build\bin
251
- throw "Can't find stable-diffusion.dll"
252
- }
253
- 7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip $filePath
112
+ echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
254
113
255
- - name : Copy and pack Cuda runtime
256
- id : pack_cuda_runtime
257
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build == 'cuda12' ) || github.event.inputs.create_release == 'true' }}
258
- run : |
259
- echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
260
- $dst='.\build\bin\cudart\'
261
- robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
262
- 7z a cudart-sd-bin-win-cu12-x64.zip $dst\*
114
+ cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.5.dll" ./build/bin
115
+ cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin
116
+ cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin
263
117
264
- - name : Upload Cuda runtime
265
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build == 'cuda12' ) || github.event.inputs.create_release == 'true' }}
266
- uses : actions/upload-artifact@v4
267
- with :
268
- name : sd-cudart-sd-bin-win-cu12-x64.zip
269
- path : |
270
- cudart-sd-bin-win-cu12-x64.zip
118
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_level_zero.dll" ./build/bin
119
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_opencl.dll" ./build/bin
120
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_loader.dll" ./build/bin
121
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_win_proxy_loader.dll" ./build/bin
271
122
272
- - name : Upload artifacts
273
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
274
- uses : actions/upload-artifact@v4
275
- with :
276
- name : sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
277
- path : |
278
- sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
279
-
280
- release :
281
- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
123
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl8.dll" ./build/bin
124
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin
125
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin
126
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libiomp5md.dll" ./build/bin
282
127
283
- runs-on : ubuntu-latest
128
+ cp "${{ env.ONEAPI_ROOT }}/dnnl/latest/bin/dnnl.dll" ./build/bin
129
+ cp "${{ env.ONEAPI_ROOT }}/tbb/latest/bin/tbb12.dll" ./build/bin
284
130
285
- needs :
286
- - ubuntu-latest-cmake
287
- - macOS-latest-cmake
288
- - windows-latest-cmake
131
+ echo "cp oneAPI running time dll files to ./build/bin done"
289
132
290
- steps :
291
- - name : Download artifacts
292
- id : download-artifact
293
- uses : actions/download-artifact@v4
294
- with :
295
- path : ./artifact
296
- pattern : sd-*
297
- merge-multiple : true
298
-
299
- - name : Get commit hash
300
- id : commit
301
- uses : pr-mpt/actions-commit-hash@v2
302
-
303
- - name : Create release
304
- id : create_release
305
- uses : anzz1/action-create-release@v1
306
- env :
307
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
308
- with :
309
- tag_name : ${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}
310
-
311
- - name : Upload release
312
- id : upload_release
313
- uses : actions/github-script@v3
133
+ - name : Upload artifacts
134
+ uses : actions/upload-artifact@v4
314
135
with :
315
- github-token : ${{secrets.GITHUB_TOKEN}}
316
- script : |
317
- const path = require('path');
318
- const fs = require('fs');
319
- const release_id = '${{ steps.create_release.outputs.id }}';
320
- for (let file of await fs.readdirSync('./artifact')) {
321
- if (path.extname(file) === '.zip') {
322
- console.log('uploadReleaseAsset', file);
323
- await github.repos.uploadReleaseAsset({
324
- owner: context.repo.owner,
325
- repo: context.repo.repo,
326
- release_id: release_id,
327
- name: file,
328
- data: await fs.readFileSync(`./artifact/${file}`)
329
- });
330
- }
331
- }
136
+ name : sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
137
+ path : build/bin/
0 commit comments