Skip to content

LLM inference in C/C++

C++ ggml

ci : clear cache instead of "no timestamp" keys + fix macos (#23895)

Georgi Gerganovd4204b03a592
diff --git a/.github/actions/ccache-clear/action.yml b/.github/actions/ccache-clear/action.yml
new file mode 100644
index 0000000000..d38587efaf
--- /dev/null
+++ b/.github/actions/ccache-clear/action.yml
@@ -0,0 +1,22 @@
+name: "ccache-clear"
+description: "Delete all GitHub Actions caches matching a key prefix"
+inputs:
+ key:
+ description: "Cache key prefix to match and delete"
+ required: true
+
+runs:
+ using: "composite"
+ steps:
+ - name: Clear caches
+ shell: bash
+ run: |
+ CACHES=$(gh cache list --key "ccache-${{ inputs.key }}" --json id,key --jq '.[] | "\(.id) \(.key)"' 2>/dev/null)
+ if [ -z "$CACHES" ]; then
+ echo "No caches found with key prefix: ${{ inputs.key }}"
+ exit 0
+ fi
+ while read -r id key; do
+ echo "Deleting cache: $id ($key)"
+ gh cache delete "$id"
+ done <<< "$CACHES"
diff --git a/.github/workflows/build-cuda-windows.yml b/.github/workflows/build-cuda-windows.yml
index 631ff4ed26..e9e941421b 100644
--- a/.github/workflows/build-cuda-windows.yml
+++ b/.github/workflows/build-cuda-windows.yml
@@ -13,6 +13,7 @@ concurrency:
queue: max
env:
+ GH_TOKEN: ${{ github.token }}
GGML_NLOOP: 3
GGML_N_THREADS: 1
LLAMA_ARG_LOG_COLORS: 1
@@ -23,6 +24,9 @@ jobs:
cuda:
runs-on: windows-2022
+ permissions:
+ actions: write
+
strategy:
matrix:
cuda: ['12.4', '13.3']
@@ -36,7 +40,6 @@ jobs:
uses: ggml-org/[email protected]
with:
key: release-windows-2022-x64-cuda-${{ matrix.cuda }}
- append-timestamp: false # note: use this only with non-concurrent jobs!
- name: Install Cuda Toolkit
uses: ./.github/actions/windows-setup-cuda
@@ -67,9 +70,17 @@ jobs:
cmake --build build --config Release -j %NINJA_JOBS% -t ggml
cmake --build build --config Release
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-windows-2022-x64-cuda-${{ matrix.cuda }}
+
hip:
runs-on: windows-2022
+ permissions:
+ actions: write
+
env:
# Make sure this is in sync with build-cache.yml
HIPSDK_INSTALLER_VERSION: "26.Q1"
@@ -125,7 +136,6 @@ jobs:
# to populate the ccache for the release with manual runs of this workflow
#key: release-windows-2022-x64-hip-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ matrix.name }}
key: cuda-windows-2022-x64-hip-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ matrix.name }}
- append-timestamp: false # note: use this only with non-concurrent jobs!
- name: Build
id: cmake_build
@@ -144,3 +154,9 @@ jobs:
-DGPU_TARGETS="gfx1100" `
-DGGML_RPC=ON
cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
+
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ #key: release-windows-2022-x64-hip-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ matrix.name }}
+ key: cuda-windows-2022-x64-hip-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ matrix.name }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 08f02af63e..4785bbe167 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -28,6 +28,7 @@ on:
]
env:
+ GH_TOKEN: ${{ github.token }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON"
@@ -83,6 +84,9 @@ jobs:
runs-on: ${{ matrix.os }}
+ permissions:
+ actions: write
+
steps:
- name: Clone
id: checkout
@@ -101,7 +105,6 @@ jobs:
uses: ggml-org/[email protected]
with:
key: release-${{ matrix.os }}-${{ matrix.arch }}
- append-timestamp: false # note: use this only with non-concurrent jobs!
- name: Build
id: cmake_build
@@ -116,6 +119,11 @@ jobs:
${{ env.CMAKE_ARGS }}
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-${{ matrix.os }}-${{ matrix.arch }}
+
- name: Determine tag name
id: tag
uses: ./.github/actions/get-tag-name
@@ -147,6 +155,9 @@ jobs:
runs-on: ${{ matrix.os }}
+ permissions:
+ actions: write
+
steps:
- name: Clone
id: checkout
@@ -161,13 +172,6 @@ jobs:
cache: "npm"
cache-dependency-path: "tools/ui/package-lock.json"
- - name: ccache
- if: ${{ matrix.build != 's390x' }}
- uses: ggml-org/[email protected]
- with:
- key: release-${{ matrix.os }}-cpu
- append-timestamp: false # note: use this only with non-concurrent jobs!
-
- name: Dependencies
id: depends
run: |
@@ -181,6 +185,12 @@ jobs:
echo "CC=gcc-14" >> "$GITHUB_ENV"
echo "CXX=g++-14" >> "$GITHUB_ENV"
+ - name: ccache
+ if: ${{ matrix.build != 's390x' }}
+ uses: ggml-org/[email protected]
+ with:
+ key: release-${{ matrix.os }}-cpu
+
- name: Build
id: cmake_build
run: |
@@ -194,6 +204,11 @@ jobs:
${{ env.CMAKE_ARGS }}
cmake --build build --config Release -j $(nproc)
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-${{ matrix.os }}-cpu
+
- name: Determine tag name
id: tag
uses: ./.github/actions/get-tag-name
@@ -224,6 +239,9 @@ jobs:
runs-on: ${{ matrix.os }}
+ permissions:
+ actions: write
+
steps:
- name: Clone
id: checkout
@@ -238,12 +256,6 @@ jobs:
cache: "npm"
cache-dependency-path: "tools/ui/package-lock.json"
- - name: ccache
- uses: ggml-org/[email protected]
- with:
- key: release-${{ matrix.os }}-vulkan
- append-timestamp: false # note: use this only with non-concurrent jobs!
-
- name: Dependencies
id: depends
run: |
@@ -259,6 +271,11 @@ jobs:
echo "CXX=g++-14" >> "$GITHUB_ENV"
fi
+ - name: ccache
+ uses: ggml-org/[email protected]
+ with:
+ key: release-${{ matrix.os }}-vulkan
+
- name: Build
id: cmake_build
run: |
@@ -272,6 +289,11 @@ jobs:
${{ env.CMAKE_ARGS }}
cmake --build build --config Release -j $(nproc)
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-${{ matrix.os }}-vulkan
+
- name: Determine tag name
id: tag
uses: ./.github/actions/get-tag-name
@@ -294,6 +316,9 @@ jobs:
runs-on: ubuntu-latest
+ #permissions:
+ # actions: write
+
env:
NDK_VERSION: "29.0.14206865"
@@ -311,18 +336,6 @@ jobs:
cache: "npm"
cache-dependency-path: "tools/ui/package-lock.json"
- # note : disabled to spare some cache space (https://github.com/ggml-org/llama.cpp/pull/23789)
- # for some reason, the ccache does not improve the build time in this case
- # example:
- # cache off: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78160400831
- # cache on: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78224189394
- #
- #- name: ccache
- # uses: ggml-org/[email protected]
- # with:
- # key: release-android-arm64
- # append-timestamp: false # note: use this only with non-concurrent jobs!
-
- name: Set up JDK
uses: actions/setup-java@v5
with:
@@ -339,6 +352,17 @@ jobs:
sdkmanager "ndk;${{ env.NDK_VERSION }}"
echo "ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${{ env.NDK_VERSION }}" >> $GITHUB_ENV
+ # note : disabled to spare some cache space (https://github.com/ggml-org/llama.cpp/pull/23789)
+ # for some reason, the ccache does not improve the build time in this case
+ # example:
+ # cache off: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78160400831
+ # cache on: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78224189394
+ #
+ #- name: ccache
+ # uses: ggml-org/[email protected]
+ # with:
+ # key: release-android-arm64
+
- name: Build
id: cmake_build
run: |
@@ -357,6 +381,11 @@ jobs:
${{ env.CMAKE_ARGS }}
cmake --build build --config Release -j $(nproc)
+ #- name: ccache-clear
+ # uses: ./.github/actions/ccache-clear
+ # with:
+ # key: release-android-arm64
+
- name: Determine tag name
id: tag
uses: ./.github/actions/get-tag-name
@@ -379,6 +408,9 @@ jobs:
runs-on: ubuntu-24.04
+ permissions:
+ actions: write
+
outputs:
openvino_version: ${{ steps.openvino_version.outputs.value }}
@@ -409,7 +441,6 @@ jobs:
uses: ggml-org/[email protected]
with:
key: release-ubuntu-24.04-openvino-release-no-preset-v1
- append-timestamp: false # note: use this only with non-concurrent jobs!
- name: Dependencies
run: |
@@ -447,6 +478,11 @@ jobs:
-DGGML_OPENVINO=ON
cmake --build build/ReleaseOV --config Release -j $(nproc)
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-ubuntu-24.04-openvino-release-no-preset-v1
+
- name: Determine tag name
id: tag
uses: ./.github/actions/get-tag-name
@@ -469,6 +505,9 @@ jobs:
runs-on: windows-2025
+ permissions:
+ actions: write
+
strategy:
matrix:
include:
@@ -488,15 +527,14 @@ jobs:
cache: "npm"
cache-dependency-path: "tools/ui/package-lock.json"
+ - name: Install Ninja
+ run: |
+ choco install ninja
+
- name: ccache
uses: ggml-org/[email protected]
with:
key: release-windows-2025-${{ matrix.arch }}-cpu
- append-timestamp: false # note: use this only with non-concurrent jobs!
-
- - name: Install Ninja
- run: |
- choco install ninja
- name: Build
shell: cmd
@@ -512,6 +550,11 @@ jobs:
${{ env.CMAKE_ARGS }}
cmake --build build --config Release
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-windows-2025-${{ matrix.arch }}-cpu
+
- name: Pack artifacts
id: pack_artifacts
run: |
@@ -530,6 +573,9 @@ jobs:
runs-on: windows-2025
+ permissions:
+ actions: write
+
env:
OPENBLAS_VERSION: 0.3.23
VULKAN_VERSION: 1.4.313.2
@@ -558,12 +604,6 @@ jobs:
cache: "npm"
cache-dependency-path: "tools/ui/package-lock.json"
- - name: ccache
- uses: ggml-org/[email protected]
- with:
- key: release-windows-2025-${{ matrix.arch }}-${{ matrix.backend }}
- append-timestamp: false # note: use this only with non-concurrent jobs!
-
- name: Install Vulkan SDK
id: get_vulkan
if: ${{ matrix.backend == 'vulkan' }}
@@ -578,6 +618,11 @@ jobs:
run: |
choco install ninja
+ - name: ccache
+ uses: ggml-org/[email protected]
+ with:
+ key: release-windows-2025-${{ matrix.arch }}-${{ matrix.backend }}
+
- name: Install OpenCL Headers and Libs
id: install_opencl
if: ${{ matrix.backend == 'opencl-adreno' && matrix.arch == 'arm64' }}
@@ -604,6 +649,11 @@ jobs:
cmake -S . -B build ${{ matrix.defines }} -DGGML_NATIVE=OFF -DGGML_CPU=OFF -DGGML_BACKEND_DL=ON -DLLAMA_BUILD_BORINGSSL=ON
cmake --build build --config Release --target ${{ matrix.target }}
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-windows-2025-${{ matrix.arch }}-${{ matrix.backend }}
+
- name: Pack artifacts
id: pack_artifacts
run: |
@@ -621,6 +671,9 @@ jobs:
runs-on: windows-2022
+ permissions:
+ actions: write
+
strategy:
matrix:
cuda: ['12.4', '13.3']
@@ -637,12 +690,6 @@ jobs:
cache: "npm"
cache-dependency-path: "tools/ui/package-lock.json"
- - name: ccache
- uses: ggml-org/[email protected]
- with:
- key: release-windows-2022-x64-cuda-${{ matrix.cuda }}
- append-timestamp: false # note: use this only with non-concurrent jobs!
-
- name: Install Cuda Toolkit
uses: ./.github/actions/windows-setup-cuda
with:
@@ -653,6 +700,11 @@ jobs:
run: |
choco install ninja
+ - name: ccache
+ uses: ggml-org/[email protected]
+ with:
+ key: release-windows-2022-x64-cuda-${{ matrix.cuda }}
+
- name: Build
id: cmake_build
shell: cmd
@@ -669,6 +721,11 @@ jobs:
set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
cmake --build build --config Release -j %NINJA_JOBS% --target ggml-cuda
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-windows-2022-x64-cuda-${{ matrix.cuda }}
+
- name: Pack artifacts
id: pack_artifacts
run: |
@@ -748,7 +805,6 @@ jobs:
# uses: ggml-org/[email protected]
# with:
# key: release-windows-2022-x64-sycl
-# append-timestamp: false # note: use this only with non-concurrent jobs!
#
# - name: Build
# id: cmake_build
@@ -869,7 +925,6 @@ jobs:
# uses: ggml-org/[email protected]
# with:
# key: release-ubuntu-24.04-sycl
-# append-timestamp: false # note: use this only with non-concurrent jobs!
#
# - name: Build
# id: cmake_build
@@ -908,6 +963,9 @@ jobs:
runs-on: ubuntu-22.04
+ permissions:
+ actions: write
+
strategy:
matrix:
include:
@@ -938,7 +996,6 @@ jobs:
uses: ggml-org/[email protected]
with:
key: release-ubuntu-22.04-rocm-${{ matrix.ROCM_VERSION }}
- append-timestamp: false # note: use this only with non-concurrent jobs!
- name: Dependencies
id: depends
@@ -996,6 +1053,11 @@ jobs:
${{ env.CMAKE_ARGS }}
cmake --build build --config Release -j $(nproc)
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-ubuntu-22.04-rocm-${{ matrix.ROCM_VERSION }}
+
- name: Determine tag name
id: tag
uses: ./.github/actions/get-tag-name
@@ -1021,6 +1083,9 @@ jobs:
runs-on: windows-2022
+ permissions:
+ actions: write
+
env:
HIPSDK_INSTALLER_VERSION: "26.Q1"
@@ -1060,7 +1125,6 @@ jobs:
uses: ggml-org/[email protected]
with:
key: release-windows-2022-x64-hip-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ matrix.name }}
- append-timestamp: false # note: use this only with non-concurrent jobs!
- name: Install ROCm
if: steps.cache-rocm.outputs.cache-hit != 'true'
@@ -1120,6 +1184,11 @@ jobs:
cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
cp "${env:HIP_PATH}\bin\hipblaslt\library\*" "build\bin\hipblaslt\library\"
+ - name: ccache-clear
+ uses: ./.github/actions/ccache-clear
+ with:
+ key: release-windows-2022-x64-hip-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ matrix.name }}
+
- name: Pack artifacts
id: pack_artifacts
run: |
@@ -1134,7 +1203,9 @@ jobs:
ios-xcode-build:
needs: [check_release]
if: ${{ needs.check_release.outputs.should_release == 'true' }}
- runs-on: macos-26
+ # TODO: figure out how to make this work with macos-26
+ # https://github.com/ggml-org/llama.cpp/actions/runs/26652714555/job/78604869474
+ runs-on: macos-15
steps:
- name: Checkout code