Skip to content

Commit 883f2c9

Browse files
author
danielhanchen
committed
Merge b10775 into kimi-k3-vision-only
# Conflicts: # src/models/kimi-k3.cpp # tools/mtmd/clip.cpp
2 parents edfd4c1 + 67a17c1 commit 883f2c9

1,026 files changed

Lines changed: 73031 additions & 38796 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devops/openvino.Dockerfile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
ARG OPENVINO_VERSION_MAJOR=2026.2.1
2-
ARG OPENVINO_VERSION_FULL=2026.2.1.21919.ede283a88e3
1+
ARG OPENVINO_VERSION_MAJOR=2026.3.1
2+
ARG OPENVINO_VERSION_FULL=2026.3.1.22476.56d9685302d
33
ARG UBUNTU_VERSION=24.04
44

55
# Intel GPU driver versions. https://github.com/intel/compute-runtime/releases
6-
ARG IGC_VERSION=v2.36.3
7-
ARG IGC_VERSION_FULL=2_2.36.3+21719
8-
ARG COMPUTE_RUNTIME_VERSION=26.22.38646.4
9-
ARG COMPUTE_RUNTIME_VERSION_FULL=26.22.38646.4-0
6+
ARG IGC_VERSION=v2.40.13
7+
ARG IGC_VERSION_FULL=2_2.40.13+22418
8+
ARG COMPUTE_RUNTIME_VERSION=26.31.39395.13
9+
ARG COMPUTE_RUNTIME_VERSION_FULL=26.31.39395.13-0
1010
ARG IGDGMM_VERSION=22.10.0
1111

1212
# Intel NPU driver versions. https://github.com/intel/linux-npu-driver/releases
13-
ARG NPU_DRIVER_VERSION=v1.33.0
14-
ARG NPU_DRIVER_FULL=v1.33.0.20260529-26625960453
15-
ARG LIBZE1_VERSION=1.27.0-1~24.04~ppa2
13+
ARG NPU_DRIVER_VERSION=v1.35.0
14+
ARG NPU_DRIVER_FULL=v1.35.0.20260722-29947505341
15+
ARG LIBZE1_VERSION=1.28.2-1~24.04~ppa1
1616

1717
# Optional proxy build arguments
1818
ARG http_proxy=
@@ -90,6 +90,9 @@ RUN bash -c "source ${OpenVINO_DIR}/setupvars.sh && \
9090
cmake -B build/ReleaseOV -G Ninja \
9191
-DCMAKE_BUILD_TYPE=Release \
9292
-DLLAMA_BUILD_TESTS=OFF \
93+
-DGGML_NATIVE=OFF \
94+
-DGGML_BACKEND_DL=ON \
95+
-DGGML_CPU_ALL_VARIANTS=ON \
9396
-DGGML_OPENVINO=ON && \
9497
cmake --build build/ReleaseOV --parallel "
9598

@@ -170,7 +173,7 @@ RUN --mount=type=cache,target=/var/cache/intel-npu,sharing=locked \
170173
fi; \
171174
DEB=/var/cache/intel-npu/libze1_${LIBZE1_VERSION}_amd64.deb; \
172175
if [ ! -f "$DEB" ]; then \
173-
wget -q -O "$DEB" https://snapshot.ppa.launchpadcontent.net/kobuk-team/intel-graphics/ubuntu/20260324T100000Z/pool/main/l/level-zero-loader/libze1_${LIBZE1_VERSION}_amd64.deb; \
176+
wget -q -O "$DEB" https://snapshot.ppa.launchpadcontent.net/kobuk-team/intel-graphics/ubuntu/20260606T100000Z/pool/main/l/level-zero-loader/libze1_${LIBZE1_VERSION}_amd64.deb; \
174177
fi; \
175178
mkdir /tmp/npu/ && cd /tmp/npu/ && tar -xf "$TGZ" && cp "$DEB" .; \
176179
apt-get update; \
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: "ccache-buckets"
2+
description: "Save/restore latest GitHub Actions ccache matching a key prefix to/from HF buckets"
3+
inputs:
4+
key:
5+
description: "Cache key prefix to match and load"
6+
required: true
7+
folder:
8+
description: "Bucket folder containing ccache files"
9+
required: true
10+
evict-old-files:
11+
description: "Corresponds to the ccache --evict-older-than AGE option, where AGE is the number of seconds or days followed by the 's' or 'd' suffix respectively."
12+
default: ''
13+
save:
14+
description: "Save ccache"
15+
required: false
16+
default: false
17+
type: boolean
18+
hf_bucket:
19+
description: 'Hugging Face buckets path'
20+
required: true
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Install Hugging Face Hub CLI
26+
shell: bash
27+
run: |
28+
python3 -m venv .venv-hf
29+
.venv-hf/bin/pip install -U huggingface_hub==1.28.0
30+
31+
- name: Restore ccache from buckets
32+
if: ${{ inputs.save != 'true' }}
33+
shell: bash
34+
run: |
35+
set +e -uo pipefail
36+
source .venv-hf/bin/activate
37+
CCACHE_DIR=$(ccache -k cache_dir)
38+
if [[ -d "$CCACHE_DIR" ]]; then
39+
CACHE_PATH=$(hf buckets list "hf://buckets/${{ inputs.hf_bucket }}/${{ inputs.folder }}" --json | jq -r '[.[] | select(.type == "file") | select(.path | startswith("${{ inputs.folder }}/${{ inputs.key }}") and endswith(".tar.gz"))] | sort_by(.path) | last | .path // ""')
40+
if [[ -n "$CACHE_PATH" ]]; then
41+
echo "Restoring ccache from '$CACHE_PATH'."
42+
hf buckets cp "hf://buckets/${{ inputs.hf_bucket }}/$CACHE_PATH" ccache_bucket.tar.gz
43+
mkdir -p ccache_bucket
44+
if tar -xzf ccache_bucket.tar.gz -C ccache_bucket; then
45+
rm -rf "$CCACHE_DIR"
46+
mv ccache_bucket "$CCACHE_DIR"
47+
ccache -z
48+
fi
49+
rm ccache_bucket.tar.gz
50+
else
51+
echo "No ccache found."
52+
fi
53+
else
54+
echo "'$CCACHE_DIR' not found."
55+
fi
56+
57+
- name: Save ccache to buckets
58+
if: ${{ inputs.save == 'true' }}
59+
shell: bash
60+
run: |
61+
if [[ -n "$HF_TOKEN" ]]; then
62+
set +e -uo pipefail
63+
source .venv-hf/bin/activate
64+
CCACHE_DIR=$(ccache -k cache_dir)
65+
if [[ -d "$CCACHE_DIR" ]]; then
66+
ccache -s
67+
if [[ -n "${{ inputs.evict-old-files }}" ]]; then
68+
ccache --evict-older-than "${{ inputs.evict-old-files }}"
69+
fi
70+
DATESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
71+
CACHEFILE="${{ inputs.key }}-$DATESTAMP.tar.gz"
72+
if tar -czf ccache_bucket.tar.gz -C "$CCACHE_DIR" .; then
73+
hf buckets cp ccache_bucket.tar.gz "hf://buckets/${{ inputs.hf_bucket }}/${{ inputs.folder }}/$CACHEFILE"
74+
fi
75+
rm ccache_bucket.tar.gz
76+
else
77+
echo "'$CCACHE_DIR' not found."
78+
fi
79+
fi
80+
81+
- name: Remove old ccache files from buckets
82+
if: ${{ inputs.save == 'true' }}
83+
shell: bash
84+
run: |
85+
if [[ -n "$HF_TOKEN" ]]; then
86+
set +e -uo pipefail
87+
source .venv-hf/bin/activate
88+
CACHE_FILES=$(hf buckets list "hf://buckets/${{ inputs.hf_bucket }}/${{ inputs.folder }}" --json | jq -r '[.[] | select(.type == "file") | select((.uploaded_at | .[:19]+"Z" | fromdateiso8601) < (now - 5 * 60)) | select(.path | startswith("${{ inputs.folder }}/${{ inputs.key }}") and endswith(".tar.gz"))] | sort_by(.path)[:-1] | .[] | [.path // ""] | @tsv')
89+
if [[ -n "$CACHE_FILES" ]]; then
90+
echo "Removing old ccache files..."
91+
while IFS=$'\t' read -r CACHE_PATH; do
92+
hf buckets rm "hf://buckets/${{ inputs.hf_bucket }}/$CACHE_PATH" -y
93+
done <<< "$CACHE_FILES"
94+
fi
95+
fi
Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,50 @@
1+
# note: place this as the last step of the job, so the new cache is saved by "Post ccache" right after the old one is cleared
12
name: "ccache-clear"
2-
description: "Delete all GitHub Actions caches matching a key prefix"
3+
description: "Delete GitHub Actions caches matching a key prefix, oldest first"
34
inputs:
45
key:
56
description: "Cache key prefix to match and delete"
67
required: true
8+
older:
9+
description: "Only delete caches created more than this long ago (e.g. 90m, 1h, 1d). By default all matching caches are deleted"
10+
required: false
11+
default: ""
12+
min:
13+
description: "Stop deleting if fewer than this many caches would remain (e.g. 1). By default there is no minimum"
14+
required: false
15+
default: "0"
16+
dry-run:
17+
description: "Only print the caches that would be deleted, without deleting them"
18+
required: false
19+
default: "false"
720

821
runs:
922
using: "composite"
1023
steps:
11-
- name: Clear caches
24+
- name: Install GitHub CLI if missing
1225
shell: bash
1326
run: |
14-
CACHES=$(gh cache list --key "ccache-${{ inputs.key }}" --json id,key --jq '.[] | "\(.id) \(.key)"' 2>/dev/null)
15-
if [ -z "$CACHES" ]; then
16-
echo "No caches found with key prefix: ${{ inputs.key }}"
17-
exit 0
27+
# e.g. in container jobs, where it is not preinstalled
28+
if ! command -v gh >/dev/null 2>&1; then
29+
echo "GitHub CLI not found, installing..."
30+
if ! command -v curl >/dev/null 2>&1; then
31+
apt-get update >/dev/null 2>&1 || true
32+
apt-get install -y curl >/dev/null 2>&1 || true
33+
fi
34+
mkdir -p -m 755 /etc/apt/keyrings
35+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null
36+
chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
37+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list
38+
apt-get update >/dev/null 2>&1 || true
39+
apt-get install -y gh || { echo "Failed to install GitHub CLI (gh)" >&2; exit 1; }
1840
fi
19-
while read -r id key; do
20-
echo "Deleting cache: $id ($key)"
21-
gh cache delete "$id"
22-
done <<< "$CACHES"
41+
command -v gh >/dev/null 2>&1 || { echo "GitHub CLI (gh) is required but could not be installed" >&2; exit 1; }
42+
43+
- name: Clear caches
44+
shell: bash
45+
run: |
46+
bash scripts/ccache-clear.sh \
47+
--key "${{ inputs.key }}" \
48+
--older "${{ inputs.older }}" \
49+
--min "${{ inputs.min }}" \
50+
${{ inputs.dry-run == 'true' && '--dry-run' || '' }}

.github/actions/linux-setup-vulkan/action.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/actions/windows-setup-cuda/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ inputs:
66
required: true
77
cuda_arch:
88
description: "CUDA target architecture"
9-
required: false
10-
default: "x64"
9+
required: true
1110

1211
runs:
1312
using: "composite"

.github/actions/windows-setup-rocm/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
2525
write-host "Installing ROCm wheels for multi-arch support"
2626
# Install ROCm wheels for multi-arch support (this may take several minutes)
27-
python -m pip install --index-url https://repo.amd.com/rocm/whl-multi-arch/ "rocm[libraries,devel]==${{ inputs.version }}"
27+
python -m pip install --index-url https://stable.repo.amd.com/rocm/whl-next/ "rocm[libraries,devel]==${{ inputs.version }}"
2828
2929
# Pre-expand the devel tree so it is included in the cache
3030
write-host "Initializing ROCm devel tree"

.github/workflows/build-android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
# cache on: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78224189394
111111
#
112112
#- name: ccache
113-
# uses: ggml-org/ccache-action@v1.2.21
113+
# uses: ggml-org/ccache-action@v1.2.24
114114
# with:
115115
# key: android-ubuntu-arm64
116116
# evict-old-files: 1d

.github/workflows/build-apple.yml

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ on:
2222
types: [opened, synchronize, reopened]
2323
paths: [
2424
'.github/workflows/build-apple.yml',
25-
'ggml/src/ggml-metal/**'
25+
'ggml/src/ggml-metal/**',
26+
'ggml/src/ggml-rpc/**'
2627
]
2728

2829
concurrency:
@@ -46,7 +47,7 @@ jobs:
4647
uses: actions/checkout@v6
4748

4849
- name: ccache
49-
uses: ggml-org/ccache-action@v1.2.21
50+
uses: ggml-org/ccache-action@v1.2.24
5051
with:
5152
key: apple-arm64
5253
evict-old-files: 1d
@@ -65,14 +66,30 @@ jobs:
6566
-DGGML_RPC=ON \
6667
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.3
6768
time cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
68-
leaks -atExit -- ./build/bin/test-thread-safety -hf ggml-org/gemma-3-270m-qat-GGUF -ngl 99 -p "$(printf 'hello %.0s' {1..128})" -n 16 -c 512 -ub 32 -np 2 -t 2 -lv 1
69+
70+
- name: Check for leaks
71+
run: |
72+
cmd=(./build/bin/test-thread-safety -hf ggml-org/gemma-3-270m-qat-GGUF -ngl 99 -p "$(printf 'hello %.0s' {1..128})" -n 16 -c 512 -ub 32 -np 2 -t 2 -lv 1)
73+
leaks -atExit -- "${cmd[@]}"
74+
# Graphics devices are leaked by Metal in Apple code sometimes, so we ignore those leaks
75+
OBJC_DEBUG_MISSING_POOLS=YES "${cmd[@]}" 2>&1 | awk '{ print } index($0, "autoreleased with no pool in place") && !/class [a-zA-Z0-9]+Device autoreleased/ { found = 1 } END { exit found }'
6976
7077
- name: Test
7178
id: cmake_test
7279
run: |
7380
cd build
7481
ctest -L main -E "test-llama-archs" --verbose --timeout 900
7582
83+
- name: ccache-clear
84+
uses: ./.github/actions/ccache-clear
85+
env:
86+
GH_TOKEN: ${{ github.token }}
87+
with:
88+
key: apple-arm64
89+
older: 5m
90+
min: 1
91+
dry-run: ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' }}
92+
7693
macos-latest-x64:
7794
runs-on: macos-15-intel
7895

@@ -82,7 +99,7 @@ jobs:
8299
uses: actions/checkout@v6
83100

84101
- name: ccache
85-
uses: ggml-org/ccache-action@v1.2.21
102+
uses: ggml-org/ccache-action@v1.2.24
86103
with:
87104
key: apple-x64
88105
evict-old-files: 1d
@@ -109,6 +126,16 @@ jobs:
109126
cd build
110127
ctest -L main --verbose --timeout 900
111128
129+
- name: ccache-clear
130+
uses: ./.github/actions/ccache-clear
131+
env:
132+
GH_TOKEN: ${{ github.token }}
133+
with:
134+
key: apple-x64
135+
older: 5m
136+
min: 1
137+
dry-run: ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' }}
138+
112139
macos-latest-ios-xcode:
113140
runs-on: macos-latest
114141

@@ -163,14 +190,6 @@ jobs:
163190
id: checkout
164191
uses: actions/checkout@v6
165192

166-
# TODO: this likely does not do anything - if yes, remove it
167-
- name: ccache
168-
uses: ggml-org/ccache-action@v1.2.21
169-
with:
170-
key: apple-tvos
171-
evict-old-files: 1d
172-
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
173-
174193
- name: Build
175194
id: cmake_build
176195
run: |
@@ -196,14 +215,6 @@ jobs:
196215
id: checkout
197216
uses: actions/checkout@v6
198217

199-
# TODO: this likely does not do anything - if yes, remove it
200-
- name: ccache
201-
uses: ggml-org/ccache-action@v1.2.21
202-
with:
203-
key: apple-visionos
204-
evict-old-files: 1d
205-
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
206-
207218
- name: Build
208219
id: cmake_build
209220
run: |
@@ -234,14 +245,6 @@ jobs:
234245
id: checkout
235246
uses: actions/checkout@v6
236247

237-
# TODO: this likely does not do anything - if yes, remove it
238-
- name: ccache
239-
uses: ggml-org/ccache-action@v1.2.21
240-
with:
241-
key: apple-swift
242-
evict-old-files: 1d
243-
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
244-
245248
- name: Download xcframework artifact
246249
uses: actions/download-artifact@v7
247250
with:

0 commit comments

Comments
 (0)