Skip to content

Commit c3a0b51

Browse files
ci: add support for optimized Windows ARM64 builds with MSVC and LLVM
1 parent 81f1802 commit c3a0b51

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -663,24 +663,26 @@ jobs:
663663
strategy:
664664
matrix:
665665
include:
666-
- build: 'noavx'
666+
- build: 'noavx-x64'
667667
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DBUILD_SHARED_LIBS=ON'
668-
- build: 'avx2'
668+
- build: 'avx2-x64'
669669
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
670-
- build: 'avx'
670+
- build: 'avx-x64'
671671
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX2=OFF -DBUILD_SHARED_LIBS=ON'
672-
- build: 'avx512'
672+
- build: 'avx512-x64'
673673
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON'
674-
- build: 'clblast'
674+
- build: 'clblast-x64'
675675
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CLBLAST=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/clblast"'
676-
- build: 'openblas'
676+
- build: 'openblas-x64'
677677
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
678-
- build: 'kompute'
678+
- build: 'kompute-x64'
679679
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON -DBUILD_SHARED_LIBS=ON'
680-
- build: 'vulkan'
680+
- build: 'vulkan-x64'
681681
defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON -DBUILD_SHARED_LIBS=ON'
682-
- build: 'arm64'
683-
defines: '-A ARM64 -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
682+
- build: 'llvm-arm64'
683+
defines: '-G Ninja -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
684+
- build: 'msvc-arm64'
685+
defines: '-G Ninja -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-msvc.cmake -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
684686

685687
steps:
686688
- name: Clone
@@ -691,21 +693,21 @@ jobs:
691693

692694
- name: Clone Kompute submodule
693695
id: clone_kompute
694-
if: ${{ matrix.build == 'kompute' }}
696+
if: ${{ matrix.build == 'kompute-x64' }}
695697
run: |
696698
git submodule update --init kompute
697699
698700
- name: Download OpenCL SDK
699701
id: get_opencl
700-
if: ${{ matrix.build == 'clblast' }}
702+
if: ${{ matrix.build == 'clblast-x64' }}
701703
run: |
702704
curl.exe -o $env:RUNNER_TEMP/opencl.zip -L "https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v${env:OPENCL_VERSION}/OpenCL-SDK-v${env:OPENCL_VERSION}-Win-x64.zip"
703705
mkdir $env:RUNNER_TEMP/opencl
704706
tar.exe -xvf $env:RUNNER_TEMP/opencl.zip --strip-components=1 -C $env:RUNNER_TEMP/opencl
705707
706708
- name: Download CLBlast
707709
id: get_clblast
708-
if: ${{ matrix.build == 'clblast' }}
710+
if: ${{ matrix.build == 'clblast-x64' }}
709711
run: |
710712
curl.exe -o $env:RUNNER_TEMP/clblast.7z -L "https://github.com/CNugteren/CLBlast/releases/download/${env:CLBLAST_VERSION}/CLBlast-${env:CLBLAST_VERSION}-windows-x64.7z"
711713
curl.exe -o $env:RUNNER_TEMP/CLBlast.LICENSE.txt -L "https://github.com/CNugteren/CLBlast/raw/${env:CLBLAST_VERSION}/LICENSE"
@@ -718,7 +720,7 @@ jobs:
718720
719721
- name: Download OpenBLAS
720722
id: get_openblas
721-
if: ${{ matrix.build == 'openblas' }}
723+
if: ${{ matrix.build == 'openblas-x64' }}
722724
run: |
723725
curl.exe -o $env:RUNNER_TEMP/openblas.zip -L "https://github.com/xianyi/OpenBLAS/releases/download/v${env:OPENBLAS_VERSION}/OpenBLAS-${env:OPENBLAS_VERSION}-x64.zip"
724726
curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
@@ -731,38 +733,41 @@ jobs:
731733
732734
- name: Install Vulkan SDK
733735
id: get_vulkan
734-
if: ${{ matrix.build == 'kompute' || matrix.build == 'vulkan' }}
736+
if: ${{ matrix.build == 'kompute-x64' || matrix.build == 'vulkan-x64' }}
735737
run: |
736738
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"
737739
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
738740
Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
739741
Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
740742
743+
- name: Install Ninja
744+
id: install_ninja
745+
run: |
746+
choco install ninja
747+
741748
- name: Build
742749
id: cmake_build
743750
run: |
744-
mkdir build
745-
cd build
746-
cmake .. ${{ matrix.defines }}
747-
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
751+
cmake -S . -B build ${{ matrix.defines }}
752+
cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
748753
749754
- name: Add clblast.dll
750755
id: add_clblast_dll
751-
if: ${{ matrix.build == 'clblast' }}
756+
if: ${{ matrix.build == 'clblast-x64' }}
752757
run: |
753758
cp $env:RUNNER_TEMP/clblast/lib/clblast.dll ./build/bin/Release
754759
cp $env:RUNNER_TEMP/CLBlast.LICENSE.txt ./build/bin/Release/CLBlast-${env:CLBLAST_VERSION}.txt
755760
756761
- name: Add libopenblas.dll
757762
id: add_libopenblas_dll
758-
if: ${{ matrix.build == 'openblas' }}
763+
if: ${{ matrix.build == 'openblas-x64' }}
759764
run: |
760765
cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
761766
cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
762767
763768
- name: Check AVX512F support
764769
id: check_avx512f
765-
if: ${{ matrix.build == 'avx512' }}
770+
if: ${{ matrix.build == 'avx512-x64' }}
766771
continue-on-error: true
767772
run: |
768773
cd build
@@ -776,14 +781,14 @@ jobs:
776781
- name: Test
777782
id: cmake_test
778783
# not all machines have native AVX-512
779-
if: ${{ matrix.build != 'arm64' && matrix.build != 'clblast' && matrix.build != 'kompute' && matrix.build != 'vulkan' && (matrix.build != 'avx512' || env.HAS_AVX512F == '1') }}
784+
if: ${{ matrix.build != 'msvc-arm64' && matrix.build != 'llvm-arm64' && matrix.build != 'clblast-x64' && matrix.build != 'kompute-x64' && matrix.build != 'vulkan-x64' && (matrix.build != 'avx512-x64' || env.HAS_AVX512F == '1') }}
780785
run: |
781786
cd build
782787
ctest -L main -C Release --verbose --timeout 900
783788
784789
- name: Test (Intel SDE)
785790
id: cmake_test_sde
786-
if: ${{ matrix.build == 'avx512' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
791+
if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
787792
run: |
788793
curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
789794
# for some weird reason windows tar doesn't like sde tar.xz
@@ -811,14 +816,14 @@ jobs:
811816
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
812817
run: |
813818
Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
814-
7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
819+
7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip .\build\bin\Release\*
815820
816821
- name: Upload artifacts
817822
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
818823
uses: actions/upload-artifact@v4
819824
with:
820-
path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip
821-
name: llama-bin-win-${{ matrix.build }}-x64.zip
825+
path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip
826+
name: llama-bin-win-${{ matrix.build }}.zip
822827

823828
windows-latest-cmake-cuda:
824829
runs-on: windows-latest

0 commit comments

Comments
 (0)