30
30
with :
31
31
submodules : recursive
32
32
33
-
34
33
- name : Dependencies
35
34
id : depends
36
35
run : |
@@ -42,14 +41,37 @@ jobs:
42
41
run : |
43
42
mkdir build
44
43
cd build
45
- cmake ..
44
+ cmake .. -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON
46
45
cmake --build . --config Release
47
46
48
- # - name: Test
49
- # id: cmake_test
50
- # run: |
51
- # cd build
52
- # ctest --verbose --timeout 900
47
+ - name : Get commit hash
48
+ id : commit
49
+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }}
50
+ uses : pr-mpt/actions-commit-hash@v2
51
+
52
+ - name : Fetch system info
53
+ id : system-info
54
+ run : |
55
+ echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT"
56
+ echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT"
57
+ echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT"
58
+ echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT"
59
+
60
+ - name : Pack artifacts
61
+ id : pack_artifacts
62
+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
63
+ run : |
64
+ cp ggml/LICENSE ./build/bin/ggml.txt
65
+ cp LICENSE ./build/bin/stable-diffusion.cpp.txt
66
+ 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/*
67
+
68
+ - name : Upload artifacts
69
+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
70
+ uses : actions/upload-artifact@v3
71
+ with :
72
+ path : |
73
+ 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
74
+
53
75
54
76
macOS-latest-cmake :
55
77
runs-on : macos-latest
@@ -63,24 +85,46 @@ jobs:
63
85
64
86
- name : Dependencies
65
87
id : depends
66
- continue-on-error : true
67
88
run : |
68
- brew update
89
+ brew install zip
69
90
70
91
- name : Build
71
92
id : cmake_build
72
93
run : |
73
94
sysctl -a
74
95
mkdir build
75
96
cd build
76
- cmake ..
97
+ cmake .. -DGGML_AVX2=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DSD_BUILD_SHARED_LIBS=ON
77
98
cmake --build . --config Release
78
99
79
- # - name: Test
80
- # id: cmake_test
81
- # run: |
82
- # cd build
83
- # ctest --verbose --timeout 900
100
+ - name : Get commit hash
101
+ id : commit
102
+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/main' ) || github.event.inputs.create_release == 'true' }}
103
+ uses : pr-mpt/actions-commit-hash@v2
104
+
105
+ - name : Fetch system info
106
+ id : system-info
107
+ run : |
108
+ echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT"
109
+ echo "OS_NAME=`sw_vers -productName`" >> "$GITHUB_OUTPUT"
110
+ echo "OS_VERSION=`sw_vers -productVersion`" >> "$GITHUB_OUTPUT"
111
+ echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT"
112
+
113
+ - name : Pack artifacts
114
+ id : pack_artifacts
115
+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
116
+ run : |
117
+ cp ggml/LICENSE ./build/bin/ggml.txt
118
+ cp LICENSE ./build/bin/stable-diffusion.cpp.txt
119
+ 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/*
120
+
121
+ - name : Upload artifacts
122
+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
123
+ uses : actions/upload-artifact@v3
124
+ with :
125
+ path : |
126
+ 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
127
+
84
128
85
129
windows-latest-cmake :
86
130
runs-on : windows-latest
@@ -89,21 +133,47 @@ jobs:
89
133
matrix :
90
134
include :
91
135
- build : ' noavx'
92
- defines : ' -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF'
136
+ defines : ' -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON '
93
137
- build : ' avx2'
94
- defines : ' -DGGML_AVX2=ON'
138
+ defines : ' -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON '
95
139
- build : ' avx'
96
- defines : ' -DGGML_AVX2=OFF'
140
+ defines : ' -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON '
97
141
- build : ' avx512'
98
- defines : ' -DGGML_AVX512=ON'
99
-
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'
146
+ 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'
100
147
steps :
101
148
- name : Clone
102
149
id : checkout
103
150
uses : actions/checkout@v3
104
151
with :
105
152
submodules : recursive
106
153
154
+ - name : Install cuda-toolkit
155
+ id : cuda-toolkit
156
+ if : ${{ matrix.build == 'cuda12' }}
157
+
158
+ with :
159
+ cuda : ' 12.2.0'
160
+ method : ' network'
161
+ sub-packages : ' ["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
162
+
163
+ - name : Install rocm-toolkit
164
+ id : rocm-toolkit
165
+ if : ${{ matrix.build == 'rocm5.5' }}
166
+ uses :
Cyberhan123/[email protected]
167
+ with :
168
+ rocm : ' 5.5.0'
169
+
170
+ - name : Install Ninja
171
+ id : install-ninja
172
+ if : ${{ matrix.build == 'rocm5.5' }}
173
+ uses : urkle/action-get-ninja@v1
174
+ with :
175
+ version : 1.11.1
176
+
107
177
- name : Build
108
178
id : cmake_build
109
179
run : |
@@ -125,12 +195,6 @@ jobs:
125
195
& $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
126
196
.\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
127
197
128
- # - name: Test
129
- # id: cmake_test
130
- # run: |
131
- # cd build
132
- # ctest -C Release --verbose --timeout 900
133
-
134
198
- name : Get commit hash
135
199
id : commit
136
200
if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
@@ -140,9 +204,37 @@ jobs:
140
204
id : pack_artifacts
141
205
if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
142
206
run : |
143
- Copy-Item ggml/LICENSE .\build\bin\Release\ggml.txt
144
- Copy-Item LICENSE .\build\bin\Release\stable-diffusion.cpp.txt
145
- 7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
207
+ $filePath = ".\build\bin\Release\*"
208
+ if (Test-Path $filePath) {
209
+ echo "Exists at path $filePath"
210
+ Copy-Item ggml/LICENSE .\build\bin\Release\ggml.txt
211
+ Copy-Item LICENSE .\build\bin\Release\stable-diffusion.cpp.txt
212
+ } elseif (Test-Path ".\build\bin\stable-diffusion.dll") {
213
+ $filePath = ".\build\bin\*"
214
+ echo "Exists at path $filePath"
215
+ Copy-Item ggml/LICENSE .\build\bin\ggml.txt
216
+ Copy-Item LICENSE .\build\bin\stable-diffusion.cpp.txt
217
+ } else {
218
+ ls .\build\bin
219
+ throw "Can't find stable-diffusion.dll"
220
+ }
221
+ 7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip $filePath
222
+
223
+ - name : Copy and pack Cuda runtime
224
+ id : pack_cuda_runtime
225
+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build == 'cuda12' ) || github.event.inputs.create_release == 'true' }}
226
+ run : |
227
+ echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
228
+ $dst='.\build\bin\cudart\'
229
+ robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
230
+ 7z a cudart-sd-bin-win-cu12-x64.zip $dst\*
231
+
232
+ - name : Upload Cuda runtime
233
+ 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
235
+ with :
236
+ path : |
237
+ cudart-sd-bin-win-cu12-x64.zip
146
238
147
239
- name : Upload artifacts
148
240
if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
0 commit comments