3030 with :
3131 submodules : recursive
3232
33-
3433 - name : Dependencies
3534 id : depends
3635 run : |
@@ -42,14 +41,37 @@ jobs:
4241 run : |
4342 mkdir build
4443 cd build
45- cmake ..
44+ cmake .. -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON
4645 cmake --build . --config Release
4746
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+
5375
5476 macOS-latest-cmake :
5577 runs-on : macos-latest
@@ -63,24 +85,46 @@ jobs:
6385
6486 - name : Dependencies
6587 id : depends
66- continue-on-error : true
6788 run : |
68- brew update
89+ brew install zip
6990
7091 - name : Build
7192 id : cmake_build
7293 run : |
7394 sysctl -a
7495 mkdir build
7596 cd build
76- cmake ..
97+ cmake .. -DGGML_AVX2=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DSD_BUILD_SHARED_LIBS=ON
7798 cmake --build . --config Release
7899
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+
84128
85129 windows-latest-cmake :
86130 runs-on : windows-latest
@@ -89,21 +133,47 @@ jobs:
89133 matrix :
90134 include :
91135 - 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 '
93137 - build : ' avx2'
94- defines : ' -DGGML_AVX2=ON'
138+ defines : ' -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON '
95139 - build : ' avx'
96- defines : ' -DGGML_AVX2=OFF'
140+ defines : ' -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON '
97141 - 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'
100147 steps :
101148 - name : Clone
102149 id : checkout
103150 uses : actions/checkout@v3
104151 with :
105152 submodules : recursive
106153
154+ - name : Install cuda-toolkit
155+ id : cuda-toolkit
156+ if : ${{ matrix.build == 'cuda12' }}
157+ uses : Jimver/cuda-toolkit@v0.2.11
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/rocm-toolkit@v0.1.0
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+
107177 - name : Build
108178 id : cmake_build
109179 run : |
@@ -125,12 +195,6 @@ jobs:
125195 & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
126196 .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
127197
128- # - name: Test
129- # id: cmake_test
130- # run: |
131- # cd build
132- # ctest -C Release --verbose --timeout 900
133-
134198 - name : Get commit hash
135199 id : commit
136200 if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
@@ -140,9 +204,37 @@ jobs:
140204 id : pack_artifacts
141205 if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
142206 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
146238
147239 - name : Upload artifacts
148240 if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
0 commit comments