@@ -43,350 +43,6 @@ concurrency:
4343 cancel-in-progress : true
4444
4545jobs :
46- ubuntu-latest-cmake :
47- runs-on : ubuntu-latest
48-
49- steps :
50- - name : Clone
51- id : checkout
52- uses : actions/checkout@v3
53- with :
54- submodules : recursive
55-
56- - name : Dependencies
57- id : depends
58- run : |
59- sudo apt-get update
60- sudo apt-get install build-essential
61-
62- - name : Build
63- id : cmake_build
64- run : |
65- mkdir build
66- cd build
67- cmake .. -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON
68- cmake --build . --config Release
69-
70- - name : Get commit hash
71- id : commit
72- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
73- uses : pr-mpt/actions-commit-hash@v2
74-
75- - name : Fetch system info
76- id : system-info
77- run : |
78- echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT"
79- echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT"
80- echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT"
81- echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT"
82-
83- - name : Pack artifacts
84- id : pack_artifacts
85- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
86- run : |
87- cp ggml/LICENSE ./build/bin/ggml.txt
88- cp LICENSE ./build/bin/stable-diffusion.cpp.txt
89- 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/*
90-
91- - name : Upload artifacts
92- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
93- uses : actions/upload-artifact@v4
94- with :
95- 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
96- path : |
97- 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
98-
99- ubuntu-latest-cmake-vulkan :
100- runs-on : ubuntu-latest
101-
102- steps :
103- - name : Clone
104- id : checkout
105- uses : actions/checkout@v3
106- with :
107- submodules : recursive
108-
109- - name : Dependencies
110- id : depends
111- run : |
112- sudo apt-get update
113- sudo apt-get install build-essential libvulkan-dev glslc
114-
115- - name : Build
116- id : cmake_build
117- run : |
118- mkdir build
119- cd build
120- cmake .. -DSD_BUILD_SHARED_LIBS=ON -DSD_VULKAN=ON
121- cmake --build . --config Release
122-
123- - name : Get commit hash
124- id : commit
125- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
126- uses : pr-mpt/actions-commit-hash@v2
127-
128- - name : Fetch system info
129- id : system-info
130- run : |
131- echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT"
132- echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT"
133- echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT"
134- echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT"
135-
136- - name : Pack artifacts
137- id : pack_artifacts
138- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
139- run : |
140- cp ggml/LICENSE ./build/bin/ggml.txt
141- cp LICENSE ./build/bin/stable-diffusion.cpp.txt
142- 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 }}-vulkan.zip ./build/bin/*
143-
144- - name : Upload artifacts
145- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
146- uses : actions/upload-artifact@v4
147- with :
148- 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 }}-vulkan.zip
149- path : |
150- 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 }}-vulkan.zip
151-
152- build-and-push-docker-images :
153- name : Build and push container images
154- runs-on : ubuntu-latest
155-
156- permissions :
157- contents : read
158- packages : write
159- id-token : write
160- attestations : write
161- artifact-metadata : write
162-
163- strategy :
164- matrix :
165- variant : [musa, sycl, vulkan]
166-
167- env :
168- REGISTRY : ghcr.io
169- IMAGE_NAME : ${{ github.repository }}
170-
171- steps :
172- - name : Checkout
173- uses : actions/checkout@v6
174- with :
175- submodules : recursive
176-
177- - name : Get commit hash
178- id : commit
179- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
180- uses : pr-mpt/actions-commit-hash@v2
181-
182- - name : Set up Docker Buildx
183- uses : docker/setup-buildx-action@v3
184-
185- - name : Log in to the container registry
186- uses : docker/login-action@v3
187- with :
188- registry : ${{ env.REGISTRY }}
189- username : ${{ github.actor }}
190- password : ${{ secrets.GITHUB_TOKEN }}
191-
192- - name : Extract metadata for Docker
193- id : meta
194- uses : docker/metadata-action@v5
195- with :
196- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
197-
198- - name : Free Disk Space (Ubuntu)
199- uses : jlumbroso/free-disk-space@v1.3.1
200- with :
201- # this might remove tools that are actually needed,
202- # if set to "true" but frees about 6 GB
203- tool-cache : false
204-
205- - name : Build and push Docker image
206- id : build-push
207- uses : docker/build-push-action@v6
208- with :
209- platforms : linux/amd64
210- push : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
211- file : Dockerfile.${{ matrix.variant }}
212- tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ matrix.variant }}
213- labels : ${{ steps.meta.outputs.labels }}
214- annotations : ${{ steps.meta.outputs.annotations }}
215-
216- macOS-latest-cmake :
217- runs-on : macos-latest
218-
219- steps :
220- - name : Clone
221- id : checkout
222- uses : actions/checkout@v3
223- with :
224- submodules : recursive
225-
226- - name : Dependencies
227- id : depends
228- run : |
229- brew install zip
230-
231- - name : Build
232- id : cmake_build
233- run : |
234- sysctl -a
235- mkdir build
236- cd build
237- cmake .. -DGGML_AVX2=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DSD_BUILD_SHARED_LIBS=ON
238- cmake --build . --config Release
239-
240- - name : Get commit hash
241- id : commit
242- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
243- uses : pr-mpt/actions-commit-hash@v2
244-
245- - name : Fetch system info
246- id : system-info
247- run : |
248- echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT"
249- echo "OS_NAME=`sw_vers -productName`" >> "$GITHUB_OUTPUT"
250- echo "OS_VERSION=`sw_vers -productVersion`" >> "$GITHUB_OUTPUT"
251- echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT"
252-
253- - name : Pack artifacts
254- id : pack_artifacts
255- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
256- run : |
257- cp ggml/LICENSE ./build/bin/ggml.txt
258- cp LICENSE ./build/bin/stable-diffusion.cpp.txt
259- 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/*
260-
261- - name : Upload artifacts
262- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
263- uses : actions/upload-artifact@v4
264- with :
265- 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
266- path : |
267- 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
268-
269- windows-latest-cmake :
270- runs-on : windows-2022
271-
272- env :
273- VULKAN_VERSION : 1.4.328.1
274-
275- strategy :
276- matrix :
277- include :
278- - build : " noavx"
279- defines : " -DGGML_NATIVE=OFF -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON"
280- - build : " avx2"
281- defines : " -DGGML_NATIVE=OFF -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON"
282- - build : " avx"
283- defines : " -DGGML_NATIVE=OFF -DGGML_AVX=ON -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON"
284- - build : " avx512"
285- defines : " -DGGML_NATIVE=OFF -DGGML_AVX512=ON -DGGML_AVX=ON -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON"
286- - build : " cuda12"
287- defines : " -DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_ARCHITECTURES='61;70;75;80;86;89;90;100;120' -DCMAKE_CUDA_FLAGS='-Xcudafe \" --diag_suppress=177\" -Xcudafe \" --diag_suppress=550\" '"
288- - build : " vulkan"
289- defines : " -DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON"
290- steps :
291- - name : Clone
292- id : checkout
293- uses : actions/checkout@v3
294- with :
295- submodules : recursive
296-
297- - name : Install cuda-toolkit
298- id : cuda-toolkit
299- if : ${{ matrix.build == 'cuda12' }}
300- uses : Jimver/cuda-toolkit@v0.2.22
301- with :
302- cuda : " 12.8.1"
303- method : " network"
304- sub-packages : ' ["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
305-
306- - name : Install Vulkan SDK
307- id : get_vulkan
308- if : ${{ matrix.build == 'vulkan' }}
309- run : |
310- curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_VERSION}.exe"
311- & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
312- Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
313- Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
314-
315- - name : Activate MSVC environment
316- id : msvc_dev_cmd
317- uses : ilammy/msvc-dev-cmd@v1
318-
319- - name : Build
320- id : cmake_build
321- run : |
322- mkdir build
323- cd build
324- cmake .. -DCMAKE_CXX_FLAGS='/bigobj' -G Ninja -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_BUILD_TYPE=Release ${{ matrix.defines }}
325- cmake --build .
326-
327- - name : Check AVX512F support
328- id : check_avx512f
329- if : ${{ matrix.build == 'avx512' }}
330- continue-on-error : true
331- run : |
332- cd build
333- $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
334- $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
335- $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe')
336- echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c
337- & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
338- .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
339-
340- - name : Get commit hash
341- id : commit
342- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
343- uses : pr-mpt/actions-commit-hash@v2
344-
345- - name : Pack artifacts
346- id : pack_artifacts
347- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
348- run : |
349- $filePath = ".\build\bin\Release\*"
350- if (Test-Path $filePath) {
351- echo "Exists at path $filePath"
352- Copy-Item ggml/LICENSE .\build\bin\Release\ggml.txt
353- Copy-Item LICENSE .\build\bin\Release\stable-diffusion.cpp.txt
354- } elseif (Test-Path ".\build\bin\stable-diffusion.dll") {
355- $filePath = ".\build\bin\*"
356- echo "Exists at path $filePath"
357- Copy-Item ggml/LICENSE .\build\bin\ggml.txt
358- Copy-Item LICENSE .\build\bin\stable-diffusion.cpp.txt
359- } else {
360- ls .\build\bin
361- throw "Can't find stable-diffusion.dll"
362- }
363- 7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip $filePath
364-
365- - name : Copy and pack Cuda runtime
366- id : pack_cuda_runtime
367- if : ${{ matrix.build == 'cuda12' && (github.event_name == 'push' && github.ref == 'refs/heads/master' || github.event.inputs.create_release == 'true') }}
368- run : |
369- echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
370- $dst='.\build\bin\cudart\'
371- robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
372- 7z a cudart-sd-bin-win-cu12-x64.zip $dst\*
373-
374- - name : Upload Cuda runtime
375- if : ${{ matrix.build == 'cuda12' && (github.event_name == 'push' && github.ref == 'refs/heads/master' || github.event.inputs.create_release == 'true') }}
376- uses : actions/upload-artifact@v4
377- with :
378- name : sd-cudart-sd-bin-win-cu12-x64.zip
379- path : |
380- cudart-sd-bin-win-cu12-x64.zip
381-
382- - name : Upload artifacts
383- if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
384- uses : actions/upload-artifact@v4
385- with :
386- name : sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
387- path : |
388- sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
389-
39046 windows-latest-cmake-hip :
39147 runs-on : windows-2022
39248
@@ -601,12 +257,7 @@ jobs:
601257 runs-on : ubuntu-latest
602258
603259 needs :
604- - ubuntu-latest-cmake
605- - ubuntu-latest-cmake-vulkan
606260 - ubuntu-latest-rocm
607- - build-and-push-docker-images
608- - macOS-latest-cmake
609- - windows-latest-cmake
610261 - windows-latest-cmake-hip
611262
612263 steps :
0 commit comments