11name : CI
22
33on :
4+ workflow_dispatch : # allows manual triggering
5+ inputs :
6+ create_release :
7+ description : ' Create new release'
8+ required : true
9+ type : boolean
410 push :
511 branches :
612 - master
13+ - ci
714 paths : ['.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu']
815 pull_request :
916 types : [opened, synchronize, reopened]
7582 windows-latest-cmake :
7683 runs-on : windows-latest
7784
85+ strategy :
86+ matrix :
87+ include :
88+ - build : ' noavx'
89+ defines : ' -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF'
90+ - build : ' avx2'
91+ defines : ' -DGGML_AVX2=ON'
92+ - build : ' avx'
93+ defines : ' -DGGML_AVX2=OFF'
94+ - build : ' avx512'
95+ defines : ' -DGGML_AVX512=ON'
96+
7897 steps :
7998 - name : Clone
8099 id : checkout
@@ -87,12 +106,45 @@ jobs:
87106 run : |
88107 mkdir build
89108 cd build
90- cmake ..
109+ cmake .. ${{ matrix.defines }}
91110 cmake --build . --config Release
92111
112+ - name : Check AVX512F support
113+ id : check_avx512f
114+ if : ${{ matrix.build == 'avx512' }}
115+ continue-on-error : true
116+ run : |
117+ cd build
118+ $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
119+ $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
120+ $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe')
121+ echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c
122+ & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
123+ .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
124+
93125 # - name: Test
94126 # id: cmake_test
95127 # run: |
96128 # cd build
97129 # ctest -C Release --verbose --timeout 900
98130
131+ - name : Get commit hash
132+ id : commit
133+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
134+ uses : pr-mpt/actions-commit-hash@v2
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+ Copy-Item ggml/LICENSE .\build\bin\Release\ggml.txt
141+ Copy-Item LICENSE .\build\bin\Release\stable-diffusion.cpp.txt
142+ 7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
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@v3
147+ with :
148+ path : |
149+ sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
150+
0 commit comments