Skip to content

Commit b4bb31d

Browse files
authored
finalize cross platform builds (#6)
* fix(workflow): enhance Windows build configurations for CUDA, HIP, and OpenCL support * fix(workflow): update Windows OpenBLAS build configuration * update(workflow): update Windows CUDA * fix(workflow): missing if condition in install cuda step * fix(workflow): configure CUDA for MinGW on Windows builds * fix(workflow): windows test were missing custom make flags * clear(workflow): update conditional dependencies for Windows Vulkan and OpenBLAS * clear(workflow): remove unnecessary shell specification for Windows Vulkan and CUDA steps * fix(workflow): update Windows HIP toolkit installation process * fix(workflow): set HIP_PATH and CMAKE_PREFIX_PATH for Windows HIP toolkit installation * fix(workflow): enhance Windows HIP build configuration with ROCm and compiler flags * fix(workflow): update Windows HIP build configuration * fix(workflow): update Windows HIP build configuration * fix(workflow): update Windows HIP build configuration to disable CPU support * fix(workflow): Windows HIP pwsh path to bash path * fix(workflow): correct path handling for HIP and CMAKE_PREFIX in Windows setup * fix(workflow): set HIP_PLATFORM to amd and update environment variables for Windows HIP setup * fix(workflow): update CMake flags for Windows HIP build to remove unnecessary warning flags * fix(workflow): increase timeout for build job and adjust CUDA host compiler settings for Windows * fix(workflow): update Windows build steps for sqlite-ai with CUDA and refine make command * fix(workflow): add Ninja installation step for Windows CUDA build and set CMAKE_GENERATOR * fix(workflow): update Windows build steps to use Ninja and adjust CMake arguments for CUDA * fix(workflow): no escape ninja argument windows cuda * fix(workflow): update Windows CUDA build configuration to use Ninja generator and adjust build command * fix(workflow): increase timeout for Windows CUDA build to 60 minutes and ensure ggml-cuda build step is conditional * fix(build): update windows cuda linker flags * fix(workflow): remove unnecessary LLAMA_ARGS from windows ggml-cuda build step * fix(build): update WHISPER_OPTIONS to use llama.cpp GGML * fix(build): update WHISPER_OPTIONS and add ggml package config for whisper.cpp * fix(build): update ggml package config for whisper.cpp to use new directory structure * fix(build): update ggml package config for whisper.cpp to use new include directory * fix(build): fix windows hip and cuda linker flags * fix(build): update LLAMA_LDFLAGS to include CUDA and HIP library paths * fix(build): update LLAMA_LDFLAGS to link against amdhip64 library for HIP support * fix(build): add msvcrt library to LLAMA_LDFLAGS for Windows support * fix(build): update LLAMA_LDFLAGS to include vcruntime and ucrt for Windows support * fix(build): update LLAMA_LDFLAGS for improved Windows support and remove unnecessary HIP flags * fix(build): update make command to build extension for Windows * fix(build): enhance Windows build process for CUDA and HIP support with MSVC integration * fix(utils): improve timestamp handling for UUID generation across platforms * fix(utils): improve Windows compatibility by adjusting header inclusion for status definitions * fix(build): update linker flags for MSVC compatibility in Makefile * fix(build): update Windows build configuration for CUDA and HIP support * fix(build): update Windows HIP build configuration to use Clang instead of MSVC * fix(build): update MSVC linker flags and library handling for Windows platform * fix(build): update path for rocwmma library include in Windows HIP build configuration * fix(build): update Windows HIP build configuration to use Clang and cache ROCm toolkit * fix(build): update Windows build process to set PATH for VCTools and use link.exe for linking * fix(build): update Windows HIP build configuration to include ROCWMMA path and adjust PATH settings for MSVC * feat(workflow): cache dependencies and modules build * feat(workflow): disable Windows CUDA and HIP build and test steps to cache modules and dependencies * fix(workflow): update cache keys to include OS and architecture for llama, whisper, and miniaudio builds * fix(workflow): include make hash in cache keys for llama, whisper, and miniaudio builds to avoid exceeding 512 characters limit * fix(workflow): make command hash cross platform fix * fix(workflow): rename step to clarify purpose of calculating cache version hashes for modules and dependencies * feat(workflow): add support for Windows SYCL builds and install Intel OneAPI toolkit * fix(workflow): use environment variable for make hash calculation in cache version hashes step * fix(build): enhance support for SYCL builds in Windows and adjust MSVC linking * fix(workflow): add caching for CUDA toolkit installation on Windows * fix(workflow): add verification for Intel OneAPI installation in Windows setup * run(workflow): skip windows-hip steps to create cache for hip toolkit installation * fix(test): re-enable every sycl, cuda and hip step * fix(workflow): update include path for hip build on Windows * fix(workflow): add caching for module dependencies and intel oneAPI toolkit installation * run(workflow): skip failing compilation to cache windows-sycl dependencies * fix(workflow): re-enable windows-sycl steps * fix(build): remove DEF_FILE from link command for MSVC * fix(build): update MSVC library paths to use backslashes for compatibility * fix(build): update link command to use absolute path for MSVC linker * fix(build): update link command to use cmd.exe for MSVC compatibility * fix(build): update MSVC link command to use response file for improved readability * fix(build): add checks for build directories and required library files in MSVC target * fix(build): reorder LLAMA_LIBS for correct library linking in MSVC target * fix(build): add CUDA_PATH and MSVC_LIBS echo statements for improved debugging in Makefile * fix(build): escape quotes in MSVC_LIBS for proper CUDA library linking * fix(build): update MSVC link command to use printf for improved formatting in response file * fix(build): add support for HIP Clang in Makefile for improved compatibility with HIP builds * fix(build): correct MSVC_LIBS path formatting for CUDA libraries in Makefile * fix(build): add additional MSVC libraries for improved compatibility in Makefile * fix(build): add support for additional MSVC libraries and implement strncasecmp for compatibility * run(workflow): cache llama, whisper and miniaudio hip builds * fix(workflow): enable hip build * fix(build): add HIP_CLANG support for object file compilation * fix(workflow): install sqlite alongside ninja for cuda, hip, and sycl on Windows * fix(build): quote paths for clang executables in HIP_CLANG configuration * fix(workflow): set CUDA_PATH for windows-cuda in build environment * fix(build): correct paths for LLAMA_LIBS and update linker flags for HIP builds * fix(build): clear linker flags for WHISPER and MINIAUDIO when using HIP_CLANG * fix(build): update LLAMA_LDFLAGS to set linker flags correctly for HIP builds * fix(tests): update SQLite command to load AI version from the correct path * fix(tests): update test command to load AI version from the correct path * fix(build): add linker flags for HIP_CLANG to support shared library builds * fix(build): add MSVC libraries for HIP_CLANG support and update linker flags * fix(build): remove unnecessary MSVC libraries for HIP_CLANG support * fix(workflow): uncomment and format OneAPI setup for windows-sycl * fix(workflow): escape backslashes in OneAPI setvars.bat path for windows-sycl * fix(workflow): update OneAPI setvars.bat path handling for windows-sycl * fix(workflow): streamline build steps for llama.cpp, whisper.cpp, and miniaudio in windows-sycl * fix(build): enforce release build type for LLAMA, WHISPER, and MINIAUDIO when using SYCL on Windows * fix(build): adjust LLAMA library linking for SYCL on Windows * fix(workflow): increase build timeout to 120 minutes and CACHE consolidate GPU build configurations for Windows * fix(build): update LLAMA build configurations for CUDA, HIP, and SYCL on Windows * fix(build): adjust llama.cpp build condition * fix(build): cache android modules * fix(build): add adb command to push commands.sh to Android device * fix(build): update LLAMA build flags for windows-gpu and disable unnecessary build steps * fix(build): remove unnecessary GGML_BACKEND_DL flag for windows-gpu build * fix(build): enable GGML_BACKEND_DL flag for windows-gpu CUDA and HIP builds * fix(build): enable dynamic backend loading for Windows builds and adjust linking options * Update main.yml * fix(build): update llama.cpp build commands for windows-gpu to include multiple targets * fix(build): add CUDAToolkit_ROOT environment variable for windows-gpu build * fix(build): correct CUDAToolkit_ROOT path format for Windows * fix(build): add CUDA toolkit setup for windows-gpu in workflow * fix(build): change shell to cmd for llama.cpp build on windows-gpu * fix(build): add call to setvars.bat for Intel oneAPI in windows-gpu build * fix(build): consolidate Linux build configurations and install steps * fix(build): enable dynamic loading backend for Linux builds * fix(build): remove backend dynamic loading flag for Linux builds * fix(build): update LLAMA and WHISPER make options for Linux and Windows builds * fix(build): update iOS build configuration for universal binary support * fix(build): update make options for LLAMA and WHISPER across all platforms * clear(build): change build order * fix(build): update Windows setup conditions and streamline Vulkan package installation * fix(build): enhance iOS Miniaudio options for compatibility with Objective-C * fix(build): update llama.cpp build targets for improved compatibility * fix(build): set VULKAN_SDK environment variable for Windows build * fix(build): set VULKAN_SDK environment variable for Windows testing * fix(build): update iOS build settings for universal binary support and SDK paths * fix(build): update Windows build environment setup for llama.cpp * fix(build): test build cuda * fix(build): add call to setvars.bat for Intel oneAPI environment setup on Windows * restore ios and isim makefile * fix(build): update iOS make command to use 'isim' platform for compatibility * fix(build): add iOS support for Miniaudio options in Makefile * fix(build): update iOS make command * fix(build): update iOS build configuration for isim platform * fix(build): update iSIM build configuration for arm64 architecture * fix(build): enhance iOS support for 'isim' platform with multi-architecture flags * fix(build): simplify make commands for windows-gpu and remove unused build steps * fix(build): update Windows build conditions to use 'windows-latest' and disable 'windows-gpu' steps * Windows gpu enable cpu * Cpu all variants * Update main.yml * fix(build): resolve symbol conflicts for GGML_STATIC Windows builds * fix(build): update make options for Linux and Windows to enable Vulkan and OpenCL * fix(build): remove OpenBLAS installation from Linux workflow and streamline OpenCL setup * fix(build): add static linking flags for Linux to improve compatibility * fix(build): update linker and compiler flags for Linux to enhance compatibility * fix(build): update Ubuntu version in workflow and remove deprecated C++ ABI flags for Linux builds * fix(build): simplify compiler flags for Windows builds and remove unused conditions * fix(build): remove static linking support for CUDA, HIP, and SYCL in Makefile * fix(build): correct object file extension handling in Makefile * fix(build): streamline LLAMA_OPTIONS and linker flags for shared library support * fix(src): remove msvc changes * fix(build): standardize formatting of LLAMA_OPTIONS and LLAMA_LDFLAGS assignments * fix(src): revert msvc changes * fix(build): adjust LLAMA_OPTIONS and LDFLAGS for shared library support * fix(build): enable shared library support for Whisper and Miniaudio * fix(build): conditionally include Vulkan and OpenCL dependencies for Windows * fix(build): remove unnecessary installation of ninja and sqlite for windows-gpu * fix(build): ensure conditional inclusion of Vulkan and OpenCL dependencies for Windows * fix(build): add ggml build directory to caching and update library paths * fix(build): update CMake command for Whisper to use CMAKE_PREFIX_PATH * fix(build): ensure object files depend on llama.cpp.stamp for proper build order * fix(build): disable OpenMP for LLAMA and WHISPER on macOS * fix(build): remove duplicate ggml-blas library from macOS and iOS build configurations * fix(build): update test command to conditionally include make options * fix(build): update Whisper build command to use ggml_DIR for CMake * fix(build): update WHISPER_OPTIONS to include ggml_DIR for CMake configuration * fix(build): update WHISPER_OPTIONS to use CMAKE_PREFIX_PATH for ggml directory * fix(build): update WHISPER_OPTIONS to set ggml_DIR for CMake configuration * fix(build): add ggml_DIR to WHISPER_OPTIONS for CMake configuration * fix(build): ensure ggml_DIR is set correctly in Whisper build command * fix(build): export ggml_DIR for CMake configuration in Whisper build process * fix(build): remove redundant export of ggml_DIR in Whisper build process * fix(build): update ggml_DIR configuration for Whisper build process * fix(build): update Whisper build options for iOS and isim platforms * fix(build): update CMake command for Whisper build to include CMAKE_PREFIX_PATH * fix(build): update CMake command for Whisper build to specify ggml_DIR * fix(build): update CMake command for Whisper build to use absolute path for ggml_DIR * fix(build): disable GGML_OPENMP for iOS and isim platforms in build options * fix(build): simplify CMake command for Whisper build by removing redundant CMAKE_PREFIX_PATH * fix(build): update CMake command for Whisper build to use -D flag for CMAKE_PREFIX_PATH * fix(build): update CMake command for Whisper build to use ggml_DIR instead of CMAKE_PREFIX_PATH * fix(build): add additional Miniaudio dependencies to linker flags * fix(build): refactor Makefile and Workflow file * fix(build): update macOS build configuration and refine Android make options * fix(build): update make options for LLAMA and WHISPER in macOS and Linux configurations * fix(build): include Makefile hash in cache keys for llama, whisper, and miniaudio builds * fix(build): update Android make options to enable AVX2 and FMA optimizations * bump version * fix(build): remove unnecessary make options for Android build
1 parent e172b9c commit b4bb31d

File tree

3 files changed

+182
-150
lines changed

3 files changed

+182
-150
lines changed

.github/workflows/main.yml

Lines changed: 135 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -10,108 +10,53 @@ jobs:
1010
build:
1111
runs-on: ${{ matrix.os }}
1212
name: ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'isim' && matrix.name != 'ios' && ' + test' || ''}}
13-
timeout-minutes: 20
13+
timeout-minutes: 120
1414
strategy:
1515
fail-fast: false
1616
matrix:
1717
include:
18-
# Linux builds
19-
- os: ubuntu-latest
18+
- os: macos-latest
19+
name: macos
20+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_METAL=ON -DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple" WHISPER="-DWHISPER_COREML=ON -DWHISPER_COREML_ALLOW_FALLBACK=ON"
21+
- os: ubuntu-22.04
2022
arch: x86_64
2123
name: linux-cpu
22-
make: LLAMA="-DGGML_NATIVE=ON"
23-
- os: ubuntu-latest
24-
arch: x86_64
25-
name: linux-cpu-avx2
26-
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_AVX2=ON -DGGML_FMA=ON -DGGML_F16C=ON"
27-
- os: ubuntu-latest
28-
arch: x86_64
29-
name: linux-cpu-avx512
30-
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_AVX512=ON -DGGML_AVX512_VNNI=ON"
31-
- os: ubuntu-latest
32-
arch: x86_64
33-
name: linux-openblas
34-
make: LLAMA="-DGGML_NATIVE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
35-
- os: ubuntu-latest
24+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_CPU=ON -DGGML_AVX2=ON"
25+
- os: ubuntu-22.04
3626
arch: x86_64
37-
name: linux-vulkan
38-
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_VULKAN=ON"
39-
- os: ubuntu-latest
40-
arch: x86_64
41-
name: linux-opencl
42-
make: LLAMA="-DGGML_NATIVE=ON -DGGML_OPENCL=ON"
43-
44-
# Linux ARM64 builds
27+
name: linux-gpu
28+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_CPU=ON -DGGML_VULKAN=ON -DGGML_OPENCL=ON"
4529
- os: LinuxARM64
4630
arch: arm64
4731
name: linux-cpu
48-
make: LLAMA="-DGGML_NATIVE=ON"
49-
- os: LinuxARM64
50-
arch: arm64
51-
name: linux-neon
52-
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8.2-a"
53-
- os: LinuxARM64
54-
arch: arm64
55-
name: linux-openblas
56-
make: LLAMA="-DGGML_NATIVE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
32+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_CPU=ON -DGGML_CPU_ARM_ARCH=armv8.2-a"
5733
- os: LinuxARM64
5834
arch: arm64
59-
name: linux-vulkan
60-
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_VULKAN=ON"
61-
- os: LinuxARM64
62-
arch: arm64
63-
name: linux-opencl
64-
make: LLAMA="-DGGML_NATIVE=ON -DGGML_OPENCL=ON"
65-
66-
# macOS builds
67-
- os: macos-latest
68-
name: macos
69-
make: LLAMA="-DGGML_NATIVE=ON -DGGML_METAL=ON -DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple" WHISPER="-DGGML_METAL=ON -DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple -DWHISPER_COREML=ON -DWHISPER_COREML_ALLOW_FALLBACK=ON"
70-
71-
# Windows builds
35+
name: linux-gpu
36+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_CPU=ON -DGGML_VULKAN=ON -DGGML_OPENCL=ON"
7237
- os: windows-latest
7338
arch: x86_64
7439
name: windows-cpu
75-
make: LLAMA="-DGGML_NATIVE=ON"
76-
- os: windows-latest
77-
arch: x86_64
78-
name: windows-cpu-avx2
79-
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_AVX2=ON -DGGML_FMA=ON -DGGML_F16C=ON -DGGML_BMI2=ON -DGGML_SSE42=ON"
40+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_CPU=ON -DGGML_AVX2=ON"
8041
- os: windows-latest
8142
arch: x86_64
82-
name: windows-cpu-avx512
83-
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_AVX512=ON -DGGML_AVX512_VNNI=ON -DGGML_AVX512_VBMI=ON -DGGML_AVX512_BF16=ON"
84-
# - os: windows-latest
85-
# arch: x86_64
86-
# name: windows-openblas
87-
# make: LLAMA="-DGGML_NATIVE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
88-
# - os: windows-latest
89-
# arch: x86_64
90-
# name: windows-vulkan
91-
# make: LLAMA="-DGGML_NATIVE=OFF -DGGML_VULKAN=ON"
92-
# - os: windows-latest
93-
# arch: x86_64
94-
# name: windows-opencl
95-
# make: LLAMA="-DGGML_NATIVE=ON -DGGML_OPENCL=ON"
96-
97-
# Android builds
98-
- os: ubuntu-latest
99-
arch: arm64-v8a
100-
name: android
101-
make: PLATFORM=android ARCH=arm64-v8a
43+
name: windows-gpu
44+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_CPU=ON -DGGML_VULKAN=ON -DGGML_OPENCL=ON"
10245
- os: ubuntu-latest
10346
arch: x86_64
10447
name: android
10548
make: PLATFORM=android ARCH=x86_64
10649
sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
107-
108-
# iOS builds
50+
- os: ubuntu-latest
51+
arch: arm64-v8a
52+
name: android
53+
make: PLATFORM=android ARCH=arm64-v8a LLAMA="-DGGML_CPU_ARM_ARCH=armv8.2-a+dotprod"
10954
- os: macos-latest
11055
name: ios
111-
make: PLATFORM=ios
56+
make: PLATFORM=ios LLAMA="-DGGML_NATIVE=OFF -DGGML_METAL=ON -DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple" WHISPER="-DWHISPER_COREML=ON -DWHISPER_COREML_ALLOW_FALLBACK=ON"
11257
- os: macos-latest
11358
name: isim
114-
make: PLATFORM=isim
59+
make: PLATFORM=isim LLAMA="-DGGML_NATIVE=OFF -DGGML_METAL=ON -DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple" WHISPER="-DWHISPER_COREML=ON -DWHISPER_COREML_ALLOW_FALLBACK=ON"
11560

11661
defaults:
11762
run:
@@ -123,6 +68,38 @@ jobs:
12368
with:
12469
submodules: true
12570

71+
- name: calculate cache version hashes for modules and dependencies
72+
id: submodule-hashes
73+
env:
74+
MATRIX_MAKE: ${{ matrix.make && matrix.make || '' }}
75+
run: |
76+
LLAMA_HASH=$(git -C modules/llama.cpp rev-parse HEAD)
77+
WHISPER_HASH=$(git -C modules/whisper.cpp rev-parse HEAD)
78+
MINIAUDIO_HASH=$(git -C modules/miniaudio rev-parse HEAD)
79+
if command -v sha256sum >/dev/null 2>&1; then
80+
MAKE_HASH=$(echo "$MATRIX_MAKE" | sha256sum | cut -d' ' -f1)
81+
MAKEFILE_HASH=$(sha256sum Makefile | cut -d' ' -f1)
82+
DPCPP_MKL_HASH=$(echo "$WINDOWS_DPCPP_MKL" | sha256sum | cut -d' ' -f1)
83+
BASEKIT_URL_HASH=$(echo "$WINDOWS_BASEKIT_URL" | sha256sum | cut -d' ' -f1)
84+
elif command -v shasum >/dev/null 2>&1; then
85+
MAKE_HASH=$(echo "$MATRIX_MAKE" | shasum -a 256 | cut -d' ' -f1)
86+
MAKEFILE_HASH=$(shasum -a 256 Makefile | cut -d' ' -f1)
87+
DPCPP_MKL_HASH=$(echo "$WINDOWS_DPCPP_MKL" | shasum -a 256 | cut -d' ' -f1)
88+
BASEKIT_URL_HASH=$(echo "$WINDOWS_BASEKIT_URL" | shasum -a 256 | cut -d' ' -f1)
89+
else
90+
MAKE_HASH=$(echo "$MATRIX_MAKE" | openssl dgst -sha256 | cut -d' ' -f2)
91+
MAKEFILE_HASH=$(openssl dgst -sha256 Makefile | cut -d' ' -f2)
92+
DPCPP_MKL_HASH=$(echo "$WINDOWS_DPCPP_MKL" | openssl dgst -sha256 | cut -d' ' -f2)
93+
BASEKIT_URL_HASH=$(echo "$WINDOWS_BASEKIT_URL" | openssl dgst -sha256 | cut -d' ' -f2)
94+
fi
95+
echo "llama=$LLAMA_HASH" >> $GITHUB_OUTPUT
96+
echo "whisper=$WHISPER_HASH" >> $GITHUB_OUTPUT
97+
echo "miniaudio=$MINIAUDIO_HASH" >> $GITHUB_OUTPUT
98+
echo "make=$MAKE_HASH" >> $GITHUB_OUTPUT
99+
echo "makefile=$MAKEFILE_HASH" >> $GITHUB_OUTPUT
100+
echo "dpcpp-mkl=$DPCPP_MKL_HASH" >> $GITHUB_OUTPUT
101+
echo "basekit-url=$BASEKIT_URL_HASH" >> $GITHUB_OUTPUT
102+
126103
- uses: msys2/[email protected]
127104
if: matrix.os == 'windows-latest'
128105
with:
@@ -133,25 +110,18 @@ jobs:
133110
sqlite
134111
mingw-w64-x86_64-cc
135112
mingw-w64-x86_64-cmake
136-
${{ contains(matrix.name, 'vulkan') && 'mingw-w64-x86_64-vulkan-headers' || '' }}
137-
${{ contains(matrix.name, 'vulkan') && 'mingw-w64-x86_64-vulkan-loader' || '' }}
138-
${{ contains(matrix.name, 'vulkan') && 'mingw-w64-x86_64-shaderc' || '' }}
139-
${{ contains(matrix.name, 'openblas') && 'mingw-w64-x86_64-openblas' || '' }}
140-
${{ contains(matrix.name, 'opencl') && 'mingw-w64-x86_64-opencl-headers' || '' }}
141-
${{ contains(matrix.name, 'opencl') && 'mingw-w64-x86_64-opencl-icd' || '' }}
142-
143-
- name: linux install openblas
144-
if: matrix.name == 'linux-openblas'
145-
run: |
146-
sudo apt-get install -y libopenblas-dev
113+
${{ matrix.name == 'windows-gpu' && 'mingw-w64-x86_64-vulkan-headers' || '' }}
114+
${{ matrix.name == 'windows-gpu' && 'mingw-w64-x86_64-vulkan-loader' || '' }}
115+
${{ matrix.name == 'windows-gpu' && 'mingw-w64-x86_64-shaderc' || '' }}
116+
${{ matrix.name == 'windows-gpu' && 'mingw-w64-x86_64-opencl-headers' || '' }}
117+
${{ matrix.name == 'windows-gpu' && 'mingw-w64-x86_64-opencl-icd' || '' }}
147118
148119
- name: linux install opencl
149-
if: matrix.name == 'linux-opencl'
150-
run: |
151-
sudo apt-get install -y opencl-headers ocl-icd-opencl-dev
120+
if: matrix.name == 'linux-gpu'
121+
run: sudo apt-get install -y opencl-headers ocl-icd-opencl-dev
152122

153123
- name: linux-x86_64 install vulkan
154-
if: matrix.name == 'linux-vulkan' && matrix.arch == 'x86_64'
124+
if: matrix.name == 'linux-gpu' && matrix.arch == 'x86_64'
155125
run: |
156126
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
157127
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
@@ -168,7 +138,7 @@ jobs:
168138
echo "VK_ADD_LAYER_PATH=$VK_ADD_LAYER_PATH" >> $GITHUB_ENV
169139
170140
- name: linux-arm64 install vulkan
171-
if: matrix.name == 'linux-vulkan' && matrix.arch == 'arm64'
141+
if: matrix.name == 'linux-gpu' && matrix.arch == 'arm64'
172142
run: |
173143
sudo dpkg --add-architecture arm64
174144
@@ -181,26 +151,75 @@ jobs:
181151
EOF
182152
183153
sudo apt-get update || true ;# Prevent failure due to missing URLs.
154+
sudo apt-get install -y --no-install-recommends build-essential glslc crossbuild-essential-arm64 libvulkan-dev:arm64
184155
185-
sudo apt-get install -y --no-install-recommends \
186-
build-essential \
187-
glslc \
188-
crossbuild-essential-arm64 \
189-
libvulkan-dev:arm64
156+
- name: cache llama.cpp build
157+
id: cache-llama
158+
uses: actions/cache@v4
159+
with:
160+
path: |
161+
build/ggml
162+
build/llama.cpp
163+
build/llama.cpp.stamp
164+
key: llama-${{ matrix.name }}-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.submodule-hashes.outputs.llama }}-${{ hashFiles('modules/llama.cpp/**') }}-${{ steps.submodule-hashes.outputs.make }}-${{ steps.submodule-hashes.outputs.makefile }}
190165

191-
- name: windows setup vulkan environment
192-
if: matrix.name == 'windows-vulkan'
193-
run: |
194-
# MSYS2 Vulkan packages are already installed, just set up environment
195-
echo "VULKAN_SDK=C:/msys64/mingw64" >> $GITHUB_ENV
196-
shell: bash
166+
- name: cache whisper.cpp build
167+
id: cache-whisper
168+
uses: actions/cache@v4
169+
with:
170+
path: |
171+
build/whisper.cpp
172+
build/whisper.cpp.stamp
173+
key: whisper-${{ matrix.name }}-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.submodule-hashes.outputs.whisper }}-${{ hashFiles('modules/whisper.cpp/**') }}-${{ steps.submodule-hashes.outputs.make }}-${{ steps.submodule-hashes.outputs.makefile }}
174+
175+
- name: cache miniaudio build
176+
id: cache-miniaudio
177+
uses: actions/cache@v4
178+
with:
179+
path: |
180+
build/miniaudio
181+
build/miniaudio.stamp
182+
key: miniaudio-${{ matrix.name }}-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.submodule-hashes.outputs.miniaudio }}-${{ hashFiles('modules/miniaudio/**') }}-${{ steps.submodule-hashes.outputs.make }}-${{ steps.submodule-hashes.outputs.makefile }}
183+
184+
- name: windows build llama.cpp
185+
if: matrix.os == 'windows-latest' && steps.cache-llama.outputs.cache-hit != 'true'
186+
shell: msys2 {0}
187+
run: make build/llama.cpp.stamp ${{ matrix.make && matrix.make || ''}}
188+
env:
189+
VULKAN_SDK: "C:/msys64/mingw64"
190+
191+
- name: unix build llama.cpp
192+
if: matrix.os != 'windows-latest' && steps.cache-llama.outputs.cache-hit != 'true'
193+
run: make build/llama.cpp.stamp ${{ matrix.make && matrix.make || ''}}
194+
195+
- name: windows build whisper.cpp
196+
if: matrix.os == 'windows-latest' && steps.cache-whisper.outputs.cache-hit != 'true'
197+
shell: msys2 {0}
198+
run: make build/whisper.cpp.stamp ${{ matrix.make && matrix.make || ''}}
199+
env:
200+
VULKAN_SDK: "C:/msys64/mingw64"
201+
202+
- name: unix build whisper.cpp
203+
if: matrix.os != 'windows-latest' && steps.cache-whisper.outputs.cache-hit != 'true'
204+
run: make build/whisper.cpp.stamp ${{ matrix.make && matrix.make || ''}}
205+
206+
- name: windows build miniaudio
207+
if: matrix.os == 'windows-latest' && steps.cache-miniaudio.outputs.cache-hit != 'true'
208+
shell: msys2 {0}
209+
run: make build/miniaudio.stamp ${{ matrix.make && matrix.make || ''}}
210+
211+
- name: unix build miniaudio
212+
if: matrix.os != 'windows-latest' && steps.cache-miniaudio.outputs.cache-hit != 'true'
213+
run: make build/miniaudio.stamp ${{ matrix.make && matrix.make || ''}}
197214

198215
- name: windows build sqlite-ai
199216
if: matrix.os == 'windows-latest'
200217
run: make extension ${{ matrix.make && matrix.make || ''}}
201218
shell: msys2 {0}
219+
env:
220+
VULKAN_SDK: "C:/msys64/mingw64"
202221

203-
- name: build sqlite-ai
222+
- name: unix build sqlite-ai
204223
if: matrix.os != 'windows-latest'
205224
run: make extension ${{ matrix.make && matrix.make || ''}}
206225

@@ -235,7 +254,6 @@ jobs:
235254
$(make test PLATFORM=$PLATFORM ARCH=$ARCH -n)
236255
EOF
237256
# remove big unused folders to avoid emulator errors
238-
rm -rf build modules
239257
echo "::endgroup::"
240258
241259
- name: android test sqlite-ai
@@ -247,17 +265,22 @@ jobs:
247265
script: |
248266
adb root
249267
adb remount
250-
adb push ${{ github.workspace }}/. /data/local/tmp/
268+
adb push ${{ github.workspace }}/commands.sh /data/local/tmp/
269+
adb push ${{ github.workspace }}/sqlite3 /data/local/tmp/
270+
adb push ${{ github.workspace }}/dist /data/local/tmp/
271+
adb push ${{ github.workspace }}/Makefile /data/local/tmp/
251272
adb shell "sh /data/local/tmp/commands.sh"
252273
253274
- name: windows test sqlite-ai
254-
if: startsWith(matrix.name, 'windows-')
255-
run: make test
275+
if: matrix.os == 'windows-latest'
276+
run: make test ${{ matrix.make && matrix.make || ''}}
256277
shell: msys2 {0}
278+
env:
279+
VULKAN_SDK: "C:/msys64/mingw64"
257280

258-
- name: test sqlite-ai
259-
if: startsWith(matrix.name, 'linux-') || matrix.name == 'macos'
260-
run: make test
281+
- name: unix test sqlite-ai
282+
if: contains(matrix.name, 'linux') || matrix.name == 'macos'
283+
run: make test ${{ matrix.make && matrix.make || ''}}
261284

262285
- uses: actions/[email protected]
263286
if: always()
@@ -316,4 +339,4 @@ jobs:
316339
ai-*-${{ steps.tag.outputs.version }}.zip
317340
ai-*-${{ steps.tag.outputs.version }}.tar.xz
318341
ai-*-${{ steps.tag.outputs.version }}.tar.gz
319-
make_latest: true
342+
make_latest: true

0 commit comments

Comments
 (0)