Skip to content

Commit c3718a8

Browse files
committed
Reapply "Merge remote-tracking branch 'upstream/master'"
This reverts commit fc34048.
1 parent fc34048 commit c3718a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2433551
-2170
lines changed

.github/workflows/build.yml

Lines changed: 63 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,36 @@ on:
44
workflow_dispatch: # allows manual triggering
55
inputs:
66
create_release:
7-
description: 'Create new release'
7+
description: "Create new release"
88
required: true
99
type: boolean
1010
push:
1111
branches:
1212
- master
1313
- ci
14-
paths: ['.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu']
14+
paths:
15+
[
16+
".github/workflows/**",
17+
"**/CMakeLists.txt",
18+
"**/Makefile",
19+
"**/*.h",
20+
"**/*.hpp",
21+
"**/*.c",
22+
"**/*.cpp",
23+
"**/*.cu",
24+
]
1525
pull_request:
1626
types: [opened, synchronize, reopened]
17-
paths: ['**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu']
27+
paths:
28+
[
29+
"**/CMakeLists.txt",
30+
"**/Makefile",
31+
"**/*.h",
32+
"**/*.hpp",
33+
"**/*.c",
34+
"**/*.cpp",
35+
"**/*.cu",
36+
]
1837

1938
env:
2039
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
@@ -67,12 +86,12 @@ jobs:
6786
6887
- name: Upload artifacts
6988
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
70-
uses: actions/upload-artifact@v3
89+
uses: actions/upload-artifact@v4
7190
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
7292
path: |
7393
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
7494
75-
7695
macOS-latest-cmake:
7796
runs-on: macos-latest
7897

@@ -120,30 +139,35 @@ jobs:
120139
121140
- name: Upload artifacts
122141
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
123-
uses: actions/upload-artifact@v3
142+
uses: actions/upload-artifact@v4
124143
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
125145
path: |
126146
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
127147
128-
129148
windows-latest-cmake:
130-
runs-on: windows-latest
149+
runs-on: windows-2019
150+
151+
env:
152+
VULKAN_VERSION: 1.3.261.1
131153

132154
strategy:
133155
matrix:
134156
include:
135-
- build: 'noavx'
136-
defines: '-DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON'
137-
- build: 'avx2'
138-
defines: '-DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON'
139-
- build: 'avx'
140-
defines: '-DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON'
141-
- build: 'avx512'
142-
defines: '-DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON'
143-
- build: 'cuda12'
144-
defines: '-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON'
145-
- build: 'rocm5.5'
157+
- build: "noavx"
158+
defines: "-DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON"
159+
- 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_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON"
167+
- build: "rocm5.5"
146168
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'
169+
- build: 'vulkan'
170+
defines: "-DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON"
147171
steps:
148172
- name: Clone
149173
id: checkout
@@ -156,23 +180,31 @@ jobs:
156180
if: ${{ matrix.build == 'cuda12' }}
157181
uses: Jimver/cuda-toolkit@v0.2.11
158182
with:
159-
cuda: '12.2.0'
160-
method: 'network'
183+
cuda: "12.2.0"
184+
method: "network"
161185
sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
162186

163187
- name: Install rocm-toolkit
164188
id: rocm-toolkit
165189
if: ${{ matrix.build == 'rocm5.5' }}
166190
uses: Cyberhan123/rocm-toolkit@v0.1.0
167191
with:
168-
rocm: '5.5.0'
192+
rocm: "5.5.0"
169193

170194
- name: Install Ninja
171195
id: install-ninja
172196
if: ${{ matrix.build == 'rocm5.5' }}
173197
uses: urkle/action-get-ninja@v1
174198
with:
175199
version: 1.11.1
200+
- name: Install Vulkan SDK
201+
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"
176208
177209
- name: Build
178210
id: cmake_build
@@ -231,15 +263,17 @@ jobs:
231263
232264
- name: Upload Cuda runtime
233265
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build == 'cuda12' ) || github.event.inputs.create_release == 'true' }}
234-
uses: actions/upload-artifact@v3
266+
uses: actions/upload-artifact@v4
235267
with:
268+
name: sd-cudart-sd-bin-win-cu12-x64.zip
236269
path: |
237270
cudart-sd-bin-win-cu12-x64.zip
238271
239272
- name: Upload artifacts
240273
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
241-
uses: actions/upload-artifact@v3
274+
uses: actions/upload-artifact@v4
242275
with:
276+
name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
243277
path: |
244278
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
245279
@@ -256,7 +290,11 @@ jobs:
256290
steps:
257291
- name: Download artifacts
258292
id: download-artifact
259-
uses: actions/download-artifact@v3
293+
uses: actions/download-artifact@v4
294+
with:
295+
path: ./artifact
296+
pattern: sd-*
297+
merge-multiple: true
260298

261299
- name: Get commit hash
262300
id: commit

CMakeLists.txt

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,31 @@ option(SD_BUILD_EXAMPLES "sd: build examples" ${SD_STANDALONE})
2727
option(SD_CUBLAS "sd: cuda backend" OFF)
2828
option(SD_HIPBLAS "sd: rocm backend" OFF)
2929
option(SD_METAL "sd: metal backend" OFF)
30+
option(SD_VULKAN "sd: vulkan backend" OFF)
31+
option(SD_SYCL "sd: sycl backend" OFF)
3032
option(SD_FLASH_ATTN "sd: use flash attention for x4 less memory usage" OFF)
3133
option(SD_FAST_SOFTMAX "sd: x1.5 faster softmax, indeterministic (sometimes, same seed don't generate same image), cuda only" OFF)
3234
option(SD_BUILD_SHARED_LIBS "sd: build shared libs" OFF)
3335
#option(SD_BUILD_SERVER "sd: build server example" ON)
3436

3537
if(SD_CUBLAS)
36-
message("Use CUBLAS as backend stable-diffusion")
37-
set(GGML_CUBLAS ON)
38+
message("Use CUBLAS as backend stable-diffusion")
39+
set(GGML_CUDA ON)
3840
add_definitions(-DSD_USE_CUBLAS)
3941
endif()
4042

4143
if(SD_METAL)
42-
message("Use Metal as backend stable-diffusion")
44+
message("Use Metal as backend stable-diffusion")
4345
set(GGML_METAL ON)
4446
add_definitions(-DSD_USE_METAL)
4547
endif()
4648

49+
if (SD_VULKAN)
50+
message("Use Vulkan as backend stable-diffusion")
51+
set(GGML_VULKAN ON)
52+
add_definitions(-DSD_USE_VULKAN)
53+
endif ()
54+
4755
if (SD_HIPBLAS)
4856
message("Use HIPBLAS as backend stable-diffusion")
4957
set(GGML_HIPBLAS ON)
@@ -53,6 +61,12 @@ if (SD_HIPBLAS)
5361
endif()
5462
endif ()
5563

64+
if(SD_SYCL)
65+
message("Use SYCL as backend stable-diffusion")
66+
set(GGML_SYCL ON)
67+
add_definitions(-DSD_USE_SYCL)
68+
endif()
69+
5670
if(SD_FLASH_ATTN)
5771
message("Use Flash Attention for memory optimization")
5872
add_definitions(-DSD_USE_FLASH_ATTENTION)
@@ -88,7 +102,10 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
88102
add_definitions(-DGGML_MAX_NAME=128)
89103

90104
# deps
91-
add_subdirectory(ggml)
105+
# Only add ggml if it hasn't been added yet
106+
if (NOT TARGET ggml)
107+
add_subdirectory(ggml)
108+
endif()
92109

93110
add_subdirectory(thirdparty)
94111

0 commit comments

Comments
 (0)