Skip to content

Commit

Permalink
wip4
Browse files Browse the repository at this point in the history
  • Loading branch information
slaren committed Dec 1, 2024
1 parent edddcaf commit cc5a750
Showing 1 changed file with 34 additions and 47 deletions.
81 changes: 34 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,40 +33,31 @@ env:
LLAMA_LOG_TIMESTAMPS: 1

jobs:
windows-msys2-cpu-x86_64:
windows-mingw-cpu-x86_64:
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
arch: [avx, avx2, avx512, amx]
include:
- { sys: UCRT64, env: ucrt-x86_64, build: Release }
- { arch: avx, defines: '-DGGML_AVX=ON -DGGML_AVX2=OFF -DGGML_AVX512=OFF -DGGML_AMX_TILE=OFF -DGGML_AMX_INT8=OFF' }
- { arch: avx2, defines: '-DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_AVX512=OFF -DGGML_AMX_TILE=OFF -DGGML_AMX_INT8=OFF' }
- { arch: avx512, defines: '-DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_AVX512=ON -DGGML_AMX_TILE=OFF -DGGML_AMX_INT8=OFF' }
- { arch: amx, defines: '-DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_AVX512=ON -DGGML_AMX_TILE=ON -DGGML_AMX_INT8=ON' }
- { arch: sse, defines: '-DGGML_FMA=OFF -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_AVX_VNNI=OFF -DGGML_F16C=OFF -DGGML_AVX512=OFF -DGGML_AVX512_VNNI=OFF -DGGML_AMX_TILE=OFF -DGGML_AMX_INT8=OFF' }
- { arch: avx, defines: '-DGGML_FMA=ON -DGGML_AVX=ON -DGGML_AVX2=OFF -DGGML_AVX_VNNI=OFF -DGGML_F16C=ON -DGGML_AVX512=OFF -DGGML_AVX512_VNNI=OFF -DGGML_AMX_TILE=OFF -DGGML_AMX_INT8=OFF' }
- { arch: avx2, defines: '-DGGML_FMA=ON -DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_AVX_VNNI=ON -DGGML_F16C=ON -DGGML_AVX512=OFF -DGGML_AVX512_VNNI=OFF -DGGML_AMX_TILE=OFF -DGGML_AMX_INT8=OFF' }
- { arch: avx512, defines: '-DGGML_FMA=ON -DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_AVX_VNNI=ON -DGGML_F16C=ON -DGGML_AVX512=ON -DGGML_AVX512_VNNI=ON -DGGML_AMX_TILE=OFF -DGGML_AMX_INT8=OFF' }
- { arch: amx, defines: '-DGGML_FMA=ON -DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_AVX_VNNI=ON -DGGML_F16C=ON -DGGML_AVX512=ON -DGGML_AVX512_VNNI=ON -DGGML_AMX_TILE=ON -DGGML_AMX_INT8=ON' }

steps:
- name: Clone
uses: actions/checkout@v4

- name: Setup ${{ matrix.sys }}
uses: msys2/setup-msys2@v2
with:
update: true
msystem: ${{matrix.sys}}
install: >-
base-devel
mingw-w64-${{matrix.env}}-toolchain
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-ninja
- name: Install Ninja
run: |
choco install ninja
- name: Build using CMake
shell: msys2 {0}
run: |
cmake -B build -G "Ninja Multi-Config" -DGGML_NATIVE=OFF -DBUILD_SHARED_LIBS=ON -DGGML_BACKEND_DL=ON ${{ matrix.defines }}
cmake --build build --config ${{ matrix.build }} -t ggml-cpu
cmake --build build --config Release -t ggml-cpu
- name: Rename artifacts
run: mv build/bin/Release/ggml-cpu.dll ggml-cpu-${{ matrix.arch }}.dll
Expand All @@ -78,43 +69,39 @@ jobs:
path: ggml-cpu-${{ matrix.arch }}.dll
name: ggml-cpu-${{ matrix.arch }}.dll

windows-msys2-x86_64:
windows-mingw-x86_64:
runs-on: windows-latest

needs:
- windows-msys2-cpu-x86_64

strategy:
fail-fast: false
matrix:
include:
- { sys: UCRT64, env: ucrt-x86_64, build: Release }
- windows-mingw-cpu-x86_64

steps:
- name: Clone
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup ${{ matrix.sys }}
uses: msys2/setup-msys2@v2
with:
update: true
msystem: ${{matrix.sys}}
install: >-
base-devel
git
mingw-w64-${{matrix.env}}-toolchain
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-curl
- name: Install Ninja
run: |
dir c:/mingw64
dir c:/mingw64/bin
choco install ninja
- name: Download curl for Windows
run: |
curl.exe -O https://curl.se/windows/dl-8.11.0_4/curl-8.11.0_4-win64-mingw.zip
7z x curl-8.11.0_4-win64-mingw.zip -ocurl
- name: Build using CMake
shell: msys2 {0}
run: |
cmake -B build -G "Ninja Multi-Config" -DLLAMA_CURL=ON -DLLAMA_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DGGML_BACKEND_DL=ON
cmake --build build --config ${{ matrix.build }}
rm build/bin/Release/ggml-cpu.dll
cmake -B build -G "Ninja Multi-Config" -DLLAMA_CURL=ON -DLLAMA_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DCURL_INCLUDE_DIR="curl/curl-8.11.0_4-win64-mingw/include/" -DCURL_LIBRARY="curl/curl-8.11.0_4-win64-mingw/lib/libcurl.dll.a"
cmake --build build --config Release -t llama-bench -t llama-cli -t llama-gguf-hash -t llama-gguf-split -t llama-imatrix -t llama-perplexity -t llama-quantize -t llama-simple -t llama-simple-chat -t llama-tokenize
rm build/bin/Release/ggml-cpu.dll
cp curl/curl-8.11.0_4-win64-mingw/bin/libcurl-x64.dll build/bin/Release
cp c:/mingw64/bin/libwinpthread-1.dll build/bin/Release
cp c:/mingw64/bin/libstdc++-6.dll build/bin/Release
cp c:/mingw64/bin/libgcc_s_seh-1.dll build/bin/Release
cp c:/mingw64/bin/libgomp-1.dll build/bin/Release
- name: Download CPU backend artifacts
uses: actions/download-artifact@v4
Expand All @@ -141,23 +128,23 @@ jobs:
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
run: |
Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
7z a llama-${{ steps.tag.outputs.name }}-bin-msys2-cpu-${{ matrix.build }}.zip .\build\bin\Release\*
7z a llama-${{ steps.tag.outputs.name }}-bin-mingw-cpu.zip .\build\bin\Release\*
- name: Upload artifacts
id: upload_artifacts
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
uses: actions/upload-artifact@v4
with:
path: llama-${{ steps.tag.outputs.name }}-bin-msys2-cpu-${{ matrix.build }}.zip
name: llama-${{ steps.tag.outputs.name }}-bin-msys2-cpu-${{ matrix.build }}.zip
path: llama-${{ steps.tag.outputs.name }}-bin-mingw-cpu.zip
name: llama-${{ steps.tag.outputs.name }}-bin-mingw-cpu.zip

release:
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}

runs-on: ubuntu-latest

needs:
- windows-msys2-x86_64
- windows-mingw-x86_64

steps:
- name: Clone
Expand Down

0 comments on commit cc5a750

Please sign in to comment.