Skip to content

Commit d7dfd34

Browse files
committed
Merge upstream/master (7c158fb) into opencl/x2-unified
Brings in 188 upstream commits (2026-05-25 -> 2026-06-04): OpenCL q5_0/q5_1 and bf16->f16 support, flat q4_K/q6_K gemv for large M, the upstream OP_GATED_DELTA_NET kernel (ggml-org#23312), plus broad model/converter updates including Gemma 4 (Gemma4ForCausalLM converter, mtmd projector fixes). Two OpenCL files conflicted; resolved as: ggml-opencl.cpp - has_subgroup_shuffle: keep our field, adopt upstream default-init. - EXP/EXPM1: keep our Adreno F32-only guard (F16 overflows post-convert). - MUL_MAT / SoA extras: keep our Q4_0 dequant-to-f16 special-case and the soa0_src view-follow (SIGSEGV) fix; fold in upstream's new Q5_0/Q5_1. - GATED_DELTA_NET: adopt upstream's implementation wholesale (member array, per-(S_V,KDA,tgpp) loader, supports_op S_v gate, 6-src dispatch) and drop our sv128/generic two-kernel version. Removed the now-duplicate 4-arg ggml_cl_gated_delta_net definition. Our GGML_OPENCL_DISABLE_GDN A/B env toggles dropped with it. gated_delta_net.cl - Take upstream's kernel (add/add); kernel entry kernel_gated_delta_net matches the loader. Validated on Adreno X2-90: ggml-opencl builds + links clean; GATED_DELTA_NET test-backend-ops 36/36 OK (incl. K>1 MTP-snapshot, kda, permuted, v_repeat). Follow-up: re-bench GDN tg vs the dropped sv128 kernel on Qwen3.6-A3B.
2 parents 12aecf6 + 7c158fb commit d7dfd34

436 files changed

Lines changed: 35009 additions & 13625 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/nix/package.nix

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
glibc,
44
config,
55
stdenv,
6+
stdenvNoCC,
67
runCommand,
78
cmake,
89
ninja,
@@ -19,6 +20,8 @@
1920
openssl,
2021
shaderc,
2122
spirv-headers,
23+
nodejs,
24+
importNpmLock,
2225
useBlas ?
2326
builtins.all (x: !x) [
2427
useCuda
@@ -130,7 +133,31 @@ effectiveStdenv.mkDerivation (finalAttrs: {
130133
src = lib.cleanSource ../../.;
131134
};
132135

133-
postPatch = ''
136+
# Builds the webui locally, taking care not to require updating any sha256 hash.
137+
webui = stdenvNoCC.mkDerivation {
138+
pname = "webui";
139+
version = llamaVersion;
140+
src = lib.cleanSource ../../tools/ui;
141+
142+
nativeBuildInputs = [
143+
nodejs
144+
importNpmLock.linkNodeModulesHook
145+
];
146+
147+
# no sha256 required when using buildNodeModules
148+
npmDeps = importNpmLock.buildNodeModules {
149+
npmRoot = ../../tools/ui;
150+
inherit nodejs;
151+
};
152+
153+
installPhase = ''
154+
LLAMA_UI_OUT_DIR=$out npm run build --offline
155+
'';
156+
};
157+
158+
postPatch = lib.optionalString useWebUi ''
159+
cp -r ${finalAttrs.webui} tools/ui/dist
160+
chmod -R u+w tools/ui/dist
134161
'';
135162

136163
# With PR#6015 https://github.com/ggml-org/llama.cpp/pull/6015,

.devops/zendnn.Dockerfile

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
ARG UBUNTU_VERSION=24.04
2+
ARG BUILD_DATE=N/A
3+
ARG APP_VERSION=N/A
4+
ARG APP_REVISION=N/A
5+
6+
FROM ubuntu:$UBUNTU_VERSION AS build
7+
8+
RUN apt-get update && \
9+
apt-get install -y gcc-13 g++-13 build-essential git cmake libssl-dev libomp-dev libnuma-dev python3 ca-certificates
10+
11+
ENV CC=gcc-13 CXX=g++-13
12+
13+
WORKDIR /app
14+
15+
COPY . .
16+
17+
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_ZENDNN=ON && \
18+
cmake --build build -j $(nproc)
19+
20+
RUN mkdir -p /app/lib && \
21+
find build -name "*.so*" -exec cp -P {} /app/lib \;
22+
23+
RUN mkdir -p /app/full \
24+
&& cp build/bin/* /app/full \
25+
&& cp *.py /app/full \
26+
&& cp -r conversion /app/full \
27+
&& cp -r gguf-py /app/full \
28+
&& cp -r requirements /app/full \
29+
&& cp requirements.txt /app/full \
30+
&& cp .devops/tools.sh /app/full/tools.sh
31+
32+
## Base image
33+
FROM ubuntu:$UBUNTU_VERSION AS base
34+
35+
ARG BUILD_DATE=N/A
36+
ARG APP_VERSION=N/A
37+
ARG APP_REVISION=N/A
38+
ARG IMAGE_URL=https://github.com/ggml-org/llama.cpp
39+
ARG IMAGE_SOURCE=https://github.com/ggml-org/llama.cpp
40+
LABEL org.opencontainers.image.created=$BUILD_DATE \
41+
org.opencontainers.image.version=$APP_VERSION \
42+
org.opencontainers.image.revision=$APP_REVISION \
43+
org.opencontainers.image.title="llama.cpp" \
44+
org.opencontainers.image.description="LLM inference in C/C++" \
45+
org.opencontainers.image.url=$IMAGE_URL \
46+
org.opencontainers.image.source=$IMAGE_SOURCE
47+
48+
RUN apt-get update \
49+
&& apt-get install -y libgomp1 libnuma1 curl \
50+
&& apt autoremove -y \
51+
&& apt clean -y \
52+
&& rm -rf /tmp/* /var/tmp/* \
53+
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
54+
&& find /var/cache -type f -delete
55+
56+
COPY --from=build /app/lib/ /app
57+
58+
### Full
59+
FROM base AS full
60+
61+
COPY --from=build /app/full /app
62+
63+
WORKDIR /app
64+
65+
RUN apt-get update \
66+
&& apt-get install -y \
67+
git \
68+
python3 \
69+
python3-pip \
70+
python3-wheel \
71+
&& pip install --break-system-packages --upgrade setuptools \
72+
&& pip install --break-system-packages -r requirements.txt \
73+
&& apt autoremove -y \
74+
&& apt clean -y \
75+
&& rm -rf /tmp/* /var/tmp/* \
76+
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
77+
&& find /var/cache -type f -delete
78+
79+
ENTRYPOINT ["/app/tools.sh"]
80+
81+
### Light, CLI only
82+
FROM base AS light
83+
84+
COPY --from=build /app/full/llama-cli /app/full/llama-completion /app
85+
86+
WORKDIR /app
87+
88+
ENTRYPOINT [ "/app/llama-cli" ]
89+
90+
### Server, Server only
91+
FROM base AS server
92+
93+
ENV LLAMA_ARG_HOST=0.0.0.0
94+
95+
COPY --from=build /app/full/llama-server /app
96+
97+
WORKDIR /app
98+
99+
HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
100+
101+
ENTRYPOINT [ "/app/llama-server" ]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "ccache-clear"
2+
description: "Delete all GitHub Actions caches matching a key prefix"
3+
inputs:
4+
key:
5+
description: "Cache key prefix to match and delete"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Clear caches
12+
shell: bash
13+
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
18+
fi
19+
while read -r id key; do
20+
echo "Deleting cache: $id ($key)"
21+
gh cache delete "$id"
22+
done <<< "$CACHES"

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,34 @@ runs:
9696
echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
9797
echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
9898
echo "CUDA_PATH_V13_1=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
99+
100+
- name: Install Cuda Toolkit 13.3
101+
if: ${{ inputs.cuda_version == '13.3' }}
102+
shell: pwsh
103+
run: |
104+
mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3"
105+
choco install unzip -y
106+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_crt/windows-x86_64/cuda_crt-windows-x86_64-13.3.33-archive.zip"
107+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-13.3.29-archive.zip"
108+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-13.3.33-archive.zip"
109+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-13.3.33-archive.zip"
110+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-13.5.1.27-archive.zip"
111+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libnvvm/windows-x86_64/libnvvm-windows-x86_64-13.3.33-archive.zip"
112+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-13.3.29-archive.zip"
113+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_profiler_api/windows-x86_64/cuda_profiler_api-windows-x86_64-13.3.27-archive.zip"
114+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-13.3.27-archive.zip"
115+
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cccl/windows-x86_64/cccl-windows-x86_64-13.3.3.3.1-archive.zip"
116+
unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3"
117+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\cuda_crt-windows-x86_64-13.3.33-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
118+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\cuda_cudart-windows-x86_64-13.3.29-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
119+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\cuda_nvcc-windows-x86_64-13.3.33-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
120+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\cuda_nvrtc-windows-x86_64-13.3.33-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
121+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\libcublas-windows-x86_64-13.5.1.27-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
122+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\libnvvm-windows-x86_64-13.3.33-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
123+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\cuda_nvtx-windows-x86_64-13.3.29-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
124+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\cuda_profiler_api-windows-x86_64-13.3.27-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
125+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\visual_studio_integration-windows-x86_64-13.3.27-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
126+
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\cccl-windows-x86_64-13.3.3.3.1-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" /E /I /H /Y
127+
echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
128+
echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
129+
echo "CUDA_PATH_V13_3=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

.github/workflows/build-3rd-party.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ concurrency:
2222
env:
2323
GGML_NLOOP: 3
2424
GGML_N_THREADS: 1
25-
LLAMA_LOG_COLORS: 1
26-
LLAMA_LOG_PREFIX: 1
27-
LLAMA_LOG_TIMESTAMPS: 1
25+
LLAMA_ARG_LOG_COLORS: 1
26+
LLAMA_ARG_LOG_PREFIX: 1
27+
LLAMA_ARG_LOG_TIMESTAMPS: 1
2828

2929
jobs:
3030
ubuntu-24-llguidance:

.github/workflows/build-and-test-snapdragon.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
android-ndk-snapdragon:
3232
runs-on: ubuntu-latest
3333
container:
34-
image: 'ghcr.io/snapdragon-toolchain/arm64-android:v0.6'
34+
image: 'ghcr.io/snapdragon-toolchain/arm64-android:v0.7'
3535
defaults:
3636
run:
3737
shell: bash
@@ -61,7 +61,7 @@ jobs:
6161
linux-iot-snapdragon:
6262
runs-on: ubuntu-latest
6363
container:
64-
image: 'ghcr.io/snapdragon-toolchain/arm64-linux:v0.6'
64+
image: 'ghcr.io/snapdragon-toolchain/arm64-linux:v0.7'
6565
defaults:
6666
run:
6767
shell: bash

.github/workflows/build-android.yml

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ concurrency:
2727
env:
2828
GGML_NLOOP: 3
2929
GGML_N_THREADS: 1
30-
LLAMA_LOG_COLORS: 1
31-
LLAMA_LOG_PREFIX: 1
32-
LLAMA_LOG_TIMESTAMPS: 1
30+
LLAMA_ARG_LOG_COLORS: 1
31+
LLAMA_ARG_LOG_PREFIX: 1
32+
LLAMA_ARG_LOG_TIMESTAMPS: 1
3333

3434
jobs:
35-
android:
35+
default:
3636
runs-on: ubuntu-latest
3737

3838
steps:
@@ -58,7 +58,7 @@ jobs:
5858
cd examples/llama.android
5959
./gradlew build --no-daemon
6060
61-
android-ndk:
61+
ndk:
6262
runs-on: ubuntu-latest
6363
container:
6464
image: 'ghcr.io/snapdragon-toolchain/arm64-android:v0.3'
@@ -91,3 +91,59 @@ jobs:
9191
with:
9292
name: llama-cpp-android-arm64-cpu
9393
path: pkg-adb/llama.cpp
94+
95+
arm64:
96+
runs-on: ubuntu-latest
97+
98+
env:
99+
NDK_VERSION: "29.0.14206865"
100+
101+
steps:
102+
- name: Clone
103+
id: checkout
104+
uses: actions/checkout@v6
105+
106+
# note : disabled to spare some cache space (https://github.com/ggml-org/llama.cpp/pull/23789)
107+
# for some reason, the ccache does not improve the build time in this case
108+
# example:
109+
# cache off: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78160400831
110+
# cache on: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78224189394
111+
#
112+
#- name: ccache
113+
# uses: ggml-org/ccache-action@v1.2.21
114+
# with:
115+
# key: android-ubuntu-arm64
116+
# evict-old-files: 1d
117+
# save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
118+
119+
- name: Set up JDK
120+
uses: actions/setup-java@v5
121+
with:
122+
java-version: 17
123+
distribution: temurin
124+
125+
- name: Setup Android SDK
126+
uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1
127+
with:
128+
log-accepted-android-sdk-licenses: false
129+
130+
- name: Install NDK
131+
run: |
132+
sdkmanager "ndk;${{ env.NDK_VERSION }}"
133+
echo "ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${{ env.NDK_VERSION }}" >> $GITHUB_ENV
134+
135+
- name: Build
136+
id: cmake_build
137+
run: |
138+
cmake -B build \
139+
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
140+
-DANDROID_ABI=arm64-v8a \
141+
-DANDROID_PLATFORM=android-28 \
142+
-DLLAMA_FATAL_WARNINGS=ON \
143+
-DGGML_BACKEND_DL=ON \
144+
-DGGML_NATIVE=OFF \
145+
-DGGML_CPU_ALL_VARIANTS=ON \
146+
-DGGML_OPENMP=OFF \
147+
-DLLAMA_BUILD_BORINGSSL=ON \
148+
-DGGML_RPC=ON
149+
time cmake --build build --config Release -j $(nproc)

0 commit comments

Comments
 (0)