Repository navigation
jinja: support json sort_keys=true - #32366
Merged
Merged
Conversation
aldehir
approved these changes
Nov 16, 2026
CISC
approved these changes
Nov 16, 2026
bahooo22
added a commit
to bahooo22/llama.cpp
that referenced
this pull request
Nov 16, 2026
…мплекта сохранена Что изменено? - Переезд UI (`tools/ui` -> `ui/apps/chat`, апстрим ggml-org#32032): 1000 записей R и 1 новый файл `ui/apps/chat/tests/client/settings-tools-policy.svelte.test.ts` (+1/-0); `tools/ui` после мержа пуст (0 файлов), `ui/apps/chat` — 1001 файл. `scripts/ui-assets.cmake` (+3/-3) ведёт сборку на новый путь. - Batch API (`a06044b93` ggml-org#32306, `62a6d3a30` ggml-org#32356): `src/llama-context.cpp` (+13/-16), `src/llama-context.h` (+1/-1), `common/arg.cpp` (+12/-4), `common/common.h` (+1/-0), `CMakeLists.txt` (+1/-1) — старый batch API объявлен устаревшим, внутренности переехали на `llama_batch_ext`. - Jinja (`ef6bc6f36` ggml-org#32396, `e1925b369` ggml-org#32366): `common/jinja/runtime.h` (+30/-3), `common/jinja/value.cpp` (+20/-14), `common/jinja/runtime.cpp` (+4/-3), `common/jinja/value.h` (+1/-1) — поиск по scope-chain и `sort_keys=true`. - CUDA/HIP: `ggml/src/ggml-cuda/gated-delta-net-mma.cu` (+139/-72, GDN mma на CDNA — ggml-org#31327), `ggml/src/ggml-cuda/mmvq.cu` (+8/-0, тюнинг ne11 для RDNA3_5 — ggml-org#32308), `ggml/src/ggml-cuda/vendors/hip.h` (+2/-2) — слиты автоматически, моих правок в них нет. - Vulkan: `ggml/src/ggml-vulkan/ggml-vulkan.cpp` (+100/-24), `vulkan-shaders/topk_radix_select.comp` (+140/-21), `vulkan-shaders/conv3d_mm.comp` (+14/-5), плюс 4 служебных файла — split_k для conv3d (ggml-org#29929), детерминированный top-k (ggml-org#31931), фикс 32-битной сборки (ggml-org#32275), shmem FA (ggml-org#32244). - WebGPU: `ggml/src/ggml-webgpu/ggml-webgpu.cpp` (+33/-19), `ggml-webgpu-shader-lib.hpp` (+10/-7) и 5 wgsl-шейдеров — per-head FA-маски (ggml-org#32394). - mtmd/conversion: `tools/mtmd/mtmd-helper-gen.cpp` (+304/-91), `tools/mtmd/models/fish-s2-gen.cpp` (+74/-0), `tools/mtmd/models/fish-s2-spkenc.cpp` (+135/-0), `conversion/fish_s2.py` (+276/-0) и ещё 12 файлов — fish audio s2 (ggml-org#32330). - Тесты: `tests/test-arg-parser.cpp` (+27/-0), `tests/test-jinja.cpp` (+15/-0), `tests/test-backend-ops.cpp` (+15/-8), `tests/test-batch-alloc.cpp` (+6/-2). - Прочее из апстрима: `README.md` (+9/-41, `8bfd64b5a` + `5cb951679`), 10 файлов `.devops/*` (+4/-4 каждый, docker-теги vX.Y.Z — ggml-org#32388), `scripts/make-release-summary.txt` (+1/-1). - 8 унаследованных workflow апстрима (`docker.yml`, `release.yml`, `ui.yml`, `ui-build.yml`, `ui-build-self-hosted.yml`, `ui-publish.yml`, `ui-self-hosted.yml`, `pr-video-demo-label.yml`) решены в пользу удаления форка (`git rm`, по 0 строк в дельте): они были сняты правкой `39628e5a4`, и в итоговом дереве живы только 2 файла ноги — `kit-build-cuda.yml` и `bench.yml.disabled`. Зачем? `master` форка отставал от `ggml-org/llama.cpp` на 20 коммитов, и GitHub предлагал закрыть разрыв сбросом ветки («Discard 53 commits»), то есть удалением всей ноги комплекта, патча upload-stream, отката unbuffered load и диагностик. Синк локальным мержем закрывает отставание, оставляя 53 коммита форка на месте; без него следующая сборка llama-ноги и рабочих серверов шла бы на старой базе. Замеры? - `git merge-tree --write-tree` до мержа: `rc=1`, 8 конфликтов класса modify/delete, auto-merging без находок у `README.md`, `vendors/hip.h`, `src/llama-context.cpp`; полный вывод — `E:\tmp\llama_sync_check_2026-11-16_merge-tree.txt`. - После `git rm`: неразрешённых 0, `write-tree` = `b14174eeb9c5c020332bd397fabcedd2eb05a38b`, файлов в дереве 4133. - Дельта против `fork/master` (`git diff --cached -M --numstat HEAD`): 1095 записей, +2179/-632, бинарных 8; по классам A=4, M=91, R=1000, D=0. - Расхождение до мержа (`git rev-list --count`): ahead 53 / behind 20 — совпало с экраном GitHub; merge-base `6b01a4767`, `origin/master` = `4303cd94a`, `fork/master` = `42d80425a`. - Не проверено на этом шаге: компиляция ноги (апстрим перенёс batch API) и тесты — это следующий шаг, а не этот коммит. Принятый остаток? Сборка llama-ноги на новой базе и замена рабочих серверов — отдельными прогонами; CI-аппрувы и описания PR остаются за пользователем. Итог `master` форка = апстрим `4303cd94a` + 53 коммита форка; история мержей синка не прервана, страховка `backup/llama-master-pre-sync-2026-11-16` = `42d80425a`. --- EN: sync: master absorbed origin/master (20 commits), kit CI leg preserved What changed? - UI relocation (`tools/ui` -> `ui/apps/chat`, upstream ggml-org#32032): 1000 R entries plus one new file `ui/apps/chat/tests/client/settings-tools-policy.svelte.test.ts` (+1/-0); `tools/ui` is empty after the merge (0 files), `ui/apps/chat` holds 1001 files. `scripts/ui-assets.cmake` (+3/-3) points the build at the new path. - Batch API (`a06044b93` ggml-org#32306, `62a6d3a30` ggml-org#32356): `src/llama-context.cpp` (+13/-16), `src/llama-context.h` (+1/-1), `common/arg.cpp` (+12/-4), `common/common.h` (+1/-0), `CMakeLists.txt` (+1/-1) — the old batch API is deprecated and internals moved to `llama_batch_ext`. - Jinja (`ef6bc6f36` ggml-org#32396, `e1925b369` ggml-org#32366): `common/jinja/runtime.h` (+30/-3), `common/jinja/value.cpp` (+20/-14), `common/jinja/runtime.cpp` (+4/-3), `common/jinja/value.h` (+1/-1) — scope-chain key lookup and `sort_keys=true`. - CUDA/HIP: `ggml/src/ggml-cuda/gated-delta-net-mma.cu` (+139/-72, GDN mma on CDNA — ggml-org#31327), `ggml/src/ggml-cuda/mmvq.cu` (+8/-0, RDNA3_5 ne11 gate tuning — ggml-org#32308), `ggml/src/ggml-cuda/vendors/hip.h` (+2/-2) — auto-merged, no local edits inside. - Vulkan: `ggml/src/ggml-vulkan/ggml-vulkan.cpp` (+100/-24), `vulkan-shaders/topk_radix_select.comp` (+140/-21), `vulkan-shaders/conv3d_mm.comp` (+14/-5) plus 4 supporting files — split_k conv3d (ggml-org#29929), deterministic top-k (ggml-org#31931), 32-bit build fix (ggml-org#32275), shmem FA (ggml-org#32244). - WebGPU: `ggml/src/ggml-webgpu/ggml-webgpu.cpp` (+33/-19), `ggml-webgpu-shader-lib.hpp` (+10/-7) and 5 wgsl shaders — per-head FA masks (ggml-org#32394). - mtmd/conversion: `tools/mtmd/mtmd-helper-gen.cpp` (+304/-91), `tools/mtmd/models/fish-s2-gen.cpp` (+74/-0), `tools/mtmd/models/fish-s2-spkenc.cpp` (+135/-0), `conversion/fish_s2.py` (+276/-0) and 12 more files — fish audio s2 (ggml-org#32330). - Tests: `tests/test-arg-parser.cpp` (+27/-0), `tests/test-jinja.cpp` (+15/-0), `tests/test-backend-ops.cpp` (+15/-8), `tests/test-batch-alloc.cpp` (+6/-2). - Rest of upstream: `README.md` (+9/-41, `8bfd64b5a` + `5cb951679`), 10 `.devops/*` files (+4/-4 each, vX.Y.Z docker tags — ggml-org#32388), `scripts/make-release-summary.txt` (+1/-1). - 8 inherited upstream workflows (`docker.yml`, `release.yml`, `ui.yml`, `ui-build.yml`, `ui-build-self-hosted.yml`, `ui-publish.yml`, `ui-self-hosted.yml`, `pr-video-demo-label.yml`) resolved in favour of the fork's deletion (`git rm`, 0 lines in the delta): they were removed by `39628e5a4`, and the merged tree keeps only 2 leg files — `kit-build-cuda.yml` and `bench.yml.disabled`. Why? The fork's `master` was 20 commits behind `ggml-org/llama.cpp`, and GitHub offered to close the gap by discarding the branch ("Discard 53 commits"), i.e. deleting the whole kit CI leg, the upload-stream patch, the unbuffered-load revert and the diagnostics. A local merge closes the lag and keeps all 53 fork commits; without it the next llama-leg build and the replacement of the live servers would run on a stale base. Verified? - `git merge-tree --write-tree` before the merge: `rc=1`, 8 modify/delete conflicts, clean auto-merge for `README.md`, `vendors/hip.h`, `src/llama-context.cpp`; full output in `E:\tmp\llama_sync_check_2026-11-16_merge-tree.txt`. - After `git rm`: 0 unmerged paths, `write-tree` = `b14174eeb9c5c020332bd397fabcedd2eb05a38b`, 4133 files in the tree. - Delta against `fork/master` (`git diff --cached -M --numstat HEAD`): 1095 entries, +2179/-632, 8 binary; by class A=4, M=91, R=1000, D=0. - Divergence before the merge (`git rev-list --count`): ahead 53 / behind 20 — matches the GitHub screen; merge-base `6b01a4767`, `origin/master` = `4303cd94a`, `fork/master` = `42d80425a`. - Not verified at this step: compiling the leg (upstream moved the batch API) and tests — that is the next step, not this commit. Accepted remainder? Building the llama leg on the new base and replacing the live servers run as separate steps; CI approvals and PR descriptions stay with the user. Result Fork `master` = upstream `4303cd94a` + 53 fork commits; the sync-merge history is unbroken, safety ref `backup/llama-master-pre-sync-2026-11-16` = `42d80425a`.
alex-spacemit
added a commit
to spacemit-com/llama.cpp
that referenced
this pull request
Nov 19, 2026
* cuda : add sm70 FlashAttention config case for DKQ=256, DV=256, ncols=64 (#27997) * CUDA : add sm70 FlashAttention config case for the 256x256 head * CUDA : tune sm70 FlashAttention for 256x256 ncols=32 Assisted-by: Codex --------- Co-authored-by: Jirka Svítil <[email protected]> * cuda : use MMVF for BF16 matrices of few rows at small batch sizes (#31959) MMF tiles 32 rows per block, so a BF16 matrix with few rows (e.g. the qwen4exp hyper-connection projections, 320 rows with K = 10240) runs only a handful of blocks and leaves most SMs idle at batch sizes 2..8. MMVF runs a block per row and wins there when K is long enough. MMVF's cost grows with rows x batch while MMF's stays roughly flat in that range, so use MMVF only while rows * ne11 * 256 <= nsm * min(K, max_k) and K >= 1024. The budget scales with the SM count, which keeps GPUs with few SMs (e.g. the A16) on MMF. Blackwell allows up to 8 columns and max_k = 6144; older GPUs stop at 5 columns and max_k = 4096. Add eval cases at 128x2560, 512x2560 and 320x10240 for n = 2, 3, 4, 5 and 8. * ui: open the virtual keyboard in the chat editor on Android (#32060) CodeMirror takes text input through EditContext on Chrome for Android only, and there the chat editor never brings up the virtual keyboard. The editor now always takes its input through contenteditable, as on desktop and iOS. A press in the input box outside the text also focuses the editor, in the collapsed form too, so the whole box is a tap target again as the textarea was. * tests : use only the public ggml API (#32077) * vulkan: allocate the device fault vendor binary buffer (#32008) * vulkan : allocate the device fault vendor binary buffer * vulkan : drop the redundant vector include --------- Co-authored-by: figkcoci-debug <[email protected]> * vulkan: allow dequantized KV optimization with CM2 (#31526) * additional FA test cases Assisted-by: Codex * vulkan: allow dequantized KV optimization with CM2 Enable the KV dequantization optimization with coopmat2, guarded by a heuristic based on query tokens*GQA ratio. While doing this we saw very large speedups for certain head sizes, and it was because those head sizes were incorrectly treated as unaligned. So also fix those to be treated as aligned, which should help for when the dequant optimization doesn't apply. * gqa uses nbq2 for the stride, so we need to check that value for alignment * tests : use VARS_TO_STR18 for flash attention Assisted-by: Codex * webgpu: add PAD_REFLECT_1D support (#31877) * webgpu : add PAD_REFLECT_1D support * webgpu: remove redundant PAD_REFLECT_1D contiguity check * tests: simplify PAD_REFLECT_1D setup * cpu: accumulate flash attention V in F32 (#29810) * cpu: accumulate flash attention V in F32 in the one-chunk kernel The one-chunk kernel accumulated an F16 V cache in an F16 running sum that is only normalized at the end, which overflows past 65504 on long contexts: inf, then NaN on every following token. Every V type now accumulates in F32, like the tiled kernel. F16 rows go through ggml_vec_mad_f16_f32, which converts and multiplies in the same register (F16C/AVX512, NEON, RVV) with no round trip through a temporary F32 row, so decode keeps master speed on x86 and loses about 4% at 4k context on ARM, where master used native F16 FMA. * cpu: widen the F16 V rows like ggml_vec_dot_f16_f32 ggml_vec_mad_f16_f32 required F16C and FMA, so AVX builds without FMA fell back to a scalar loop and ran 3x slower than master. It now follows the guards of ggml_vec_dot_f16_f32: AVX512, then AVX with F16C through GGML_F32x8_FMA, then NEON and RVV, then the scalar loop. * quantize: fix imatrix GGUF filepath metadata leak (#32000) * ROCm/HIP: fixed BLAS workspace instead of rocBLAS allocating one per call (#31838) * ROCm/HIP: fixed BLAS workspace instead of rocBLAS allocating one per call Assisted-by: Claude Opus 5 * ROCm/HIP: corrected by only setting the workspace on ROCm 7.0 or newer * test-fp8.cpp: use only the public ggml API (#32083) * backend : re-instantiate CUDA graphs when the cluster dims of a kernel change (#31284) * CUDA: re-instantiate graphs when the cluster dims of a kernel change * CUDA: keep the cluster dims with the graph instance, check them only on Hopper+ Assisted-by: Claude Opus 5.5 * CUDA: use CUDA_CHECK and a helper struct for the graph cluster dims Co-Authored-By: Claude Opus 5.5 <[email protected]> * CUDA: add a TODO for the graph cluster dims test Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * vendor: update cpp-httplib to 0.66.0 (#32049) * devops : add missing MKL runtime DLLs to the Windows SYCL release package (#32005) ggml-sycl.dll built with oneAPI 2026.2 imports mkl_intel_thread.3.dll and libimalloc.dll, which are not part of the release package. LoadLibrary fails and the SYCL backend is silently skipped, llama.cpp falls back to CPU. Adding both DLLs fixes the load: measured on Arc B570 with LFM2.5-8B-A1B Q4_K_M, pp4096 goes from 404 t/s (CPU fallback) to 2232 t/s (SYCL) with the extracted b12244 package. Assisted-by: GLM (z-ai/glm-5.3-flash) Co-authored-by: Asahi-Prv <[email protected]> * llama : remove non-fused GDN and ubatch-dependent graph nodes (#32078) - remove build_delta_net_chunking and build_delta_net_autoregressive - always use the fused gated delta net - make graph_max_nodes independent of the ubatch size - drop the fused GDN probes and fused node tags Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ci : remove dead snakes (#32084) * chat: allow TTS model to provide custom text normalizer via jinja (#32053) * chat: allow TTS model to provide custom text normalizer via jinja * rm tts_norm_is_reserved_name * jinja : support chained comparisons and argument unpacking (#32072) * llama : reuse graph result instances across scheduler reserves (#32089) Allocate gf_res_reserve and both gf_res_prev entries once in the llama_context constructor. Add llm_graph_result::set_max_nodes() and reset the existing instances in sched_reserve() instead of recreating them. get_gf_res_prev() now only selects the arena for the current batch. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * vendor : update LibreSSL to 4.4.1 [no ci] (#32106) Co-authored-by: Alessandro de Oliveira Faria (A.K.A.CABELO) <[email protected]> * vulkan: support batched tensor copy API (#31418) * vulkan: support batched tensor copy API * allocate staging buffer only for copies that actually need it * metal : prevent out-of-bounds reads in SOLVE_TRI kernel (#32103) * ci: move test models to ggml-org-dev (#32096) * ci: move test models to ggml-org-dev * fix test spec * server: fix --cors-origins handling + protect against DNS rebinding (#32098) * server: fix --cors-origins localhost handling * server: validate Host on loopback connections against DNS rebinding A page whose own name resolves to 127.0.0.1 reaches the server with that name in Host and a matching Origin, so the same-origin shortcut let it through. On a loopback connection, Host must now name loopback or the host of an allowed --cors-origins entry. The LAN tests reach the server through a real interface instead of a forged Host. * fix python type check --------- Co-authored-by: Pascal <[email protected]> * ui: take the logo and favicons from the llama-brand package (#32039) * ui : take the logo and favicons from llama-brand The web UI's logo mark and favicons now come from llama-brand, added as a dev dependency from GitHub and pinned to a commit, so the UI draws the same icon as the README cover instead of its own copy of an older one. Logo.svelte inlines the brand's icon and fills it with currentColor, and the PWA asset generator starts from the brand's web favicons, which carry their own margin and optical centring, so the UI's colouring and padding script, its test and its logo.svg go. Assisted-by: Claude (Opus 5.5 Medium) * ui : follow llama-brand's master instead of a pinned commit Assisted-by: Claude (Opus 5.5 Medium) * ui: keep downloads in Discover during search and fix their progress with a draft (#31467) * ui : keep downloads in Discover sidebar during search, sort base-org repos first - Show the sticky Downloading section regardless of an active search query - Order search results so repos published by their base model's org lead Assisted-by: Claude (Opus 5.5 Medium) * server : throttle download progress per file Files of a download run in parallel threads, but progress updates were throttled with one shared timer. A small draft sidecar reports far more often than the main weights, so it took nearly every slot and the main file's updates, including the first one carrying its total size, were dropped until the draft finished. The UI then showed the draft's progress first and restarted from 0% for the model. Throttle each file on its own and always pass a file's first update. Assisted-by: Claude (Opus 5.5 Medium) * ui: list a downloading repo once and match base orgs case-insensitively A search hit that is downloading already shows under Downloading, so the results leave it out. Base model orgs compare without case, as the hub treats them. Assisted-by: Claude (Opus 5.5 Medium) * server : tell clients a download stopped on request When a client paused or cancelled a download, every other client following /models/sse got a bare download_failed and could not tell it from an error, so the web UI showed "Download failed" for a pause made in the Llama app. A stop asked for through unload or delete now fails with {"stopped": true}. Deleting a paused download, which has no instance left, now sends model_remove as deleting a running one does, so other clients drop its row. Assisted-by: Claude (Opus 5.5 Medium) * ui : follow downloads other clients start, pause or cancel A download another client started (e.g. the Llama app) already showed up from the feed; it now also picks up the sidecars the list reports for it. A stop another client asked for reads as a pause instead of a failure, and a removal clears the download row even when the list does not carry it yet. Assisted-by: Claude (Opus 5.5 Medium) * docs: update image link in README.md (#32038) * Update image link in README.md I guess the image in the main README is now this one https://github.com/ggml-org/llama-brand/blob/master/logo/svg/cover/llama-cpp/cover-llama-cpp-dark.svg * Fix image link in README.md * Update image alt text in README.md * ui: move js sandbox setting out of "developer" (#32054) * ui: move js sandbox setting out of "developer" * make js sandbox enabled by default * opencl: add decomposed FA for Adreno (#32046) * opencl: add decomposed FA Assisted-by: Claude Opus 5.5 Co-authored-by: Hongqiang Wang <[email protected]> Co-authored-by: Shaofei Qi <[email protected]> * opencl: build FA MQ kernel on first FA call * so allows warmup to early build neccessary kernels Assisted-by: Claude Opus 5.5 * opencl: handle inf for fully masked row * opencl: refine condition for using fa decomp * opencl: support dp4a for PV mm Assisted-by: Codex * opencl: add direct PV for FA decomp to avoid V transpose for small batch Assisted-by: Codex * opencl: enable direct pv by default * opencl: expand X2E decomposed FA to smaller heads and batches - Lower the default head dimension threshold from 256 to 128 on X2E. - Allow DK64 with P8, no attention sinks, GQA >= 2 and n_kv >= max(1024, 2*n_q). - Allow P8 with V transpose for 2-31 queries when direct PV is unavailable, DK >= 128 and n_kv >= 1024. Assisted-by: Codex * opencl: adjust format --------- Co-authored-by: Li He <[email protected]> Co-authored-by: Hongqiang Wang <[email protected]> * server: use the moved test model in the router CORS test (#32117) test_router_restricted_cors_same_origin_reaches_child still named ggml-org/tinygemma3-GGUF, which the router no longer finds since the test models moved to ggml-org-dev, so the Server test job fails on master. Assisted-by: Claude (Opus 5.5 Medium) * CUDA: skip empty MoE tiles in MMQ stream-k fixup (#32067) * CUDA: skip empty MoE tiles in MMQ stream-k fixup mul_mat_q_stream_k_fixup loads ids_dst[col_low + j] for all j < J before checking j_sup. mul_mat_q returns early on col_low == col_high, the fixup kernel did not. mm_ids_helper emits one extra tile per expert that may be empty; for trailing experts col_low == ncols_dst, so the load reads one element past the J_best-1 padding added in #29953. The kernel returns at j >= j_sup before storing anything, so results are unaffected. Return early when j_sup <= 0, like the main kernel. The return is block-uniform (tsj is loaded once per block) and precedes __syncthreads(). Add test_mul_mat_id_unused_tail to test-backend-ops: only the first n_mats/2 experts are selected, so the trailing experts have zero rows and their tiles are empty; m=33, k=512 keeps tile efficiency low enough that stream-k splits along K and launches the fixup kernel. * CUDA: drop the extra MUL_MAT_ID test case and the explanatory comment (review) * opencl: add bin kernel `kernel_gemm_noshuffle_q4_0_f32_32b_trans_ila_a7_bin` (#30947) * opencl: add A7 Q4_0 non-MoE binary kernel * opencl: refactor --------- Co-authored-by: Li He <[email protected]> * CUDA: add cuda debug buffer pool (#31919) * CUDA: add cuda debug buffer pool * CUDA: add code comment for debug pool with compute-sanitizer * sycl : use cached device-id in set_main_device (#32013) ggml_sycl_set_main_device() runs at the start of every graph compute. Its early-return check called dpct::get_current_device_id(), which locks the device manager mutex and looks up the thread-to-device map. Use the thread-local cached id that the rest of the backend already uses. Assisted-by: Claude Code Co-authored-by: zhaoyshine <[email protected]> * sycl : fix AOT for more than 4GB (#31873) * fix aot for >4g garbage output issue; add --aot in build script * correct the aot flag * support no-xmx build, update the code for no-xmx building, rename nossl to no-ssl * sycl: make oneDNN FA cache thread-safe and memoize runtime failures (#31138) * llama : avoid touching unused graph metadata pages (#32043) Each graph result reserves metadata for max_nodes, but many graphs use only a fraction of that capacity. The vector resize initializes the whole reserve and makes otherwise unused pages resident. Allocate the reserve with new uint8_t[] instead. * chat : refactor gemma4 to build loose schema rules and clean up (#31915) * chat : build a schema-shaped PEG parser for Gemma 4 tool arguments * chat : enforce only the key structure of Gemma 4 tool arguments * chat : remove old gemma4 workarounds * cont : add node.as<>() to simplify static casts * cont : add depth_guard and use numerical rule names * cont : clean up * cont : extract gemma 4 parsers * cont : clean up * cont : clean up * cont : remove dynamic cast * server: when --tools-runtime is specified, ignore x-tool-runtime (#32119) * ui: install llama-brand from a GitHub tarball instead of git (#32112) npm 11.20 refuses git dependencies by default (EALLOWGIT), so npm ci failed on fresh installs. Pin llama-brand to the same commit through an HTTPS tarball, which also adds an integrity hash to the lockfile. Assisted-by: Claude (Opus 5.5 Medium) * ui: add search_chats tool (#32051) * ui: add search_chats tool * add from_timestamp / to_timestamp * ui: search_chats review fixes - keep search_chats disabled on import, copy tool policy on fork - stream messages without attachment payloads, one transaction for time ranges - keep the output within budget, cut whole messages from the older end - reject impossible date-times, quote titles and attachment names - typed readOnly tables, move localIsoString to formatters as formatLocalIso Assisted-by: Claude (Opus 5.5 Medium) --------- Co-authored-by: Aleksander Grygier <[email protected]> * ggml : dispatch SpacemiT Q4_1 32x256 through the HP kernel (#31929) The 32x256 pack already keeps a separate uint8 zero point. Complete the M1 path and use the same HP kernel as Q4_0. Assisted-by: Codex Signed-off-by: gitGurugu <[email protected]> Signed-off-by: Wang Yang <[email protected]> * ggml-backend : prefetch only inputs computed by earlier splits (#32100) * ggml-backend : prefetch only inputs computed by earlier splits The copy callback of a split runs after the prefetch and can write tensors that a later split reads, e.g. the MoE cache uploads missed experts into its bank. A prefetch of such a tensor reads it before the write. * llama : skip the MoE cache when its device cannot run the cached mul_mat_id Otherwise the scheduler runs the matmul on another backend and copies the whole bank every ubatch. * CUDA: Optimize prefil via fuse of w_s scale in epilogue MMQ for nvfp4 checkpoints (#26048) * ggml-cuda: Apply NVFP4 weight scale in MMQ write-back * ggml-cuda: Fuse mul_mat(_id) + scale into MMQ * ggml-cuda: Tests for the fused scale * ggml-cuda: reuse existing graph to test fusion in mmq epiloque * ggml-cuda: rename test_mul_mat_vec_fusion to test_mul_mat_fusion for consistency * ggml-cuda: refine comments for clarity on MMQ dispatch and fusion checks in mul_mat functions * ggml-cuda: refactor fusion checks for mul_mat operations and remove unused function * ggml-cpu: use the 4x4 simd_gemm tile on ARM NEON (#32128) Assisted-by: Claude Fable 5.2 * vulkan : Intel FA kernel for prefill. (#29357) * vulkan : Intel customized FA shader for prefill usage * vulkan : adding check of max_bias/logit_softcap for Intel FA kernel path * vulkan : add m16n16k16/SIMD32 support for Xe FA prefill shader * vulkan : Intel FA shader and host refinement, with accuracy issues fixes * vulkan : Limit the SLM usage to 48 KiB for Intel prefill FA shader * vulkan : Update Intel FA shaders to handle cases with large head dimension K, unaligned Q head stride and multi head mask cases * vulkan : Intel FA shader and host refinement to align with existing design, extreme cases handling, shape check relaxing. * vulkan : Intel FA shader and host update to support q as tensor view, unaligned batch stride q. Add env variable for enforcing XE FA path for other vendor GPUs with 16x16x16 CM1 and SIMD32 support * vulkan : Inte FA shader and host update to fix the potential SLM over 48 KiB issue, enhance the buffer access robust and add asymmetric qk/pv ration support. * vulkan : Inte FA shader and host update to add SLM 48 KiB size check, remove unnecessary extensions and finetune the unroll/dont_unroll loops * vulkan : Intel FA shader and host update to add SLM size check function, use real device max SLM size in shader specialization constants. * vulkan : Intel FA shader and host update to consolidate host helper function, remove redundant buffer sync, bypass unused pipeline and buffer, fix subgroup shmem conflict and add negative case handling. * vulkan : Intel FA host update to correct get_xe_fa_tuning_params() function log message, and add workgroupMemoryExplicitLayout/workgroupMemoryExplicitLayout16BitAccess prerequisite feature check. * ggml : route GATED_DELTA_NET to the SpacemiT RVV kernel (#31897) The SpacemiT compute case was commented out, so the op stayed on the scalar CPU path. Type dispatch stays with the other ops, and use_ref keeps the reference path on the generic CPU kernel. Assisted-by: Codex Signed-off-by: gitGurugu <[email protected]> Signed-off-by: Wang Yang <[email protected]> * mtmd: require a 2x2 spatial merge for the Qwen-VL projectors (#32130) The Qwen2-VL, Qwen2.5-VL, Qwen3-VL and Ling3-VL graphs build their input with a temporal merge that assumes a 2x2 patch grid, and the Qwen2-VL merger reshapes by 4. Any other spatial_merge_size from the GGUF reaches a GGML_ASSERT at the first image request and aborts the server. Reject a spatial_merge_size other than 2 when loading the hparams. * mtmd: require the MLP projector and patch embedding tensors (#32129) * mtmd: require the MLP projector and patch embedding tensors The loader marks the patch embedding and the LLaVA projector tensors as optional, while the graphs and n_mmproj_embd() dereference them unconditionally. A GGUF without them crashes on a null tensor during the warmup. Load the patch embedding as required for the vision encoders that start with it, which is all of them except GEMMA3NV, DEEPSEEKOCR and DEEPSEEKOCR2. Load mm.0 and mm.2 as required for MLP, and mm.0, mm.1, mm.3 and mm.4 for the Yi-type MLP_NORM variant, selected by mm.3. The graph no longer tests mm.2 and the yasa2 assert on the patch embedding is covered by the loader. * mtmd: keep the Yi-type llava TODO The Yi-type variant is still detected by the presence of mm.3, the TODO on that detection stays. * mtmd: read the MiniCPM-V projection width from ne[1] (#32132) The MiniCPM-V resampler ends with build_mm(mm_model_proj), whose output width is ne[1], while n_mmproj_embd() returns ne[0]. Both are equal in real models, the projection is square. A non square projection passes the text model n_embd check and only aborts at the encode, on the output buffer size check. Return ne[1], so the width matches the graph output. * mtmd: require an F32 position embedding for HunyuanVL (#32131) HunyuanVL resamples its position embedding on the host into a float buffer sized for F32, then reads ggml_nbytes() of the tensor into it. The graph never uses the tensor, so any type loads, and an F64 tensor overflows the buffer at the first image request. Require the position embedding to be present and F32 when loading the HunyuanVL tensors. * server: keep the server awake while a request uses its state (#32133) With --sleep-idle-seconds, a handler passes wait_until_no_sleep() while the server is awake, then keeps using the server state, for example to parse the body and tokenize. If the idle timer expires in that window, the main loop enters sleep and the callbacks destroy the model: the handler reads freed vocab memory, and a task posted after that stays in the queue with nobody awake to process it. Count the requests that passed wait_until_no_sleep() and are not done yet, and do not enter sleep while the count is positive. The response generator releases its count in its destructor, so every return path of a handler gives it back. Co-authored-by: Venkata Vineel <[email protected]> * server: disallow direct access child instance from browser (#32120) * server: explicit opt-in tools via non-loopback addr, check cors host port (#32113) * server: explicit opt-in tools via non-loopback addr, check host port * fix ci * server: fix SSRF for CORS proxy and media URLs (#32115) * ci : build ui on non-slim runner (#32138) * Title: CUDA: few-row MMQ for BS 2-24 (#31533) * CUDA: few-row MMQ for 2-24 src1 columns New int8 MMA kernel for quantized mat-muls with 2-24 src1 columns, e.g. speculative decoding verify passes. Supports Q8_0, Q3_K, Q4_K, Q5_K, Q6_K, IQ3_S, IQ4_NL and IQ4_XS on NVIDIA GPUs from Ampere on. * nit fixes * CUDA-only guard for few-row MMQ, weights flag in test_mul_mat * few-row quantize: DS4 sum from the quantized values, as in #31247 * few-row MMQ: clearer HIP/MUSA abort, test_mul_mat two-context build * few-row MMQ: dispatch order MMVQ, few-row, MMQ * qwen3.5: merge tensors on convert also (#32102) * qwen3.5: merge tensors on convert also * Remove conversion test for qwen3.5 * server : cancel MCP tool calls on client disconnect or timeout (#32025) * server : cancel MCP tool calls on client disconnect or timeout * server : shorten MCP cancellation tests and fix a type-check error * hexagon: add Q5_0 and Q5_1 support (#32094) * hexagon: add q5_0 and q5_1 support * hex-mm: dedicated q5_0 kernels * ggml : prune (#29801) * ggml : prune deprecated API * cont : bump RPC version * cont : minor * ggml : remove outdated documentation from ggml.h The 172-line comment block at the top of the header has not been updated in a substantive way since the backend v2 split (Nov 2023) and now documents APIs that no longer exist: - `ggml_set_f32()`, `ggml_get_f32_1d()`, `ggml_set_f32_1d()` were removed - `ggml_conv_1d_1s()`, `ggml_conv_1d_2s()` ops no longer exist - `ggml_set_param()` no longer takes a context argument - `ggml_graph_compute_with_ctx()` moved to the CPU backend header - the optimization API now lives in `ggml-opt.h` The block also ended with 5 empty `TODO` sections. Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (MacBook, M5 Max, 128GB) * ggml : remove DIAG_MASK_INF and DIAG_MASK_ZERO (#31946) * rpc : bump RPC protocol major version The tensor op enum is sent over the wire, so removing GGML_OP_ADD1, GGML_OP_DIAG_MASK_INF and GGML_OP_DIAG_MASK_ZERO shifts the value of every op that follows them and peers built before and after this change would misinterpret each other's ops. The handshake compares the major version for exact equality and ignores the patch version, so bumping the major version is what rejects incompatible peers instead of silently misbehaving. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) --------- Co-authored-by: losewayy <[email protected]> * llama : prune (#30565) * llama : remove deprecated `llama_set_warmup` Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : remove remaining deprecated API Drop the APIs marked DEPRECATED in llama.h, the deprecated llama_context_params::defrag_thold field and the --defrag-thold option. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * fit-params : remove stale `llama-ext.h` include Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : document `llama_model_dflash_selector_top_k` Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : promote the NextN / speculative API from `llama-ext.h` Move the NextN, layer input, embd row and state row APIs to `llama.h` and rename `llama_set_embd_state_src` to `llama_set_ctx_state_src`, with the internal `llama_context::set_state_src` following the same name. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * llama : polish the NextN API promotion Move the NextN draft model queries next to the Adapters section, rename the `src` parameters of `llama_set_ctx_state_src` and `llama_context::set_ctx_state_src` to `ctx_src`, and drop the now-redundant `llama-ext.h` includes from `common/speculative.cpp` and `tools/imatrix`. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * fix(hexagon): make host build work with clang-cl on Windows ARM64 (#32011) * fix(hexagon): make host build work with clang-cl on Windows ARM64 Two CMake fixes for building ggml-hexagon natively on Windows-on-ARM64 with x64-hosted clang-cl (validated on Snapdragon X Elite, discussion in qualcomm/GenieX#1390): - Some clang drivers (e.g. x64-hosted toolchains used on ARM64) don't predefine the arch macro, which makes winnt.h fail with "No Target Architecture". Define _M_ARM64/_ARM64_ explicitly for the host TUs. - The Hexagon SDK's incs/stddef include (AEEStdDef.h and friends) poisons the MSVC header chain when it leaks onto dependent TUs' include paths via htp_iface's PUBLIC includes. Keep it PRIVATE to the interface stub and system-level for the backend's own TUs (which include <AEEStdErr.h> directly). Originally validated 2026-08-26 as reported in the issue; applies cleanly to 15759e0. * hex-cmake: trim down excessive comments --------- Co-authored-by: Max Krasnyansky <[email protected]> * server: skip LAN address tests when the host cannot reach it [no ci] (#32166) The same-origin tests over the LAN address block forever on the Metal runners: the request to the host's own LAN address never returns and has no timeout, so the job runs until the 6h limit. get_lan_ip() now probes /health on that address with a short timeout and returns None when the host cannot reach it, which skips the test. The test requests themselves use the default request timeout so a hang fails the test instead of stalling the job. * server: allow private media URLs in the vision tests [no ci] (#32167) The vision tests download their images from huggingface.co, which resolves to a private address on the runners inside the HF network. The media URL check refuses it with "host is not a public address" and the server-cuda job fails. The vision fixture enables media_allow_private_urls. The private address check keeps its own coverage in test_vision_image_url_private_address. * server, fix CI: read a small temp file in the read_file tool test [no release] (#32168) * server: read a small temp file in the read_file tool test test_tools_builtin_read_file read its own file, which grows with every added test. On Windows the CRLF checkout puts it at 16664 bytes, over the 16384 byte read limit, and the tool refuses it. The test now writes a small file of its own and checks the exact content read back. * server: use a temp cwd in the x-tool-cwd tool test test_tools_builtin_cwd_header read test_tools_builtin.py through the x-tool-cwd header, which hits the same 16384 byte read limit on the Windows CRLF checkout, and wrote its shell marker into the source tree. The test now uses a temp directory as cwd, reads a small file from it and checks the shell marker lands there. * chat : accept </ifm|think> as K2 Horizon closer at medium/low effort (#30335) * ci : set windows-cuda ccache size to 1G (#32185) * ci: fix HIP quality check by ignoring the FP8 vec FA kernel spill (#32183) The D=256 vec flash attention kernel with F8_E4M3 K and V uses 257 VGPRs (255 + 2 spilled) on gfx908, one over the limit of the check. The spill is a perf issue only, like the Q4_0 D=256 vec kernel already in the ignore list. Both variants of the kernel join the ignore list. [no ci] * examples : clean-up old/obsolete stuff (#32184) * examples : clean-up old/obsolete stuff * examples : update references to removed files Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) [no ci] * ggml : bump version to 1.0.0 (ggml/1690) * ggml : bump version to 1.0.0 * examples : bump test-cmake (ggml/0) * sync : ggml [no ci] * llama.cpp : bump version to 1.0.0 (#32190) * llama.cpp : bump version to 1.0.0 * readme : bump major version in link [no ci] * examples : bump test-cmake version [no ci] * examples : remove explict version from test-cmake (#32191) This commit removes the llama version test-cmake and instead uses the version that is supplied by CMAKE_PREFIX_PATH. The motivation for this is to avoid issues when bumping major versions. * CUDA: split the PAD_REFLECT_1D grid to stay within the HIP grid limit (#32179) The kernel launches one block per row and 256-wide tile, so the {2, 16777217} test case asks for 16777217 blocks of 256 threads. HIP refuses a grid dimension above 2^32 threads and the ROCm jobs fail with "invalid configuration argument". The host now launches the grid in chunks of at most UINT32_MAX / 256 blocks and passes the chunk offset to the kernel. Real sizes fit in a single chunk and keep their timings. * llama: move moe-cache code out of llama-graph (#32157) * grammar : optimize matching with left factoring (#29557) * grammar : limit the number of alternatives * grammar : introduce an AST for grammar parsing * grammar : revert AST refactor and alternatives limit This reverts commits: - 84f3b57c4d6c482e7187a30735d16b02de3784fa - 393a707ebb7e6f798abdb8af34cb1bc102f4aaa6 * grammar: optimize big grammar matching by using left-factorization * grammar : preserve character class boundaries during left factoring * grammar : prevent infinite expansion during left factoring * grammar : use ASCII characters in comments * grammar : test empty suffixes after left factoring * grammar : deduplicate left factoring logic * grammar : add comments * grammar : use number parameters and clarify RSS output * grammar : clarify character class test names * grammar : remove performance benchmark * grammar : share immutable rules --------- Co-authored-by: Piotr Wilkin <[email protected]> * ggml-vulkan: add optional device keepalive (#29267) * ggml-vulkan: add optional device keepalive * simplify implementation, move ownership to backend, change env var to seconds --------- Co-authored-by: Acmmi <[email protected]> Co-authored-by: Ruben Ortlam <[email protected]> * spec : Warn when --spec-draft-p-min is used with probabilistic draft sampling (#31294) * spec : skip p_min for sampled MTP and DFlash2 drafts Under rejection sampling the acceptance at a position is 1 - TV(p, q), which the draft's top probability does not tell, so the p_min cutoff dropped draft tokens the target would have accepted. Skip it when MTP or DFlash2 samples the draft. draft-simple keeps it: each extra draft token costs a full draft model pass. * spec : replace the sampled-draft p_min skip with a warning p_min behaves as on master again for every drafter and sampling mode. Instead, log a warning when --spec-draft-p-min > 0 is used with --spec-draft-sampling probabilistic, suggesting p_min 0: under rejection sampling the draft's top probability does not tell how much of the draft the target accepts. The cut is not skipped because with MTP at long drafts it can still pay off. * spec : warn about p_min only for drafters that use it The n-gram drafters ignore p_min, and DSpark uses it as the cutoff of its confidence head, so the warning is skipped when only these are configured. --------- Co-authored-by: Pranesh Gonegandla <[email protected]> * vulkan: add TOP_K_MASK (#31544) * vulkan: add TOP_K_MASK Assisted-by: Claude Opus 5.5 * vulkan: fix the TOP_K_MASK barrier and use the common offset helper Assisted-by: Claude Opus 5.5 * vulkan: declare ggml_vk_top_k_mask in the common header Assisted-by: Claude Opus 5.5 * ggml : add BF16 support to RMS_NORM (CPU, CUDA) (#32135) * ggml : add BF16 support to RMS_NORM (CPU, CUDA) * cuda : use one helper for the F32/BF16 RMS_NORM launches * CUDA: add SM103 SASS to non-native builds (#30099) Signed-off-by: ynankani <[email protected]> * hexagon: improve buffer allocations and mappings (mmap stacking) (#32144) * hex-bufs: combine queue and fence buffers * hex-bufs: use n_threads for queue sizing * hex-mmap: optimize buffer stacking at the host to avoid iova fragmentation * hex-mmap: add simply retry for spurios mmap failures * hex-mmap: use eager mode for extended mmap retries * requirements, Fix CI: support Python 3.15 (#32199) * requirements : support Python 3.15 torch 2.11.0, numpy 2.4, matplotlib 3.10, pandas 2.3, pillow 11.3 and cffi 1.16 have no Python 3.15 wheels, so the CI runner on 3.15 cannot install the requirements. Python 3.15 gets the first releases that ship 3.15 wheels through version markers, and every version below 3.15 stays as is. pyproject.toml now allows 3.15 and picks torch 2.15.0 there. * requirements : apply review suggestions numpy 2.5.4 from Python 3.14, matplotlib 3.11.2 and pandas 3.0.6 from 3.11, cffi 2.1.1 and pillow 12.3.0 for every version. cffi 1.16.0 has no 3.14 wheel and fails to build there, so this also fixes the tokenizer test requirements on 3.14. * ggml-cuda: hip: tune GCN MMQ configs (#30021) * ci: reduce qdc timeouts to avoid stalling pipelines and runners (#32148) * ci: reduce qdc timeouts to avoid stalling pipelines and runners * ci: fix flake8 warnings * ui: configure allow-remote=root in .npmrc for npm 12+ (#32158) (#32196) * hexagon: add support for SSM_SCAN op (#31921) * hexagon: add SSM_SCAN Op support * hex-ssm-scan: fix multi-device spliting * hex-ssm-scan: remove redundant checks and make kernel use host config * hex-ssm-scan: remove direct ddr access * hex-ssm-scan: remove DMA ordering * hex-ops: update supported ops * hex-ssm-scan: rewrite the dma pipeline to match other ops (dbl.buf, etc) * hex-ssm-scan: remove all fallbacks, only dma/vtcm paths * hex-ssm-scan: add kernel_type to kparams and remove redundant recomputes * hex-ssm-scan: avoid stalls in the overall pipeline (dma flush between chunks) * hex-ssm-scan: vectorize softplus * hex-ssm-scan: optimize hvx loops * hex-ssm-scan: add HMX support * hex-ssm-scan: add support for GGML_HEXAGON_SSM_SELECT * hex-ssm-scan: cleanup kernel names * hex-ssm-scan: simplify mdev checks * hex-mdev: improve mdev row-split solver --------- Co-authored-by: Max Krasnyansky <[email protected]> * metal : fix mul_mv destination offset overflow (#32221) * chat : remove mistral workaround (#32230) * Hexagon: add support for IQ2_XXS and NVFP4 (#31954) * ggml-hexagon: IQ2_XXS and NVFP4 tiled repack layouts * ggml-hexagon: IQ2_XXS HVX matmul kernel * ggml-hexagon: NVFP4 HVX matmul kernel * ggml-hexagon: NVFP4 per-tensor scale * ggml-hexagon: HMX paths for IQ2_XXS and NVFP4 * ggml-hexagon: supports_op coverage for NVFP4 and IQ2_XXS * fix HMX IQ2_XXS dequant scale underflow in fp16 * hexagon: IQ2_XXS 2-gather tile decode with compact grid, small-weight tests * IQ2_XXS vpopcount sign parity and gather pipelining * pipeline IQ2_XXS HMX dequant gathers and add large_w tests * hex-iq2-xxs: rebase and cleanup Remove unused helper functions. Add lut_size to the overall vtcm required size. Trim down (way way down) the new tests. * hex-iq2-xxs: actually trim down the tests --------- Co-authored-by: Max Krasnyansky <[email protected]> * spec + model: refactor DFlash based speculative decoding methods (#32016) * dflash : move the DSpark markov head and backbone graphs to dspark.cpp Move-only: build_dspark_markov_head, graph_dsv4, graph_dsv41 and graph_mistral_large4 move verbatim. build_inp_target_features and build_dspark_markov_head become static members of llama_model_dflash so both files can use them. * dflash : detect the head and the backbone once, split the loaders per file load_arch_hparams sets llama_model_dflash::variant (DFlash, DFlash2, DSpark, LiliCorr) and ::backbone (base, DSV4, DSV4.1, Mistral Large 4). The head, backbone and base layer loaders become member helpers in dflash.cpp, dflash2.cpp, lilicorr.cpp and dspark.cpp. build_arch_graph dispatches on the backbone. The DFlash2 and LiliCorr loaders create the DFlash2 conv tensors through a helper in dflash2.cpp, right after their head tensors instead of in the base layer loop; the other tensors keep their creation order. The DFlash2 loader drops its copy of the conv group size check, which master never reached. * dflash : share the injection input, token embeddings and lm head lookups build_inject_inp (target features + fc + encoder norm), get_tok_embd and get_lm_head replace the copies in the base, DSV4, DSV4.1 and Mistral Large 4 graphs. build_inp_target_features is file-static again. * dflash : split the DFlash decoder into a graph per head graph_base creates the shared inputs and provides build_inject, build_inp_tokens, build_layers and build_logits. graph_dflash (dflash.cpp), graph_dflash2 (dflash2.cpp), graph_dspark (dspark.cpp) and graph_lilicorr (lilicorr.cpp) assemble them and add their head; the selector, scorer and markov head builders move to the file of their graph, and the DFlash2 local conv run by build_layers to dflash2.cpp. build_arch_graph dispatches on the backbone, then on the head. The op order and the tensor names are unchanged. * speculative : split the DFlash driver into a class per head common_speculative_impl_draft_dflash stays the DFlash implementation and becomes the base of draft_dspark, draft_dflash2 and draft_lilicorr. Its protected constructor only reads the draft metadata; init() then sets up the contexts with the options of the draft (draft length, backend sampling, device features, masked h_nextn). Each derived class overrides draft() with the path of its head from the former draft(). DFlash2 also overrides begin() to reseed its generator per request, and LiliCorr overrides process() to store the context features of each injected chunk, which its noise block carries as its state. The factory keeps the current routing: draft-dspark picks DSpark, draft-dflash picks DFlash2 or LiliCorr from the draft metadata and DFlash otherwise. draft-dspark with a DFlash2 or LiliCorr draft now runs the DSpark reader instead of a mix of both. sample_from_anchor is logged by DSpark only. * speculative : add the draft-dflash2 and draft-lilicorr types draft-dflash2 and draft-lilicorr name the DFlash2 and LiliCorr drafts, which draft-dflash keeps running too: it picks them from the draft metadata. draft-dflash2 and draft-lilicorr must match the draft model, draft-dspark rejects a DFlash2 or LiliCorr draft, a model that is not a DFlash draft is rejected, and a run uses at most one DFlash family type; these errors leave speculative decoding uninitialized. The type detected from the draft GGUF is now the concrete one, and draft-dflash2 and draft-lilicorr download the dflash sidecar. * docs : describe the DFlash2 and LiliCorr drafts Add the DFlash2 and LiliCorr sections and the new types, and explain that draft-dflash also runs DFlash2 and LiliCorr drafts. * speculative : drop the unused DFlash is_mrope Nothing reads it since the migration to common_batch (#29385), which picks the number of M-RoPE position rows from the rope type of the draft. * doc: update spec dec * address review comments * mtmd : avoid padding-only Whisper audio chunks (#30403) Assisted-by: Claude Opus 5 * jinja : reduce template rendering overhead (#32023) * jinja : reduce value allocation and lookup overhead Assisted-by: GPT-6 Astra * jinja : address rendering review feedback Assisted-by: GPT-6 Astra * jinja : test multipart strings and simplify lookup Assisted-by: GPT-6 Astra * fix "undefined hint" * fix divisibleby 0 * clean up --------- Co-authored-by: Xuan Son Nguyen <[email protected]> * mtmd : allow custom video decoder (#32188) * mtmd : allow custom video decoder * also adapt to wllama requirements * clean up * add test --------- Co-authored-by: Xuan Son Nguyen <[email protected]> * mtmd: fix video pixel aspect ratio and video rotation (#32267) * convert : pplx-decider must match qwen3.5 model_type (#32156) * convert : require matcher to check backbone definition (model_type) in config.json Fixes #32152 * Revert the modified llama_test_cmd_entry. --------- Co-authored-by: Jonathan Buck <[email protected]> * ggml-backend : start a new split at an incompatible weight in a split without inputs (#31775) * convert : register Granite4VisionForConditionalGeneration for text (#32237) Signed-off-by: Matt Rutkowski <[email protected]> * qwen2vl : apply FFN weight scales (#32241) The qwen2vl graph passed NULL for the ffn_up/gate/down scales, so the per-tensor NVFP4 scales loaded by the generic pass were never applied and the model produced garbage (PPL ~1e6 on CUDA, NaN on CPU). Pass the scales to build_ffn like qwen2 does. Fixes #32101 * hexagon: fix fa no-mask tail (#32243) * Fix ctz64 on 32bit (#32273) * chat : allow Gemma4 tool call during thought (#32232) The thought channel is normally closed with <channel|>, but the model may open it and go straight to a tool call without closing it. Stop the reasoning at <channel|> OR <|tool_call>, so an unclosed thought does not swallow the following tool call. Fixes: #32231 Assisted-by: Qwen 3.8 27b * opencl: fixes for q4_k mv oob access, f16 swiglu_oai, cpy with strided dst, batched group_norm and bf16 sigmoid (#32251) * opencl: fix q4_K mv oob read Assisted-by: Codex * opencl: fix kernel dispatch and oob writes for f16 swiglu_oai Assisted-by: Codex * opencl: fix the row broadcast for add/mul Assisted-by: Codex * opencl: respect destination tensor strides for cpy Assisted-by: Codex * opencl: handle batches in ne3 for group_norm Assisted-by: Codex * opencl: avoid double rounding for bf16 sigmoid Assisted-by: Codex * common : fix infinite recursion in debug build for peg parser dump (#32282) Change dump()->dump_impl() calls to avoid infinite recursion. * chat : allow tool calls inside reasoning blocks for Ministral-3 (#32271) * chat: allow tool calls inside reasoning blocks for Ministral-3 and Qwen3 Fixes #29248 Fixes #20837 * chat: address review feedback for Ministral-3 reasoning end - Remove <function= from Qwen3 (intentionally not used outside outdated coder models) - Ministral-3: use choice between [/THINK] and peek([TOOL_CALLS]) instead of optional * chat: add [TOOL_CALLS] to Ministral-3 thinking_end_tags * chat: simplify Ministral-3 reasoning end choice * chat: restore peek lookahead for Ministral-3 tool call start * chat: keep [TOOL_CALLS] only in parser, not in thinking_end_tags * cont : revert tool call tag removal and update tests --------- Co-authored-by: Alen Požun <[email protected]> Co-authored-by: Alde Rojas <[email protected]> * docs : add OpenVINO backend to ops matrix (#32259) * chat : allow undeclared tool calls in LFM2 tool-call grammar (#32164) * chat : honor OpenAI tool strict flag in LFM2 tool-call grammar * chat : drop strict, always allow undeclared LFM2 tool calls * sycl : optimize mtmd image processing (#32109) * vulkan: use GPU copies on UMA with uncached memory on Intel (#32024) * vulkan: optimize matrix multiplication for narrow N (#31990) * vulkan: optimize matrix multiplication for narrow N Add new "narrow" tile configs for coopmat1/coopmat2 that are tuned for N<=32. * Attempt to handle wave64 * add n=16 tile for cm1 * apply RDNA split_k heuristic to narrow_n generally --------- Co-authored-by: Ruben Ortlam <[email protected]> * cuda : keep columns in registers for cooperative softmax (#28982) Template soft_max_f32_parallelize_cols_single_row to keep column elements in registers when they fit, reducing memory traffic from 5 global memory passes to 2 passes. Assisted-by: Gemini 3.8 Flash * vulkan: optimize prompt processing Flash Attention for RDNA3 and RDNA4 (#31323) * vulkan: optimize Flash Attention cm1 for RDNA3 and RDNA4 * reduce shmem use through buffer reuse * clean up and fixes * limit q_in_regs to prefill * vulkan: add flipped FA path, each subgroup owns 16 Q rows * cleanup * move flip shader into own file * replace kvsep with direct load mode * fix nvidia hang, tune AMD * only store pv in sfsh if necessary * fix skip condition * nvidia tuning * reduce occupancy on RDNA4 for large attention head sizes * fix sparse FA fp16 underflow bug * vulkan: Explicitly include SPIRV-Headers (#31416) * vulkan: Explicitly include SPIRV-Headers Distros that don't put the headers in a system include path need to specify it to the compiler. So we use the appropriate CMake target to include it. Assisted-by: Codex * vulkan: Add explicit headers location to workaround OSX CI runner conf * llama : allocate the tensor staging buffer from the CPU buffer type (#31438) * llama : allocate the tensor staging buffer from the CPU buffer type * llama : drop the staging buffer test, reword the comment * llamafile: introduce more Q0 quant support for s390x (#32203) Signed-off-by: Aaron Teo <[email protected]> * memory : fix non-consecutive position warning for M-RoPE (#32287) * hexagon: add TIMESTEP_EMBEDDING HVX kernel (#32228) * hexagon: add TIMESTEP_EMBEDDING HVX kernel * hex-timestep: add dma, improve kparams, and work-splits, and tracing * timestep: add testcases that cover WAN2.2 * hex-timestep: relax the gates to cont_rows --------- Co-authored-by: Max Krasnyansky <[email protected]> * server : Fix connection reuse after streamed responses (#30492) Assisted-by: Codex * common : reject out-of-range grammar_triggers type instead of aborting (#30835) (#31478) * common : reject out-of-range grammar_triggers type instead of aborting (#30835) * tests : remove the invalid grammar trigger type regression test (#30835) * feat: add Inkling 2 support (text + vision) (#32217) * convert : add Inkling2 text GGUF conversion Assisted-by: Codex * llama : implement Inkling2 text inference Assisted-by: Codex * tests : cover Inkling2 text support Assisted-by: Codex * conversion : dequantize packed Inkling2 experts in row chunks Decode per-layer NVFP4 and MXFP8 schemes, validate companions, and use stored scale shapes with a warning for the declared MXFP8 [32,32] grid. Reorder packed w13 rows and their scale rows together. Keep normal GGUF outtype selection and 3D expert tensors. Stream 128 rows per expert through LazyChunkedTensor. Real w13 (384x4608x4608) needs a 2.25 MiB F32 chunk instead of a 30.375 GiB expanded layer. Real-shaped sparse probes peak below 5.8 MiB of Python/NumPy chunk allocations, plus 5.2 MiB of callback metadata: budget about 16 MiB per projection including mapped pages, excluding runtime, other tensors and OS cache. Full-model chunk metadata is roughly 370 MiB. Packed synthetic GGUF weights match the independent pinned vLLM decode bit-for-bit. CPU prefill/decode logits remain within 3.1e-6 absolute error, with 100% argmax agreement. Float fixtures, original-name conversion and CPU architecture checks pass. Real checkpoint conversion remains untested. Assisted-by: Codex * convert : add Inkling2 vision mmproj support Assisted-by: Codex * mtmd : implement Inkling2 still-image encoder Assisted-by: Codex * inkling2 : scope image loading Assisted-by: Codex * inkling2 : enable flash attention with folded bias and sinks Assisted-by: Codex * cuda : route per-head flash attention masks through vec Assisted-by: Codex * mtmd : support Inkling2 temporal frame means Assisted-by: Codex * style : restore shared image comment Assisted-by: Codex * tests : enlarge Inkling2 context fixture Assisted-by: Codex * inkling2 : load per-layer expert feed-forward widths Assisted-by: Codex * tests : add Inkling2 Metal fusion baselines Assisted-by: Codex * inkling2 : group and align registry entries Assisted-by: Fable * convert : regenerate the Inkling2 tokenizer hash with the update script Assisted-by: Fable * conversion : revert the print_registered_models change Assisted-by: Fable * conversion : sort the Inkling2 model map entries Assisted-by: Fable * convert : map Inkling2 vision checkpoint names in the tensor table Assisted-by: Fable * convert : map Inkling2 text checkpoint names in the tensor table Assisted-by: Fable * tests : document the Inkling2 packed expert conversion test Assisted-by: Fable * tests : cover Inkling2 checkpoint and transformers tensor names Assisted-by: Fable * llama : place Inkling2 fields and list entries by file convention Assisted-by: Fable * gguf-py : align Inkling2 tensor mapping comments Assisted-by: Fable * mtmd : place Inkling2 entries by file convention Assisted-by: Fable * tests : place Inkling2 cases after the existing ones Assisted-by: Fable * cuda : index per-head flash attention masks in the tile and mma kernels Assisted-by: Claude Claude-Session: https://claude.ai/code/session_01GbYSza1yxgmTz8wdr6uV8Q * inkling2 : project the relative bias before the gather, drop arch branches Assisted-by: Claude Claude-Session: https://claude.ai/code/session_01GbYSza1yxgmTz8wdr6uV8Q * convert : require Inkling2 hparams, add inkling2 pre-tokenizer Assisted-by: Claude Claude-Session: https://claude.ai/code/session_01GbYSza1yxgmTz8wdr6uV8Q * mtmd : cap Inkling2 image size, drop video frame averaging Assisted-by: Claude Claude-Session: https://claude.ai/code/session_01GbYSza1yxgmTz8wdr6uV8Q * inkling2 : fix CI build, Meta device assert and Windows conversion test Assisted-by: Claude * tests : use the default sliding window for the Inkling2 test model Assisted-by: Claude * simplify mtmd part * give _v arch for vision * remove alpha channel handling, it should be a follow up * explicit rule about audio + vision models * add audio support * rm audio * rm gguf mtmd rope base * address review comment * nits * do not normalize embd from mtmd --------- Co-authored-by: Xuan Son Nguyen <[email protected]> * model : metal : workaround fusion for LFM3 (#32296) * lfm3 : put the normed tensor first in residual adds to enable norm fusion Assisted-by: Claude Opus 5.5 * tests : update Metal fusion baseline for lfm3 Assisted-by: Claude Opus 5.5 * opencl: add A7 Q6_K non-MoE binary kernel (#30949) * tests: Fail `test-backend-ops` and exit with error status 1 when missing and/or unsupported types and/or unsupported backends are provided in the command line (#30279) * Fail tests on missing or unsupported type * Fix output * Remove whitespace * Fail if no tests ran regardless of backend support * Revert unnecessary cosmetic change * server : clear slot cache when the global lora config changes (#30367) * server: refactor, add server_slot_sched, prompt running hash (#32154) * server: refactor, add server_slot_sched, prompt running hash * use sha256 hash * vendor: sync stb_image (#32305) * chat: fix inkling 2 begin/end of image tokens placement (#32294) * chat: fix inkling 2 begin/end of image tokens placement * add test * CUDA/HIP: Refactor the use of _sync warp primitives (#31617) Uses the rocm-native primitives, increases the rocm version requirement to 6.3 and makes top-k selectable warp. * server : fix output_config.effort being dropped in /v1/messages (#32321) * Support DFLASH2 for Recursive Ripple-65B-Preview (#31904) * fixed support for DFlash2 for Ripple 65B * spec: Add NoPE handling to DFlash (cherry picked from commit 89ea8e3e77e3359d17902a2db136022d5d419d88) * spec: Fix NoPE not being picked up by DFlash (cherry picked from commit 43393b95fda2ce7e7d243e2650bf7b1cadf1c732) --------- Co-authored-by: James Pickering <[email protected]> * CI/HIP: update fattn symbol names in hip-quality-check (#32331) * CI/HIP: update fattn symbol names in hip-quality-check * ignore import-not-found --------- Co-authored-by: Sigbjørn Skjæret <[email protected]> * ggml-cpu: add x86 VNNI Q2_0 dot product (#26348) * ggml-cpu: use VNNI for Q2_0 dot products Keep the upstream AVX2 unpacking, accumulation, and fallback. Use VNNI for the integer dot product on supported x86 CPUs. Assisted-by: Codex * ggml-cpu: use VBMI for Q2_0 unpacking Use multishift to unpack Q2_0 weights on CPUs with AVX-512 VBMI and VL. Retain the existing shift-and-mask unpacking on other CPUs. Assisted-by: Codex * Update ggml/src/ggml-cpu/arch/x86/quants.c Co-authored-by: Sigbjørn Skjæret <[email protected]> --------- Co-authored-by: Sigbjørn Skjæret <[email protected]> * server : ignore empty stop strings (#32093) * model: support MiniMax-M3.1 (#32301) * docs: move per-model TTS to /docs, refer it from other pages (#32304) * jinja: add 4 missing features * Revert "jinja: add 4 missing features" This reverts commit a681a53b6092d57597b9e66f2fc9d4556155b9e4. * mtmd: add zonos3-mini TTS model (#32020) * zonos3 init * add audio gen pipeline * fix string_format * add default voice as gguf metadata * better ref * support voice clone * add delivery params * optimize speed * nits * nits 2 * add text normalization * nits * model : read qwen3vl output head size from the tensor (#32349) Allows Qwen3-ForcedAligner, whose output head (5000 timestamp classes) is smaller than the vocab. * mtmd: support higgs v3 STT and vibevoice-ASR (#32329) * mtmd: support higgs v3 and vibevoice-ASR * use proper mapping * address review comment * nits * rm hacky get_audio_length, add mtmd_helper_get_media_meta * server : skip MCP discovery for router children (#32359) * jinja: add 4 missing features (#32352) * jinja: add 4 missing features * apply suggestion Co-authored-by: Aldehir Rojas <[email protected]> * fix error msg --------- Co-authored-by: Aldehir Rojas <[email protected]> * convert: fix ripple dflash2 NoPE metadata (#32363) * convert: fix ripple dflash2 NoPE metadata was wrong https://huggingface.co/ricursiveAI/Ripple-65B-Preview-DFlash2/blob/743c4669f7daa11d3ca350b9a057c059481b1afd/config.json#L45-L47 * Update conversion/base.py Co-authored-by: Sigbjørn Skjæret <[email protected]> --------- Co-authored-by: Sigbjørn Skjæret <[email protected]> * ggml-cuda: fix MoE regression on HIP with #29948 (#32344) * server: answer reasoning_effort levels the template rejects with 400 (#32332) The reasoning effort probe already renders every candidate level, but it dropped the ones the template raises on, so a request with such a level (e.g. max on Qwen3.8) reached the template and came back as a 500 on /v1/chat/completions, /v1/responses and /v1/messages. Keep the raising levels in reasoning_effort_rejected and reject them in oaicompat_chat_params_parse with an invalid_argument, which the server answers with a 400 listing the supported levels. Aliases and levels a template ignores are not rejected, so high on Qwen3.8 still renders as xhigh. Also trim the output_config.effort test to a single level. * kv-cells: avoid an O(n_cells) scan per sequence removal (#32380) * cuda : fix MUL_MAT_ID abort with odd src0 columns on AMD (#32385) On AMD devices MUL_MAT_ID with an F32, F16 or BF16 src0 and at most 8 tokens always used MMVF. MMVF reads src0 in pairs of values and asserts an even ne[0], so a rank 1 LoRA on MoE expert weights (lora_b has ne[0] == 1) aborted. Use MMVF there only for an even ne[0]; other shapes take the existing fallback. Fixes #30576 Assisted-by: GitHub Copilot Signed-off-by: AMD ROCm Contributor <[email protected]> * CI: trigger spec dec testing for relevant PRs (#32281) * ci: trigger spec dec testing after refactoring * add options to run spec dec ci nightly manually * vulkan: make the radix top-k tie selection deterministic (#31931) * vulkan: make the radix top-k tie selection deterministic The radix select gathers the elements above the threshold and the ties with an atomic counter, so with more ties than remaining slots the kept columns depend on the thread scheduling. Each subgroup now owns a contiguous chunk of the row with the same column mapping in every pass, counts its kept elements, and writes them at ranks from a scan of the subgroup totals; overflowing ties are ranked in column order with a ballot, so the lowest tied columns win, as on CUDA and Metal. The radix pipelines require subgroup arithmetic, ballot and full subgroups. Enable the deterministic top-k check on Vulkan. * optimize shader for AMD, Intel and Nvidia --------- Co-authored-by: Ruben Ortlam <[email protected]> * vulkan : fix 32-bit compilation (#32275) * ci : use vX.Y.Z tags as docker tags (#32388) * ci : use vX.Y.Z tags as docker tags When the Docker workflow is manually dispatched from a vX.Y.Z tag, use that tag verbatim for the image tags instead of appending the build number and commit hash. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ci : require a tag for manual docker runs Manual dispatches of the Docker workflow must now use a tag ref, so the image tags are derived from the selected tag. The check can be skipped with the new skip_ref_check input. Scheduled nightly builds are unchanged. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * jinja: support json sort_keys=true (#32366) * readme : update (#32382) * readme : update * authors : update * readme : minor * cont : minor * cont : typos Co-authored-by: Sigbjørn Skjæret <[email protected]> Co-authored-by: Niklas Wenzel <[email protected]> --------- Co-authored-by: Sigbjørn Skjæret <[email protected]> Co-authored-by: Niklas Wenzel <[email protected]> * readme : fix line endings * webgpu: support per-head flash attention masks (#32394) The flash attention shaders indexed the mask without its head dimension, so masks with ne[2] > 1 gave wrong results. The mask offset and the vec block states now include the head, broadcast as head % mask->ne[2] like the other backends. The params buffer grows to 256 bytes to fit the two new mask fields. The shared memory estimate dropped kv_shmem when only one of K and V is read directly, while the shaders keep it unless both are, which made the K f16 / V q8_0 cases exceed the workgroup storage limit. The vec kv tile now takes both flags: the memory estimate drops kv_shmem only when both are direct, and the tile still divides the KV padding when either is. get_alloc_size and supports_op use the same rule as the pipelines, and supports_op accounts for the register tile fallback. * hip: add gfx1013 to rdna1 (#32236) * vulkan: fix Nvidia fp32 FA shmem overflow, disable shmem staging if it takes too much memory (#32244) * HIP/CUDA: enable GDN mma kernel on CDNA (#31327) * vulkan: Support split_k for conv3d. (#29929) This tries to use the 256x128 shape (coopmat2-only) with split_k when it appears profitable. It reuses the mul_mat split_k reduce shader. * llama : migrate to `llama_batch_ext` (#32356) * llama : migrate to llama_batch_ext * mtmd : migrate zonos3-mini code Added in https://github.com/ggml-org/llama.cpp/pull/32020 * llama : deprecate old batch API (#32306) * jinja: impl scope-chain key lookup (#32396) * jinja: impl scope-chain key lookup * add test for call_statement lambda * arg : allow up to llama_max_devices() configs for --tensor-split and --fit-target (#13293) (#31435) * fix:- Misc. bug: Settings/Tools is lying about tool picks inside a ch… (#32223) * fix:- Misc. bug: Settings/Tools is lying about tool picks inside a chat #32214 * checks run lint error --------- Co-authored-by: Developer <[email protected]> * ui: move the web UI to ui/apps/chat and call it Llama Chat (#32032) * ui: move tools/ui to ui/apps/chat The chat app moves to its own root folder, ui/apps/chat, as the first step of splitting the UI into one library (ui/lib) and the apps built on it (ui/apps). The code is unchanged; every path that pointed at tools/ui now points at ui/apps/chat: CMake adds it from tools/, and the Dockerfiles, the Nix package, the workflows, the labeler, CODEOWNERS, .editorconfig, the git hooks, the dev and demo scripts and the docs follow it. Assisted-by: Claude (Opus 5.5 Medium) * ui: name Llama Chat's package @ggml-org/llama-chat It was still called llama-ui, the name of the library that now sits beside it in ui/lib (@ggml-org/llama-ui). The package stays private; the app's display name and the llama-ui.zip build artifact are unchanged. Assisted-by: Claude (Opus 5.5 Medium) * ui: call the built-in web UI Llama Chat in docs, help text and comments The app in tools/ui is Llama Chat; Llama UI is the component library it is built from. Prose that said "Web UI", "web UI" or "WebUI" for the app now names it: the READMEs, SECURITY.md, the --ui help text, the CMake option description, one server log line, code comments and the Storybook intro. Names that others depend on are unchanged: the deprecated --webui flag aliases, the LLAMA_*_WEBUI CMake and environment names, the webui_settings field, the storage migration keys and the Nix attributes. Assisted-by: Claude (Opus 5.5 Medium) * ui: name tools/ui as a former path of Llama Chat in the code-review skill Changes under the old tools/ui path, as well as tools/server/webui, still get the Llama Chat checklist. Assisted-by: Claude (Opus 5.5 Medium) * ui: name Llama Chat's path in the security policy's exclusions Llama Chat no longer lives under tools/server/, so the exclusion listed under it now names ui/apps/chat. What is covered stays the same. Assisted-by: Claude (Opus 5.5 Medium) * mtmd: support fish audio s2 (#32330) * add fisk-audio-s2 support * add voice cloning * cont merge master * nits * nits * clean up * nits * use new batch api * MMVQ: Tune ne11 Gate for RDNA3_5 (#32308) * contributing: mark agents.md and code-review as required (#32416) * chat : implement inkling parser (#32381) * opencl: fix three defects of the bin flash-attention prefill path (#32110) * opencl: release the WMM flash-attention mask fallback image The fallback image is created on every call of the bin flash-attention kernel over a sub-buffer of the K cache and was never released, so each call kept a K-cache sub-buffer alive. Every call with more than one query row takes this path, including each speculative-decoding verify step, so the objects pile up and the server slows with every request. * opencl: keep q8_0 K/V at head size 512 off the WMM flash-attention kernel With q8_0 K/V at DK=512 the bin flash-attention kernel gives wrong results whenever V holds different values from K (test-backend-ops FLASH_ATTN_EXT hsk=512 q8_0, max error 2.04 on X2-90); f16 K/V at DK=512 is correct. The backend's own flash-attention kernels already decline q8_0 at DK=512, so the shape is now handled the sam…
Contributor
|
@ngxson Oh thanks haha - sorry I've been inundated with stuff I couldn't get to this - appreciate it! |
fencerJP
pushed a commit
to fencerJP/llama-apu
that referenced
this pull request
Nov 21, 2026
ByCzech
pushed a commit
to ByCzech/llama.cpp
that referenced
this pull request
Nov 21, 2026
Backport ggml-org ggml-org#32217, ggml-org#32429, ggml-org#32657, ggml-org#32694 and the merged ggml-org#32704 scale-sharing fix onto b12359.2. Include required sorted JSON (ggml-org#32366), image block placement (ggml-org#32294) and the dedicated Inkling chat parser (ggml-org#32381). Keep the existing graph budget implementation and add a three-pass scaled-expert fixture. Assisted-by: Codex
ByCzech
pushed a commit
to ByCzech/llama.cpp
that referenced
this pull request
Nov 21, 2026
Backport ggml-org ggml-org#32217, ggml-org#32429, ggml-org#32657, ggml-org#32694 and the merged ggml-org#32704 scale-sharing fix onto b12359.2. Include required sorted JSON (ggml-org#32366), image block placement (ggml-org#32294) and the dedicated Inkling chat parser (ggml-org#32381). Keep the existing graph budget implementation and add a three-pass scaled-expert fixture. Assisted-by: Codex
bong-water-water-bong
pushed a commit
to 1bit-MONSTER/llama.cpp
that referenced
this pull request
Nov 22, 2026
…g#32381); jinja: tojson sort_keys=true (upstream ggml-org#32366) The Inkling 2 Mini chat template renders tool specs with tojson(sort_keys=true), which this fork's jinja threw on ('tojson sort_keys=true not implemented'), so any request with tools failed. test-chat (all tests passed, Inkling templates included) and test-jinja pass on CPU. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
pushed a commit
to 1bit-MONSTER/llama.cpp
that referenced
this pull request
Nov 22, 2026
…g#32381); jinja: tojson sort_keys=true (upstream ggml-org#32366) The Inkling 2 Mini chat template renders tool specs with tojson(sort_keys=true), which this fork's jinja threw on ('tojson sort_keys=true not implemented'), so any request with tools failed. test-chat (all tests passed, Inkling templates included) and test-jinja pass on CPU. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
added a commit
to 1bit-MONSTER/llama.cpp
that referenced
this pull request
Nov 23, 2026
…onverter, ported from upstream (engine#3328) (#489) * model: Inkling 2 / Inkling 2 Mini (inkling2, inkling2_loop), text, ported from upstream Ported from ggml-org/llama.cpp ggml-org#32217 (Inkling 2), ggml-org#32429 (attention mask), ggml-org#32694 (Inkling 2 Mini, looped), ggml-org#32704 (loop slots after the scale pass), ggml-org#32799 (ignore_merges) and ggml-org#32381 (Inkling chat parser), at upstream 5bacb7c. Adapted to this fork: the graph takes the model by reference; the relative position bias goes through build_attn's kq_b (pre-divided by kq_scale, since build_attn_mha adds kq_b before soft_max_ext scales); the short-conv state is stored with this fork's n_rs_seq slot layout; the lm_head accumulates in F32 via ggml_prec_set_acc. The relative-position input is a subclass of the hybrid iSWA input. Vision (mtmd) and the converter are not part of this. Co-Authored-By: Claude Opus 5.5 <[email protected]> * convert: Inkling 2 / Inkling 2 Mini text converter (inkling2, inkling2_loop), ported from upstream conversion/inkling2.py from ggml-org/llama.cpp at 5bacb7c (ggml-org#32217, ggml-org#32694), without the vision (mmproj) class; the gguf-py keys, writer methods, tensors and name mappings it uses (text only), and the inkling2 pre-tokenizer hash. The NVFP4/MXFP8 experts are dequantized in the converter. Checked on strixhalo: thinkingmachines/Inkling-2-Mini (sha 65e60f51) -> --outtype q8_0 gives the same metadata and 664 of 704 tensors byte-identical to ggml-org's Q8_0 (d57542f8); the 40 that differ are the NVFP4 expert tensors, within one Q8_0 step (max |d| 0.3-0.5 % of the tensor max), the MXFP8 experts are identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * tests: test-llama-archs rows for inkling2 and inkling2_loop, and the inkling2 model-saver keys (from upstream ggml-org#32217, ggml-org#32694) test-llama-archs -a '^inkling2' on CPU: inkling2 NMSE 0 + roundtrip OK, inkling2_loop NMSE 0 (roundtrip skipped: the loop arch is not savable, as upstream). Co-Authored-By: Claude Opus 5.5 <[email protected]> * tests: Inkling chat-parser cases and templates (from upstream ggml-org#32381); jinja: tojson sort_keys=true (upstream ggml-org#32366) The Inkling 2 Mini chat template renders tool specs with tojson(sort_keys=true), which this fork's jinja threw on ('tojson sort_keys=true not implemented'), so any request with tools failed. test-chat (all tests passed, Inkling templates included) and test-jinja pass on CPU. Co-Authored-By: Claude Opus 5.5 <[email protected]> * model: load ffn_gate_up_exps scales and pass the expert scales in Inkling 2 (upstream ggml-org#32657) The generic scale pass loaded per-expert .scale tensors for ffn_gate_exps, ffn_up_exps and ffn_down_exps but not for the merged ffn_gate_up_exps, so NVFP4 GGUFs with merged experts did not load: unsloth's Mainline_Support Inkling-2-Mini-UD-Q4_K_XL (sha e6427665, NVFP4 experts on layers 0-19) failed with 'done_getting_tensors: wrong number of tensors; expected 744, got 724' (strixhalo). Load it as ffn_up_exps_s (build_moe_ffn applies up_exps_s to the merged gate_up output) and pass the scales to build_moe_ffn from the Inkling 2 graph. Co-Authored-By: Claude Opus 5.5 <[email protected]> * convert: Inkling 2 experts kept native NVFP4 (INKLING2_NVFP4_NATIVE=1), from upstream ggml-org#32786 Opt-in, same switch as the open upstream PR: the checkpoint's NVFP4 experts are repacked into ggml block_nvfp4 (E2M1 codes and E4M3 block scales unchanged, value j paired with j+8 per 16-group, gate/up rows de-interleaved) with the per-expert amax/denominator as the .scale tensor, instead of being dequantized and quantized again. Without the switch nothing changes. Checked on strixhalo: thinkingmachines/Inkling-2-Mini (sha 65e60f51), INKLING2_NVFP4_NATIVE=1 --outtype q8_0 -> 744 tensors, 17.6 GB; all 88 expert tensors (NVFP4 weights + F32 scales on layers 0-19, Q8_0 for the MXFP8 layers 20-23) are byte-identical to unsloth's Mainline_Support Inkling-2-Mini-UD-Q4_K_XL (sha e6427665), whose KLD vs HF bf16 is 0.0045 (Q8_0: 0.0043). tests/test_inkling2_nvfp4.py: 3 tests OK. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Nindaleth
pushed a commit
to Nindaleth/llama.cpp
that referenced
this pull request
Nov 26, 2026
amangupta-tether
added a commit
to tetherto/qvac-fabric-llm.cpp
that referenced
this pull request
Nov 26, 2026
…ggml-org#32704 to temp-12032) (#568) * ggml: bound views by the bytes their strides reach (ggml-org#31584) * ggml: bound views by the bytes their strides reach A view was checked against its source with the size of a contiguous tensor of the same shape, computed before its strides were set. Views whose rows overlap failed that check although they stay inside their source, and views with wider strides passed it while reaching past the end. The view functions now pass their strides to the tensor constructor, which checks the bytes they actually reach, like ggml_nbytes. The conv windows of delta_net are created with all their rows at once instead of being widened after the check. * ggml: assert that a strided view starts from contiguous elements The view functions set nb[0] to the type size, so the source must have contiguous elements along dim 0 for the view to read them. (cherry picked from commit bbb02c9) Backport note: prerequisite of the Inkling 2 port. build_conv_state_store (next commit) writes the conv rollback slots through a view with overlapping rows, which the old contiguous-size check rejects. The delta-net-base.cpp hunk is not taken: fabric's delta-net writes its conv snapshots with one copy per slot and never builds that widened view. * graph: store the MTP conv snapshots of every recurrent model in one set_rows (ggml-org#31660) * graph: store the conv state of every rollback arch in one set_rows The rollback slots of the causal conv history were written with one copy per slot in qwen4exp, glm5-next, kimi-k3, bailingmoe3, lfm and mamba2, while delta_net already wrote them with a single set_rows. build_conv_state_store now does this for all of them: one copy without rollback, otherwise one set_rows of the overlapping windows into the min(n, n_rs_seq + 1) slots a rollback can read. The slot order {n_rs_seq, ..., 0} is computed once per graph and each conv layer takes a view of its tail. Its size does not depend on the ubatch, so the reserved graph covers every ubatch shape, and the graph input that held it is gone. A model that is not causal never rolls back, so the context clamps n_rs_seq to 0 for it, like for an arch without rollback support. * nits: compute the conv slot order in the graph and keep the n_head name of bailingmoe3 * graph: build the conv slot order in each conv layer The slot order {K-1, ..., 0} of the conv state store was one tensor shared by every conv layer of the graph, built on the device of the first one, so each layer on another device copied the view of its tail. Each conv layer now builds its own order next to its set_rows, and llm_graph_input_rs no longer holds it. (cherry picked from commit 040ce19) Backport note: partial pick, prerequisite of the Inkling 2 port. Only the new llm_graph_context::build_conv_state_store helper is taken (Inkling 2's short convolutions call it). The conversion of the existing recurrent models (delta-net, qwen4exp, glm5-next, kimi-k3, bailingmoe3, lfm, mamba), the s_slot_rev input removal and the non-causal n_rs_seq clamp are left out: fabric's recurrent state code (deferred GDN commit, ragged ubatches, per-slot conv snapshots, no s_slot_rev) has diverged from upstream here, so those hunks conflict and would change the graphs of the existing models. * feat: add Inkling 2 support (text + vision) (ggml-org#32217) * convert : add Inkling2 text GGUF conversion Assisted-by: Codex * llama : implement Inkling2 text inference Assisted-by: Codex * tests : cover Inkling2 text support Assisted-by: Codex * conversion : dequantize packed Inkling2 experts in row chunks Decode per-layer NVFP4 and MXFP8 schemes, validate companions, and use stored scale shapes with a warning for the declared MXFP8 [32,32] grid. Reorder packed w13 rows and their scale rows together. Keep normal GGUF outtype selection and 3D expert tensors. Stream 128 rows per expert through LazyChunkedTensor. Real w13 (384x4608x4608) needs a 2.25 MiB F32 chunk instead of a 30.375 GiB expanded layer. Real-shaped sparse probes peak below 5.8 MiB of Python/NumPy chunk allocations, plus 5.2 MiB of callback metadata: budget about 16 MiB per projection including mapped pages, excluding runtime, other tensors and OS cache. Full-model chunk metadata is roughly 370 MiB. Packed synthetic GGUF weights match the independent pinned vLLM decode bit-for-bit. CPU prefill/decode logits remain within 3.1e-6 absolute error, with 100% argmax agreement. Float fixtures, original-name conversion and CPU architecture checks pass. Real checkpoint conversion remains untested. Assisted-by: Codex * convert : add Inkling2 vision mmproj support Assisted-by: Codex * mtmd : implement Inkling2 still-image encoder Assisted-by: Codex * inkling2 : scope image loading Assisted-by: Codex * inkling2 : enable flash attention with folded bias and sinks Assisted-by: Codex * cuda : route per-head flash attention masks through vec Assisted-by: Codex * mtmd : support Inkling2 temporal frame means Assisted-by: Codex * style : restore shared image comment Assisted-by: Codex * tests : enlarge Inkling2 context fixture Assisted-by: Codex * inkling2 : load per-layer expert feed-forward widths Assisted-by: Codex * tests : add Inkling2 Metal fusion baselines Assisted-by: Codex * inkling2 : group and align registry entries Assisted-by: Fable * convert : regenerate the Inkling2 tokenizer hash with the update script Assisted-by: Fable * conversion : revert the print_registered_models change Assisted-by: Fable * conversion : sort the Inkling2 model map entries Assisted-by: Fable * convert : map Inkling2 vision checkpoint names in the tensor table Assisted-by: Fable * convert : map Inkling2 text checkpoint names in the tensor table Assisted-by: Fable * tests : document the Inkling2 packed expert conversion test Assisted-by: Fable * tests : cover Inkling2 checkpoint and transformers tensor names Assisted-by: Fable * llama : place Inkling2 fields and list entries by file convention Assisted-by: Fable * gguf-py : align Inkling2 tensor mapping comments Assisted-by: Fable * mtmd : place Inkling2 entries by file convention Assisted-by: Fable * tests : place Inkling2 cases after the existing ones Assisted-by: Fable * cuda : index per-head flash attention masks in the tile and mma kernels Assisted-by: Claude Claude-Session: https://claude.ai/code/session_01GbYSza1yxgmTz8wdr6uV8Q * inkling2 : project the relative bias before the gather, drop arch branches Assisted-by: Claude Claude-Session: https://claude.ai/code/session_01GbYSza1yxgmTz8wdr6uV8Q * convert : require Inkling2 hparams, add inkling2 pre-tokenizer Assisted-by: Claude Claude-Session: https://claude.ai/code/session_01GbYSza1yxgmTz8wdr6uV8Q * mtmd : cap Inkling2 image size, drop video frame averaging Assisted-by: Claude Claude-Session: https://claude.ai/code/session_01GbYSza1yxgmTz8wdr6uV8Q * inkling2 : fix CI build, Meta device assert and Windows conversion test Assisted-by: Claude * tests : use the default sliding window for the Inkling2 test model Assisted-by: Claude * simplify mtmd part * give _v arch for vision * remove alpha channel handling, it should be a follow up * explicit rule about audio + vision models * add audio support * rm audio * rm gguf mtmd rope base * address review comment * nits * do not normalize embd from mtmd --------- Co-authored-by: Xuan Son Nguyen <[email protected]> (cherry picked from commit 5c008e0) Backport notes (temp-12032 conflict resolution): - Adjacency conflicts with models upstream added after b12032 (ricursive, metis16, kimi-k31, chatterbox, ...): kept fabric's lines, added only the Inkling 2 lines. - llama-graph build_attn: fabric reads the mask from .cnv (aliases .raw except for dflash); the new kq_mask parameter falls back to .cnv. - llama-graph build_moe_ffn: expert_weights_norm_eps branch placed before fabric's training_ctx branch, so inference matches upstream. - test-backend-ops: mask_heads appended after fabric's n_sparse_mask / scale / packed_window ctor arguments. - tools/mtmd: temp-12032 predates the mtmd refactor (upstream 7d7f028), so the mtmd-graph.cpp / mtmd-model.cpp / mtmd-subcontext.cpp hunks are placed verbatim at the equivalent spots of clip.cpp (mtmd-impl.h -> clip-impl.h, mtmd-model.h -> clip-model.h). The README-dev.md line is dropped: it extends a "Structure" section that only exists after that refactor. API renames follow in a separate commit. * fabric: adapt Inkling 2 to the temp-12032 graph and mtmd APIs temp-12032 predates two upstream refactors that the Inkling 2 commit builds on; pulling them in would touch 170+ and 90+ files, so the new code is renamed to the pre-refactor API instead. No behaviour change. - llm_graph_context still takes the model as a constructor argument (upstream e0f96a1 made it a member): graph(model, params) and make_unique<graph>(*this, params). - mtmd is still clip-based (upstream 7d7f028 moved it to mtmd_*): mtmd_graph -> clip_graph, mtmd_layer -> clip_layer, mtmd_image_u8/f32 -> clip_image_u8/f32, MTMD_ALIGN -> CLIP_ALIGN, mtmd_format -> string_format, models.v.get() -> ctx_v, also in the new test-mtmd-impl case (mtmd_hparams / mtmd_image_size -> clip_*). - test-backend-ops: fabric's test_flash_attn_ext takes n_sparse_mask, scale and packed_window where upstream has q_head_padding, so the new per-head-mask cases pass the defaults for those before mask_heads. - mtmd-image.cpp: drop the trailing blank line left by the relocation. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chat: fix inkling 2 begin/end of image tokens placement (ggml-org#32294) * chat: fix inkling 2 begin/end of image tokens placement * add test (cherry picked from commit dd099a6) Backport notes (temp-12032 conflict resolution): chat.cpp keeps fabric's thinking_forced_open block before the new split_media call; parsers.h keeps fabric's workaround namespace; mtmd.cpp keeps the ctx_v argument of the pre-refactor mtmd API. * jinja: support json sort_keys=true (ggml-org#32366) (cherry picked from commit e1925b3) * chat : implement inkling parser (ggml-org#32381) (cherry picked from commit 4ddf2b9) Backport note (temp-12032 conflict resolution): chat.cpp keeps fabric's thinking_forced_open block; only the split_media call is removed. * convert: Fix inkling 2 mmproj conversion (ggml-org#32430) (cherry picked from commit d998c67) * llama: fixes for Inkling 2 attention mask (ggml-org#32429) * llama : give Inkling2 its own relative-position attention input The Inkling2 graph built its flash attention mask from the hybrid iswa input and passed it to build_attn through a new kq_mask argument. That argument let a caller pair its own dense mask with the kv_rows of llm_graph_input_attn_kv_iswa, whose mask follows the per-sequence cell lists whenever kv_rows is enabled. Add llm_graph_input_attn_rel_pos instead. It owns dense KQ masks and the query-to-cell distances, fills both from the same cells, and its build_attn overload adds the per-head bias to its own mask and never passes kv_rows. The iswa build_attn is back to its previous signature; its body moves to build_attn_iswa_impl, which both overloads call. Inkling2 now folds the per-query sink into the bias with and without flash attention, so build_attn_mha no longer needs the per-query sink path. Assisted-By: Claude Opus 5.5 <[email protected]> * inkling2 : make the expert weight scale and final logit softcap optional Load both keys as optional and skip them when they are zero, as other models do, instead of rejecting zero at load. Assisted-By: Claude Opus 5.5 <[email protected]> * llama : build kv_rows masks for the hybrid iswa memory llm_graph_input_mem_hybrid_iswa checked its masks with can_reuse_attn_mask, which expects kv_rows whenever they are enabled, but built them dense. With a unified cache and flash attention the check always failed, and hybrid iswa models (LFM2, LFM3, Inkling2) never reused a graph. Build the masks with build_attn_inp_attn_mask, like the plain iswa input. Assisted-By: Claude Opus 5.5 <[email protected]> * llama : make the relative-position input a hybrid iswa input Address review: llm_graph_input_mem_hybrid_iswa_rel derives from llm_graph_input_mem_hybrid_iswa and owns the attention and recurrent inputs, so Inkling2 builds one memory input instead of two. Its attention input is built with dense masks, can_reuse checks them as dense, and its build_attn asserts that the mask has no kv_rows (TODO: a kv_rows variant). build_attn_iswa_impl is now a static helper. Assisted-By: Claude Opus 5.5 <[email protected]> * llama : compose the hybrid iswa rel input, format inkling2 Address review: llm_graph_input_mem_hybrid_iswa_rel owns its attention and recurrent inputs like the other composite inputs instead of deriving from llm_graph_input_mem_hybrid_iswa. Format src/models/inkling2.cpp like the other model sources: grouped and aligned key and tensor loading, descriptive per-layer names, blank lines and section comments between the steps, and cb() names for the intermediate tensors. The graph is unchanged. Assisted-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 8af68d4) Backport notes (temp-12032 conflict resolution): - build_attn_iswa_impl keeps fabric's slicing of a dense mask that is wider than the K view; the iswa build_attn passes fabric's .cnv mask. - inkling2.cpp keeps the (model, params) graph constructor of temp-12032. * fabric: fill the Inkling 2 recurrent inputs with the fabric helpers llm_graph_input_mem_hybrid_iswa_rel (upstream 8af68d4) copies the upstream recurrent-state input code. On temp-12032 the recurrent inputs also carry the deferred GDN copy indices, the moved-state range and the ragged-ubatch offsets, so set_input() and can_reuse() do what fabric's llm_graph_input_mem_hybrid_iswa does: llm_graph_set_input_rs() and the moved-range / in-place / ragged checks. Same as the non-rel hybrid iswa input; no change for upstream-shaped batches. Co-Authored-By: Claude Opus 5.5 <[email protected]> * model : load ffn_gate_up_exps scales (ggml-org#32657) * model: load `ffn_gate_up_exps` scales The generic scale pass loads per-expert scales for ffn_gate_exps, ffn_up_exps and ffn_down_exps but not for the merged ffn_gate_up_exps. Load ~ffn_gate_up_exps_s there~ and expose it as ffn_up_exps_s ~when the layer has no separate up tensor,~ since build_moe_ffn applies up_exps_s to the merged gate_up output. Inkling 2 now passes the expert scales to build_moe_ffn like the other MoE models. * Update src/llama-model.cpp Co-authored-by: Sigbjørn Skjæret <[email protected]> * Update src/llama-model.h Co-authored-by: Sigbjørn Skjæret <[email protected]> --------- Co-authored-by: Sigbjørn Skjæret <[email protected]> (cherry picked from commit a1f4222) * model : Inkling 2 Mini (ggml-org#32694) * Conversion * Separate model_type * Add gate_rank to allow building from metadata while testing * Base model * Loop graph * Support the new is_varloop attribute * Adopt naming scheme from ggml-org#32588 * Rename to varying (cherry picked from commit 29b52d3) Backport notes (temp-12032 conflict resolution): adjacency conflicts with models upstream added after b12032 (domyn-edge, metis16, zaya1, kokoro): kept fabric's lines, added only the Inkling 2 Mini lines. The graph constructor is adapted to the temp-12032 API in the next commit. * fabric: adapt the Inkling 2 Mini graphs to the temp-12032 graph API Upstream 29b52d3 splits the Inkling 2 graph into build_inputs(), build_layer() and build_output() members that read `model`, which upstream llm_graph_context holds since e0f96a1. temp-12032 still passes the model to the graph constructor, so the Inkling 2 graph keeps it in a `model` member (as fabric's bailingmoe3 graph does) and the Inkling 2 / Inkling 2 loop constructors and build_arch_graph() pass it through. No behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]> * model : inkling2_loop share the loop slots after the scale pass (ggml-org#32704) The loop slots copied the physical layers at the end of load_arch_tensors, before the generic pass attaches the optional .scale tensors, so the later passes through the core ran NVFP4 experts without their per-expert scales. Add an optional post_arch_tensors hook that runs after the scale pass and share the slots there. (cherry picked from commit 690b87d) * CUDA : fused row L2 clip for Inkling 2 Inkling 2 clips the rows of Q, K and the relative-position queries to an L2 norm with 8 or 9 ops (the optional per-channel scale MUL, SQR, SUM_ROWS, SQRT, SCALE, FILL, DIV, CLAMP, MUL), three times per layer visit: on Inkling 2 Mini that is 144 chains and about 1250 small kernels per token. ggml_cuda_try_fuse now runs such a chain as one kernel (one warp per row), and the NVRTC fusion planner leaves the chains to it. test-backend-ops: L2_CLIP cases with the Q, K and relative-query shapes. Assisted-by: Claude Opus 5.5 * CUDA : L2 clip fusion skips in-place intermediates, x may alias dst An in-place node inside the chain changes what the graph computes: with ggml_fill_inplace the FILL overwrites the norm before the DIV reads it, so the graph gives x * clamp(1) while the kernel gave the clipped rows. The matcher now rejects the chain when any intermediate node is in place. The output may be x itself (the last MUL in place), so x is no longer __restrict__ in the kernel. test-backend-ops gets an in-place FILL case, which must not fuse (it failed with the fusion before), and a case whose output is written over the input. Assisted-by: Claude Opus 5.5 * Merge pull request #573 from tetherto/gb10-moe-mmq-temp-12032 CUDA : MMQ for MoE batches that pick many experts on DGX Spark * Merge pull request #579 from tetherto/inkling2-fewrow-moe-temp-12032 CUDA : few-row MMQ for MUL_MAT_ID and Inkling 2 expert rows (port of ggml-org#32065) * model : Inkling 2 Mini mix() weighted sum with the scores as src0 (port of ggml-org#32855) (#581) * model : Inkling 2 Mini mix() weighted sum with the scores as src0 The weighted sum over the depth states has K = # of states so the old operand order ran one small mat-vec per token. Putting scores first makes n_embd the long dimension and speeds up prefill by 14-18% on MI300X and 25-37% on B200. (cherry picked from commit 357a9ee) * model : keep the old mix() operand order when the model runs on the CPU The scores as src0 make n_embd the long dimension of the weighted sum, which is faster on GPUs, but on the CPU the subgraph took 1.5-1.9x as long (review of this PR, Core Ultra 7 155H). When no layer is offloaded and the output is on the CPU, mix() builds the former graph again: one mat-vec per token with the states as src0. A partly offloaded model keeps the swap everywhere. Choosing per layer was slower than both orders with 12 of 24 layers on the GPU (DGX Spark: pp512 487 t/s against 507 with the old order and 536 with the swap), as the loop slots and the physical layers whose weights they share can sit on different devices. Assisted-by: Claude Opus 5.5 --------- Co-authored-by: Eddie Zhou <[email protected]> * ggml-backend, llama : copy shared MoE weights again for each split that reads them (#588) With op offload, llama's copy callback uploads only the experts that the ids of the split's first MUL_MAT_ID select. The scheduler lists a host weight as an input only of the first split that reads it on a backend, and later splits reuse that copy. When several MUL_MAT_IDs share an expert weight (Inkling 2 runs its core layers again in later passes, each with its own routing), the later ones read experts that were never uploaded: any partial offload of Inkling 2 Mini gave NaN perplexity, also on upstream master. The scheduler now lists such a weight again for every later split that reads it as src0 of a MUL_MAT_ID while a copy callback is set, and the callback keeps track of the experts it uploaded in the current graph compute, so a later split uploads only the experts that are still missing. Assisted-by: Claude Opus 5.5 * ci : HIP VGPR check ignores the flash attention kernels under their new signature ggml-org#32429 (Inkling 2 attention mask) widened the mask's head stride nb32 of the flash attention kernels from int32 to int64, which changes their mangled names from ...iiiiil to ...iiiill. The 88 flash attention kernels the check already ignores no longer matched, so ubuntu-22-hip-quality-check reported 31 known gfx908 spills on #568, every one an entry of the list under the old signature. The entries now use the new signature, as upstream's copy of the script does. Assisted-by: Claude Opus 5.5 * ggml-webgpu : flash attention does not support a mask per head ggml-org#32429 lets the flash attention mask carry a plane per head or head group (mask->ne[2] > 1, broadcast over heads like ne[3] over sequences) for Inkling 2's relative-position bias, and test-backend-ops gained mask_heads cases. The WebGPU shaders read one mask plane per sequence, so they applied head 0's plane to every head: all 50 FLASH_ATTN_EXT cases with mask_heads 2, 4 or 8 failed on gpu-webgpu-apple and gpu-webgpu-nvidia, and inkling2_loop missed the test-llama-archs tolerance on webgpu-nvidia (1.08e-4). supports_op now declines such masks, so the op runs on another backend. Assisted-by: Claude Opus 5.5 * tests : re-record the Metal fusion baseline for the Inkling 2 port The metal job failed test-fusion with 8 rows on #568: - ggml-org#32657 creates ffn_gate_up_exps.scale (as ffn_up_exps_s) for layers with merged gate/up experts. test-llama-archs builds its models with every optional tensor, so the generated cohere2moe, hy_v3, qwen35moe, qwen3next and qwen4exp models now carry the scale and build_moe_ffn multiplies the merged MUL_MAT_ID output by it. The Metal MUL_MAT_ID+GLU decode fusion only matches MUL_MAT_ID -> VIEW -> VIEW -> GLU, and silu(s*g)*(s*u) cannot be folded, so those 5 rows no longer occur. GGUFs without the optional scale build the old graph and keep the fusion; models with it are NVFP4, which the fusion does not take anyway. - The inkling2 rows were recorded on a tree with a Metal top-k fusion that #568 does not have; the same scale pass adds MUL_MAT_ID+MUL for Inkling 2. Re-recorded on the M3 Ultra with the CI flags: 534 ok, 0 failed on #568's head and on #568 merged with the current temp-12032. Assisted-by: Claude Opus 5.5 --------- Co-authored-by: Pascal <[email protected]> Co-authored-by: Piotr Wilkin (ilintar) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Xuan-Son Nguyen <[email protected]> Co-authored-by: Aldehir Rojas <[email protected]> Co-authored-by: Bartowski <[email protected]> Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Sigbjørn Skjæret <[email protected]> Co-authored-by: Pedro Cuenca <[email protected]> Co-authored-by: Aman Gupta <[email protected]> Co-authored-by: Eddie Zhou <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
required by inkling template: https://huggingface.co/thinkingmachines/Inkling/blob/main/chat_template.jinja#L36
Requirements