Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .github/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,28 @@ if /I "%USE_CACHE%"=="true" (
)
)

REM NOTE: nvcc is NOT wrapped with sccache on Windows. Unlike build.sh (Linux) -- where
REM sccache caches the per-arch .cu device passes -- sccache on Windows cannot parse the
REM nvcc command line (it dies with `sccache: error: Could not parse shell line` and
REM fails every .cu compile). So CUDA device code is built by nvcc directly (uncached)
REM here; the cl.exe C/C++ TUs still cache via the C/CXX launcher set above.

mkdir build
cmake -Bbuild %LAUNCH% %*
if errorlevel 1 exit /b %ERRORLEVEL%
if errorlevel 1 exit /b 1
cmake --build build --config Release
if errorlevel 1 exit /b %ERRORLEVEL%
set "BUILD_RC=!ERRORLEVEL!"

REM Only query stats when sccache was actually wired in as the launcher; re-invoking
REM a rejected/crashing sccache here would just repeat its failure output.
REM Print cache stats (best-effort) regardless of build outcome -- only when sccache
REM was wired in as the launcher.
if defined LAUNCH (
echo build.bat: sccache --show-stats
sccache --show-stats
)

REM Propagate a build failure as a non-zero exit (a prior bug let a failed `cmake
REM --build` reach here and exit 0, masquerading as a green build with no artifacts).
if not "!BUILD_RC!"=="0" (
echo build.bat: cmake --build failed with exit code !BUILD_RC!.
exit /b !BUILD_RC!
)
6 changes: 3 additions & 3 deletions .github/build_opencl_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ HEADERS_DIR="$OPENCL_STAGE/OpenCL-Headers"
LOADER_DIR="$OPENCL_STAGE/OpenCL-ICD-Loader"
LOADER_BUILD="$LOADER_DIR/build"

# Pinned tags for reproducibility.
HEADERS_TAG=v2025.07.22
LOADER_TAG=v2025.07.22
# Pinned tags for reproducibility (OpenCL 3.1.1 spec release).
HEADERS_TAG=v2026.05.29
LOADER_TAG=v2026.05.29

if [ ! -d "$HEADERS_DIR" ]; then
mkdir -p "$OPENCL_STAGE"
Expand Down
54 changes: 54 additions & 0 deletions .github/build_opencl_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
REM SPDX-FileCopyrightText: 2026 Bernard Ladenthin <bernard.ladenthin@gmail.com>
REM
REM SPDX-License-Identifier: MIT
REM
REM Windows x86_64 build with the OpenCL backend enabled, shipped as the
REM `opencl-windows-x86-64` classifier. The windows-2025 runner image ships
REM neither OpenCL headers nor an OpenCL import library, so this script first
REM stages Khronos OpenCL-Headers and builds OpenCL-ICD-Loader (producing
REM OpenCL.lib) before delegating the jllama configure+build to build.bat with
REM the OpenCL paths. Mirrors build_opencl_android.sh.
REM
REM At runtime the GPU vendor's ICD (System32\OpenCL.dll, installed by the
REM NVIDIA/AMD/Intel driver) provides the actual OpenCL symbols; we link only
REM against the loader's import library, so no OpenCL.dll is shipped.

@echo off
setlocal enabledelayedexpansion

set "OPENCL_STAGE=%RUNNER_TEMP%\opencl-stage"
if "%RUNNER_TEMP%"=="" set "OPENCL_STAGE=%TEMP%\opencl-stage"
set "HEADERS_DIR=%OPENCL_STAGE%\OpenCL-Headers"
set "LOADER_DIR=%OPENCL_STAGE%\OpenCL-ICD-Loader"
set "LOADER_BUILD=%LOADER_DIR%\build"

REM Pinned tags for reproducibility (OpenCL 3.1.1; match build_opencl_android.sh).
set "HEADERS_TAG=v2026.05.29"
set "LOADER_TAG=v2026.05.29"

if not exist "%HEADERS_DIR%" (
git clone --depth 1 --branch %HEADERS_TAG% https://github.com/KhronosGroup/OpenCL-Headers.git "%HEADERS_DIR%"
if errorlevel 1 exit /b 1
)

if not exist "%LOADER_BUILD%\Release\OpenCL.lib" if not exist "%LOADER_BUILD%\OpenCL.lib" (
if not exist "%LOADER_DIR%" (
git clone --depth 1 --branch %LOADER_TAG% https://github.com/KhronosGroup/OpenCL-ICD-Loader.git "%LOADER_DIR%"
if errorlevel 1 exit /b 1
)
cmake -B "%LOADER_BUILD%" -S "%LOADER_DIR%" -DOPENCL_ICD_LOADER_HEADERS_DIR="%HEADERS_DIR%" -DBUILD_TESTING=OFF
if errorlevel 1 exit /b 1
cmake --build "%LOADER_BUILD%" --config Release
if errorlevel 1 exit /b 1
)

REM Resolve the import library: multi-config generators emit build\Release\OpenCL.lib,
REM single-config ones emit build\OpenCL.lib.
set "OPENCL_LIB=%LOADER_BUILD%\Release\OpenCL.lib"
if not exist "%OPENCL_LIB%" set "OPENCL_LIB=%LOADER_BUILD%\OpenCL.lib"

REM Delegate to build.bat so the jllama build inherits the sccache probe + Depot
REM cache launcher and --show-stats output. The OpenCL paths satisfy ggml's
REM find_package(OpenCL); the caller appends -G/-DGGML_OPENCL/-DOS_* via %*.
call .github\build.bat -DOpenCL_INCLUDE_DIR="%HEADERS_DIR%" -DOpenCL_LIBRARY="%OPENCL_LIB%" %*
exit /b %ERRORLEVEL%
Loading
Loading