From d98656ea22a557ae07f224a02a2f46d3c3f97f60 Mon Sep 17 00:00:00 2001 From: Skippy llama updater Date: Sun, 29 Nov 2026 11:05:01 +0000 Subject: [PATCH 1/2] Update llama.cpp to 918fe468dbaae80bcdaf975c1b368023f2578ead --- crates/skippy-api/src/native-recipe.json | 4 +- ...ippy-define-graph-derived-native-ABI.patch | 37 +- ...ize-admitted-stages-from-live-graphs.patch | 163 +++--- ...rate-live-stage-planning-and-executi.patch | 237 ++++----- ...se-stage-independent-graph-semantics.patch | 496 +++++++++--------- ...e-native-runtime-and-backend-support.patch | 79 ++- ...cover-live-graph-and-state-contracts.patch | 148 +++--- ...native-MTP-state-across-verify-trims.patch | 17 +- ...re-attaching-backend-samplers-betwee.patch | 15 +- ...r-use-a-secure-RNG-for-generated-IDs.patch | 7 +- ...-selected-token-scores-in-causal-bat.patch | 15 +- ...-literal-lazy-triggers-without-regex.patch | 11 +- ...e-routed-experts-of-a-block-range-in.patch | 19 +- ...the-argmax-path-for-temperature-0-ch.patch | 19 +- ...rrent-rollback-for-speculative-verif.patch | 17 +- ...-back-staged-verify-windows-in-place.patch | 37 +- ...which-layer-inputs-a-graph-publishes.patch | 19 +- ...skippy-retain-fatal-CUDA-diagnostics.patch | 9 +- ...st-bound-synthetic-MiMo2-KV-geometry.patch | 11 +- ...ease-temporary-MTP-planning-contexts.patch | 7 +- ...esident-prefixes-as-shared-cells-plu.patch | 37 +- ...ls-without-rollback-snapshots-unless.patch | 17 +- ...tive-trace-spans-and-GPU-command-tim.patch | 123 +++-- ...mple-a-batch-s-requests-concurrently.patch | 43 +- .../0024-skippy-trace-K-V-row-list-runs.patch | 19 +- ...consecutive-row-list-blocks-like-den.patch | 7 +- ...uence-s-unified-pool-cells-in-chunks.patch | 11 +- ...le-a-gather-free-row-list-attention-.patch | 29 +- ...GML_METAL_CAPTURE_DIR-choose-where-a.patch | 7 +- ...ost-of-ordinary-vs-row-list-decode-a.patch | 11 +- ...-start-every-row-list-run-on-an-atte.patch | 25 +- ...METAL_ROWS_DEBUG-counts-the-row-atte.patch | 11 +- ...rt-every-backend-buffer-s-life-as-a-.patch | 11 +- ...ol-cells-as-the-high-water-mark-adva.patch | 17 +- ...ages-of-freed-KV-chunks-back-to-the-.patch | 11 +- ...unified-KV-pool-and-choose-its-memor.patch | 25 +- ...-request-s-share-of-a-batch-together.patch | 13 +- ...wave-through-a-configurable-executor.patch | 25 +- ...list-attention-over-the-lists-a-unif.patch | 23 +- ...leased-chunks-before-compaction-copi.patch | 13 +- ...-every-row-list-entry-before-reading.patch | 23 +- ...takes-a-run-s-tasks-only-while-that-.patch | 11 +- ...-KV-memory-options-to-every-attentio.patch | 7 +- ...restore-hybrid-checkpoint-components.patch | 7 +- ...arate-resident-capability-components.patch | 7 +- ...-empty-command-buffers-as-other-work.patch | 9 +- ...g-fully-overwritten-kv-import-chunks.patch | 13 +- ...-operation-diagnostics-with-upstream.patch | 7 +- ...evices-without-optional-nvml-headers.patch | 17 +- ...upstream-in-place-state-fill-effects.patch | 11 +- ...begin-each-logical-batch-transaction.patch | 13 +- ...primal-activation-for-adapter-deltas.patch | 13 +- ...egen-import-only-into-empty-kv-cells.patch | 11 +- ...posite-attention-occupancy-reporting.patch | 7 +- ...ct-fill-in-recurrent-planning-proofs.patch | 9 +- ...ader-progress-and-position-contracts.patch | 35 +- ...y-preserve-text-chat-parser-contract.patch | 17 +- ...t-retain-cachegen-fixture-parameters.patch | 7 +- ...ph-preserve-registered-expert-scales.patch | 34 +- ...-moe-routing-with-scaled-projections.patch | 34 +- ...metal-trace-chunked-graph-submission.patch | 13 +- ...61-test-pass-recurrent-replay-policy.patch | 7 +- ...horten-vulkan-shader-generator-paths.patch | 4 +- .../patches/generated/0001-family-afmoe.patch | 2 +- .../generated/0002-family-apertus.patch | 2 +- .../patches/generated/0003-family-arcee.patch | 2 +- .../generated/0004-family-arwkv7--rwkv7.patch | 2 +- .../generated/0005-family-bailingmoe2.patch | 2 +- .../generated/0006-family-bailingmoe3.patch | 6 +- .../patches/generated/0007-family-bloom.patch | 2 +- .../generated/0008-family-chameleon.patch | 2 +- .../generated/0009-family-cohere2.patch | 2 +- ...ily-deepseek2--glm47-flash--mistral4.patch | 6 +- .../generated/0011-family-deepseek32.patch | 2 +- .../generated/0012-family-deepseek4.patch | 8 +- .../patches/generated/0013-family-dots1.patch | 2 +- .../generated/0014-family-ernie4-5.patch | 2 +- .../generated/0015-family-ernie4-5-moe.patch | 2 +- .../generated/0016-family-exaone4.patch | 2 +- .../generated/0017-family-falcon-dense.patch | 2 +- .../generated/0018-family-falcon-h1.patch | 2 +- .../patches/generated/0019-family-gemma.patch | 2 +- .../generated/0020-family-gemma2.patch | 2 +- .../generated/0021-family-gemma3.patch | 2 +- .../generated/0022-family-gemma3n.patch | 2 +- .../generated/0023-family-gemma4.patch | 2 +- .../generated/0024-family-glm-dsa.patch | 2 +- .../0025-family-glm4--glm4-expansion.patch | 2 +- .../0026-family-glm4-expansion.patch | 2 +- .../generated/0027-family-glm45-air.patch | 6 +- .../generated/0028-family-gpt-oss.patch | 2 +- .../generated/0029-family-gptneox.patch | 2 +- ...-granite-dense--granite-moe--minicpm.patch | 2 +- .../0031-family-granite-hybrid.patch | 2 +- .../generated/0032-family-granite-swa.patch | 2 +- .../0033-family-granite-switch.patch | 2 +- .../generated/0034-family-grovemoe.patch | 2 +- .../generated/0035-family-hunyuan-dense.patch | 2 +- .../patches/generated/0036-family-hy-v3.patch | 2 +- .../generated/0037-family-inkling.patch | 2 +- .../generated/0038-family-internlm2.patch | 2 +- .../patches/generated/0039-family-jais.patch | 2 +- .../patches/generated/0040-family-jais2.patch | 2 +- .../generated/0041-family-jamba2.patch | 2 +- .../generated/0042-family-kimi-k3.patch | 2 +- .../generated/0043-family-kimi-linear.patch | 4 +- .../generated/0044-family-laguna.patch | 2 +- .../0045-family-lfm2--lfm2-moe--lfm2-vl.patch | 2 +- .../patches/generated/0046-family-llama.patch | 2 +- .../generated/0047-family-llama--olmo2.patch | 2 +- .../generated/0048-family-llama4.patch | 2 +- .../generated/0049-family-maincoder.patch | 2 +- .../generated/0050-family-mamba--mamba2.patch | 2 +- .../generated/0051-family-mellum.patch | 2 +- .../patches/generated/0052-family-mimo2.patch | 2 +- .../generated/0053-family-minicpm3.patch | 2 +- .../generated/0054-family-minimax-m2.patch | 2 +- .../generated/0055-family-minimax-m3.patch | 2 +- .../0056-family-mistral-small--mistral3.patch | 2 +- .../patches/generated/0057-family-mpt.patch | 2 +- .../generated/0058-family-muse-glimmer.patch | 2 +- .../0059-family-nemotron--nemotron-nano.patch | 6 +- .../0060-family-nemotron-expansion.patch | 2 +- .../patches/generated/0061-family-phi2.patch | 2 +- .../generated/0062-family-phi3--phi4.patch | 2 +- .../patches/generated/0063-family-qwen2.patch | 2 +- .../generated/0064-family-qwen2-moe.patch | 2 +- .../generated/0065-family-qwen2-vl.patch | 2 +- .../generated/0066-family-qwen3-dense.patch | 2 +- .../generated/0067-family-qwen3-moe.patch | 2 +- .../generated/0068-family-qwen3-next.patch | 2 +- .../generated/0069-family-qwen3-vl.patch | 2 +- .../generated/0070-family-qwen35.patch | 2 +- .../generated/0071-family-qwen35moe.patch | 2 +- .../generated/0072-family-qwen3vlmoe.patch | 2 +- .../generated/0073-family-qwen4exp.patch | 2 +- .../patches/generated/0074-family-rwkv6.patch | 6 +- .../patches/generated/0075-family-rwkv7.patch | 4 +- .../generated/0076-family-smollm3.patch | 2 +- .../generated/0077-family-spark2-5.patch | 2 +- .../generated/0078-family-stablelm.patch | 2 +- .../generated/0079-family-starcoder2.patch | 2 +- .../generated/0080-family-step35.patch | 2 +- .../generated/0081-family-unmapped.patch | 172 +++--- llama_cpp/patches/generated/series.json | 164 +++--- ...01-models-add-inkling-family-support.patch | 131 +++-- ...-residual-checkpoint-activation-port.patch | 7 +- ...03-llama-port-diffusiongemma-support.patch | 117 ++--- ...-add-diffusiongemma-system-one-reads.patch | 17 +- ...skippy-query-diffusion-canvas-length.patch | 9 +- ...dels-add-laya-decision-model-support.patch | 45 +- ...-parse-implicit-reasoning-continuati.patch | 11 +- ...0008-models-add-qwen3-moe-native-mtp.patch | 37 +- ...kippy-add-whisper-speech-recognition.patch | 17 +- ...rd-per-token-logprobs-while-sampling.patch | 29 +- ...pose-glm5-next-stage-graph-semantics.patch | 35 +- ...skippy-add-clef-joint-decision-reads.patch | 17 +- ...expose-metis16-delegated-pass-layers.patch | 35 +- ...-skippy-cover-head-input-publication.patch | 11 +- ...0015-models-add-laguna-dflash-drafts.patch | 103 ++-- ...spine-block-parallel-drafter-support.patch | 69 ++- ...e-callback-backed-checkpoint-serving.patch | 23 +- ...ing2-zonos3-builders-for-stage-proof.patch | 158 ++++-- ...a4-register-shared-kv-pruning-inputs.patch | 7 +- ...ad-indexer-tensors-by-attention-role.patch | 7 +- ...reserve-media-aware-template-routing.patch | 11 +- ...pulate-the-graph-owned-lattice-stash.patch | 9 +- ...r-retain-token-aware-turn-boundaries.patch | 7 +- ...e-checkpoint-layouts-and-head-scales.patch | 27 +- ...istinguish-b12780-upstream-c-layouts.patch | 7 +- llama_cpp/upstream.txt | 2 +- 171 files changed, 1713 insertions(+), 1922 deletions(-) diff --git a/crates/skippy-api/src/native-recipe.json b/crates/skippy-api/src/native-recipe.json index 53f9b658..e09b80a6 100644 --- a/crates/skippy-api/src/native-recipe.json +++ b/crates/skippy-api/src/native-recipe.json @@ -1,4 +1,4 @@ { - "llama_upstream_sha": "09c1410642fa0395ca234571980093bc5c7f2ef5", - "patch_queue_sha256": "1290b315656275be554d09672e18c069f7a92521a6e1632008f86f61ef1a5d9e" + "llama_upstream_sha": "918fe468dbaae80bcdaf975c1b368023f2578ead", + "patch_queue_sha256": "ef915b25ba3f425f9f6c04ce5eab253c5d94fecb9c16153d80d6ee2b08f9eb82" } \ No newline at end of file diff --git a/llama_cpp/patches/0001-feat-skippy-define-graph-derived-native-ABI.patch b/llama_cpp/patches/0001-feat-skippy-define-graph-derived-native-ABI.patch index 0665a0c3..3a80fc56 100644 --- a/llama_cpp/patches/0001-feat-skippy-define-graph-derived-native-ABI.patch +++ b/llama_cpp/patches/0001-feat-skippy-define-graph-derived-native-ABI.patch @@ -1,4 +1,4 @@ -From c3c085fef9dcfd48fd501b1ff4b52a74ed4c2bb1 Mon Sep 17 00:00:00 2001 +From e4ac96241415b7a42c0d39b83460f42024e2903b Mon Sep 17 00:00:00 2001 From: James Dumay Date: Tue, 13 Oct 2026 22:06:42 +1100 Subject: [PATCH] feat(skippy): define graph-derived native ABI @@ -40,7 +40,7 @@ Subject: [PATCH] feat(skippy): define graph-derived native ABI diff --git a/include/skippy.h b/include/skippy.h new file mode 100644 -index 000000000..dc8cbb431 +index 0000000000000000000000000000000000000000..dc8cbb431d31b21358507ce9136debd0fbe1fbbf --- /dev/null +++ b/include/skippy.h @@ -0,0 +1,29 @@ @@ -75,7 +75,7 @@ index 000000000..dc8cbb431 +#endif // SKIPPY_H diff --git a/include/skippy/activation.h b/include/skippy/activation.h new file mode 100644 -index 000000000..673c1d81c +index 0000000000000000000000000000000000000000..673c1d81cafffd797ac6a63b34e0f48e4ed8d927 --- /dev/null +++ b/include/skippy/activation.h @@ -0,0 +1,66 @@ @@ -147,7 +147,7 @@ index 000000000..673c1d81c +#endif // SKIPPY_ACTIVATION_H diff --git a/include/skippy/common.h b/include/skippy/common.h new file mode 100644 -index 000000000..b9b5259af +index 0000000000000000000000000000000000000000..b9b5259afe44fe588e485a3abeccb8bc58bf0ed8 --- /dev/null +++ b/include/skippy/common.h @@ -0,0 +1,146 @@ @@ -299,7 +299,7 @@ index 000000000..b9b5259af +#endif // SKIPPY_COMMON_H diff --git a/include/skippy/devices.h b/include/skippy/devices.h new file mode 100644 -index 000000000..36c6eb641 +index 0000000000000000000000000000000000000000..36c6eb641b3f850ade443f6522a81b10eadfe635 --- /dev/null +++ b/include/skippy/devices.h @@ -0,0 +1,56 @@ @@ -361,7 +361,7 @@ index 000000000..36c6eb641 +#endif diff --git a/include/skippy/events.h b/include/skippy/events.h new file mode 100644 -index 000000000..2e0aa446f +index 0000000000000000000000000000000000000000..2e0aa446f6df19d28dd6af958f71e983ed01f4ac --- /dev/null +++ b/include/skippy/events.h @@ -0,0 +1,229 @@ @@ -596,7 +596,7 @@ index 000000000..2e0aa446f +#endif // SKIPPY_EVENTS_H diff --git a/include/skippy/execution.h b/include/skippy/execution.h new file mode 100644 -index 000000000..7098677d8 +index 0000000000000000000000000000000000000000..7098677d8bf27a333c7438dc4895d1859fc8eab4 --- /dev/null +++ b/include/skippy/execution.h @@ -0,0 +1,264 @@ @@ -866,7 +866,7 @@ index 000000000..7098677d8 +#endif // SKIPPY_EXECUTION_H diff --git a/include/skippy/model_package.h b/include/skippy/model_package.h new file mode 100644 -index 000000000..944f57fdf +index 0000000000000000000000000000000000000000..944f57fdfc258b0608688272ed906f79152766e4 --- /dev/null +++ b/include/skippy/model_package.h @@ -0,0 +1,93 @@ @@ -965,7 +965,7 @@ index 000000000..944f57fdf +#endif // SKIPPY_MODEL_PACKAGE_H diff --git a/include/skippy/model_source.h b/include/skippy/model_source.h new file mode 100644 -index 000000000..5d77f4804 +index 0000000000000000000000000000000000000000..5d77f4804b3a34f9ccb7057d82846060c587ef37 --- /dev/null +++ b/include/skippy/model_source.h @@ -0,0 +1,84 @@ @@ -1055,7 +1055,7 @@ index 000000000..5d77f4804 +#endif // SKIPPY_MODEL_SOURCE_H diff --git a/include/skippy/runtime.h b/include/skippy/runtime.h new file mode 100644 -index 000000000..799bdca2d +index 0000000000000000000000000000000000000000..799bdca2dadf1ef102ea5b207827ffda1ef8abf0 --- /dev/null +++ b/include/skippy/runtime.h @@ -0,0 +1,277 @@ @@ -1338,7 +1338,7 @@ index 000000000..799bdca2d +#endif // SKIPPY_RUNTIME_H diff --git a/include/skippy/sampling.h b/include/skippy/sampling.h new file mode 100644 -index 000000000..1b42f32c0 +index 0000000000000000000000000000000000000000..1b42f32c0c68b206273cdb4d992bad2419b6e6be --- /dev/null +++ b/include/skippy/sampling.h @@ -0,0 +1,76 @@ @@ -1420,7 +1420,7 @@ index 000000000..1b42f32c0 +#endif // SKIPPY_SAMPLING_H diff --git a/include/skippy/signals.h b/include/skippy/signals.h new file mode 100644 -index 000000000..c4d3d24d9 +index 0000000000000000000000000000000000000000..c4d3d24d92ab40ccb0f62d1479076bc5fd619183 --- /dev/null +++ b/include/skippy/signals.h @@ -0,0 +1,53 @@ @@ -1479,7 +1479,7 @@ index 000000000..c4d3d24d9 +#endif // SKIPPY_SIGNALS_H diff --git a/include/skippy/speculative_decoding.h b/include/skippy/speculative_decoding.h new file mode 100644 -index 000000000..0b5994482 +index 0000000000000000000000000000000000000000..0b5994482975cac5744acc595db38710d2224c37 --- /dev/null +++ b/include/skippy/speculative_decoding.h @@ -0,0 +1,71 @@ @@ -1556,7 +1556,7 @@ index 000000000..0b5994482 +#endif // SKIPPY_SPECULATIVE_DECODING_H diff --git a/include/skippy/stage_plan.h b/include/skippy/stage_plan.h new file mode 100644 -index 000000000..7ffe65277 +index 0000000000000000000000000000000000000000..7ffe652772e8c3a4ca737b12b8b4877a9b1d01a9 --- /dev/null +++ b/include/skippy/stage_plan.h @@ -0,0 +1,256 @@ @@ -1818,7 +1818,7 @@ index 000000000..7ffe65277 +#endif // SKIPPY_STAGE_PLAN_H diff --git a/include/skippy/state.h b/include/skippy/state.h new file mode 100644 -index 000000000..1cfaaa5c6 +index 0000000000000000000000000000000000000000..1cfaaa5c69329eb0d21307c72cb7629267002be3 --- /dev/null +++ b/include/skippy/state.h @@ -0,0 +1,236 @@ @@ -2060,7 +2060,7 @@ index 000000000..1cfaaa5c6 +#endif // SKIPPY_STATE_H diff --git a/include/skippy/tokenization.h b/include/skippy/tokenization.h new file mode 100644 -index 000000000..c9697cf6c +index 0000000000000000000000000000000000000000..c9697cf6c5c6da8147b849d79c85062edf8e56ba --- /dev/null +++ b/include/skippy/tokenization.h @@ -0,0 +1,85 @@ @@ -2151,7 +2151,7 @@ index 000000000..c9697cf6c +#endif // SKIPPY_TOKENIZATION_H diff --git a/include/skippy/workloads.h b/include/skippy/workloads.h new file mode 100644 -index 000000000..6aff32414 +index 0000000000000000000000000000000000000000..6aff324149748c35da2b7e62451e758b288d69f5 --- /dev/null +++ b/include/skippy/workloads.h @@ -0,0 +1,93 @@ @@ -2248,6 +2248,3 @@ index 000000000..6aff32414 +#endif + +#endif // SKIPPY_WORKLOADS_H --- -2.56.1 - diff --git a/llama_cpp/patches/0002-feat-skippy-realize-admitted-stages-from-live-graphs.patch b/llama_cpp/patches/0002-feat-skippy-realize-admitted-stages-from-live-graphs.patch index a3975f4d..0d598e46 100644 --- a/llama_cpp/patches/0002-feat-skippy-realize-admitted-stages-from-live-graphs.patch +++ b/llama_cpp/patches/0002-feat-skippy-realize-admitted-stages-from-live-graphs.patch @@ -1,4 +1,4 @@ -From 80217d28206f5240e9d0697a374638f5fef7f912 Mon Sep 17 00:00:00 2001 +From 68e6dc5352663efd02a17830c3344b3c7d7c3f3d Mon Sep 17 00:00:00 2001 From: James Dumay Date: Tue, 13 Oct 2026 22:06:42 +1100 Subject: [PATCH] feat(skippy): realize admitted stages from live graphs @@ -152,7 +152,7 @@ Subject: [PATCH] feat(skippy): realize admitted stages from live graphs create mode 100644 src/skippy/workloads_internal.h diff --git a/common/common.cpp b/common/common.cpp -index b009d460d..2cf5cc7fc 100644 +index b009d460d697246bb5c5e74125f4f3507e60fdc9..2cf5cc7fc398b31c4a4c2af474e6040b840133bb 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -67,14 +67,6 @@ @@ -293,7 +293,7 @@ index b009d460d..2cf5cc7fc 100644 const llama_model * model = llama_get_model(ctx); const llama_vocab * vocab = llama_model_get_vocab(model); diff --git a/common/common.h b/common/common.h -index 22724e817..4981afa92 100644 +index 22724e81743642a35a35e7ff82ba46d7fac9cecc..4981afa922f87d9f344e44b17c2ece103472cbc4 100644 --- a/common/common.h +++ b/common/common.h @@ -43,7 +43,7 @@ @@ -370,7 +370,7 @@ index 22724e817..4981afa92 100644 llama_token token, bool special = true); diff --git a/common/json.cpp b/common/json.cpp -index 37713cef2..694d85bad 100644 +index 37713cef29e78833fd09cfff607cc83b3eb871c6..694d85badbcfee2675cde403e929116da813c857 100644 --- a/common/json.cpp +++ b/common/json.cpp @@ -92,7 +92,7 @@ static std::shared_ptr set_json(const std::set & vals) { @@ -426,7 +426,7 @@ index 37713cef2..694d85bad 100644 COMMON_JSON_GET(bool) COMMON_JSON_GET(int) diff --git a/common/json.h b/common/json.h -index 95b6d6f21..da3b599dc 100644 +index 95b6d6f212e533fc83072b0c8f40120b36c33eef..da3b599dcd412a2ce63dbe94f64f5b88f851b3dc 100644 --- a/common/json.h +++ b/common/json.h @@ -1,5 +1,7 @@ @@ -497,7 +497,7 @@ index 95b6d6f21..da3b599dc 100644 diff --git a/common/log-terminal.cpp b/common/log-terminal.cpp new file mode 100644 -index 000000000..a486de11c +index 0000000000000000000000000000000000000000..a486de11c717de44e9ad9954a49493509304335f --- /dev/null +++ b/common/log-terminal.cpp @@ -0,0 +1,52 @@ @@ -554,7 +554,7 @@ index 000000000..a486de11c +} + diff --git a/common/log.h b/common/log.h -index 93ea58e76..6bc5c5914 100644 +index 93ea58e76158add30c7050032d641261317af800..6bc5c5914a3dcb4c3f02a2478b175a5eaf78adf5 100644 --- a/common/log.h +++ b/common/log.h @@ -1,5 +1,6 @@ @@ -648,7 +648,7 @@ index 93ea58e76..6bc5c5914 100644 #define LOG_JSON(type, data) \ diff --git a/common/regex-escape.cpp b/common/regex-escape.cpp new file mode 100644 -index 000000000..12c3888f6 +index 0000000000000000000000000000000000000000..12c3888f6d0d0c37cf5d968dd6013d2d2e5b53fb --- /dev/null +++ b/common/regex-escape.cpp @@ -0,0 +1,8 @@ @@ -662,7 +662,7 @@ index 000000000..12c3888f6 + diff --git a/common/sampling-config.cpp b/common/sampling-config.cpp new file mode 100644 -index 000000000..bf3c4c8e6 +index 0000000000000000000000000000000000000000..bf3c4c8e672a9159e2e7cf80cd5962deb28c60f5 --- /dev/null +++ b/common/sampling-config.cpp @@ -0,0 +1,169 @@ @@ -837,7 +837,7 @@ index 000000000..bf3c4c8e6 +} diff --git a/common/sampling-report.cpp b/common/sampling-report.cpp new file mode 100644 -index 000000000..d40a39f71 +index 0000000000000000000000000000000000000000..d40a39f71d0de99da8634cbfb5ffa1a53f4e5175 --- /dev/null +++ b/common/sampling-report.cpp @@ -0,0 +1,51 @@ @@ -894,7 +894,7 @@ index 000000000..d40a39f71 + diff --git a/common/sampling-timing.cpp b/common/sampling-timing.cpp new file mode 100644 -index 000000000..3936d82f6 +index 0000000000000000000000000000000000000000..3936d82f6dca515c41f13f26d16f557bc5b2523f --- /dev/null +++ b/common/sampling-timing.cpp @@ -0,0 +1,10 @@ @@ -909,7 +909,7 @@ index 000000000..3936d82f6 +} + diff --git a/common/sampling.cpp b/common/sampling.cpp -index 078bfd984..8ac63d672 100644 +index 078bfd984f424573199841633a7fb419ea5d5591..8ac63d67264137d2cf0eaf5c344cc123d49ae3ed 100644 --- a/common/sampling.cpp +++ b/common/sampling.cpp @@ -1,7 +1,6 @@ @@ -1255,7 +1255,7 @@ index 078bfd984..8ac63d672 100644 - } -} diff --git a/common/sampling.h b/common/sampling.h -index f19bd27c4..97b4c278a 100644 +index f19bd27c40f8b41de21d409caaa9e343a1eb7d5b..97b4c278a2c7c7e4e79b157c92c3dc2004df92a5 100644 --- a/common/sampling.h +++ b/common/sampling.h @@ -37,23 +37,25 @@ struct common_sampler; @@ -1367,7 +1367,7 @@ index f19bd27c4..97b4c278a 100644 struct common_sampler_deleter { diff --git a/common/tokenization.cpp b/common/tokenization.cpp new file mode 100644 -index 000000000..7f5064cb5 +index 0000000000000000000000000000000000000000..7f5064cb5bcf8af357769443f4b11e1b33ccc917 --- /dev/null +++ b/common/tokenization.cpp @@ -0,0 +1,58 @@ @@ -1430,7 +1430,7 @@ index 000000000..7f5064cb5 +} + diff --git a/src/llama-batch.cpp b/src/llama-batch.cpp -index 3391cb49e..cf1dfe8c6 100644 +index 3391cb49e858a98b42b2cf462e6ed85c81d18a1b..cf1dfe8c6f9efdd687e45c7db6c886601044bcd5 100644 --- a/src/llama-batch.cpp +++ b/src/llama-batch.cpp @@ -28,7 +28,8 @@ llama_batch_allocr::llama_batch_allocr(uint32_t n_pos_per_embd, bool allow_mixed @@ -1501,7 +1501,7 @@ index 3391cb49e..cf1dfe8c6 100644 llama_batch_compat::~llama_batch_compat() { diff --git a/src/llama-batch.h b/src/llama-batch.h -index e6f4be6a2..9b4c5a7dc 100644 +index e6f4be6a28a02287f47367342a2457d67e11f5ed..9b4c5a7dc59d5b7ebb60c6f2978224cb5e867524 100644 --- a/src/llama-batch.h +++ b/src/llama-batch.h @@ -170,7 +170,8 @@ public: @@ -1528,7 +1528,7 @@ index e6f4be6a2..9b4c5a7dc 100644 + static void init(llama_batch_ext & batch_ext, const llama_batch & batch_inp, size_t n_embd_row = 0, bool activation_positions = false); }; diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index aa0b93045..d73188ffb 100644 +index 35308bf3eb300660f35e40bbd1fc797c7417159e..545347cd7a5775ed6e81badc30e0c47a43279228 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -2214,7 +2214,9 @@ int llama_context::decode(const llama_batch_ext & batch_inp) { @@ -1543,7 +1543,7 @@ index aa0b93045..d73188ffb 100644 return -1; } diff --git a/src/llama-memory-hybrid-idx.cpp b/src/llama-memory-hybrid-idx.cpp -index 3866d5980..a7f6f9d84 100644 +index 3866d5980f37caf7cd07eeba6ff755e9a2b23580..a7f6f9d848bb43e04110777ab57ccb44a0449b1a 100644 --- a/src/llama-memory-hybrid-idx.cpp +++ b/src/llama-memory-hybrid-idx.cpp @@ -195,6 +195,16 @@ bool llama_memory_hybrid_idx::seq_rm(llama_seq_id seq_id, llama_pos p0, llama_po @@ -1564,7 +1564,7 @@ index 3866d5980..a7f6f9d84 100644 // only whole sequences are copied: the recurrent state ignores the range, and a shared cell holds a single pool grouping GGML_ASSERT(p0 <= 0 && p1 < 0 && "partial seq_cp is not supported"); diff --git a/src/llama-memory-hybrid-idx.h b/src/llama-memory-hybrid-idx.h -index ebd082ab5..d32ea0c7b 100644 +index ebd082ab5685215db13b334aef318e03b921e9d2..d32ea0c7b1f32442d214396d7a16bf0eac08d956 100644 --- a/src/llama-memory-hybrid-idx.h +++ b/src/llama-memory-hybrid-idx.h @@ -66,6 +66,10 @@ public: @@ -1580,7 +1580,7 @@ index ebd082ab5..d32ea0c7b 100644 // state write/load diff --git a/src/skippy/abi.cpp b/src/skippy/abi.cpp new file mode 100644 -index 000000000..ceed6e5d3 +index 0000000000000000000000000000000000000000..ceed6e5d36ca9521bbba0d32a176defb2a425b3b --- /dev/null +++ b/src/skippy/abi.cpp @@ -0,0 +1,59 @@ @@ -1645,7 +1645,7 @@ index 000000000..ceed6e5d3 +} diff --git a/src/skippy/activation.cpp b/src/skippy/activation.cpp new file mode 100644 -index 000000000..d1c094548 +index 0000000000000000000000000000000000000000..d1c094548c7c3e0273366d2fb067c037d1878255 --- /dev/null +++ b/src/skippy/activation.cpp @@ -0,0 +1,1028 @@ @@ -2679,7 +2679,7 @@ index 000000000..d1c094548 +} diff --git a/src/skippy/activation_internal.h b/src/skippy/activation_internal.h new file mode 100644 -index 000000000..29674ebda +index 0000000000000000000000000000000000000000..29674ebda7c23f0c136cc3b5b58a4ea1d5caf4f9 --- /dev/null +++ b/src/skippy/activation_internal.h @@ -0,0 +1,88 @@ @@ -2773,7 +2773,7 @@ index 000000000..29674ebda + skippy_error ** out_error); diff --git a/src/skippy/activation_layout.cpp b/src/skippy/activation_layout.cpp new file mode 100644 -index 000000000..0cb2181df +index 0000000000000000000000000000000000000000..0cb2181dfe5dfc953355ea4e10e86217e5f9dabd --- /dev/null +++ b/src/skippy/activation_layout.cpp @@ -0,0 +1,164 @@ @@ -2943,7 +2943,7 @@ index 000000000..0cb2181df +} // extern "C" diff --git a/src/skippy/block_boundaries.cpp b/src/skippy/block_boundaries.cpp new file mode 100644 -index 000000000..e72a49b0c +index 0000000000000000000000000000000000000000..e72a49b0cd23a755a8967f25f47e1e077bc41313 --- /dev/null +++ b/src/skippy/block_boundaries.cpp @@ -0,0 +1,64 @@ @@ -3013,7 +3013,7 @@ index 000000000..e72a49b0c +} diff --git a/src/skippy/block_boundaries.h b/src/skippy/block_boundaries.h new file mode 100644 -index 000000000..7c9aae114 +index 0000000000000000000000000000000000000000..7c9aae1144fdf8134efefaaf83d4073636a7185d --- /dev/null +++ b/src/skippy/block_boundaries.h @@ -0,0 +1,42 @@ @@ -3061,7 +3061,7 @@ index 000000000..7c9aae114 + std::string & error); diff --git a/src/skippy/chat_sampling.cpp b/src/skippy/chat_sampling.cpp new file mode 100644 -index 000000000..3c9fc758b +index 0000000000000000000000000000000000000000..3c9fc758bdae343a7ae9581a32bb95b436d5de28 --- /dev/null +++ b/src/skippy/chat_sampling.cpp @@ -0,0 +1,75 @@ @@ -3142,7 +3142,7 @@ index 000000000..3c9fc758b +} diff --git a/src/skippy/chat_sampling.h b/src/skippy/chat_sampling.h new file mode 100644 -index 000000000..1c01b2bd0 +index 0000000000000000000000000000000000000000..1c01b2bd032dbc912c26450f13462f0e65bd98ec --- /dev/null +++ b/src/skippy/chat_sampling.h @@ -0,0 +1,7 @@ @@ -3155,7 +3155,7 @@ index 000000000..1c01b2bd0 +llama_token skippy_chat_sample_token(skippy_session * session, int32_t logits_index); diff --git a/src/skippy/devices.cpp b/src/skippy/devices.cpp new file mode 100644 -index 000000000..2068a9b1c +index 0000000000000000000000000000000000000000..2068a9b1cd2030203a8bac51f964b299652e35a0 --- /dev/null +++ b/src/skippy/devices.cpp @@ -0,0 +1,106 @@ @@ -3267,7 +3267,7 @@ index 000000000..2068a9b1c + diff --git a/src/skippy/environment.h b/src/skippy/environment.h new file mode 100644 -index 000000000..a9f574b2f +index 0000000000000000000000000000000000000000..a9f574b2f271d21caf60e533fa5876ffd4832d60 --- /dev/null +++ b/src/skippy/environment.h @@ -0,0 +1,48 @@ @@ -3321,7 +3321,7 @@ index 000000000..a9f574b2f +} diff --git a/src/skippy/errors.h b/src/skippy/errors.h new file mode 100644 -index 000000000..08a147aae +index 0000000000000000000000000000000000000000..08a147aae8f8aabc99115fd9397eff9652e8c7a7 --- /dev/null +++ b/src/skippy/errors.h @@ -0,0 +1,66 @@ @@ -3393,7 +3393,7 @@ index 000000000..08a147aae + diff --git a/src/skippy/events.cpp b/src/skippy/events.cpp new file mode 100644 -index 000000000..a7bbe6028 +index 0000000000000000000000000000000000000000..a7bbe60281bbdfe33a952a760168a0be98706fec --- /dev/null +++ b/src/skippy/events.cpp @@ -0,0 +1,243 @@ @@ -3642,7 +3642,7 @@ index 000000000..a7bbe6028 +} diff --git a/src/skippy/events_internal.h b/src/skippy/events_internal.h new file mode 100644 -index 000000000..040f89e1e +index 0000000000000000000000000000000000000000..040f89e1e16abb1d9255e0391568f68132fc65a1 --- /dev/null +++ b/src/skippy/events_internal.h @@ -0,0 +1,35 @@ @@ -3683,7 +3683,7 @@ index 000000000..040f89e1e +#endif // SKIPPY_EVENTS_INTERNAL_H diff --git a/src/skippy/executable_graph.cpp b/src/skippy/executable_graph.cpp new file mode 100644 -index 000000000..fb993cbd9 +index 0000000000000000000000000000000000000000..fb993cbd92de310b9113acc79a103652ae32eb53 --- /dev/null +++ b/src/skippy/executable_graph.cpp @@ -0,0 +1,335 @@ @@ -4024,7 +4024,7 @@ index 000000000..fb993cbd9 +} diff --git a/src/skippy/executable_graph.h b/src/skippy/executable_graph.h new file mode 100644 -index 000000000..aa02187d1 +index 0000000000000000000000000000000000000000..aa02187d17802923dcf4092e5a772a8de20f79b3 --- /dev/null +++ b/src/skippy/executable_graph.h @@ -0,0 +1,37 @@ @@ -4067,7 +4067,7 @@ index 000000000..aa02187d1 + std::string & error); diff --git a/src/skippy/execution-batch.cpp b/src/skippy/execution-batch.cpp new file mode 100644 -index 000000000..2b9593e0c +index 0000000000000000000000000000000000000000..2b9593e0cfc957c583a5c4c9d2679f8ab4c70d9a --- /dev/null +++ b/src/skippy/execution-batch.cpp @@ -0,0 +1,499 @@ @@ -4572,7 +4572,7 @@ index 000000000..2b9593e0c +} // extern "C" diff --git a/src/skippy/execution-single.cpp b/src/skippy/execution-single.cpp new file mode 100644 -index 000000000..4ce3d4ba9 +index 0000000000000000000000000000000000000000..4ce3d4ba92e3a572bc8bc229d41f84eef8c36b61 --- /dev/null +++ b/src/skippy/execution-single.cpp @@ -0,0 +1,642 @@ @@ -5220,7 +5220,7 @@ index 000000000..4ce3d4ba9 +} // extern "C" diff --git a/src/skippy/execution_internal.h b/src/skippy/execution_internal.h new file mode 100644 -index 000000000..1d59e00d3 +index 0000000000000000000000000000000000000000..1d59e00d3cef298ef44554ab9e59f29b75f278df --- /dev/null +++ b/src/skippy/execution_internal.h @@ -0,0 +1,20 @@ @@ -5246,7 +5246,7 @@ index 000000000..1d59e00d3 + const skippy_graph_build_inputs * graph_build_inputs = nullptr); diff --git a/src/skippy/glm_dsa.cpp b/src/skippy/glm_dsa.cpp new file mode 100644 -index 000000000..7ce838ee1 +index 0000000000000000000000000000000000000000..7ce838ee1df0f665bbe931f2de29976f7cd2fb7b --- /dev/null +++ b/src/skippy/glm_dsa.cpp @@ -0,0 +1,857 @@ @@ -6109,7 +6109,7 @@ index 000000000..7ce838ee1 + diff --git a/src/skippy/glm_dsa.h b/src/skippy/glm_dsa.h new file mode 100644 -index 000000000..7d7f5cc0d +index 0000000000000000000000000000000000000000..7d7f5cc0dde837aacc03805fb9e3fb9402a032ff --- /dev/null +++ b/src/skippy/glm_dsa.h @@ -0,0 +1,14 @@ @@ -6129,7 +6129,7 @@ index 000000000..7d7f5cc0d +void skippy_glm_dsa_op_timing_end(skippy_session * session); diff --git a/src/skippy/graph_build_inputs.h b/src/skippy/graph_build_inputs.h new file mode 100644 -index 000000000..c08f2d510 +index 0000000000000000000000000000000000000000..c08f2d510d27cd1ee0ec0bc022c1a34df305692c --- /dev/null +++ b/src/skippy/graph_build_inputs.h @@ -0,0 +1,109 @@ @@ -6244,7 +6244,7 @@ index 000000000..c08f2d510 +} diff --git a/src/skippy/graph_dependencies.cpp b/src/skippy/graph_dependencies.cpp new file mode 100644 -index 000000000..c0e3cd7b9 +index 0000000000000000000000000000000000000000..c0e3cd7b97cad3ade858712fc1bc21c4aa36fe8f --- /dev/null +++ b/src/skippy/graph_dependencies.cpp @@ -0,0 +1,57 @@ @@ -6307,7 +6307,7 @@ index 000000000..c0e3cd7b9 +} diff --git a/src/skippy/graph_dependencies.h b/src/skippy/graph_dependencies.h new file mode 100644 -index 000000000..d34f53fe4 +index 0000000000000000000000000000000000000000..d34f53fe428318b7a6df4cdd05e4a6b19d59bc43 --- /dev/null +++ b/src/skippy/graph_dependencies.h @@ -0,0 +1,11 @@ @@ -6324,7 +6324,7 @@ index 000000000..d34f53fe4 + const llama_model * model); diff --git a/src/skippy/graph_identity.cpp b/src/skippy/graph_identity.cpp new file mode 100644 -index 000000000..ab2dd50e9 +index 0000000000000000000000000000000000000000..ab2dd50e950a41f34a6f95e2f357e7aa4b882011 --- /dev/null +++ b/src/skippy/graph_identity.cpp @@ -0,0 +1,1092 @@ @@ -7422,7 +7422,7 @@ index 000000000..ab2dd50e9 +} diff --git a/src/skippy/graph_identity.h b/src/skippy/graph_identity.h new file mode 100644 -index 000000000..843c7ba7f +index 0000000000000000000000000000000000000000..843c7ba7fddea5fdadaded990108c96a92b607e6 --- /dev/null +++ b/src/skippy/graph_identity.h @@ -0,0 +1,71 @@ @@ -7499,7 +7499,7 @@ index 000000000..843c7ba7f + std::string & error); diff --git a/src/skippy/model_lifecycle.cpp b/src/skippy/model_lifecycle.cpp new file mode 100644 -index 000000000..caa9fcd6d +index 0000000000000000000000000000000000000000..caa9fcd6de0d0dabfe636feba45bbdd1808bf87f --- /dev/null +++ b/src/skippy/model_lifecycle.cpp @@ -0,0 +1,155 @@ @@ -7660,7 +7660,7 @@ index 000000000..caa9fcd6d +} // extern "C" diff --git a/src/skippy/model_load_config.cpp b/src/skippy/model_load_config.cpp new file mode 100644 -index 000000000..2e8d3c4ed +index 0000000000000000000000000000000000000000..2e8d3c4ed6d312e4ce618d04eddf18dae7782c5b --- /dev/null +++ b/src/skippy/model_load_config.cpp @@ -0,0 +1,213 @@ @@ -7879,7 +7879,7 @@ index 000000000..2e8d3c4ed +} diff --git a/src/skippy/model_load_config_internal.h b/src/skippy/model_load_config_internal.h new file mode 100644 -index 000000000..554d2bdd3 +index 0000000000000000000000000000000000000000..554d2bdd3be1a734c30fdd53ae7ef05658fb45e4 --- /dev/null +++ b/src/skippy/model_load_config_internal.h @@ -0,0 +1,35 @@ @@ -7920,7 +7920,7 @@ index 000000000..554d2bdd3 +skippy_context_capabilities skippy_context_capabilities_of(const llama_model * model); diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp new file mode 100644 -index 000000000..60a27669f +index 0000000000000000000000000000000000000000..60a27669fb6a2ef80651e41bc79de1da494a43a8 --- /dev/null +++ b/src/skippy/model_loading.cpp @@ -0,0 +1,1189 @@ @@ -9115,7 +9115,7 @@ index 000000000..60a27669f +} // extern "C" diff --git a/src/skippy/model_loading_internal.h b/src/skippy/model_loading_internal.h new file mode 100644 -index 000000000..97e966e4e +index 0000000000000000000000000000000000000000..97e966e4e9e5282b3acc0bb25800ff0588dc97ed --- /dev/null +++ b/src/skippy/model_loading_internal.h @@ -0,0 +1,38 @@ @@ -9159,7 +9159,7 @@ index 000000000..97e966e4e +} // extern "C" diff --git a/src/skippy/model_package.cpp b/src/skippy/model_package.cpp new file mode 100644 -index 000000000..75cf28fbd +index 0000000000000000000000000000000000000000..75cf28fbd29f7bc1b5a2eccaf28b2bf3ac259f16 --- /dev/null +++ b/src/skippy/model_package.cpp @@ -0,0 +1,782 @@ @@ -9947,7 +9947,7 @@ index 000000000..75cf28fbd +} diff --git a/src/skippy/model_source.cpp b/src/skippy/model_source.cpp new file mode 100644 -index 000000000..02ad771ad +index 0000000000000000000000000000000000000000..02ad771ade0bac7dddfc4d31eff27247fbadd207 --- /dev/null +++ b/src/skippy/model_source.cpp @@ -0,0 +1,463 @@ @@ -10416,7 +10416,7 @@ index 000000000..02ad771ad +} diff --git a/src/skippy/package_tensor_binding.cpp b/src/skippy/package_tensor_binding.cpp new file mode 100644 -index 000000000..5fb51f899 +index 0000000000000000000000000000000000000000..5fb51f89997a22d9448e2a948d7d12efed2447db --- /dev/null +++ b/src/skippy/package_tensor_binding.cpp @@ -0,0 +1,120 @@ @@ -10542,7 +10542,7 @@ index 000000000..5fb51f899 +} diff --git a/src/skippy/package_tensor_binding.h b/src/skippy/package_tensor_binding.h new file mode 100644 -index 000000000..751048af8 +index 0000000000000000000000000000000000000000..751048af8a7a747872fc7c8b8d92833f30966aa2 --- /dev/null +++ b/src/skippy/package_tensor_binding.h @@ -0,0 +1,27 @@ @@ -10575,7 +10575,7 @@ index 000000000..751048af8 + std::string & error); diff --git a/src/skippy/rerank_template.h b/src/skippy/rerank_template.h new file mode 100644 -index 000000000..f0c3b2ea7 +index 0000000000000000000000000000000000000000..f0c3b2ea791b08f467d359e7e5cd674f7fba25c1 --- /dev/null +++ b/src/skippy/rerank_template.h @@ -0,0 +1,36 @@ @@ -10617,7 +10617,7 @@ index 000000000..f0c3b2ea7 +} diff --git a/src/skippy/runtime_support.h b/src/skippy/runtime_support.h new file mode 100644 -index 000000000..d7e991307 +index 0000000000000000000000000000000000000000..d7e99130754c2447fac040b6af979b687b59241b --- /dev/null +++ b/src/skippy/runtime_support.h @@ -0,0 +1,47 @@ @@ -10670,7 +10670,7 @@ index 000000000..d7e991307 + skippy_error ** out_error); diff --git a/src/skippy/runtime_types.h b/src/skippy/runtime_types.h new file mode 100644 -index 000000000..f19a25b76 +index 0000000000000000000000000000000000000000..f19a25b76a54088ef1cf49c27ac75a22f88514cd --- /dev/null +++ b/src/skippy/runtime_types.h @@ -0,0 +1,183 @@ @@ -10859,7 +10859,7 @@ index 000000000..f19a25b76 +}; diff --git a/src/skippy/sampling.cpp b/src/skippy/sampling.cpp new file mode 100644 -index 000000000..6fd1240e3 +index 0000000000000000000000000000000000000000..6fd1240e375eb08280bdc303ff6ce90a1e8ccf67 --- /dev/null +++ b/src/skippy/sampling.cpp @@ -0,0 +1,602 @@ @@ -11467,7 +11467,7 @@ index 000000000..6fd1240e3 +} diff --git a/src/skippy/sampling_config.cpp b/src/skippy/sampling_config.cpp new file mode 100644 -index 000000000..6be5559e2 +index 0000000000000000000000000000000000000000..6be5559e23d9db28d07485eeefefd8d2af5891e4 --- /dev/null +++ b/src/skippy/sampling_config.cpp @@ -0,0 +1,178 @@ @@ -11651,7 +11651,7 @@ index 000000000..6be5559e2 +} diff --git a/src/skippy/sampling_internal.h b/src/skippy/sampling_internal.h new file mode 100644 -index 000000000..7bbf16016 +index 0000000000000000000000000000000000000000..7bbf160164aa3c25d33ab90dcad39d63f5250847 --- /dev/null +++ b/src/skippy/sampling_internal.h @@ -0,0 +1,67 @@ @@ -11724,7 +11724,7 @@ index 000000000..7bbf16016 +llama_token skippy_sample_token(skippy_session * session, const skippy_sampling_config * sampling); diff --git a/src/skippy/sampling_vocab.cpp b/src/skippy/sampling_vocab.cpp new file mode 100644 -index 000000000..baf83db44 +index 0000000000000000000000000000000000000000..baf83db4466ee03c9d58cb4e966f4643f9584b6e --- /dev/null +++ b/src/skippy/sampling_vocab.cpp @@ -0,0 +1,74 @@ @@ -11804,7 +11804,7 @@ index 000000000..baf83db44 +} diff --git a/src/skippy/session.cpp b/src/skippy/session.cpp new file mode 100644 -index 000000000..f1de95cc5 +index 0000000000000000000000000000000000000000..f1de95cc5290334672181cdda2ce7c7796e772c5 --- /dev/null +++ b/src/skippy/session.cpp @@ -0,0 +1,521 @@ @@ -12331,7 +12331,7 @@ index 000000000..f1de95cc5 +} // extern "C" diff --git a/src/skippy/speculative_decoding.cpp b/src/skippy/speculative_decoding.cpp new file mode 100644 -index 000000000..3d15111fb +index 0000000000000000000000000000000000000000..3d15111fb304c38341aade0a9e44e09962f55c87 --- /dev/null +++ b/src/skippy/speculative_decoding.cpp @@ -0,0 +1,568 @@ @@ -12905,7 +12905,7 @@ index 000000000..3d15111fb +} diff --git a/src/skippy/speculative_internal.h b/src/skippy/speculative_internal.h new file mode 100644 -index 000000000..d8276944d +index 0000000000000000000000000000000000000000..d8276944dea03fc64c202fa184213d47a73cfcf3 --- /dev/null +++ b/src/skippy/speculative_internal.h @@ -0,0 +1,32 @@ @@ -12943,7 +12943,7 @@ index 000000000..d8276944d + skippy_error ** out_error); diff --git a/src/skippy/stage_execution_contract.cpp b/src/skippy/stage_execution_contract.cpp new file mode 100644 -index 000000000..719e04462 +index 0000000000000000000000000000000000000000..719e044627deb9e605ffbc64a9b3724dfc15b145 --- /dev/null +++ b/src/skippy/stage_execution_contract.cpp @@ -0,0 +1,78 @@ @@ -13027,7 +13027,7 @@ index 000000000..719e04462 +} diff --git a/src/skippy/stage_execution_contract.h b/src/skippy/stage_execution_contract.h new file mode 100644 -index 000000000..bcb56cdd7 +index 0000000000000000000000000000000000000000..bcb56cdd764f0a37d566bb9fac792f1c296eab98 --- /dev/null +++ b/src/skippy/stage_execution_contract.h @@ -0,0 +1,15 @@ @@ -13048,7 +13048,7 @@ index 000000000..bcb56cdd7 + bool embedding_input = false); diff --git a/src/skippy/stage_plan.cpp b/src/skippy/stage_plan.cpp new file mode 100644 -index 000000000..380e1eaad +index 0000000000000000000000000000000000000000..380e1eaad93d222fd8f9ab318a5c34c3ae26059e --- /dev/null +++ b/src/skippy/stage_plan.cpp @@ -0,0 +1,709 @@ @@ -13763,7 +13763,7 @@ index 000000000..380e1eaad +} diff --git a/src/skippy/stage_realization.cpp b/src/skippy/stage_realization.cpp new file mode 100644 -index 000000000..4a91e986b +index 0000000000000000000000000000000000000000..4a91e986b7383b52c10e198babb502074e65dcb5 --- /dev/null +++ b/src/skippy/stage_realization.cpp @@ -0,0 +1,362 @@ @@ -14131,7 +14131,7 @@ index 000000000..4a91e986b +} diff --git a/src/skippy/stage_realization.h b/src/skippy/stage_realization.h new file mode 100644 -index 000000000..6ef94f46d +index 0000000000000000000000000000000000000000..6ef94f46dc46ea41ed76cf6166f51dda52683583 --- /dev/null +++ b/src/skippy/stage_realization.h @@ -0,0 +1,21 @@ @@ -14158,7 +14158,7 @@ index 000000000..6ef94f46d + llm_graph_result & result); diff --git a/src/skippy/stage_slice_plan.cpp b/src/skippy/stage_slice_plan.cpp new file mode 100644 -index 000000000..7444a760e +index 0000000000000000000000000000000000000000..7444a760e8b417519c03772e3f29483d5a253a3a --- /dev/null +++ b/src/skippy/stage_slice_plan.cpp @@ -0,0 +1,907 @@ @@ -15071,7 +15071,7 @@ index 000000000..7444a760e +} diff --git a/src/skippy/stage_slice_plan.h b/src/skippy/stage_slice_plan.h new file mode 100644 -index 000000000..1cb24c7cb +index 0000000000000000000000000000000000000000..1cb24c7cb74226c999296f4d42ab761d8e2882eb --- /dev/null +++ b/src/skippy/stage_slice_plan.h @@ -0,0 +1,136 @@ @@ -15213,7 +15213,7 @@ index 000000000..1cb24c7cb + std::string & error); diff --git a/src/skippy/state.cpp b/src/skippy/state.cpp new file mode 100644 -index 000000000..f035ea13f +index 0000000000000000000000000000000000000000..f035ea13fdcfd88fb0681918f3acf389199bc81b --- /dev/null +++ b/src/skippy/state.cpp @@ -0,0 +1,1189 @@ @@ -16408,7 +16408,7 @@ index 000000000..f035ea13f +} // extern "C" diff --git a/src/skippy/state_effects.cpp b/src/skippy/state_effects.cpp new file mode 100644 -index 000000000..b33ed2d5d +index 0000000000000000000000000000000000000000..b33ed2d5d881faa7aaff49767c907944c83069c8 --- /dev/null +++ b/src/skippy/state_effects.cpp @@ -0,0 +1,450 @@ @@ -16864,7 +16864,7 @@ index 000000000..b33ed2d5d +} diff --git a/src/skippy/state_effects.h b/src/skippy/state_effects.h new file mode 100644 -index 000000000..5bb6b779b +index 0000000000000000000000000000000000000000..5bb6b779b6c03a49447ec9dc5d1bb52128edf1d8 --- /dev/null +++ b/src/skippy/state_effects.h @@ -0,0 +1,74 @@ @@ -16944,7 +16944,7 @@ index 000000000..5bb6b779b + std::string & error); diff --git a/src/skippy/state_memory.cpp b/src/skippy/state_memory.cpp new file mode 100644 -index 000000000..e271852ff +index 0000000000000000000000000000000000000000..e271852ff0286fde08f61bdc18565c19b063d5a2 --- /dev/null +++ b/src/skippy/state_memory.cpp @@ -0,0 +1,116 @@ @@ -17066,7 +17066,7 @@ index 000000000..e271852ff +} diff --git a/src/skippy/state_memory.h b/src/skippy/state_memory.h new file mode 100644 -index 000000000..4875cf398 +index 0000000000000000000000000000000000000000..4875cf39855d72989869e0f492de01cdf5a320d3 --- /dev/null +++ b/src/skippy/state_memory.h @@ -0,0 +1,16 @@ @@ -17088,7 +17088,7 @@ index 000000000..4875cf398 +uint32_t skippy_graph_cache_capabilities(const llm_graph_result & result); diff --git a/src/skippy/tokenization.cpp b/src/skippy/tokenization.cpp new file mode 100644 -index 000000000..54753a161 +index 0000000000000000000000000000000000000000..54753a1610a8a75da19b69f3264af1db218b88b9 --- /dev/null +++ b/src/skippy/tokenization.cpp @@ -0,0 +1,179 @@ @@ -17273,7 +17273,7 @@ index 000000000..54753a161 +} // extern "C" diff --git a/src/skippy/verification.cpp b/src/skippy/verification.cpp new file mode 100644 -index 000000000..0812485d7 +index 0000000000000000000000000000000000000000..0812485d71dfedc65a8760fe682ab8b89c3771a0 --- /dev/null +++ b/src/skippy/verification.cpp @@ -0,0 +1,256 @@ @@ -17535,7 +17535,7 @@ index 000000000..0812485d7 +} // extern "C" diff --git a/src/skippy/workloads.cpp b/src/skippy/workloads.cpp new file mode 100644 -index 000000000..d3de66cbe +index 0000000000000000000000000000000000000000..d3de66cbe98390974482208af891fa3567967f51 --- /dev/null +++ b/src/skippy/workloads.cpp @@ -0,0 +1,373 @@ @@ -17914,7 +17914,7 @@ index 000000000..d3de66cbe +} // extern "C" diff --git a/src/skippy/workloads_internal.h b/src/skippy/workloads_internal.h new file mode 100644 -index 000000000..cc9279e7e +index 0000000000000000000000000000000000000000..cc9279e7ed491543959603a3f69f69cf1401b2f2 --- /dev/null +++ b/src/skippy/workloads_internal.h @@ -0,0 +1,8 @@ @@ -17927,7 +17927,7 @@ index 000000000..cc9279e7e +// attached from an earlier chat request. +void skippy_prepare_non_chat_workload(skippy_session * session); diff --git a/tests/test-batch-alloc.cpp b/tests/test-batch-alloc.cpp -index 49e2b0755..93f8e4ef5 100644 +index 49e2b075521a3655be94f386189d178ca2e1abe4..93f8e4ef5ee64bec5fe9aff304cff8a9a56896bc 100644 --- a/tests/test-batch-alloc.cpp +++ b/tests/test-batch-alloc.cpp @@ -926,6 +926,27 @@ static void test_mrope(testing & t) { @@ -17958,6 +17958,3 @@ index 49e2b0755..93f8e4ef5 100644 t.test("token_batch_explicit_fields", [&](testing & t) { llama_token token[3] = { 5, 6, 7 }; llama_pos pos[3] = { 3, 4, 5 }; --- -2.56.1 - diff --git a/llama_cpp/patches/0003-feat-llama-integrate-live-stage-planning-and-executi.patch b/llama_cpp/patches/0003-feat-llama-integrate-live-stage-planning-and-executi.patch index 0733f528..6e0f85e2 100644 --- a/llama_cpp/patches/0003-feat-llama-integrate-live-stage-planning-and-executi.patch +++ b/llama_cpp/patches/0003-feat-llama-integrate-live-stage-planning-and-executi.patch @@ -1,4 +1,4 @@ -From 57d6b2501bc8bea57a9bc1ada9ac0fac99142357 Mon Sep 17 00:00:00 2001 +From 1a6f24ab802a6bc15236a6013f94c5b30809cab9 Mon Sep 17 00:00:00 2001 From: James Dumay Date: Tue, 13 Oct 2026 22:06:42 +1100 Subject: [PATCH] feat(llama): integrate live stage planning and execution @@ -38,18 +38,18 @@ those bounds cover their current allowances and parity/reservation tests pass. src/llama-memory-recurrent.h | 12 + src/llama-mmap.cpp | 39 +- src/llama-mmap.h | 10 + - src/llama-model-loader.cpp | 279 +++++- + src/llama-model-loader.cpp | 280 +++++- src/llama-model-loader.h | 55 +- - src/llama-model.cpp | 171 +++- + src/llama-model.cpp | 165 ++- src/llama-model.h | 22 +- src/llama-quant.cpp | 12 +- src/llama.cpp | 91 +- src/skippy-verify-checkpoint.h | 24 + - 25 files changed, 3082 insertions(+), 332 deletions(-) + 25 files changed, 3080 insertions(+), 329 deletions(-) create mode 100644 src/skippy-verify-checkpoint.h diff --git a/include/llama.h b/include/llama.h -index 9cc17a82b..7a2b918b4 100644 +index 9cc17a82b529098c8849f3f023f22818bf3d64eb..7a2b918b40eae4a476da4714617eee37a9c2b337 100644 --- a/include/llama.h +++ b/include/llama.h @@ -555,6 +555,13 @@ extern "C" { @@ -67,7 +67,7 @@ index 9cc17a82b..7a2b918b4 100644 const struct llama_model * model, const char * path_model); diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp -index 53889e037..4e213021a 100644 +index fe0b808b3a4dda69cd943df0d190c9b81e355134..d3b46066600fe1df2f4d003ec2ba1d5814692616 100644 --- a/src/llama-arch.cpp +++ b/src/llama-arch.cpp @@ -345,6 +345,8 @@ static const std::map LLM_KV_NAMES = { @@ -79,7 +79,7 @@ index 53889e037..4e213021a 100644 { LLM_KV_ATTENTION_INDEXER_BLOCK_SIZE, "%s.attention.indexer.block_size" }, { LLM_KV_ATTENTION_INDEXER_LOCAL_BLOCKS, "%s.attention.indexer.local_blocks" }, { LLM_KV_ATTENTION_INDEXER_TYPES, "%s.attention.indexer.types" }, -@@ -886,9 +888,19 @@ static const std::map LLM_TENSOR_NAMES = { +@@ -887,9 +889,19 @@ static const std::map LLM_TENSOR_NAMES = { { LLM_TENSOR_SHORTCONV_CONV, "blk.%d.shortconv.conv" }, { LLM_TENSOR_SHORTCONV_INPROJ, "blk.%d.shortconv.in_proj" }, { LLM_TENSOR_SHORTCONV_OUTPROJ, "blk.%d.shortconv.out_proj" }, @@ -99,7 +99,7 @@ index 53889e037..4e213021a 100644 { LLM_TENSOR_VISEXP_ATTN_QKV, "blk.%d.vis_attn_qkv" }, { LLM_TENSOR_VISEXP_ATTN_OUT, "blk.%d.vis_attn_output" }, { LLM_TENSOR_VISEXP_FFN_GATE, "blk.%d.vis_gate" }, -@@ -1218,6 +1230,9 @@ static const std::map LLM_TENSOR_INFOS = { +@@ -1219,6 +1231,9 @@ static const std::map LLM_TENSOR_INFOS = { {LLM_TENSOR_FFN_UP_EXPS, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT_ID}}, {LLM_TENSOR_FFN_GATE_UP_EXPS, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT_ID}}, {LLM_TENSOR_FFN_DOWN_CHEXPS, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT_ID}}, @@ -109,7 +109,7 @@ index 53889e037..4e213021a 100644 {LLM_TENSOR_FFN_GATE_CHEXPS, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT_ID}}, {LLM_TENSOR_FFN_UP_CHEXPS, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT_ID}}, {LLM_TENSOR_FFN_EXP_PROBS_B, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_ADD}}, -@@ -1260,6 +1275,13 @@ static const std::map LLM_TENSOR_INFOS = { +@@ -1261,6 +1276,13 @@ static const std::map LLM_TENSOR_INFOS = { {LLM_TENSOR_SHORTCONV_CONV, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_SSM_CONV}}, {LLM_TENSOR_SHORTCONV_INPROJ, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT}}, {LLM_TENSOR_SHORTCONV_OUTPROJ, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT}}, @@ -124,7 +124,7 @@ index 53889e037..4e213021a 100644 {LLM_TENSOR_VISEXP_ATTN_OUT, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT}}, {LLM_TENSOR_VISEXP_FFN_GATE, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT}}, diff --git a/src/llama-arch.h b/src/llama-arch.h -index fedc879bf..93cd543d9 100644 +index 305aae22aa5554c08b926f2327d64f2dd1e5421d..b36f0fb7f402c117213a18912bc50e1ce18aa45f 100644 --- a/src/llama-arch.h +++ b/src/llama-arch.h @@ -349,6 +349,8 @@ enum llm_kv { @@ -137,7 +137,7 @@ index fedc879bf..93cd543d9 100644 LLM_KV_ATTENTION_INDEXER_LOCAL_BLOCKS, LLM_KV_ATTENTION_INDEXER_TYPES, diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index d73188ffb..09562654d 100644 +index 545347cd7a5775ed6e81badc30e0c47a43279228..bc3311d98e6c48cfb0af72fd55397c9959909c5b 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -13,10 +13,16 @@ @@ -1073,9 +1073,9 @@ index d73188ffb..09562654d 100644 return { /*.model =*/ &model, /*.cparams =*/ cparams, -@@ -3079,6 +3438,9 @@ llm_graph_params llama_context::graph_params( - /*.h_nextn_dev =*/ cparams.embeddings_nextn_dev ? h_nextn_dev : nullptr, +@@ -3080,6 +3439,9 @@ llm_graph_params llama_context::graph_params( /*.h_nextn_src =*/ supports_state_row() ? cparams.ctx_state_src->get_h_nextn_dev() : nullptr, + /*.w_scales =*/ &model.w_scales, /*.samplers =*/ sampling.samplers, + /*.build_inputs=*/ graph_build_inputs, + /*.activation_export_token_axes=*/ std::move(export_token_axes), @@ -1083,7 +1083,7 @@ index d73188ffb..09562654d 100644 /*.n_outputs =*/ n_outputs, /*.cb =*/ graph_get_cb(), /*.res =*/ res, -@@ -4311,7 +4673,8 @@ void llama_context::opt_epoch_iter( +@@ -4312,7 +4674,8 @@ void llama_context::opt_epoch_iter( auto * res = get_gf_res_prev(); @@ -1093,7 +1093,7 @@ index d73188ffb..09562654d 100644 // the optimizer graph is allocated outside sched, so the next decode must rebuild gf_res_prev_active = nullptr; -@@ -4415,7 +4778,7 @@ llama_context_params llama_context_default_params() { +@@ -4416,7 +4779,7 @@ llama_context_params llama_context_default_params() { /*.n_seq_max =*/ 1, /*.n_rs_seq =*/ 0, /*.n_outputs_max =*/ 0, @@ -1102,7 +1102,7 @@ index d73188ffb..09562654d 100644 /*.n_threads =*/ GGML_DEFAULT_N_THREADS, // TODO: better default /*.n_threads_batch =*/ GGML_DEFAULT_N_THREADS, /*.ctx_type =*/ LLAMA_CONTEXT_TYPE_DEFAULT, -@@ -4452,9 +4815,10 @@ llama_context_params llama_context_default_params() { +@@ -4453,9 +4816,10 @@ llama_context_params llama_context_default_params() { return result; } @@ -1116,7 +1116,7 @@ index d73188ffb..09562654d 100644 if (!model) { LLAMA_LOG_ERROR("%s: model cannot be NULL\n", __func__); return nullptr; -@@ -4474,6 +4838,10 @@ llama_context * llama_init_from_model( +@@ -4475,6 +4839,10 @@ llama_context * llama_init_from_model( LLAMA_LOG_WARN("%s: flash_attn is not compatible with Grok - forcing off\n", __func__); params.flash_attn_type = LLAMA_FLASH_ATTN_TYPE_DISABLED; } @@ -1127,7 +1127,7 @@ index d73188ffb..09562654d 100644 if (model->split_mode() == LLAMA_SPLIT_MODE_TENSOR) { if (params.flash_attn_type == LLAMA_FLASH_ATTN_TYPE_AUTO) { -@@ -4573,15 +4941,14 @@ llama_context * llama_init_from_model( +@@ -4574,15 +4942,14 @@ llama_context * llama_init_from_model( model->hparams.pooling_type, params.pooling_type); } @@ -1145,7 +1145,7 @@ index d73188ffb..09562654d 100644 const auto & cparams = ctx->get_cparams(); if (cparams.rope_scaling_type == LLAMA_ROPE_SCALING_TYPE_YARN && cparams.rope_freq_scale != model->hparams.rope_freq_scale_train) { -@@ -4598,6 +4965,12 @@ llama_context * llama_init_from_model( +@@ -4599,6 +4966,12 @@ llama_context * llama_init_from_model( return nullptr; } @@ -1158,7 +1158,7 @@ index d73188ffb..09562654d 100644 void llama_free(llama_context * ctx) { delete ctx; } -@@ -4833,7 +5206,8 @@ struct ggml_cgraph * llama_graph_reserve( +@@ -4834,7 +5207,8 @@ struct ggml_cgraph * llama_graph_reserve( if (memory) { mctx = memory->init_full(); } @@ -1168,7 +1168,7 @@ index d73188ffb..09562654d 100644 } // llama adapter API -@@ -5060,13 +5434,25 @@ size_t llama_state_seq_load_file(llama_context * ctx, const char * filepath, lla +@@ -5061,13 +5435,25 @@ size_t llama_state_seq_load_file(llama_context * ctx, const char * filepath, lla // compat: llama_batch -> llama_batch_ext -> encode/decode int llama_context::encode(const llama_batch & batch_inp) { @@ -1198,7 +1198,7 @@ index d73188ffb..09562654d 100644 } /// -@@ -5085,7 +5471,11 @@ int32_t llama_encode( +@@ -5086,7 +5472,11 @@ int32_t llama_encode( int32_t llama_decode( llama_context * ctx, llama_batch batch) { @@ -1212,7 +1212,7 @@ index d73188ffb..09562654d 100644 LLAMA_LOG_ERROR("%s: failed to decode, ret = %d\n", __func__, ret); } diff --git a/src/llama-context.h b/src/llama-context.h -index 3e3921c7d..668065b39 100644 +index 3e3921c7df283783b44b82d81ce06cc4d0f8282b..668065b39d7fc434d5fbc08fad9c9d4f2fbc61b0 100644 --- a/src/llama-context.h +++ b/src/llama-context.h @@ -14,15 +14,38 @@ @@ -1428,7 +1428,7 @@ index 3e3921c7d..668065b39 100644 ggml_backend_buffer_ptr buf_output; diff --git a/src/llama-ext.h b/src/llama-ext.h -index a77b2f409..e5f2e6c91 100644 +index a77b2f40948a287b9d839f8c1cdc6dd0ed950561..e5f2e6c919019ad07667c8cd6b54b993a5ea2d54 100644 --- a/src/llama-ext.h +++ b/src/llama-ext.h @@ -75,6 +75,12 @@ LLAMA_API bool llama_quant_tensor_allows_quantization( @@ -1445,10 +1445,10 @@ index a77b2f409..e5f2e6c91 100644 // All tensors should be quantizable (use llama_quant_tensor_allows_quantization to filter). // result_types: caller-allocated array of n_tensors elements, filled with assigned types. diff --git a/src/llama-graph.h b/src/llama-graph.h -index 508d05531..682e255bd 100644 +index 4a1d497b7dbd8e02640253e9f72facffd0678f3d..c7488ff29cd14c4cf7df3cebcd42ca0086d8ed9c 100644 --- a/src/llama-graph.h +++ b/src/llama-graph.h -@@ -115,6 +115,10 @@ public: +@@ -116,6 +116,10 @@ public: virtual void set_input(const llama_ubatch * ubatch) = 0; @@ -1459,7 +1459,7 @@ index 508d05531..682e255bd 100644 // return true if the resulting input tensors using the provided graph parameters would be // the same as the previous input tensors that we have currently stored in the object virtual bool can_reuse(const llm_graph_params & params) { -@@ -348,6 +352,7 @@ public: +@@ -355,6 +359,7 @@ public: llm_graph_input_cross_embd( const llama_cross * cross) : cross(cross) {} virtual ~llm_graph_input_cross_embd() = default; @@ -1467,7 +1467,7 @@ index 508d05531..682e255bd 100644 void set_input(const llama_ubatch * ubatch) override; -@@ -693,6 +698,7 @@ class llm_graph_input_attn_cross : public llm_graph_input_i { +@@ -700,6 +705,7 @@ class llm_graph_input_attn_cross : public llm_graph_input_i { public: llm_graph_input_attn_cross(const llama_cross * cross) : cross(cross) {} ~llm_graph_input_attn_cross() = default; @@ -1476,7 +1476,7 @@ index 508d05531..682e255bd 100644 void set_input(const llama_ubatch * ubatch) override; diff --git a/src/llama-hparams.cpp b/src/llama-hparams.cpp -index 807f7987f..ec7a529c9 100644 +index 807f7987f2643d7b7938bf930d4b56650e7af54e..ec7a529c91861d6196f018f4002db2dbc9af6cf5 100644 --- a/src/llama-hparams.cpp +++ b/src/llama-hparams.cpp @@ -205,7 +205,22 @@ uint32_t llama_hparams::n_embd_v_gqa_max() const { @@ -1503,7 +1503,7 @@ index 807f7987f..ec7a529c9 100644 // for RWKV models return token_shift_count * n_embd; diff --git a/src/llama-hparams.h b/src/llama-hparams.h -index e87667a7d..5c5980e85 100644 +index 3e846be030fd9253b250b9b0cfa5b88bbb19613d..0e74e3e33cc058e9cfc9f616ebc7e97736abd348 100644 --- a/src/llama-hparams.h +++ b/src/llama-hparams.h @@ -74,9 +74,7 @@ struct llama_hparams { @@ -1527,7 +1527,7 @@ index e87667a7d..5c5980e85 100644 std::array n_head_arr; std::array n_head_kv_arr; std::array n_ff_arr; -@@ -359,6 +360,16 @@ struct llama_hparams { +@@ -360,6 +361,16 @@ struct llama_hparams { // MSA uint32_t indexer_block_size = 0; uint32_t indexer_local_blocks = 0; @@ -1544,7 +1544,7 @@ index e87667a7d..5c5980e85 100644 // Indexer is "full" (1) or "shared" (0) // Shared indexers reuse top-k from previous full layer -@@ -534,6 +545,9 @@ struct llama_hparams { +@@ -535,6 +546,9 @@ struct llama_hparams { uint32_t n_embd_k_gqa_max() const; uint32_t n_embd_v_gqa_max() const; @@ -1555,7 +1555,7 @@ index e87667a7d..5c5980e85 100644 // corresponds to Mamba's conv_states size or RWKV's token_shift states size uint32_t n_embd_r() const; diff --git a/src/llama-kv-cache-dsv4.cpp b/src/llama-kv-cache-dsv4.cpp -index 9c0a9b22d..9d73acd39 100644 +index 9c0a9b22dffc99568778da1c205b8cb50f6d050f..9d73acd39ac3eaed217c6e4ceca092b7a9599fd6 100644 --- a/src/llama-kv-cache-dsv4.cpp +++ b/src/llama-kv-cache-dsv4.cpp @@ -1177,14 +1177,16 @@ ggml_tensor * llama_dsv4_comp_state::get_kv_all(ggml_context * ctx, int32_t il) @@ -1578,7 +1578,7 @@ index 9c0a9b22d..9d73acd39 100644 ggml_tensor * llama_dsv4_comp_state::get_kv(ggml_context * ctx, int32_t il) const { diff --git a/src/llama-kv-cache-msa.cpp b/src/llama-kv-cache-msa.cpp -index 2d6bac0cb..8ef36beb3 100644 +index 2d6bac0cb23cf8f07458b83df398f4bfa487d636..8ef36beb33b79627962b449a6e41a2c4c2df5372 100644 --- a/src/llama-kv-cache-msa.cpp +++ b/src/llama-kv-cache-msa.cpp @@ -38,7 +38,9 @@ llama_kv_cache_msa::llama_kv_cache_msa( @@ -1602,7 +1602,7 @@ index 2d6bac0cb..8ef36beb3 100644 void llama_kv_cache_msa::clear(bool data) { diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index c7444319b..1c7d892bd 100644 +index c0166d30b4ad8fc9f2397c4ab773cbddba52c7eb..9c49fc71690ce9bbc51fa577dd7c8229e5884611 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -4,6 +4,7 @@ @@ -3244,8 +3244,8 @@ index c7444319b..1c7d892bd 100644 + ggml_row_size(k_idx->type, n_idx*kv_size)*sinfo.s0); } - static bool is_type_scaled(ggml_type type) { -@@ -1464,9 +2737,13 @@ ggml_tensor * llama_kv_cache::get_k_scale(int32_t il) const { + ggml_tensor * llama_kv_cache::get_k_scale(int32_t il) const { +@@ -1460,9 +2733,13 @@ ggml_tensor * llama_kv_cache::get_k_scale(int32_t il) const { return nullptr; } @@ -3261,7 +3261,7 @@ index c7444319b..1c7d892bd 100644 } ggml_tensor * llama_kv_cache::get_v_scale(int32_t il) const { -@@ -1474,17 +2751,19 @@ ggml_tensor * llama_kv_cache::get_v_scale(int32_t il) const { +@@ -1470,17 +2747,19 @@ ggml_tensor * llama_kv_cache::get_v_scale(int32_t il) const { return nullptr; } @@ -3286,7 +3286,7 @@ index c7444319b..1c7d892bd 100644 const int64_t n_embd_head = k_cur->ne[0]; const int64_t n_head = k_cur->ne[1]; -@@ -1517,9 +2796,7 @@ ggml_tensor * llama_kv_cache::cpy_k(ggml_context * ctx, ggml_tensor * k_cur, ggm +@@ -1513,9 +2792,7 @@ ggml_tensor * llama_kv_cache::cpy_k(ggml_context * ctx, ggml_tensor * k_cur, ggm ggml_tensor * llama_kv_cache::cpy_v(ggml_context * ctx, ggml_tensor * v_cur, ggml_tensor * v_idxs, int32_t il, const slot_info & sinfo) const { GGML_UNUSED(sinfo); @@ -3297,7 +3297,7 @@ index c7444319b..1c7d892bd 100644 const int64_t n_embd_head = v_cur->ne[0]; const int64_t n_head = v_cur->ne[1]; -@@ -1581,6 +2858,27 @@ ggml_tensor * llama_kv_cache::build_input_k_idxs(ggml_context * ctx, const llama +@@ -1577,6 +2854,27 @@ ggml_tensor * llama_kv_cache::build_input_k_idxs(ggml_context * ctx, const llama return k_idxs; } @@ -3325,7 +3325,7 @@ index c7444319b..1c7d892bd 100644 ggml_tensor * llama_kv_cache::build_input_v_idxs(ggml_context * ctx, const llama_ubatch & ubatch) const { const uint32_t n_tokens = ubatch.n_tokens; -@@ -2122,6 +3420,57 @@ void llama_kv_cache::set_input_kpool(ggml_tensor * pool_idxs, ggml_tensor * pool +@@ -2118,6 +3416,57 @@ void llama_kv_cache::set_input_kpool(ggml_tensor * pool_idxs, ggml_tensor * pool ggml_backend_tensor_set(tail_idxs, tail_idxs_data.data(), 0, ggml_nbytes(tail_idxs)); } @@ -3383,7 +3383,7 @@ index c7444319b..1c7d892bd 100644 bool llama_kv_cache::has_cell_ext() const { // M-RoPE needs the 2D position, the PLE / Engram n-gram hashes need the token id return hparams.n_pos_per_embd() > 1 || hparams.ple_n_heads > 0; -@@ -2230,6 +3579,18 @@ size_t llama_kv_cache::size_v_bytes() const { +@@ -2226,6 +3575,18 @@ size_t llama_kv_cache::size_v_bytes() const { return size_v_bytes; } @@ -3402,7 +3402,7 @@ index c7444319b..1c7d892bd 100644 ggml_tensor * llama_kv_cache::build_rope_shift( const llama_cparams & cparams, ggml_context * ctx, -@@ -2568,6 +3929,36 @@ void llama_kv_cache::state_write_data(llama_io_write_i & io, const cell_ranges_t +@@ -2564,6 +3925,36 @@ void llama_kv_cache::state_write_data(llama_io_write_i & io, const cell_ranges_t } } @@ -3439,7 +3439,7 @@ index c7444319b..1c7d892bd 100644 if (!v_trans) { for (const auto & layer : layers) { const uint32_t il = layer.il; -@@ -2898,6 +4289,68 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 +@@ -2894,6 +4285,68 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 } } @@ -3508,7 +3508,7 @@ index c7444319b..1c7d892bd 100644 if (!this->v_trans) { for (const auto & layer : layers) { const uint32_t il = layer.il; -@@ -3117,8 +4570,9 @@ llama_kv_cache_context::llama_kv_cache_context( +@@ -3113,8 +4566,9 @@ llama_kv_cache_context::llama_kv_cache_context( llama_kv_cache * kv, llama_context * lctx, bool do_shift, @@ -3520,7 +3520,7 @@ index c7444319b..1c7d892bd 100644 status = LLAMA_MEMORY_STATUS_NO_UPDATE; } } -@@ -3176,6 +4630,21 @@ uint32_t llama_kv_cache_context::get_n_kv_rows() const { +@@ -3172,6 +4626,21 @@ uint32_t llama_kv_cache_context::get_n_kv_rows() const { return n_kv_rows; } @@ -3542,7 +3542,7 @@ index c7444319b..1c7d892bd 100644 ggml_type llama_kv_cache_context::type_k() const { return kv->type_k(); } -@@ -3200,6 +4669,18 @@ ggml_tensor * llama_kv_cache_context::get_v_scale(int32_t il) const { +@@ -3196,6 +4665,18 @@ ggml_tensor * llama_kv_cache_context::get_v_scale(int32_t il) const { return kv->get_v_scale(il); } @@ -3561,7 +3561,7 @@ index c7444319b..1c7d892bd 100644 ggml_tensor * llama_kv_cache_context::cpy_k(ggml_context * ctx, ggml_tensor * k_cur, ggml_tensor * k_idxs, int32_t il) const { return kv->cpy_k(ctx, k_cur, k_idxs, il, sinfos[i_cur]); } -@@ -3208,6 +4689,10 @@ ggml_tensor * llama_kv_cache_context::cpy_v(ggml_context * ctx, ggml_tensor * v_ +@@ -3204,6 +4685,10 @@ ggml_tensor * llama_kv_cache_context::cpy_v(ggml_context * ctx, ggml_tensor * v_ return kv->cpy_v(ctx, v_cur, v_idxs, il, sinfos[i_cur]); } @@ -3572,7 +3572,7 @@ index c7444319b..1c7d892bd 100644 ggml_tensor * llama_kv_cache_context::build_input_k_idxs(ggml_context * ctx, const llama_ubatch & ubatch) const { return kv->build_input_k_idxs(ctx, ubatch); } -@@ -3253,6 +4738,10 @@ void llama_kv_cache_context::set_input_relative_pos(ggml_tensor * dst, const lla +@@ -3249,6 +4734,10 @@ void llama_kv_cache_context::set_input_relative_pos(ggml_tensor * dst, const lla kv->set_input_relative_pos(dst, ubatch, extent); } @@ -3584,7 +3584,7 @@ index c7444319b..1c7d892bd 100644 kv->get_prev_tokens(ubatch, n, res); } diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index acff46e19..bc29bfd60 100644 +index acff46e19c5931eeb47120b44ea2cefb01b12282..bc29bfd608e724630ebbf5edc44a439a1cd3968e 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -6,12 +6,15 @@ @@ -3807,7 +3807,7 @@ index acff46e19..bc29bfd60 100644 // // update context diff --git a/src/llama-kv-cells.h b/src/llama-kv-cells.h -index 1187cc736..4fcb33d16 100644 +index 1187cc736441afffeb78538d6af1c3664f231ecc..4fcb33d167cce985bd5d1a487578b8fc27f204ec 100644 --- a/src/llama-kv-cells.h +++ b/src/llama-kv-cells.h @@ -92,6 +92,7 @@ public: @@ -3919,7 +3919,7 @@ index 1187cc736..4fcb33d16 100644 // remove cell i diff --git a/src/llama-memory-recurrent.cpp b/src/llama-memory-recurrent.cpp -index bab6276f6..ca87ecc96 100644 +index 0af05571cc1a2b646612e9eea3019e385dc74816..5c0e32e03749fade7af0bb042bd656e061b9d517 100644 --- a/src/llama-memory-recurrent.cpp +++ b/src/llama-memory-recurrent.cpp @@ -28,7 +28,8 @@ llama_memory_recurrent::llama_memory_recurrent( @@ -4016,7 +4016,7 @@ index bab6276f6..ca87ecc96 100644 return false; } if (cell_count > size) { -@@ -1466,27 +1520,27 @@ uint32_t llama_memory_recurrent_context::get_size() const { +@@ -1482,27 +1536,27 @@ uint32_t llama_memory_recurrent_context::get_size() const { } ggml_tensor * llama_memory_recurrent_context::get_r_l(int32_t il) const { @@ -4051,7 +4051,7 @@ index bab6276f6..ca87ecc96 100644 bool llama_memory_recurrent_context::get_rs_replay() const { diff --git a/src/llama-memory-recurrent.h b/src/llama-memory-recurrent.h -index 5efe9c3b4..3e4a510a3 100644 +index f444b9b8ea1590cdbe3e642a39fdd56c8e085b29..956abcd060670f701a00c855b85ef97d9754fb51 100644 --- a/src/llama-memory-recurrent.h +++ b/src/llama-memory-recurrent.h @@ -131,6 +131,16 @@ public: @@ -4081,7 +4081,7 @@ index 5efe9c3b4..3e4a510a3 100644 size_t size_r_bytes() const; diff --git a/src/llama-mmap.cpp b/src/llama-mmap.cpp -index 02e4ede7c..0c2c97bc2 100644 +index 02e4ede7c4d69c5792fc945b96c33e499b49c7ea..0c2c97bc2e0928ce27b5fee1ecfcbd510870d154 100644 --- a/src/llama-mmap.cpp +++ b/src/llama-mmap.cpp @@ -646,6 +646,31 @@ llama_file::llama_file(FILE * file) : pimpl(std::make_unique(file)) {} @@ -4138,7 +4138,7 @@ index 02e4ede7c..0c2c97bc2 100644 uint32_t llama_file::read_u32() { return pimpl->read_u32(); } diff --git a/src/llama-mmap.h b/src/llama-mmap.h -index 39715bfc3..c777a59a9 100644 +index 39715bfc38b5bec7cb188f7faf2d5f4e0b5d1a0a..c777a59a92ffc46e8d8a98d03f6545fcc803237f 100644 --- a/src/llama-mmap.h +++ b/src/llama-mmap.h @@ -13,6 +13,16 @@ struct llama_file; @@ -4159,7 +4159,7 @@ index 39715bfc3..c777a59a9 100644 using llama_mmaps = std::vector>; using llama_mlocks = std::vector>; diff --git a/src/llama-model-loader.cpp b/src/llama-model-loader.cpp -index 808fb44d8..0e1fe9f27 100644 +index 83c8c042ba484b26f8295f1c19457ab210e896b3..783705c0e3533c7284d60c806ddd0f942be37e2d 100644 --- a/src/llama-model-loader.cpp +++ b/src/llama-model-loader.cpp @@ -9,6 +9,7 @@ @@ -4326,7 +4326,7 @@ index 808fb44d8..0e1fe9f27 100644 fver = (enum llama_fver) gguf_get_version(metadata); LLAMA_LOG_INFO("%s: loaded meta data with %d key-value pairs and %d tensors from %s (version %s)\n", -@@ -1213,9 +1295,11 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1215,9 +1297,11 @@ struct ggml_tensor * llama_model_loader::create_tensor( const buft_list_t * buft_list_layer, const LLM_TN_IMPL & tn, const std::initializer_list & ne, int flags) { // set below, before buft_for_tensor() runs bool is_lazy = false; @@ -4339,7 +4339,7 @@ index 808fb44d8..0e1fe9f27 100644 auto it = ctx_map.find(key); if (it == ctx_map.end()) { -@@ -1223,7 +1307,7 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1225,7 +1309,7 @@ struct ggml_tensor * llama_model_loader::create_tensor( int max_n_tensors = n_tensors; max_n_tensors += 1; // duplicated output tensor max_n_tensors += hparams.n_layer()*2; // duplicated rope freq tensors @@ -4348,7 +4348,7 @@ index 808fb44d8..0e1fe9f27 100644 max_n_tensors += hparams.n_layer()*256; // this should be well above what any model actually uses } const size_t ctx_size = ggml_tensor_overhead()*max_n_tensors; -@@ -1246,14 +1330,34 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1248,14 +1332,34 @@ struct ggml_tensor * llama_model_loader::create_tensor( return it->second.get(); }; @@ -4388,7 +4388,7 @@ index 808fb44d8..0e1fe9f27 100644 // some models use the token embedding tensor as the output, but since these are used in different layers and with different ops // the tensor is duplicated // to handle this, we check if the tensor is duplicated, and if so, we assume that it is being loaded as the output tensor -@@ -1266,7 +1370,14 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1268,7 +1372,14 @@ struct ggml_tensor * llama_model_loader::create_tensor( try { info = llm_tensor_info_for(tn_tensor); } catch (const std::out_of_range & e) { @@ -4404,7 +4404,7 @@ index 808fb44d8..0e1fe9f27 100644 } // skip unused tensors -@@ -1274,8 +1385,10 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1276,8 +1387,10 @@ struct ggml_tensor * llama_model_loader::create_tensor( const size_t nbytes = ggml_nbytes(t_meta); LLAMA_LOG_WARN("model has unused tensor %s (size = %zu bytes) -- ignoring\n", tn.str().c_str(), nbytes); @@ -4417,7 +4417,7 @@ index 808fb44d8..0e1fe9f27 100644 return nullptr; } -@@ -1295,11 +1408,11 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1323,11 +1436,11 @@ struct ggml_tensor * llama_model_loader::create_tensor( // sanity checks if (info.layer == LLM_TENSOR_LAYER_INPUT || info.layer == LLM_TENSOR_LAYER_OUTPUT) { if (tn.bid != -1) { @@ -4431,16 +4431,16 @@ index 808fb44d8..0e1fe9f27 100644 } } -@@ -1357,7 +1470,7 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1416,7 +1529,7 @@ struct ggml_tensor * llama_model_loader::create_tensor( if (!buft) { - buft = select_weight_buft(hparams, t_meta, op, buft_list); + buft = select_weight_buft(hparams, t_meta, scale_meta, op, buft_list); if (!buft) { - throw std::runtime_error(format("failed to find a compatible buffer type for tensor %s", tn.str().c_str())); + throw std::runtime_error(format("failed to find a compatible buffer type for tensor %s", tensor_name.c_str())); } } -@@ -1384,17 +1497,9 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1447,17 +1560,9 @@ struct ggml_tensor * llama_model_loader::create_tensor( return buft; }; @@ -4461,7 +4461,7 @@ index 808fb44d8..0e1fe9f27 100644 if (flags & TENSOR_NOT_REQUIRED) { for (size_t dim = 0; dim < ne.size(); dim++) { if (ne.begin()[dim] <= 0) { -@@ -1412,31 +1517,72 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1475,31 +1580,72 @@ struct ggml_tensor * llama_model_loader::create_tensor( if (dim == 0) { t_meta.nb[dim] = ggml_type_size(type); } else if (dim == 1) { @@ -4542,7 +4542,7 @@ index 808fb44d8..0e1fe9f27 100644 } ggml_tensor t_meta = *cur; -@@ -1455,6 +1601,7 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1518,6 +1664,7 @@ struct ggml_tensor * llama_model_loader::create_tensor( GGML_ASSERT(ggml_nbytes(&t_meta) == ggml_nbytes(cur)); @@ -4550,7 +4550,7 @@ index 808fb44d8..0e1fe9f27 100644 ggml_backend_buffer_type_t buft = buft_for_tensor(&t_meta); if (buft == nullptr) { return nullptr; -@@ -1464,20 +1611,18 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1527,20 +1674,18 @@ struct ggml_tensor * llama_model_loader::create_tensor( // if duplicated, check if the original tensor was allocated in the same buffer type context and avoid creating a new one if (flags & TENSOR_DUPLICATED) { @@ -4575,7 +4575,7 @@ index 808fb44d8..0e1fe9f27 100644 n_created++; } -@@ -1485,6 +1630,20 @@ struct ggml_tensor * llama_model_loader::create_tensor( +@@ -1548,6 +1693,21 @@ struct ggml_tensor * llama_model_loader::create_tensor( } void llama_model_loader::done_getting_tensors(bool partial) const { @@ -4593,10 +4593,11 @@ index 808fb44d8..0e1fe9f27 100644 + "%s: model builder requested a tensor outside the admitted resident closure", + __func__)); + } - if (n_created > n_tensors) { - throw std::runtime_error(format("%s: too many tensors created; expected %d, got %d", __func__, n_tensors, n_created)); - } -@@ -1535,9 +1694,28 @@ void llama_model_loader::init_mappings(bool prefetch, llama_mlocks * mlock_mmaps ++ + std::unordered_set created; + for (const auto & it : ctx_map) { + for (ggml_tensor * t = ggml_get_first_tensor(it.second.get()); t; t = ggml_get_next_tensor(it.second.get(), t)) { +@@ -1621,9 +1781,28 @@ void llama_model_loader::init_mappings(bool prefetch, llama_mlocks * mlock_mmaps } } @@ -4628,7 +4629,7 @@ index 808fb44d8..0e1fe9f27 100644 } } -@@ -1657,6 +1835,7 @@ bool llama_model_loader::load_all_data( +@@ -1743,6 +1922,7 @@ bool llama_model_loader::load_all_data( return true; } GGML_ASSERT(size_data != 0 && "call init_mappings() first"); @@ -4636,7 +4637,7 @@ index 808fb44d8..0e1fe9f27 100644 std::vector>> validation_result; -@@ -1786,7 +1965,10 @@ bool llama_model_loader::load_all_data( +@@ -1872,7 +2052,10 @@ bool llama_model_loader::load_all_data( } if (progress_callback) { @@ -4648,7 +4649,7 @@ index 808fb44d8..0e1fe9f27 100644 return false; } } -@@ -1928,6 +2110,7 @@ bool llama_model_loader::load_all_data( +@@ -2014,6 +2197,7 @@ bool llama_model_loader::load_all_data( } size_done += n_size; @@ -4656,7 +4657,7 @@ index 808fb44d8..0e1fe9f27 100644 } // free temporary resources used for async uploads -@@ -1954,7 +2137,7 @@ bool llama_model_loader::load_all_data( +@@ -2040,7 +2224,7 @@ bool llama_model_loader::load_all_data( } // check if this is the last call and do final cleanup @@ -4666,7 +4667,7 @@ index 808fb44d8..0e1fe9f27 100644 if (use_mmap) { for (uint32_t idx = 0; idx < mappings.size(); idx++) { diff --git a/src/llama-model-loader.h b/src/llama-model-loader.h -index ed59079a4..b8dc0cfa7 100644 +index e2db7395bcf7db282b8b34d744a65b9ed9e1292d..72d9fc0b2922d20d1b0777c5fb69d3b8d4e3b54d 100644 --- a/src/llama-model-loader.h +++ b/src/llama-model-loader.h @@ -14,11 +14,37 @@ @@ -4730,7 +4731,7 @@ index ed59079a4..b8dc0cfa7 100644 throw std::runtime_error(format("tensor '%s' data is not within the file bounds, model is corrupted or incomplete", ggml_get_name(tensor))); } } -@@ -123,6 +155,10 @@ struct llama_model_loader { +@@ -124,6 +156,10 @@ struct llama_model_loader { std::map weights_map; std::unordered_map kv_overrides; @@ -4741,7 +4742,7 @@ index ed59079a4..b8dc0cfa7 100644 const llama_model_tensor_buft_override * tensor_buft_overrides; gguf_context_ptr metadata_ptr; -@@ -149,10 +185,17 @@ struct llama_model_loader { +@@ -150,10 +186,17 @@ struct llama_model_loader { struct ctx_key { ggml_backend_buffer_type_t buft; bool lazy; @@ -4759,7 +4760,7 @@ index ed59079a4..b8dc0cfa7 100644 if (lhs.lazy != rhs.lazy) { return lhs.lazy < rhs.lazy; } -@@ -175,13 +218,19 @@ struct llama_model_loader { +@@ -179,13 +222,19 @@ struct llama_model_loader { void * set_tensor_data_ud, const std::string & fname, std::vector & splits, // optional, only need if the split does not follow naming scheme @@ -4781,7 +4782,7 @@ index ed59079a4..b8dc0cfa7 100644 template typename std::enable_if::value, bool>::type diff --git a/src/llama-model.cpp b/src/llama-model.cpp -index b83636631..970f18f98 100644 +index f06ea2ec03ce5e69cff1383667192bcee94ba724..6fb12e12793b8d63e700a15fa48f0c1e9ddd3676 100644 --- a/src/llama-model.cpp +++ b/src/llama-model.cpp @@ -7,6 +7,7 @@ @@ -4792,7 +4793,7 @@ index b83636631..970f18f98 100644 #include "llama-kv-cache.h" #include "llama-kv-cache-iswa.h" -@@ -1461,6 +1462,16 @@ struct llama_model::impl { +@@ -1475,6 +1476,16 @@ struct llama_model::impl { bool has_tensor_overrides; std::vector tensor_split_owned; @@ -4809,7 +4810,7 @@ index b83636631..970f18f98 100644 }; bool llama_prec_policy::apply(ggml_tensor * res, const ggml_tensor * w) const { -@@ -1658,6 +1669,7 @@ void llama_model_base::load_hparams(llama_model_loader & ml) { +@@ -1672,6 +1683,7 @@ void llama_model_base::load_hparams(llama_model_loader & ml) { std::fill(hparams.is_recr_impl.begin(), hparams.is_recr_impl.end(), llm_arch_is_recurrent(ml.get_arch()) ? 1 : 0); std::fill(hparams.is_indexer_full_impl.begin(), hparams.is_indexer_full_impl.end(), 0); std::iota(hparams.kv_source_impl.begin(), hparams.kv_source_impl.end(), 0); @@ -4817,7 +4818,7 @@ index b83636631..970f18f98 100644 std::fill(hparams.xielu_alpha_n.begin(), hparams.xielu_alpha_n.end(), 0.0f); std::fill(hparams.xielu_alpha_p.begin(), hparams.xielu_alpha_p.end(), 0.0f); -@@ -1906,13 +1918,33 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { +@@ -1920,13 +1932,33 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { const int i_gpu_start = std::max(n_layer_all + 1 - n_gpu_layers, 0); const int act_gpu_layers = devices.empty() ? 0 : std::min(n_gpu_layers, n_layer_all + 1); @@ -4852,24 +4853,7 @@ index b83636631..970f18f98 100644 auto * dev = devices.at(layer_gpu).dev; LLAMA_LOG_DEBUG("load_tensors: layer %3d assigned to device %s, is_swa = %d\n", il, ggml_backend_dev_name(dev), is_swa); return {dev, &pimpl->gpu_buft_list.at(dev)}; -@@ -2005,13 +2037,13 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { - } - - // MoE expert weight scales (per-expert, shape {n_expert}) -- if (!layer.ffn_gate_exps_s && layer.ffn_gate_exps) { -+ if (!layer.ffn_gate_exps_s && (layer.ffn_gate_exps || ml.get_tensor_meta(tn(LLM_TENSOR_FFN_GATE_EXPS, "scale", i).str().c_str()) != nullptr)) { - layer.ffn_gate_exps_s = create_tensor(tn(LLM_TENSOR_FFN_GATE_EXPS, "scale", i), {n_expert}, TENSOR_NOT_REQUIRED); - } -- if (!layer.ffn_down_exps_s && layer.ffn_down_exps) { -+ if (!layer.ffn_down_exps_s && (layer.ffn_down_exps || ml.get_tensor_meta(tn(LLM_TENSOR_FFN_DOWN_EXPS, "scale", i).str().c_str()) != nullptr)) { - layer.ffn_down_exps_s = create_tensor(tn(LLM_TENSOR_FFN_DOWN_EXPS, "scale", i), {n_expert}, TENSOR_NOT_REQUIRED); - } -- if (!layer.ffn_up_exps_s && layer.ffn_up_exps) { -+ if (!layer.ffn_up_exps_s && (layer.ffn_up_exps || ml.get_tensor_meta(tn(LLM_TENSOR_FFN_UP_EXPS, "scale", i).str().c_str()) != nullptr)) { - layer.ffn_up_exps_s = create_tensor(tn(LLM_TENSOR_FFN_UP_EXPS, "scale", i), {n_expert}, TENSOR_NOT_REQUIRED); - if (layer.ffn_up_exps_s && layer.ffn_gate_up_exps) { - throw std::runtime_error(format("ffn_up_exps.scale and ffn_gate_up_exps.weight both exist for layer %d", i)); -@@ -2122,7 +2154,7 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { +@@ -1979,7 +2011,7 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { post_arch_tensors(ml); } @@ -4878,7 +4862,7 @@ index b83636631..970f18f98 100644 if (per_layer_tok_embd && ml.lazy.has(per_layer_tok_embd)) { LLAMA_LOG_INFO("%s: enabling prefetch for '%s'\n", __func__, per_layer_tok_embd->name); -@@ -2138,7 +2170,27 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { +@@ -1990,7 +2022,27 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { // populate tensors_by_name for (auto & [_, ctx_ptr] : ml.ctx_map) { for (auto * cur = ggml_get_first_tensor(ctx_ptr.get()); cur != NULL; cur = ggml_get_next_tensor(ctx_ptr.get(), cur)) { @@ -4907,7 +4891,7 @@ index b83636631..970f18f98 100644 } } -@@ -2194,6 +2246,15 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { +@@ -2017,6 +2069,15 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { continue; } @@ -4923,7 +4907,7 @@ index b83636631..970f18f98 100644 // check if it is possible to use buffer_from_host_ptr with this buffer type ggml_backend_dev_t dev = ggml_backend_buft_get_device(buft); if (!dev) { -@@ -2737,6 +2798,40 @@ bool llama_model::no_alloc() const { +@@ -2602,6 +2663,40 @@ bool llama_model::no_alloc() const { return params.no_alloc; } @@ -4964,7 +4948,7 @@ index b83636631..970f18f98 100644 std::map llama_model::memory_breakdown() const { std::map ret; for (const auto & [ctx, bufs] : pimpl->ctxs_bufs) { -@@ -3114,7 +3209,32 @@ ggml_tensor * llama_model::get_rope_factors(const llama_cparams & cparams, int i +@@ -2979,7 +3074,32 @@ ggml_tensor * llama_model::get_rope_factors(const llama_cparams & cparams, int i return layers[il].rope_short; } @@ -4998,7 +4982,7 @@ index b83636631..970f18f98 100644 llama_memory_i * res; // the non-causal LFM2 and LFM3 decision graphs read the whole prompt in one batch, nothing is kept -@@ -3151,10 +3271,12 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, +@@ -3016,10 +3136,12 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, } break; case LLM_ARCH_MINIMAX_M3: { @@ -5013,7 +4997,7 @@ index b83636631..970f18f98 100644 res = new llama_kv_cache_msa( *this, params.no_alloc, -@@ -3167,7 +3289,7 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, +@@ -3032,7 +3154,7 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, cparams.n_seq_max, hparams.n_swa, hparams.swa_type, @@ -5022,7 +5006,7 @@ index b83636631..970f18f98 100644 filter_idx, nullptr); } break; -@@ -3504,7 +3626,7 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, +@@ -3369,7 +3491,7 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, cparams.n_seq_max, cparams.n_rs_seq, false, @@ -5031,7 +5015,7 @@ index b83636631..970f18f98 100644 } else if (llm_arch_is_hybrid(arch) && !mtp_on_hybrid_qwen && !mtp_on_hybrid_nemotron) { // The main difference between hybrid architectures is the // layer filters, so pick the right one here -@@ -3562,6 +3684,20 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, +@@ -3427,6 +3549,20 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, } } @@ -5052,7 +5036,7 @@ index b83636631..970f18f98 100644 if (hparams.swa_type != LLAMA_SWA_TYPE_NONE) { // Use hybrid-iswa for hybrid models with SWA res = new llama_memory_hybrid_iswa( -@@ -3650,6 +3786,8 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, +@@ -3515,6 +3651,8 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, } } @@ -5061,7 +5045,7 @@ index b83636631..970f18f98 100644 if (hparams.swa_type != LLAMA_SWA_TYPE_NONE) { GGML_ASSERT(hparams.is_swa_any()); -@@ -3731,7 +3869,8 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, +@@ -3596,7 +3734,8 @@ llama_memory_i * llama_model::create_memory(const llama_memory_params & params, ggml_cgraph * llama_model::build_graph(const llm_graph_params & params) const { std::unique_ptr llm = build_arch_graph(params); @@ -5071,7 +5055,7 @@ index b83636631..970f18f98 100644 llm->build_pooling(cls, cls_b, cls_out, cls_out_b, cls_norm); // add the LM head (if the context outputs logits) -@@ -3739,11 +3878,6 @@ ggml_cgraph * llama_model::build_graph(const llm_graph_params & params) const { +@@ -3604,11 +3743,6 @@ ggml_cgraph * llama_model::build_graph(const llm_graph_params & params) const { // add backend sampling layers (if any) llm->build_sampling(); @@ -5083,7 +5067,7 @@ index b83636631..970f18f98 100644 llm->build_dense_out(dense_2_out_layers, dense_2_out_layers_b, dense_3_out_layers); llm->build_layer_inp_dev(); -@@ -3751,6 +3885,7 @@ ggml_cgraph * llama_model::build_graph(const llm_graph_params & params) const { +@@ -3616,6 +3750,7 @@ ggml_cgraph * llama_model::build_graph(const llm_graph_params & params) const { llm->build_h_nextn_dev(); llm->res->set_outputs(params); @@ -5091,7 +5075,7 @@ index b83636631..970f18f98 100644 return llm->res->get_gf(); } -@@ -4408,7 +4543,7 @@ uint32_t llama_model_get_tok_embd(const struct llama_model * model, float * out) +@@ -4274,7 +4409,7 @@ uint32_t llama_model_get_tok_embd(const struct llama_model * model, float * out) const ggml_tensor * tensor = model->tok_embd; const size_t nelements = ggml_nelements(tensor); @@ -5101,10 +5085,10 @@ index b83636631..970f18f98 100644 if (out == nullptr) { return (uint32_t) nelements; diff --git a/src/llama-model.h b/src/llama-model.h -index 62fbda68a..7c0de5851 100644 +index c3334469d239a59c948635bd9f2e5855d47dced1..b7480fd9d012afe77b764ef1e1c1e75e833d4352 100644 --- a/src/llama-model.h +++ b/src/llama-model.h -@@ -1065,6 +1065,18 @@ struct llama_model { +@@ -1025,6 +1025,18 @@ struct llama_model { llama_split_mode split_mode() const; bool no_alloc() const; @@ -5123,7 +5107,7 @@ index 62fbda68a..7c0de5851 100644 std::map memory_breakdown() const; // total number of parameters in the model -@@ -1092,10 +1104,14 @@ struct llama_model { +@@ -1052,10 +1064,14 @@ struct llama_model { ggml_tensor * get_rope_factors(const llama_cparams & cparams, int il) const; @@ -5142,7 +5126,7 @@ index 62fbda68a..7c0de5851 100644 // apply Hadamard transform to the lightning indexer keys virtual bool lid_k_hdmd() const { return false; } diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp -index c1fab892f..73b5247eb 100644 +index 38eb0d588ba80fdacb5b3bfa86a4ae388bed0f2c..7dc9cf36a28af65765cf6af1d95804132c2181e6 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -469,6 +469,7 @@ static ggml_type fallback_type_for(const ggml_type target_type) { @@ -5162,7 +5146,7 @@ index c1fab892f..73b5247eb 100644 ml.init_mappings(false); // no prefetching auto mparams = llama_model_default_params(); -@@ -3842,6 +3843,13 @@ bool llama_quant_tensor_allows_quantization(const quantize_state_impl * qs, cons +@@ -3847,6 +3848,13 @@ bool llama_quant_tensor_allows_quantization(const quantize_state_impl * qs, cons return tensor_allows_quantization(qs->params, qs->model.arch, tensor); } @@ -5176,7 +5160,7 @@ index c1fab892f..73b5247eb 100644 void llama_quant_compute_types( quantize_state_impl * qs, const llama_ftype ftype, -@@ -3859,7 +3867,7 @@ void llama_quant_compute_types( +@@ -3864,7 +3872,7 @@ void llama_quant_compute_types( qs->i_ffn_gate = 0; qs->i_ffn_up = 0; qs->n_fallback = 0; @@ -5186,7 +5170,7 @@ index c1fab892f..73b5247eb 100644 // build metadata from tensor names diff --git a/src/llama.cpp b/src/llama.cpp -index cee6a7dc4..10beaeed4 100644 +index cee6a7dc4428efc1146b075d1cb118de22ef1b58..10beaeed437b806f70d4cf4382ef41a5b09334ee 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -314,10 +314,12 @@ static bool llama_prepare_model_devices(const llama_model_params & params, llama @@ -5336,7 +5320,7 @@ index cee6a7dc4..10beaeed4 100644 - diff --git a/src/skippy-verify-checkpoint.h b/src/skippy-verify-checkpoint.h new file mode 100644 -index 000000000..8793000c1 +index 0000000000000000000000000000000000000000..8793000c101ace2fa78b5ae4356c4bed9393fcb9 --- /dev/null +++ b/src/skippy-verify-checkpoint.h @@ -0,0 +1,24 @@ @@ -5364,6 +5348,3 @@ index 000000000..8793000c1 + checkpoints.erase(it); + return true; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0004-feat-models-expose-stage-independent-graph-semantics.patch b/llama_cpp/patches/0004-feat-models-expose-stage-independent-graph-semantics.patch index 1e5c5c68..87f84292 100644 --- a/llama_cpp/patches/0004-feat-models-expose-stage-independent-graph-semantics.patch +++ b/llama_cpp/patches/0004-feat-models-expose-stage-independent-graph-semantics.patch @@ -1,4 +1,4 @@ -From 0d0f5d0f82f46b9677c232bd85a8459029a68914 Mon Sep 17 00:00:00 2001 +From a99e3c7b699b8e9a86098786252ef4480712f78e Mon Sep 17 00:00:00 2001 From: James Dumay Date: Tue, 13 Oct 2026 22:06:42 +1100 Subject: [PATCH] feat(models): expose stage-independent graph semantics @@ -6,14 +6,14 @@ Subject: [PATCH] feat(models): expose stage-independent graph semantics --- src/llama-context.cpp | 19 +- src/llama-context.h | 3 +- - src/llama-graph.cpp | 1395 +++++++++++++++++++++++++++--- - src/llama-graph.h | 278 +++++- + src/llama-graph.cpp | 1421 +++++++++++++++++++++++++++--- + src/llama-graph.h | 282 +++++- src/llama-kv-cache.cpp | 18 - src/llama-kv-cache.h | 5 + src/models/bailingmoe3.cpp | 12 +- src/models/bitnet.cpp | 4 +- src/models/chameleon.cpp | 25 +- - src/models/deepseek32.cpp | 16 +- + src/models/deepseek32.cpp | 18 +- src/models/deepseek4.cpp | 38 +- src/models/delta-net-base.cpp | 17 +- src/models/gemma4.cpp | 5 +- @@ -24,7 +24,7 @@ Subject: [PATCH] feat(models): expose stage-independent graph semantics src/models/granite-switch.cpp | 53 +- src/models/kimi-k3.cpp | 44 +- src/models/kimi-k31.cpp | 6 +- - src/models/kimi-linear.cpp | 28 +- + src/models/kimi-linear.cpp | 31 +- src/models/lfm-base.cpp | 4 +- src/models/mamba-base.cpp | 57 +- src/models/mimo2.cpp | 15 +- @@ -32,7 +32,7 @@ Subject: [PATCH] feat(models): expose stage-independent graph semantics src/models/minimax-01.cpp | 13 +- src/models/minimax-m3.cpp | 50 +- src/models/models.h | 5 + - src/models/nemotron-h-moe.cpp | 41 +- + src/models/nemotron-h-moe.cpp | 42 +- src/models/nemotron-h.cpp | 11 +- src/models/qwen2moe.cpp | 5 +- src/models/qwen35.cpp | 3 +- @@ -44,10 +44,10 @@ Subject: [PATCH] feat(models): expose stage-independent graph semantics src/models/rwkv6.cpp | 2 +- src/models/rwkv7-base.cpp | 9 +- src/skippy/stage_realization.cpp | 15 +- - 40 files changed, 2026 insertions(+), 334 deletions(-) + 40 files changed, 2053 insertions(+), 343 deletions(-) diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index 09562654d..b3d0fd521 100644 +index bc3311d98e6c48cfb0af72fd55397c9959909c5b..52dfe91c75de4526f662d73b692346d23423fdf0 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -724,7 +724,7 @@ void llama_context::resolve_fused_ops( @@ -103,8 +103,8 @@ index 09562654d..b3d0fd521 100644 std::vector export_token_axes; // Reservation observes the frontier with multiple tokens. Reuse those // axes during decode, where singleton checkpoint/token dimensions can be -@@ -3439,6 +3449,7 @@ llm_graph_params llama_context::graph_params( - /*.h_nextn_src =*/ supports_state_row() ? cparams.ctx_state_src->get_h_nextn_dev() : nullptr, +@@ -3440,6 +3450,7 @@ llm_graph_params llama_context::graph_params( + /*.w_scales =*/ &model.w_scales, /*.samplers =*/ sampling.samplers, /*.build_inputs=*/ graph_build_inputs, + /*.activation_import_token_axes=*/ std::move(import_token_axes), @@ -112,7 +112,7 @@ index 09562654d..b3d0fd521 100644 /*.computation_generation=*/ computation_generation, /*.n_outputs =*/ n_outputs, diff --git a/src/llama-context.h b/src/llama-context.h -index 668065b39..c26fdd615 100644 +index 668065b39d7fc434d5fbc08fad9c9d4f2fbc61b0..c26fdd61584b9ae677f530871d7b0a401bf25da7 100644 --- a/src/llama-context.h +++ b/src/llama-context.h @@ -331,7 +331,8 @@ public: @@ -126,7 +126,7 @@ index 668065b39..c26fdd615 100644 bool get_activation_boundary(enum ggml_type & type, uint64_t & elements_per_token, uint64_t & bytes_per_token) const; bool get_input_activation_boundary(enum ggml_type & type, uint64_t & elements_per_token, uint64_t & bytes_per_token) const; diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp -index a96577f11..7ac671d47 100644 +index 31200d0d1267f7e91312bde9f8ef2c4245cd1cca..4b4f73e2f9c6962a98f3e52aa6a5556a468efb03 100644 --- a/src/llama-graph.cpp +++ b/src/llama-graph.cpp @@ -17,6 +17,7 @@ @@ -296,7 +296,7 @@ index a96577f11..7ac671d47 100644 return res; } -@@ -705,6 +761,7 @@ void llm_graph_input_attn_no_cache::set_input(const llama_ubatch * ubatch) { +@@ -706,6 +762,7 @@ void llm_graph_input_attn_no_cache::set_input(const llama_ubatch * ubatch) { void llm_graph_input_attn_kv::set_input(const llama_ubatch * ubatch) { // the idxs are left unallocated when the KV cache is bypassed during training @@ -304,7 +304,7 @@ index a96577f11..7ac671d47 100644 if (self_k_idxs && self_k_idxs->buffer) { mctx->set_input_k_idxs(self_k_idxs, ubatch); } -@@ -726,7 +783,9 @@ bool llm_graph_input_attn_kv::can_reuse(const llm_graph_params & params) { +@@ -727,7 +784,9 @@ bool llm_graph_input_attn_kv::can_reuse(const llm_graph_params & params) { bool res = true; @@ -315,7 +315,7 @@ index a96577f11..7ac671d47 100644 //res &= self_v_idxs->ne[0] == params.ubatch.n_tokens; // TODO: need to move this to the unified cache and check there res &= can_reuse_attn_mask(self_attn_mask, mctx, params.ubatch, params.cparams); -@@ -735,7 +794,11 @@ bool llm_graph_input_attn_kv::can_reuse(const llm_graph_params & params) { +@@ -736,7 +795,11 @@ bool llm_graph_input_attn_kv::can_reuse(const llm_graph_params & params) { } void llm_graph_input_attn_k::set_input(const llama_ubatch * ubatch) { @@ -328,7 +328,7 @@ index a96577f11..7ac671d47 100644 mctx->set_input_attn_mask(self_attn_mask, ubatch, cparams.causal_attn); } -@@ -749,7 +812,7 @@ bool llm_graph_input_attn_k::can_reuse(const llm_graph_params & params) { +@@ -750,7 +813,7 @@ bool llm_graph_input_attn_k::can_reuse(const llm_graph_params & params) { bool llm_graph_input_attn_k::can_reuse_impl(const llm_graph_params & params) { bool res = true; @@ -337,7 +337,7 @@ index a96577f11..7ac671d47 100644 res &= can_reuse_attn_mask(self_attn_mask, mctx, params.ubatch, params.cparams); -@@ -767,21 +830,25 @@ llm_graph_input_attn_kv_msa::llm_graph_input_attn_kv_msa( +@@ -768,21 +831,25 @@ llm_graph_input_attn_kv_msa::llm_graph_input_attn_kv_msa( void llm_graph_input_attn_kv_msa::set_input(const llama_ubatch * ubatch) { llm_graph_input_attn_kv::set_input(ubatch); @@ -367,7 +367,7 @@ index a96577f11..7ac671d47 100644 res &= self_k_idxs_idx->ne[0] == params.ubatch.n_tokens; } -@@ -791,20 +858,26 @@ bool llm_graph_input_attn_kv_msa::can_reuse(const llm_graph_params & params) { +@@ -792,20 +859,26 @@ bool llm_graph_input_attn_kv_msa::can_reuse(const llm_graph_params & params) { } void llm_graph_input_attn_k_dsa::set_input(const llama_ubatch * ubatch) { @@ -397,7 +397,7 @@ index a96577f11..7ac671d47 100644 return can_reuse_impl(params); } -@@ -812,8 +885,12 @@ bool llm_graph_input_attn_k_dsa::can_reuse(const llm_graph_params & params) { +@@ -813,8 +886,12 @@ bool llm_graph_input_attn_k_dsa::can_reuse(const llm_graph_params & params) { bool llm_graph_input_attn_k_dsa::can_reuse_impl(const llm_graph_params & params) { bool res = true; @@ -412,7 +412,7 @@ index a96577f11..7ac671d47 100644 res &= can_reuse_attn_mask(self_attn_mask_mla, mctx->get_mla(), params.ubatch, params.cparams); res &= can_reuse_attn_mask(self_attn_mask_lid, mctx->get_lid(), params.ubatch, params.cparams); -@@ -1179,6 +1256,32 @@ static void dsv4_build_comp_inputs( +@@ -1180,6 +1257,32 @@ static void dsv4_build_comp_inputs( } } @@ -445,7 +445,7 @@ index a96577f11..7ac671d47 100644 void llm_graph_input_dsv4_raw::set_input(const llama_ubatch * ubatch) { if (self_k_idxs && self_k_idxs->buffer) { mctx->set_input_k_idxs(self_k_idxs); -@@ -1270,15 +1373,21 @@ void llm_graph_input_attn_cross::set_input(const llama_ubatch * ubatch) { +@@ -1271,15 +1374,21 @@ void llm_graph_input_attn_cross::set_input(const llama_ubatch * ubatch) { } void llm_graph_input_mem_hybrid::set_input(const llama_ubatch * ubatch) { @@ -470,7 +470,7 @@ index a96577f11..7ac671d47 100644 GGML_ASSERT(ggml_backend_buffer_is_host(inp_rs->s_copy->buffer)); int32_t * data = (int32_t *) inp_rs->s_copy->data; -@@ -1298,14 +1407,20 @@ bool llm_graph_input_mem_hybrid::can_reuse(const llm_graph_params & params) { +@@ -1299,14 +1408,20 @@ bool llm_graph_input_mem_hybrid::can_reuse(const llm_graph_params & params) { bool res = true; @@ -494,7 +494,7 @@ index a96577f11..7ac671d47 100644 res &= inp_rs->head == mctx->get_recr()->get_head(); res &= inp_rs->rs_z == mctx->get_recr()->get_rs_z(); -@@ -1317,7 +1432,13 @@ bool llm_graph_input_mem_hybrid::can_reuse(const llm_graph_params & params) { +@@ -1319,7 +1434,13 @@ bool llm_graph_input_mem_hybrid::can_reuse(const llm_graph_params & params) { // Instead of creating a hybrid input, the graph can simply create 2 separate inputs. // Refactoring is required in the future. void llm_graph_input_mem_hybrid_k::set_input(const llama_ubatch * ubatch) { @@ -509,7 +509,7 @@ index a96577f11..7ac671d47 100644 // leave the mask unallocated if all attention layers have their own (e.g. glm5-next DSA) if (inp_attn->self_attn_mask.raw->buffer) { -@@ -1326,7 +1447,7 @@ void llm_graph_input_mem_hybrid_k::set_input(const llama_ubatch * ubatch) { +@@ -1328,7 +1449,7 @@ void llm_graph_input_mem_hybrid_k::set_input(const llama_ubatch * ubatch) { const int64_t n_rs = mctx->get_recr()->get_n_rs(); @@ -518,7 +518,7 @@ index a96577f11..7ac671d47 100644 GGML_ASSERT(ggml_backend_buffer_is_host(inp_rs->s_copy->buffer)); int32_t * data = (int32_t *) inp_rs->s_copy->data; -@@ -1346,13 +1467,19 @@ bool llm_graph_input_mem_hybrid_k::can_reuse(const llm_graph_params & params) { +@@ -1348,13 +1469,19 @@ bool llm_graph_input_mem_hybrid_k::can_reuse(const llm_graph_params & params) { bool res = true; @@ -541,7 +541,7 @@ index a96577f11..7ac671d47 100644 res &= inp_rs->head == mctx->get_recr()->get_head(); res &= inp_rs->rs_z == mctx->get_recr()->get_rs_z(); -@@ -1385,7 +1512,7 @@ void llm_graph_input_mem_hybrid_iswa::set_input(const llama_ubatch * ubatch) { +@@ -1388,7 +1515,7 @@ void llm_graph_input_mem_hybrid_iswa::set_input(const llama_ubatch * ubatch) { const int64_t n_rs = mctx->get_recr()->get_n_rs(); @@ -550,7 +550,7 @@ index a96577f11..7ac671d47 100644 GGML_ASSERT(ggml_backend_buffer_is_host(inp_rs->s_copy->buffer)); int32_t * data = (int32_t *) inp_rs->s_copy->data; -@@ -1423,9 +1550,13 @@ bool llm_graph_input_mem_hybrid_iswa::can_reuse(const llm_graph_params & params) +@@ -1426,9 +1553,13 @@ bool llm_graph_input_mem_hybrid_iswa::can_reuse(const llm_graph_params & params) res &= can_reuse_attn_mask(inp_attn->self_attn_mask_swa, attn_ctx->get_swa(), params.ubatch, params.cparams); @@ -566,7 +566,7 @@ index a96577f11..7ac671d47 100644 res &= inp_rs->head == mctx->get_recr()->get_head(); res &= inp_rs->rs_z == mctx->get_recr()->get_rs_z(); -@@ -1583,6 +1714,8 @@ void llm_graph_result::reset() { +@@ -1588,6 +1719,8 @@ void llm_graph_result::reset() { t_embd = nullptr; t_embd_pooled = nullptr; t_h_nextn = nullptr; @@ -575,7 +575,7 @@ index a96577f11..7ac671d47 100644 t_layer_inp.resize(LLAMA_MAX_LAYERS + 1); std::fill(t_layer_inp.begin(), t_layer_inp.end(), nullptr); -@@ -1599,8 +1732,17 @@ void llm_graph_result::reset() { +@@ -1604,8 +1737,17 @@ void llm_graph_result::reset() { inputs.clear(); fused_nodes.clear(); hdmd_inputs.clear(); @@ -595,7 +595,7 @@ index a96577f11..7ac671d47 100644 if (meta_size != buf_compute_meta_size) { // not make_unique: it would zero the whole reserve and make its pages resident buf_compute_meta.reset(new uint8_t[meta_size]); -@@ -1618,17 +1760,92 @@ void llm_graph_result::reset() { +@@ -1623,17 +1765,92 @@ void llm_graph_result::reset() { gf = ggml_new_graph_custom(ctx_compute.get(), max_nodes, false); } @@ -688,7 +688,7 @@ index a96577f11..7ac671d47 100644 ggml_set_output(t_embd); } if (t_embd_pooled != nullptr) { -@@ -1637,6 +1854,11 @@ void llm_graph_result::set_outputs(const llm_graph_params & params) { +@@ -1642,6 +1859,11 @@ void llm_graph_result::set_outputs(const llm_graph_params & params) { if (t_h_nextn != nullptr) { ggml_set_output(t_h_nextn); } @@ -700,7 +700,7 @@ index a96577f11..7ac671d47 100644 { const auto & embeddings_layer_inp = params.cparams.embeddings_layer_inp; for (size_t il = 0; il < embeddings_layer_inp.size() && !params.cparams.embeddings_layer_inp_dev; ++il) { -@@ -1654,6 +1876,74 @@ void llm_graph_result::set_outputs(const llm_graph_params & params) { +@@ -1659,6 +1881,74 @@ void llm_graph_result::set_outputs(const llm_graph_params & params) { } } @@ -775,7 +775,7 @@ index a96577f11..7ac671d47 100644 bool llm_graph_result::can_reuse(const llm_graph_params & params) { if (!this->params.allow_reuse(params)) { if (debug > 1) { -@@ -1687,6 +1977,43 @@ bool llm_graph_result::can_reuse(const llm_graph_params & params) { +@@ -1692,6 +1982,43 @@ bool llm_graph_result::can_reuse(const llm_graph_params & params) { } llm_graph_input_i * llm_graph_result::add_input(llm_graph_input_ptr input) { @@ -819,7 +819,7 @@ index a96577f11..7ac671d47 100644 inputs.emplace_back(std::move(input)); return inputs.back().get(); } -@@ -1706,6 +2033,7 @@ void llm_graph_result::set_hdmd_input(const ggml_tensor * cur, const ggml_tensor +@@ -1711,6 +2038,7 @@ void llm_graph_result::set_hdmd_input(const ggml_tensor * cur, const ggml_tensor void llm_graph_result::set_params(const llm_graph_params & params) { this->params = params; @@ -827,15 +827,15 @@ index a96577f11..7ac671d47 100644 } // -@@ -1758,6 +2086,7 @@ llm_graph_context::llm_graph_context(const llm_graph_params & params) : - h_nextn_src (params.h_nextn_src), +@@ -1764,6 +2092,7 @@ llm_graph_context::llm_graph_context(const llm_graph_params & params) : + w_scales (params.w_scales), samplers (params.samplers), cb_func (params.cb), + build_inputs (params.build_inputs), res (params.res), ctx0 (res->get_ctx()), gf (res->get_gf()) { -@@ -1770,7 +2099,161 @@ void llm_graph_context::cb(ggml_tensor * cur, const char * name, int il) const { +@@ -1776,7 +2105,161 @@ void llm_graph_context::cb(ggml_tensor * cur, const char * name, int il) const { } } @@ -997,26 +997,27 @@ index a96577f11..7ac671d47 100644 ggml_tensor * llm_graph_context::build_cvec( ggml_tensor * cur, -@@ -1843,14 +2326,15 @@ ggml_tensor * llm_graph_context::build_rope_indexer(ggml_tensor * cur, ggml_tens +@@ -1866,10 +2349,16 @@ ggml_tensor * llm_graph_context::get_input_scale(const ggml_tensor * w) const { + ggml_tensor * llm_graph_context::build_lora_mm( ggml_tensor * w, - ggml_tensor * cur, -- ggml_tensor * w_s) const { +- ggml_tensor * cur) const { ++ ggml_tensor * cur, + ggml_tensor * w_s, + enum ggml_prec prec) const { - if (!w_s) { - w_s = model.get_w_scale(w); - } - ++ if (!w_s) { ++ w_s = get_weight_scale(w); ++ } ++ // a Hadamard-folded weight reads the transformed input; a LoRA delta lives in the primal basis and reads `cur` - ggml_tensor * cur_mm = build_hadamard_input(w, cur); -- ggml_tensor * res = ggml_mul_mat(ctx0, w, cur_mm); +- ggml_tensor * res = ggml_mul_mat_ext(ctx0, w, cur_mm, get_weight_scale(w), get_input_scale(w)); + cur = build_hadamard_input(w, cur); -+ ggml_tensor * res = ggml_mul_mat(ctx0, w, cur); ++ ggml_tensor * res = ggml_mul_mat_ext(ctx0, w, cur, w_s, get_input_scale(w)); if (w->type == GGML_TYPE_NVFP4) { ggml_prec_set_acc(res, GGML_PREC_BF16); -@@ -1859,6 +2343,11 @@ ggml_tensor * llm_graph_context::build_lora_mm( +@@ -1877,6 +2366,11 @@ ggml_tensor * llm_graph_context::build_lora_mm( prec_policy.apply(res, w); @@ -1025,10 +1026,10 @@ index a96577f11..7ac671d47 100644 + ggml_prec_set_acc(res, prec); + } + - if (w_s) { - res = ggml_mul(ctx0, res, w_s); - } -@@ -1973,6 +2462,58 @@ ggml_tensor * llm_graph_context::build_lora_mm_id( + for (const auto & lora : *loras) { + llama_adapter_lora_weight * lw = lora.first->get_weight(w); + if (lw == nullptr) { +@@ -1982,6 +2476,58 @@ ggml_tensor * llm_graph_context::build_lora_mm_id( return res; } @@ -1087,7 +1088,7 @@ index a96577f11..7ac671d47 100644 ggml_tensor * llm_graph_context::build_norm( ggml_tensor * cur, ggml_tensor * mw, -@@ -2386,6 +2927,10 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -2392,6 +2938,10 @@ ggml_tensor * llm_graph_context::build_moe_ffn( const llm_arch arch = model.arch; const int64_t n_embd = cur->ne[0]; const int64_t n_tokens = cur->ne[1]; @@ -1098,7 +1099,7 @@ index a96577f11..7ac671d47 100644 const bool weight_before_ffn = arch == LLM_ARCH_LLAMA4; // for llama4, we apply the sigmoid-ed weights before the FFN ggml_tensor * logits = nullptr; -@@ -2452,14 +2997,14 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -2458,14 +3008,14 @@ ggml_tensor * llm_graph_context::build_moe_ffn( // organize experts into n_expert_groups ggml_tensor * selection_groups = ggml_reshape_3d(ctx0, selection_probs, n_exp_per_group, hparams.n_expert_groups, n_tokens); // [n_exp_per_group, n_expert_groups, n_tokens] @@ -1115,7 +1116,7 @@ index a96577f11..7ac671d47 100644 cb(expert_groups, "ffn_moe_group_topk", il); // mask out the other groups -@@ -2472,7 +3017,7 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -2478,7 +3028,7 @@ ggml_tensor * llm_graph_context::build_moe_ffn( // select experts ggml_tensor * selected_experts = selected_experts_in; if (selected_experts == nullptr) { @@ -1124,7 +1125,7 @@ index a96577f11..7ac671d47 100644 cb(selected_experts->src[0], "ffn_moe_argsort", il); } cb(selected_experts, "ffn_moe_topk", il); -@@ -2746,6 +3291,7 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -2752,6 +3302,7 @@ ggml_tensor * llm_graph_context::build_moe_ffn( for (uint32_t i = 0; i < n_expert_used_il; ++i) { cur_experts[i] = ggml_view_2d(ctx0, experts, n_embd, n_tokens, experts->nb[2], i*experts->nb[1]); @@ -1132,7 +1133,7 @@ index a96577f11..7ac671d47 100644 ggml_build_forward_expand(gf, cur_experts[i]); } -@@ -2768,24 +3314,508 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -2774,39 +3325,529 @@ ggml_tensor * llm_graph_context::build_moe_ffn( return moe_out; } @@ -1150,6 +1151,14 @@ index a96577f11..7ac671d47 100644 - const bool has_mixed = llm_arch_supports_mixed_batch(model.arch) && cparams.ctx_type == LLAMA_CONTEXT_TYPE_DEFAULT; - - const int64_t n_tok_rows = has_mixed ? llm_graph_n_tok_rows(ubatch) : 0; +- +- // we have 3 standard paths to produce the input embeddings for the first layer: +- // - embd0: extract from the token embeddings weight (`tok_embd`) using the input token ids +- // - embd1: pass raw embeddings, skipping the `tok_embd` +- // - embd2: mixed path of both tokens ids + raw embeddings (if supported) +- ggml_tensor * embd0 = nullptr; +- ggml_tensor * embd1 = nullptr; +- ggml_tensor * embd2 = nullptr; +ggml_tensor * llm_graph_context::build_moe_ffn( + ggml_tensor * cur, + ggml_tensor * gate_inp, @@ -1198,9 +1207,7 @@ index a96577f11..7ac671d47 100644 + ); +} -- // we have 3 standard paths to produce the input embeddings for the first layer: -- // - embd0: extract from the token embeddings weight (`tok_embd`) using the input token ids -- // - embd1: pass raw embeddings, skipping the `tok_embd` +- // construct the input tensors +ggml_tensor * llm_graph_context::build_moe_ffn( + ggml_tensor * cur, + ggml_tensor * gate_inp, @@ -1655,10 +1662,13 @@ index a96577f11..7ac671d47 100644 + // we have 3 standard paths to produce the input embeddings for the first layer: + // - embd0: extract from the token embeddings weight (`tok_embd`) using the input token ids + // - embd1: pass raw embeddings, skipping the `tok_embd` - // - embd2: mixed path of both tokens ids + raw embeddings (if supported) - ggml_tensor * embd0 = nullptr; - ggml_tensor * embd1 = nullptr; -@@ -2796,11 +3826,17 @@ ggml_tensor * llm_graph_context::build_inp_embd(ggml_tensor * tok_embd, float to ++ // - embd2: mixed path of both tokens ids + raw embeddings (if supported) ++ ggml_tensor * embd0 = nullptr; ++ ggml_tensor * embd1 = nullptr; ++ ggml_tensor * embd2 = nullptr; ++ ++ // construct the input tensors + { inp->tokens = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, ubatch.n_tokens); cb(inp->tokens, "inp_tokens", -1); ggml_set_input(inp->tokens); @@ -1676,7 +1686,7 @@ index a96577f11..7ac671d47 100644 if (has_mixed) { inp->mixed_tokens = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, n_tok_rows); -@@ -2895,6 +3931,12 @@ ggml_tensor * llm_graph_context::build_inp_embd(ggml_tensor * tok_embd, float to +@@ -2901,6 +3942,12 @@ ggml_tensor * llm_graph_context::build_inp_embd(ggml_tensor * tok_embd, float to const int idx = ubatch.is_mixed() ? 2 : ubatch.token ? 0 : 1; @@ -1689,7 +1699,7 @@ index a96577f11..7ac671d47 100644 ggml_tensor * cur = ggml_build_forward_select(gf, inps.data(), has_mixed ? 3 : 2, idx); if (n_embd_inp != n_embd) { -@@ -2905,7 +3947,7 @@ ggml_tensor * llm_graph_context::build_inp_embd(ggml_tensor * tok_embd, float to +@@ -2911,7 +3958,7 @@ ggml_tensor * llm_graph_context::build_inp_embd(ggml_tensor * tok_embd, float to // NOTE: For deepstack models, only apply scale to token inputs (ie text-only input). // Raw embeddings are assumed to be multimodal inputs that should not be scaled. @@ -1698,7 +1708,7 @@ index a96577f11..7ac671d47 100644 // For Granite architecture if (hparams.f_embedding_scale != 0.0f && !scale_tok_only) { -@@ -2965,6 +4007,7 @@ ggml_tensor * llm_graph_context::build_inp_pos() const { +@@ -2971,6 +4018,7 @@ ggml_tensor * llm_graph_context::build_inp_pos() const { cur = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, (int64_t)n_tokens*hparams.n_pos_per_embd()); ggml_set_input(cur); cb(cur, "inp_pos", -1); @@ -1706,7 +1716,7 @@ index a96577f11..7ac671d47 100644 res->add_input(std::move(inp)); -@@ -2980,6 +4023,7 @@ ggml_tensor * llm_graph_context::build_inp_attn_scale() const { +@@ -2986,6 +4034,7 @@ ggml_tensor * llm_graph_context::build_inp_attn_scale() const { cur = ggml_new_tensor_3d(ctx0, GGML_TYPE_F32, 1, 1, n_tokens); ggml_set_input(cur); cb(cur, "inp_attn_scale", -1); @@ -1714,7 +1724,7 @@ index a96577f11..7ac671d47 100644 res->add_input(std::move(inp)); -@@ -3002,6 +4046,7 @@ ggml_tensor * llm_graph_context::build_inp_out_ids() const { +@@ -3008,6 +4057,7 @@ ggml_tensor * llm_graph_context::build_inp_out_ids() const { cur = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, n_outputs); ggml_set_input(cur); ggml_set_name(cur, "out_ids"); @@ -1722,7 +1732,7 @@ index a96577f11..7ac671d47 100644 res->add_input(std::move(inp)); -@@ -3016,6 +4061,7 @@ ggml_tensor * llm_graph_context::build_inp_mean() const { +@@ -3022,6 +4072,7 @@ ggml_tensor * llm_graph_context::build_inp_mean() const { cur = ggml_new_tensor_2d(ctx0, GGML_TYPE_F32, n_tokens, ubatch.n_seqs_unq); ggml_set_input(cur); ggml_set_name(cur, "mean"); @@ -1730,7 +1740,7 @@ index a96577f11..7ac671d47 100644 res->add_input(std::move(inp)); -@@ -3030,6 +4076,7 @@ ggml_tensor * llm_graph_context::build_inp_cls() const { +@@ -3036,6 +4087,7 @@ ggml_tensor * llm_graph_context::build_inp_cls() const { cur = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, ubatch.n_seqs_unq); ggml_set_input(cur); ggml_set_name(cur, "cls"); @@ -1738,7 +1748,7 @@ index a96577f11..7ac671d47 100644 res->add_input(std::move(inp)); -@@ -3325,7 +4372,7 @@ llm_graph_input_attn_no_cache * llm_graph_context::build_attn_inp_no_cache() con +@@ -3350,7 +4402,7 @@ llm_graph_input_attn_no_cache * llm_graph_context::build_attn_inp_no_cache() con inp->self_attn_mask.raw = ggml_new_tensor_4d(ctx0, type_mask, n_kv, n_tokens, 1, 1); ggml_set_input(inp->self_attn_mask.raw); @@ -1747,7 +1757,7 @@ index a96577f11..7ac671d47 100644 if (hparams.swa_type != LLAMA_SWA_TYPE_NONE) { inp->self_attn_mask_swa.raw = ggml_new_tensor_4d(ctx0, type_mask, n_kv, n_tokens, 1, 1); -@@ -3334,6 +4381,8 @@ llm_graph_input_attn_no_cache * llm_graph_context::build_attn_inp_no_cache() con +@@ -3359,6 +4411,8 @@ llm_graph_input_attn_no_cache * llm_graph_context::build_attn_inp_no_cache() con inp->self_attn_mask_swa.raw = nullptr; } @@ -1756,7 +1766,7 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_attn_no_cache *) res->add_input(std::move(inp)); } -@@ -3428,6 +4477,7 @@ llm_graph_input_attn_kv * llm_graph_context::build_attn_inp_kv() const { +@@ -3452,6 +4506,7 @@ llm_graph_input_attn_kv * llm_graph_context::build_attn_inp_kv() const { const auto * mctx_cur = static_cast(mctx); auto inp = build_attn_inp_kv_impl(ctx0, ubatch, hparams, cparams, mctx_cur); @@ -1764,7 +1774,7 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_attn_kv *) res->add_input(std::move(inp)); } -@@ -3518,12 +4568,21 @@ ggml_tensor * llm_graph_context::build_attn( +@@ -3523,12 +4578,21 @@ ggml_tensor * llm_graph_context::build_attn( const auto & k_idxs = inp->get_k_idxs(); const auto & v_idxs = inp->get_v_idxs(); @@ -1788,7 +1798,7 @@ index a96577f11..7ac671d47 100644 } const auto & kq_mask = inp->self_attn_mask.raw; -@@ -3572,6 +4631,7 @@ llm_graph_input_attn_k * llm_graph_context::build_attn_inp_k() const { +@@ -3577,6 +4641,7 @@ llm_graph_input_attn_k * llm_graph_context::build_attn_inp_k() const { const auto * mctx_cur = static_cast(mctx); auto inp = build_attn_inp_k_impl(ctx0, ubatch, hparams, cparams, mctx_cur); @@ -1796,7 +1806,7 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_attn_k *) res->add_input(std::move(inp)); } -@@ -3602,7 +4662,9 @@ ggml_tensor * llm_graph_context::build_attn( +@@ -3606,7 +4671,9 @@ ggml_tensor * llm_graph_context::build_attn( { const auto & k_idxs = inp->get_k_idxs(); @@ -1807,7 +1817,7 @@ index a96577f11..7ac671d47 100644 } const auto & kq_mask = inp->self_attn_mask.raw; -@@ -3612,6 +4674,8 @@ ggml_tensor * llm_graph_context::build_attn( +@@ -3616,6 +4683,8 @@ ggml_tensor * llm_graph_context::build_attn( ggml_tensor * k = mctx_cur->get_k(ctx0, il); ggml_tensor * v = ggml_view_4d(ctx0, k, v_cur->ne[0], k->ne[1], k->ne[2], k->ne[3], k->nb[1], k->nb[2], k->nb[3], 0); @@ -1816,7 +1826,7 @@ index a96577f11..7ac671d47 100644 ggml_tensor * cur = build_attn_mha(q, k, v, kq_b, kq_mask, kv_rows, sinks, v_mla, 0, kq_scale, il); cb(cur, "kqv_out", il); -@@ -3717,6 +4781,7 @@ ggml_tensor * llm_graph_context::build_attn( +@@ -3720,6 +4789,7 @@ ggml_tensor * llm_graph_context::build_attn( kq_mask = inp->self_attn_mask_lid.raw; } @@ -1824,7 +1834,7 @@ index a96577f11..7ac671d47 100644 ggml_tensor * kq_mask_top_k = build_top_k_mask(kq_mask, top_k, il); ggml_tensor * q = q_cur; -@@ -3811,19 +4876,26 @@ static ggml_tensor * build_attn_iswa_impl( +@@ -3813,19 +4883,26 @@ static ggml_tensor * build_attn_iswa_impl( if (store_kv && k_cur) { const auto & k_idxs = is_swa ? inp->get_k_idxs_swa() : inp->get_k_idxs(); @@ -1850,10 +1860,10 @@ index a96577f11..7ac671d47 100644 + gctx.state_read(skippy_state_kind::kv_key, k, il); + gctx.state_read(skippy_state_kind::kv_value, v, il); + - ggml_tensor * cur = gctx.build_attn_mha(q, k, v, kq_b, kq_mask, kv_rows, sinks, v_mla, 0, kq_scale, il, bias_table, bias_indices); - cur = build_attn_scale_kv_output(ctx0, mctx_cur, cur, il); + ggml_tensor * cur = gctx.build_attn_mha(q, k, v, kq_b, kq_mask, kv_rows, sinks, v_mla, 0, kq_scale, il, bias_table, bias_indices, + mctx_cur->get_k_scale(il), mctx_cur->get_v_scale(il)); gctx.cb(cur, "kqv_out", il); -@@ -3907,7 +4979,9 @@ ggml_tensor * llm_graph_context::build_attn( +@@ -3907,7 +4984,9 @@ ggml_tensor * llm_graph_context::build_attn( if (k_cur) { const auto & k_idxs = is_swa ? inp->get_k_idxs_swa() : inp->get_k_idxs(); @@ -1864,7 +1874,7 @@ index a96577f11..7ac671d47 100644 } const auto & kq_mask = is_swa ? inp->self_attn_mask_swa.raw : inp->self_attn_mask.raw; -@@ -3918,6 +4992,8 @@ ggml_tensor * llm_graph_context::build_attn( +@@ -3918,6 +4997,8 @@ ggml_tensor * llm_graph_context::build_attn( ggml_tensor * k = mctx_cur->get_k(ctx0, il); ggml_tensor * v = ggml_view_4d(ctx0, k, v_cur->ne[0], k->ne[1], k->ne[2], k->ne[3], k->nb[1], k->nb[2], k->nb[3], 0); @@ -1873,7 +1883,7 @@ index a96577f11..7ac671d47 100644 ggml_tensor * cur = build_attn_mha(q, k, v, kq_b, kq_mask, kv_rows, sinks, v_mla, 0, kq_scale, il); cb(cur, "kqv_out", il); -@@ -4025,6 +5101,8 @@ llm_graph_input_attn_k_dsa * llm_graph_context::build_attn_inp_k_dsa() const { +@@ -4024,6 +5105,8 @@ llm_graph_input_attn_k_dsa * llm_graph_context::build_attn_inp_k_dsa() const { auto inp = build_attn_inp_k_dsa_impl(ctx0, ubatch, hparams, cparams, mctx_cur); @@ -1882,7 +1892,7 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_attn_k_dsa *) res->add_input(std::move(inp)); } -@@ -4041,6 +5119,7 @@ llm_graph_input_attn_k_dsa_iswa * llm_graph_context::build_attn_inp_k_dsa_iswa() +@@ -4040,6 +5123,7 @@ llm_graph_input_attn_k_dsa_iswa * llm_graph_context::build_attn_inp_k_dsa_iswa() inp_swa->self_attn_mask.raw = build_attn_inp_kq_mask(ctx0, mctx_cur->get_swa(), ubatch, cparams); auto inp = std::make_unique(std::move(inp_dsa), std::move(inp_swa), mctx_cur); @@ -1890,7 +1900,7 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_attn_k_dsa_iswa *) res->add_input(std::move(inp)); } -@@ -4069,6 +5148,8 @@ llm_graph_input_attn_kv_msa * llm_graph_context::build_attn_inp_kv_msa(bool msa_ +@@ -4068,6 +5152,8 @@ llm_graph_input_attn_kv_msa * llm_graph_context::build_attn_inp_kv_msa(bool msa_ inp->self_k_idxs_idx = mctx_idx->build_input_k_idxs(ctx0, ubatch); } @@ -1899,7 +1909,7 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_attn_kv_msa *) res->add_input(std::move(inp)); } -@@ -4102,6 +5183,8 @@ llm_graph_input_attn_kv_iswa * llm_graph_context::build_attn_inp_kv_iswa() const +@@ -4101,6 +5187,8 @@ llm_graph_input_attn_kv_iswa * llm_graph_context::build_attn_inp_kv_iswa() const inp->self_k_rot_swa = mctx_cur->get_swa()->get_k_rot(); inp->self_v_rot_swa = mctx_cur->get_swa()->get_v_rot(); @@ -1908,7 +1918,7 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_attn_kv_iswa *) res->add_input(std::move(inp)); } -@@ -4128,31 +5211,16 @@ llm_graph_input_attn_k_iswa * llm_graph_context::build_attn_inp_k_iswa() const { +@@ -4127,31 +5215,16 @@ llm_graph_input_attn_k_iswa * llm_graph_context::build_attn_inp_k_iswa() const { inp->self_k_rot_swa = mctx_cur->get_swa()->get_k_rot(); @@ -1926,14 +1936,14 @@ index a96577f11..7ac671d47 100644 - const int64_t n_stream = mctx_cur->get_csa_plan(ubatch).n_stream; - - GGML_ASSERT(hparams.swa_type != LLAMA_SWA_TYPE_NONE && "DSV4 expects SWA raw cache"); -- ++ auto inp = llm_graph_input_dsv4_create(ctx0, hparams, cparams, ubatch, mctx_cur); + - inp_raw->self_k_idxs = raw_ctx->build_input_k_idxs(ctx0, ubatch); - inp_raw->self_attn_mask.raw = dsv4_build_raw_kq_mask(ctx0, raw_ctx, ubatch, cparams, n_stream); - - inp_raw->self_k_rot = raw_ctx->get_k_rot(); - auto inp = std::make_unique(cparams, std::move(inp_raw), mctx_cur); -+ auto inp = llm_graph_input_dsv4_create(ctx0, hparams, cparams, ubatch, mctx_cur); - +- - dsv4_build_comp_inputs(ctx0, inp->inp_csa, mctx_cur->get_csa_plan(ubatch), "csa", cparams, n_stream); - dsv4_build_comp_inputs(ctx0, inp->inp_hca, mctx_cur->get_hca_plan(ubatch), "hca", cparams, n_stream); - dsv4_build_comp_inputs(ctx0, inp->inp_lid, mctx_cur->get_lid_plan(ubatch), "lid", cparams, n_stream); @@ -1944,12 +1954,12 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_dsv4 *) res->add_input(std::move(inp)); } -@@ -4168,14 +5236,37 @@ ggml_tensor * llm_graph_context::build_rs( - uint32_t rs_size, - int32_t rs_zero, - const llm_graph_get_rows_fn & get_state_rows) const { +@@ -4169,14 +5242,39 @@ ggml_tensor * llm_graph_context::build_rs( + const llm_graph_get_rows_fn & get_state_rows, + bool in_place, + bool from_cache) const { + return build_rs_impl(s, state_copy, state_copy_main, state_size, n_seqs, -+ n_rs, rs_head, rs_size, rs_zero, get_state_rows, nullptr, -1); ++ n_rs, rs_head, rs_size, rs_zero, get_state_rows, in_place, from_cache, nullptr, -1); +} + +ggml_tensor * llm_graph_context::build_rs_impl( @@ -1963,6 +1973,8 @@ index a96577f11..7ac671d47 100644 + uint32_t rs_size, + int32_t rs_zero, + const llm_graph_get_rows_fn & get_state_rows, ++ bool in_place, ++ bool from_cache, + const skippy_state_kind * kind, int il) const { GGML_UNUSED(rs_size); @@ -1983,7 +1995,7 @@ index a96577f11..7ac671d47 100644 // copy states // NOTE: assuming the copy destinations are ALL contained between rs_head and rs_head + n_rs -@@ -4192,10 +5283,12 @@ ggml_tensor * llm_graph_context::build_rs( +@@ -4206,10 +5304,12 @@ ggml_tensor * llm_graph_context::build_rs( // copy extra states which won't be changed further (between n_seqs and n_rs) ggml_tensor * states_extra = ggml_view_2d(ctx0, states_all, state_size, n_rs - n_seqs, states_all->nb[1], (n_seqs - i0)*states_all->nb[1]); @@ -2000,7 +2012,7 @@ index a96577f11..7ac671d47 100644 return output_states; } -@@ -4254,6 +5347,7 @@ llm_graph_input_rs * llm_graph_context::build_rs_inp() const { +@@ -4271,6 +5371,7 @@ llm_graph_input_rs * llm_graph_context::build_rs_inp() const { const auto * mctx_cur = static_cast(mctx); auto inp = build_rs_inp_impl(ctx0, ubatch, hparams, cparams, mctx_cur); @@ -2008,8 +2020,8 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_rs *) res->add_input(std::move(inp)); } -@@ -4275,6 +5369,72 @@ ggml_tensor * llm_graph_context::build_rs( - get_state_rows); +@@ -4299,6 +5400,72 @@ ggml_tensor * llm_graph_context::build_rs( + get_state_rows, in_place, from_cache); } +void llm_graph_context::build_conv_state_store( @@ -2081,7 +2093,7 @@ index a96577f11..7ac671d47 100644 void llm_graph_context::build_conv_state_store( llm_graph_input_rs * inp, ggml_tensor * s, -@@ -4336,6 +5496,22 @@ void llm_graph_context::build_conv_state_store( +@@ -4360,6 +5527,29 @@ void llm_graph_context::build_conv_state_store( ggml_build_forward_expand(gf, ggml_set_rows(ctx0, slots, windows, slot_order)); } @@ -2091,20 +2103,27 @@ index a96577f11..7ac671d47 100644 + int32_t state_size, + int32_t n_seqs, + skippy_state_kind kind, int il, -+ const llm_graph_get_rows_fn & get_state_rows) const { ++ const llm_graph_get_rows_fn & get_state_rows, ++ bool gathered) const { + const auto * kv_state = inp->mctx; ++ ++ const bool in_place = inp->rs_in_place && !get_state_rows && !gathered; ++ // read the gathered states directly: a cache move would add an unregistered write between registered writes ++ const bool from_cache = false; ++ GGML_ASSERT(get_state_rows || !from_cache || s->type == GGML_TYPE_F32); ++ + // the state kinds registered by this overload follow the same gather the plain overload uses -+ ggml_tensor * state_copy = get_state_rows ? inp->s_copy_tail : inp->s_copy; ++ ggml_tensor * state_copy = get_state_rows ? inp->s_copy_tail : from_cache ? inp->s_copy_rows : inp->s_copy; + + return build_rs_impl(s, state_copy, inp->s_copy_main, state_size, n_seqs, + kv_state->get_n_rs(), kv_state->get_head(), kv_state->get_size(), kv_state->get_rs_z(), -+ get_state_rows, &kind, il); ++ get_state_rows, in_place, from_cache, &kind, il); +} + ggml_tensor * llm_graph_context::build_rwkv_token_shift_load( llm_graph_input_rs * inp, const llama_ubatch & ubatch, -@@ -4350,7 +5526,7 @@ ggml_tensor * llm_graph_context::build_rwkv_token_shift_load( +@@ -4374,7 +5564,7 @@ ggml_tensor * llm_graph_context::build_rwkv_token_shift_load( ggml_tensor * token_shift = build_rs( inp, token_shift_all, @@ -2113,7 +2132,7 @@ index a96577f11..7ac671d47 100644 token_shift = ggml_reshape_3d(ctx0, token_shift, hparams.n_embd, token_shift_count, n_seqs); -@@ -4370,11 +5546,14 @@ ggml_tensor * llm_graph_context::build_rwkv_token_shift_store( +@@ -4394,11 +5584,14 @@ ggml_tensor * llm_graph_context::build_rwkv_token_shift_store( const auto kv_head = mctx_cur->get_head(); @@ -2133,7 +2152,7 @@ index a96577f11..7ac671d47 100644 } llm_graph_input_mem_hybrid * llm_graph_context::build_inp_mem_hybrid() const { -@@ -4382,6 +5561,8 @@ llm_graph_input_mem_hybrid * llm_graph_context::build_inp_mem_hybrid() const { +@@ -4406,6 +5599,8 @@ llm_graph_input_mem_hybrid * llm_graph_context::build_inp_mem_hybrid() const { auto inp_rs = build_rs_inp_impl (ctx0, ubatch, hparams, cparams, mctx_cur->get_recr()); auto inp_attn = build_attn_inp_kv_impl(ctx0, ubatch, hparams, cparams, mctx_cur->get_attn()); @@ -2142,7 +2161,7 @@ index a96577f11..7ac671d47 100644 auto inp = std::make_unique(cparams, std::move(inp_attn), std::move(inp_rs), mctx_cur); -@@ -4393,6 +5574,8 @@ llm_graph_input_mem_hybrid_k * llm_graph_context::build_inp_mem_hybrid_k() const +@@ -4417,6 +5612,8 @@ llm_graph_input_mem_hybrid_k * llm_graph_context::build_inp_mem_hybrid_k() const auto inp_rs = build_rs_inp_impl (ctx0, ubatch, hparams, cparams, mctx_cur->get_recr()); auto inp_attn = build_attn_inp_k_impl(ctx0, ubatch, hparams, cparams, mctx_cur->get_attn()); @@ -2151,7 +2170,7 @@ index a96577f11..7ac671d47 100644 auto inp = std::make_unique(cparams, std::move(inp_attn), std::move(inp_rs), mctx_cur); -@@ -4430,6 +5613,7 @@ llm_graph_input_mem_hybrid_iswa * llm_graph_context::build_inp_mem_hybrid_iswa() +@@ -4454,6 +5651,7 @@ llm_graph_input_mem_hybrid_iswa * llm_graph_context::build_inp_mem_hybrid_iswa() inp_attn->self_v_rot_swa = attn_ctx->get_swa()->get_v_rot(); auto inp = std::make_unique(cparams, std::move(inp_attn), std::move(inp_rs), mctx_cur); @@ -2159,7 +2178,7 @@ index a96577f11..7ac671d47 100644 return (llm_graph_input_mem_hybrid_iswa *) res->add_input(std::move(inp)); } -@@ -4467,6 +5651,7 @@ llm_graph_input_mem_hybrid_iswa_rel * llm_graph_context::build_inp_mem_hybrid_is +@@ -4491,6 +5689,7 @@ llm_graph_input_mem_hybrid_iswa_rel * llm_graph_context::build_inp_mem_hybrid_is inp_attn->self_v_rot_swa = attn_ctx->get_swa()->get_v_rot(); auto inp = std::make_unique(cparams, std::move(inp_attn), std::move(inp_rs), mctx_cur, extent, extent_swa); @@ -2168,7 +2187,7 @@ index a96577f11..7ac671d47 100644 inp->self_rel_pos = ggml_new_tensor_2d(ctx0, GGML_TYPE_I32, attn_ctx->get_base()->get_n_kv(), ubatch.n_tokens); ggml_set_input(inp->self_rel_pos); diff --git a/src/llama-graph.h b/src/llama-graph.h -index 682e255bd..e1cc92a17 100644 +index c7488ff29cd14c4cf7df3cebcd42ca0086d8ed9c..60ae9769df9cedf980d5f759045e631ac08d522f 100644 --- a/src/llama-graph.h +++ b/src/llama-graph.h @@ -5,11 +5,17 @@ @@ -2189,7 +2208,7 @@ index 682e255bd..e1cc92a17 100644 #include #include -@@ -38,6 +44,67 @@ class llama_memory_recurrent_context; +@@ -39,6 +45,67 @@ class llama_memory_recurrent_context; class llama_memory_hybrid_context; class llama_memory_hybrid_iswa_context; @@ -2257,7 +2276,7 @@ index 682e255bd..e1cc92a17 100644 // certain models (typically multi-modal) can produce different types of graphs enum llm_graph_type { LLM_GRAPH_TYPE_DEFAULT, -@@ -113,6 +180,10 @@ public: +@@ -114,6 +181,10 @@ public: virtual ~llm_graph_input_i() = default; @@ -2268,7 +2287,7 @@ index 682e255bd..e1cc92a17 100644 virtual void set_input(const llama_ubatch * ubatch) = 0; // Persistent context data outside llama_memory is not preserved by any -@@ -136,7 +207,9 @@ using llm_graph_input_ptr = std::unique_ptr; +@@ -137,7 +208,9 @@ using llm_graph_input_ptr = std::unique_ptr; class llm_graph_input_embd : public llm_graph_input_i { public: @@ -2279,7 +2298,7 @@ index 682e255bd..e1cc92a17 100644 virtual ~llm_graph_input_embd() = default; void set_input(const llama_ubatch * ubatch) override; -@@ -164,6 +237,8 @@ public: +@@ -165,6 +238,8 @@ public: void set_input(const llama_ubatch * ubatch) override; @@ -2288,7 +2307,7 @@ index 682e255bd..e1cc92a17 100644 bool can_reuse(const llm_graph_params & params) override; ggml_tensor * tokens = nullptr; // I32 [n_batch] -@@ -173,6 +248,9 @@ public: +@@ -174,6 +249,9 @@ public: const int64_t n_embd = 0; const int64_t n_embd_state = 0; @@ -2298,7 +2317,7 @@ index 682e255bd..e1cc92a17 100644 }; // original batch index of each ubatch token, used as set_rows destination rows -@@ -694,6 +772,13 @@ public: +@@ -701,6 +779,13 @@ public: const llama_kv_cache_dsv4_context * mctx; }; @@ -2312,7 +2331,7 @@ index 682e255bd..e1cc92a17 100644 class llm_graph_input_attn_cross : public llm_graph_input_i { public: llm_graph_input_attn_cross(const llama_cross * cross) : cross(cross) {} -@@ -886,6 +971,11 @@ struct llm_graph_params { +@@ -894,6 +979,11 @@ struct llm_graph_params { std::map samplers; @@ -2324,7 +2343,7 @@ index 682e255bd..e1cc92a17 100644 static bool samplers_equal( const std::map & lhs, const std::map & rhs) { -@@ -948,6 +1038,12 @@ struct llm_graph_params { +@@ -956,6 +1046,12 @@ struct llm_graph_params { return false; } @@ -2337,7 +2356,7 @@ index 682e255bd..e1cc92a17 100644 if (!samplers_equal(samplers, other.samplers)) { return false; } -@@ -980,6 +1076,7 @@ struct llm_graph_params { +@@ -988,6 +1084,7 @@ struct llm_graph_params { layer_inp_src == other.layer_inp_src && h_nextn_dev == other.h_nextn_dev && h_nextn_src == other.h_nextn_src && @@ -2345,7 +2364,7 @@ index 682e255bd..e1cc92a17 100644 model == other.model && gtype == other.gtype && cvec == other.cvec && -@@ -994,6 +1091,23 @@ struct llm_graph_fused_node { +@@ -1002,6 +1099,23 @@ struct llm_graph_fused_node { int il; }; @@ -2369,7 +2388,7 @@ index 682e255bd..e1cc92a17 100644 class llm_graph_result { public: llm_graph_result(int64_t max_nodes); -@@ -1005,6 +1119,26 @@ public: +@@ -1013,6 +1127,26 @@ public: ggml_tensor * get_embd() const { return t_embd; } ggml_tensor * get_embd_pooled() const { return t_embd_pooled; } ggml_tensor * get_h_nextn() const { return t_h_nextn; } @@ -2396,7 +2415,7 @@ index 682e255bd..e1cc92a17 100644 ggml_tensor * get_layer_inp(int il) const { return t_layer_inp[il]; } -@@ -1017,6 +1151,8 @@ public: +@@ -1025,6 +1159,8 @@ public: void reset(); @@ -2405,7 +2424,7 @@ index 682e255bd..e1cc92a17 100644 void set_inputs(const llama_ubatch * ubatch); void set_outputs(const llm_graph_params & params); -@@ -1037,6 +1173,18 @@ public: +@@ -1045,6 +1181,18 @@ public: const std::vector & get_fused_nodes() const { return fused_nodes; } @@ -2424,7 +2443,7 @@ index 682e255bd..e1cc92a17 100644 void set_params(const llm_graph_params & params); // important graph nodes -@@ -1046,6 +1194,8 @@ public: +@@ -1054,6 +1202,8 @@ public: ggml_tensor * t_embd = nullptr; ggml_tensor * t_embd_pooled = nullptr; ggml_tensor * t_h_nextn = nullptr; // [n_embd, n_outputs] hidden state before final output norm @@ -2433,7 +2452,7 @@ index 682e255bd..e1cc92a17 100644 std::vector t_layer_inp; -@@ -1061,6 +1211,13 @@ public: +@@ -1069,6 +1219,13 @@ public: std::vector inputs; std::vector fused_nodes; @@ -2447,7 +2466,7 @@ index 682e255bd..e1cc92a17 100644 std::map, ggml_tensor *> hdmd_inputs; -@@ -1164,6 +1321,8 @@ struct llm_graph_context { +@@ -1173,6 +1330,8 @@ struct llm_graph_context { const llm_graph_cb & cb_func; @@ -2456,7 +2475,7 @@ index 682e255bd..e1cc92a17 100644 llm_graph_result * res; ggml_context * ctx0 = nullptr; -@@ -1184,6 +1343,31 @@ struct llm_graph_context { +@@ -1193,6 +1352,31 @@ struct llm_graph_context { return inp_out_ids != nullptr && cparams.embeddings_nextn && !cparams.embeddings_nextn_masked; } @@ -2488,17 +2507,18 @@ index 682e255bd..e1cc92a17 100644 // // common // -@@ -1202,7 +1386,8 @@ struct llm_graph_context { +@@ -1213,7 +1397,9 @@ struct llm_graph_context { + // do mat_mul, while optionally apply lora and the weight scale ggml_tensor * build_lora_mm( ggml_tensor * w, - ggml_tensor * cur, -- ggml_tensor * w_s = nullptr) const; +- ggml_tensor * cur) const; ++ ggml_tensor * cur, + ggml_tensor * w_s = nullptr, + enum ggml_prec prec = GGML_PREC_UNDEFINED) const; - // do mat_mul_id, while optionally apply lora and per-expert scale + // do mat_mul_id, while optionally apply lora and the weight scale // if slots is set, the experts are selected by slots instead of ids, from the MoE cache if cached (see llama_moe_cache::build_lookup) -@@ -1212,6 +1397,13 @@ struct llm_graph_context { +@@ -1223,6 +1409,13 @@ struct llm_graph_context { ggml_tensor * ids, ggml_tensor * slots = nullptr, bool cached = true) const; @@ -2512,7 +2532,7 @@ index 682e255bd..e1cc92a17 100644 // rescale `cur` (the src1 of a matmul) by a power of two, computed from its maximum absolute // keep both individual values and Q8 activation block sums within F16 range -@@ -1311,12 +1503,64 @@ struct llm_graph_context { +@@ -1319,12 +1512,64 @@ struct llm_graph_context { ggml_tensor * post_exp_norm = nullptr, float post_exp_norm_eps = 1e-5f) const; @@ -2578,9 +2598,9 @@ index 682e255bd..e1cc92a17 100644 // the state input of an MTP graph: rows of the h_nextn device buffer of ctx_state_src (see llama_set_ctx_state_src()), // or uploaded from ubatch.embd_state -@@ -1514,6 +1758,19 @@ struct llm_graph_context { - int32_t rs_zero, - const llm_graph_get_rows_fn & get_state_rows = nullptr) const; +@@ -1520,6 +1765,21 @@ struct llm_graph_context { + bool in_place = false, + bool from_cache = true) const; + ggml_tensor * build_rs_impl( + ggml_tensor * s, @@ -2593,12 +2613,14 @@ index 682e255bd..e1cc92a17 100644 + uint32_t rs_size, + int32_t rs_zero, + const llm_graph_get_rows_fn & get_state_rows, ++ bool in_place, ++ bool from_cache, + const skippy_state_kind * kind, int il) const; + llm_graph_input_rs * build_rs_inp() const; - ggml_tensor * build_rs( -@@ -1525,12 +1782,27 @@ struct llm_graph_context { + // the returned states can be a view of the cache, so callers must follow 2 rules: +@@ -1535,12 +1795,28 @@ struct llm_graph_context { // store the conv history of the ubatch cells, the last n_cols columns of conv_x {n_cols + n_seq_tokens, channels, n_seqs}, // at byte offset offs of each row of s, and with n_rs_seq > 0 once per rollback slot of this ubatch @@ -2622,15 +2644,16 @@ index 682e255bd..e1cc92a17 100644 + int32_t state_size, + int32_t n_seqs, + skippy_state_kind kind, int il, -+ const llm_graph_get_rows_fn & get_state_rows = ggml_get_rows) const; ++ const llm_graph_get_rows_fn & get_state_rows = nullptr, ++ bool gathered = false) const; ggml_tensor * build_rwkv_token_shift_load( llm_graph_input_rs * inp, diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index 1c7d892bd..1a8ceeb63 100644 +index 9c49fc71690ce9bbc51fa577dd7c8229e5884611..8d1e65c6d13dda36a1ca3312400b556face77afc 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp -@@ -3453,24 +3453,6 @@ void llama_kv_cache::set_input_pos_rel_flat(ggml_tensor * dst, const llama_ubatc +@@ -3449,24 +3449,6 @@ void llama_kv_cache::set_input_pos_rel_flat(ggml_tensor * dst, const llama_ubatc } } @@ -2656,7 +2679,7 @@ index 1c7d892bd..1a8ceeb63 100644 // M-RoPE needs the 2D position, the PLE / Engram n-gram hashes need the token id return hparams.n_pos_per_embd() > 1 || hparams.ple_n_heads > 0; diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index bc29bfd60..0d683ec3e 100644 +index bc29bfd608e724630ebbf5edc44a439a1cd3968e..0d683ec3e0630c7e3f353837686216752ab7ee71 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -310,6 +310,10 @@ public: @@ -2679,7 +2702,7 @@ index bc29bfd60..0d683ec3e 100644 // see llama_kv_cache::get_prev_tokens() void get_prev_tokens(const llama_ubatch & ubatch, uint32_t n, std::vector & res) const; diff --git a/src/models/bailingmoe3.cpp b/src/models/bailingmoe3.cpp -index 20d940ca3..30dcf61c3 100644 +index 112ad927617b82b9c157a1e19f785129fc44e286..06295e71b6fad4e07c6599e1205a3dedbcc4004a 100644 --- a/src/models/bailingmoe3.cpp +++ b/src/models/bailingmoe3.cpp @@ -184,7 +184,7 @@ ggml_tensor * llama_model_bailingmoe3::graph::build_causal_conv1d( @@ -2691,7 +2714,7 @@ index 20d940ca3..30dcf61c3 100644 } ggml_tensor * conv_weight = ggml_reshape_2d(ctx0, conv_w, d_conv, d_inner); -@@ -234,7 +234,7 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : +@@ -235,7 +235,7 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : if (hparams.is_recr(il)) { const auto * mctx_cur = inp_rs->mctx; ggml_tensor * conv_states_all = mctx_cur->get_r_l(il); @@ -2700,7 +2723,7 @@ index 20d940ca3..30dcf61c3 100644 ggml_tensor * q = build_causal_conv1d( inp_rs, conv_states_all, conv_state_all, 0, cur, layer.wq, layer.ssm_q_conv, -@@ -261,7 +261,7 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : +@@ -262,7 +262,7 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : k = build_gdn_l2_norm(ctx0, k, hparams.f_norm_rms_eps); ggml_tensor * states_all = mctx_cur->get_s_l(il); @@ -2708,29 +2731,29 @@ index 20d940ca3..30dcf61c3 100644 + ggml_tensor * state = build_rs(inp_rs, states_all, hparams.n_embd_s(), n_seqs, skippy_state_kind::recurrent_ssm, il); state = ggml_reshape_4d(ctx0, state, head_dim, head_dim, n_head, n_seqs); - ggml_tensor * out = ggml_cont(ctx0, build_recurrent_attn( -@@ -322,7 +322,8 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : + ggml_tensor * out = build_recurrent_attn( +@@ -323,7 +323,8 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : attn_gate = ggml_sigmoid(ctx0, ggml_reshape_3d(ctx0, attn_gate, 1, n_head, n_tokens)); cur = ggml_reshape_3d(ctx0, cur, v_head_dim, n_head, n_tokens); cur = ggml_mul(ctx0, cur, attn_gate); -- cur = ggml_mul_mat(ctx0, layer.wo, ggml_cont_2d(ctx0, cur, v_head_dim * n_head, n_tokens)); +- cur = build_lora_mm(layer.wo, ggml_reshape_2d(ctx0, cur, v_head_dim * n_head, n_tokens)); + cur = ggml_cont_2d(ctx0, cur, v_head_dim * n_head, n_tokens); + cur = ggml_mul_mat(ctx0, layer.wo, cur); cb(cur, "mla_out", il); } -@@ -475,7 +476,8 @@ llama_model_bailingmoe3::graph_mtp::graph_mtp(const llm_graph_params & params) : +@@ -476,7 +477,8 @@ llama_model_bailingmoe3::graph_mtp::graph_mtp(const llm_graph_params & params) : attn_gate = ggml_sigmoid(ctx0, ggml_reshape_3d(ctx0, attn_gate, 1, n_head, n_tokens)); cur = ggml_reshape_3d(ctx0, cur, v_head_dim, n_head, n_tokens); cur = ggml_mul(ctx0, cur, attn_gate); -- cur = ggml_mul_mat(ctx0, layer.wo, ggml_cont_2d(ctx0, cur, v_head_dim * n_head, n_tokens)); +- cur = build_lora_mm(layer.wo, ggml_cont_2d(ctx0, cur, v_head_dim * n_head, n_tokens)); + cur = ggml_cont_2d(ctx0, cur, v_head_dim * n_head, n_tokens); -+ cur = ggml_mul_mat(ctx0, layer.wo, cur); ++ cur = ggml_mul_mat(ctx0, layer.wo, cur); ggml_tensor * ffn_inp = ggml_add(ctx0, cur, inpSA); cur = build_norm(ffn_inp, layer.ffn_norm, nullptr, LLM_NORM_RMS, il); diff --git a/src/models/bitnet.cpp b/src/models/bitnet.cpp -index caee27a3d..269028f5f 100644 +index 5c2145a4fb3fb8d2fdad9940789b77cc15a36b59..981c2ee474ea4db65d4bc3ac721bc2d9c4a21615 100644 --- a/src/models/bitnet.cpp +++ b/src/models/bitnet.cpp @@ -16,6 +16,7 @@ void llama_model_bitnet::load_arch_tensors(llama_model_loader &) { @@ -2741,7 +2764,7 @@ index caee27a3d..269028f5f 100644 for (int i = 0; i < n_layer; ++i) { auto & layer = layers[i]; -@@ -151,8 +152,7 @@ llama_model_bitnet::graph::graph(const llm_graph_params & params) : llm_graph_co +@@ -144,8 +145,7 @@ llama_model_bitnet::graph::graph(const llm_graph_params & params) : llm_graph_co res->t_embd = cur; // lm_head @@ -2752,7 +2775,7 @@ index caee27a3d..269028f5f 100644 cb(cur, "result_output", -1); res->t_logits = cur; diff --git a/src/models/chameleon.cpp b/src/models/chameleon.cpp -index ab16927c7..23402da4a 100644 +index 599890705969f595cad8027710f56bd228149fa2..9dc6644d24c063ec8a36f497813bfc5794374315 100644 --- a/src/models/chameleon.cpp +++ b/src/models/chameleon.cpp @@ -176,17 +176,20 @@ llama_model_chameleon::graph::graph(const llm_graph_params & params) : llm_graph @@ -2788,7 +2811,7 @@ index ab16927c7..23402da4a 100644 cb(cur, "result_output", -1); res->t_logits = cur; diff --git a/src/models/deepseek32.cpp b/src/models/deepseek32.cpp -index 8f6f34790..314e6d3dd 100644 +index 0f22161ec5863fae55bdac321c7db28dd512366a..522dd68e56544f583b7bdbb200fe08bc434d0ebb 100644 --- a/src/models/deepseek32.cpp +++ b/src/models/deepseek32.cpp @@ -200,6 +200,8 @@ llama_model_deepseek32::graph::graph(const llm_graph_params & params) : @@ -2800,7 +2823,7 @@ index 8f6f34790..314e6d3dd 100644 for (int il = 0; il < n_layer; ++il) { ggml_tensor * inpSA = inpL; -@@ -217,8 +219,15 @@ llama_model_deepseek32::graph::graph(const llm_graph_params & params) : +@@ -217,9 +219,16 @@ llama_model_deepseek32::graph::graph(const llm_graph_params & params) : ggml_tensor * top_k = nullptr; @@ -2813,10 +2836,12 @@ index 8f6f34790..314e6d3dd 100644 + // lightning indexer - { +- ggml_tensor * indexer_q = build_lora_mm(model.layers[il].indexer_attn_q_b, qr); + if (has_indexer) { - ggml_tensor * indexer_q = ggml_mul_mat(ctx0, model.layers[il].indexer_attn_q_b, qr); ++ ggml_tensor * indexer_q = ggml_mul_mat(ctx0, model.layers[il].indexer_attn_q_b, qr); cb(indexer_q, "indexer_q", il); + // {n_embd_indexer_head, n_indexer_head, n_tokens} @@ -272,6 +281,11 @@ llama_model_deepseek32::graph::graph(const llm_graph_params & params) : uint32_t n_top_k = indexer_score->ne[0] < n_indexer_top_k ? indexer_score->ne[0] : n_indexer_top_k; top_k = ggml_cont(ctx0, ggml_top_k(ctx0, indexer_score, n_top_k)); @@ -2828,9 +2853,9 @@ index 8f6f34790..314e6d3dd 100644 + cb(top_k, "top_k_shared", il); } - ggml_tensor * q = ggml_mul_mat(ctx0, model.layers[il].wq_b, qr); + ggml_tensor * q = build_lora_mm(model.layers[il].wq_b, qr); diff --git a/src/models/deepseek4.cpp b/src/models/deepseek4.cpp -index f4269e043..6f7b00f3b 100644 +index fb7fb304813704221d9bfa3ad99d5a0178206f6e..7fc139050734338fa4073f7af9d442fec681b268 100644 --- a/src/models/deepseek4.cpp +++ b/src/models/deepseek4.cpp @@ -12,7 +12,8 @@ void llama_model_deepseek4::load_arch_hparams(llama_model_loader & ml) { @@ -2925,7 +2950,7 @@ index f4269e043..6f7b00f3b 100644 cur = build_hc_head(inpL, model.hc_head_fn, model.hc_head_scale, model.hc_head_base); cb(cur, "mtp_hc_head", -1); diff --git a/src/models/delta-net-base.cpp b/src/models/delta-net-base.cpp -index f71e7fddd..bc5921fab 100644 +index 4ea6fb757d90f1e78882fd4a2d170dab35d84a8a..692a320ee144df1e1a5551552970a5e104654034 100644 --- a/src/models/delta-net-base.cpp +++ b/src/models/delta-net-base.cpp @@ -63,7 +63,7 @@ ggml_tensor * llm_build_delta_net_base::build_conv_state( @@ -2955,16 +2980,16 @@ index f71e7fddd..bc5921fab 100644 } GGML_ASSERT(hist_rows->ne[0] == conv_states_all->ne[0] && hist_rows->ne[1] == n_seqs); -@@ -235,7 +235,7 @@ ggml_tensor * llm_build_delta_net_base::build_recurrent_attn_replay( - ggml_tensor * cgb = ggml_reshape_4d(ctx0, spgb, g0, H_v, 2*n_pend, spgb->ne[1]); +@@ -236,7 +236,7 @@ ggml_tensor * llm_build_delta_net_base::build_recurrent_attn_replay( const auto gather = [&](ggml_tensor * rows, ggml_tensor * c) { -- return ggml_reshape_4d(ctx0, build_rs(inp, rows, rows->ne[0], n_seqs), c->ne[0], c->ne[1], c->ne[2], n_seqs); -+ return ggml_reshape_4d(ctx0, build_rs(inp, rows, rows->ne[0], n_seqs, skippy_state_kind::recurrent_ssm, il), c->ne[0], c->ne[1], c->ne[2], n_seqs); + // the gdn op can store the new inputs into these rows while it replays them, so it reads a copy +- return ggml_reshape_4d(ctx0, build_rs(inp, rows, rows->ne[0], n_seqs, nullptr, true), c->ne[0], c->ne[1], c->ne[2], n_seqs); ++ return ggml_reshape_4d(ctx0, build_rs(inp, rows, rows->ne[0], n_seqs, skippy_state_kind::recurrent_ssm, il, nullptr, true), c->ne[0], c->ne[1], c->ne[2], n_seqs); }; ggml_tensor * pk = gather(spk, ck); -@@ -309,10 +309,11 @@ ggml_tensor * llm_build_delta_net_base::build_recurrent_attn( +@@ -310,10 +310,11 @@ ggml_tensor * llm_build_delta_net_base::build_recurrent_attn( cb(output, "attn_output", il); cb(new_state, "new_state", il); @@ -2981,7 +3006,7 @@ index f71e7fddd..bc5921fab 100644 return output; } diff --git a/src/models/gemma4.cpp b/src/models/gemma4.cpp -index 491ef1283..0e1e68087 100644 +index 2af261dd052e01afdc44c27b6aad0dde51b72e05..3f0e604cd71631c17f9b23cf126f2c02d5bf0afd 100644 --- a/src/models/gemma4.cpp +++ b/src/models/gemma4.cpp @@ -114,8 +114,9 @@ void llama_model_gemma4::load_arch_tensors(llama_model_loader &) { @@ -2989,7 +3014,7 @@ index 491ef1283..0e1e68087 100644 // MoE router + const std::string ffn_gate_inp_name = tn(LLM_TENSOR_FFN_GATE_INP, "weight", i).str(); - layer.ffn_gate_inp = create_tensor(tn(LLM_TENSOR_FFN_GATE_INP, "weight", i), {n_embd, n_expert}, TENSOR_NOT_REQUIRED); + layer.ffn_gate_inp = create_tensor(tn(LLM_TENSOR_FFN_GATE_INP, "weight", i), {n_embd, n_expert}, TENSOR_NOT_REQUIRED | TENSOR_NO_SCALE); - bool has_expert = layer.ffn_gate_inp != nullptr; + bool has_expert = layer.ffn_gate_inp != nullptr || ml->get_tensor_meta(ffn_gate_inp_name.c_str()) != nullptr; @@ -3012,7 +3037,7 @@ index 491ef1283..0e1e68087 100644 inp_per_layer = ggml_get_rows(ctx0, model.per_layer_tok_embd, inp->token0); diff --git a/src/models/glm-dsa.cpp b/src/models/glm-dsa.cpp -index c0ff62e4a..4528e2adc 100644 +index 5881933b2ced55eca1a91c42073467ac11a77c3c..998a8f98f870c2e9806d52c8647b2f355d0e492d 100644 --- a/src/models/glm-dsa.cpp +++ b/src/models/glm-dsa.cpp @@ -56,14 +56,77 @@ void llama_model_glm_dsa::load_arch_hparams(llama_model_loader & ml) { @@ -3106,10 +3131,10 @@ index c0ff62e4a..4528e2adc 100644 const uint32_t kv_lora_rank = hparams.n_lora_kv; diff --git a/src/models/glm4-moe.cpp b/src/models/glm4-moe.cpp -index a3e2fa46e..685448558 100644 +index 73de9cbea9bffc2e9bd460aa8d4732ed7d46cdad..e6b73f2ca4b6457466deeeabd7766384fcd87d96 100644 --- a/src/models/glm4-moe.cpp +++ b/src/models/glm4-moe.cpp -@@ -288,13 +288,8 @@ llama_model_glm4_moe::graph::graph(const llm_graph_params & params) : llm_graph_ +@@ -285,13 +285,8 @@ llama_model_glm4_moe::graph::graph(const llm_graph_params & params) : llm_graph_ ggml_tensor * cur; ggml_tensor * inpL; @@ -3126,7 +3151,7 @@ index a3e2fa46e..685448558 100644 // inp_pos - contains the positions ggml_tensor * inp_pos = build_inp_pos(); diff --git a/src/models/glm4.cpp b/src/models/glm4.cpp -index 5c50b2f05..12da79b38 100644 +index f2f9c2f57009befd6ee3c1840a463d575f2780b9..bf6f34af0044938a5c2eda0015cbb138173998be 100644 --- a/src/models/glm4.cpp +++ b/src/models/glm4.cpp @@ -77,13 +77,8 @@ llama_model_glm4::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -3146,7 +3171,7 @@ index 5c50b2f05..12da79b38 100644 // inp_pos - contains the positions ggml_tensor * inp_pos = build_inp_pos(); diff --git a/src/models/granite-swa.cpp b/src/models/granite-swa.cpp -index 2e2609f52..fcbeb5a70 100644 +index 021de4537613011f98b64b59a935792c7725fc87..0246e11365d7ee2adfb64768651b823c259fca73 100644 --- a/src/models/granite-swa.cpp +++ b/src/models/granite-swa.cpp @@ -53,7 +53,7 @@ void llama_model_granite_swa::load_arch_hparams(llama_model_loader & ml) { @@ -3186,29 +3211,29 @@ index 2e2609f52..fcbeb5a70 100644 + // For Granite MoE Shared - gate+up kept fused in ffn_up_shexp (see LLM_FFN_SWIGLU below) if (hparams.n_ff_shexp > 0) { - ggml_tensor * ffn_shexp = build_ffn(cur, -- model.layers[il].ffn_up_shexp, NULL, model.layers[il].ffn_up_shexp_s, -- NULL, NULL, NULL, -- model.layers[il].ffn_down_shexp, NULL, model.layers[il].ffn_down_shexp_s, +- model.layers[il].ffn_up_shexp, NULL, +- NULL, NULL, +- model.layers[il].ffn_down_shexp, NULL, - NULL, - LLM_FFN_SWIGLU, LLM_FFN_SEQ, il); + ggml_tensor * ffn_shexp = model.layers[il].ffn_gate_shexp != nullptr + ? build_ffn(cur, -+ model.layers[il].ffn_up_shexp, NULL, model.layers[il].ffn_up_shexp_s, -+ model.layers[il].ffn_gate_shexp, NULL, model.layers[il].ffn_gate_shexp_s, -+ model.layers[il].ffn_down_shexp, NULL, model.layers[il].ffn_down_shexp_s, ++ model.layers[il].ffn_up_shexp, NULL, ++ model.layers[il].ffn_gate_shexp, NULL, ++ model.layers[il].ffn_down_shexp, NULL, + NULL, + LLM_FFN_SILU, LLM_FFN_PAR, il) + : build_ffn(cur, -+ model.layers[il].ffn_up_shexp, NULL, model.layers[il].ffn_up_shexp_s, -+ NULL, NULL, NULL, -+ model.layers[il].ffn_down_shexp, NULL, model.layers[il].ffn_down_shexp_s, ++ model.layers[il].ffn_up_shexp, NULL, ++ NULL, NULL, ++ model.layers[il].ffn_down_shexp, NULL, + NULL, + LLM_FFN_SWIGLU, LLM_FFN_SEQ, il); cb(ffn_shexp, "ffn_shexp", il); cur = ggml_add(ctx0, moe_out, ffn_shexp); diff --git a/src/models/granite-switch.cpp b/src/models/granite-switch.cpp -index 53195c97c..a84743b7e 100644 +index f6f1906c651c2438e6a5af263413d42636ab55c0..cb9a2eaacbfe98fa612a51ef1f62631c7f6a01a0 100644 --- a/src/models/granite-switch.cpp +++ b/src/models/granite-switch.cpp @@ -22,8 +22,14 @@ void llama_model_granite_switch::load_arch_hparams(llama_model_loader & ml) { @@ -3307,7 +3332,7 @@ index 53195c97c..a84743b7e 100644 // embed the substituted ids directly; build_inp_embd would embed the raw tokens diff --git a/src/models/kimi-k3.cpp b/src/models/kimi-k3.cpp -index 846a48866..5ce5e5491 100644 +index 882c45811d92f48ba8cbf9a8187f853677adc229..be64d662a776293d9e55e4690e21fc983a28ac65 100644 --- a/src/models/kimi-k3.cpp +++ b/src/models/kimi-k3.cpp @@ -351,6 +351,35 @@ llama_model_kimi_k3::graph::graph(const llm_graph_params & params) : @@ -3352,11 +3377,11 @@ index 846a48866..5ce5e5491 100644 ggml_tensor * conv_states_all = mctx_cur->get_r_l(il); - ggml_tensor * conv_state_all = build_rs(inp_rs, conv_states_all, conv_states_all->ne[0], n_seqs); - -- ggml_tensor * Qcur = build_kda_conv1d(inp_rs, conv_states_all, conv_state_all, 0, ggml_mul_mat(ctx0, layer.wq, cur), +- ggml_tensor * Qcur = build_kda_conv1d(inp_rs, conv_states_all, conv_state_all, 0, build_lora_mm(layer.wq, cur), - layer.ssm_q_conv, d_conv, head_dim, n_head_kda, n_seq_tokens, n_seqs, il); -- ggml_tensor * Kcur = build_kda_conv1d(inp_rs, conv_states_all, conv_state_all, 1, ggml_mul_mat(ctx0, layer.wk, cur), +- ggml_tensor * Kcur = build_kda_conv1d(inp_rs, conv_states_all, conv_state_all, 1, build_lora_mm(layer.wk, cur), - layer.ssm_k_conv, d_conv, head_dim, n_head_kda, n_seq_tokens, n_seqs, il); -- ggml_tensor * Vcur = build_kda_conv1d(inp_rs, conv_states_all, conv_state_all, 2, ggml_mul_mat(ctx0, layer.wv, cur), +- ggml_tensor * Vcur = build_kda_conv1d(inp_rs, conv_states_all, conv_state_all, 2, build_lora_mm(layer.wv, cur), - layer.ssm_v_conv, d_conv, head_dim, n_head_kda, n_seq_tokens, n_seqs, il); + ggml_tensor * conv_state_all = build_rs(inp_rs, conv_states_all, conv_states_all->ne[0], n_seqs, skippy_state_kind::recurrent_conv, il); + @@ -3376,7 +3401,7 @@ index 846a48866..5ce5e5491 100644 const float eps_norm = hparams.f_norm_rms_eps; diff --git a/src/models/kimi-k31.cpp b/src/models/kimi-k31.cpp -index 049f667de..49e0c747e 100644 +index 62719ba15f3f1268a449cd198e0a925c401911fe..5cda968252d133b3e1c12e7afaa836c1d717b748 100644 --- a/src/models/kimi-k31.cpp +++ b/src/models/kimi-k31.cpp @@ -412,7 +412,7 @@ ggml_tensor * llama_model_kimi_k31::graph::build_kda_conv1d( @@ -3407,10 +3432,10 @@ index 049f667de..49e0c747e 100644 const float eps_norm = hparams.f_norm_rms_eps; diff --git a/src/models/kimi-linear.cpp b/src/models/kimi-linear.cpp -index 2190df8c9..ad454067e 100644 +index 81b147152c7e2d59f8557e7ff424d03eafd48256..778b39143ee7a963d498f9f6893d86b06ea0e2ac 100644 --- a/src/models/kimi-linear.cpp +++ b/src/models/kimi-linear.cpp -@@ -206,13 +206,13 @@ static ggml_tensor * causal_conv1d(ggml_cgraph * gf, ggml_context * ctx0, ggml_t +@@ -203,13 +203,13 @@ static ggml_tensor * causal_conv1d(ggml_cgraph * gf, ggml_context * ctx0, ggml_t // Save last (d_conv-1) columns back to Q conv state ggml_tensor * last_conv_x = ggml_view_3d(ctx0, conv_x, d_conv - 1, d_inner, n_seqs, conv_x->nb[1], conv_x->nb[2], n_seq_tokens * conv_x->nb[0]); @@ -3430,7 +3455,7 @@ index 2190df8c9..ad454067e 100644 // Reshape conv weight: GGUF [d_conv, 1, d_inner, 1] -> ggml_ssm_conv expects [d_conv, d_inner] // GGUF stores as [d_conv, 1, d_inner, 1] with memory layout w[conv_step + channel * d_conv] // vLLM stores as [d_inner, d_conv] with memory layout w[channel * d_conv + conv_step] -@@ -228,7 +228,8 @@ static ggml_tensor * causal_conv1d(ggml_cgraph * gf, ggml_context * ctx0, ggml_t +@@ -225,7 +225,8 @@ static ggml_tensor * causal_conv1d(ggml_cgraph * gf, ggml_context * ctx0, ggml_t Xcur = ggml_reshape_2d(ctx0, Xcur, d_inner, n_tokens); Xcur = ggml_silu(ctx0, Xcur); @@ -3440,16 +3465,19 @@ index 2190df8c9..ad454067e 100644 } llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : -@@ -294,7 +295,7 @@ llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : +@@ -291,8 +292,9 @@ llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : // Get conv states from r_l tensor (Q, K, V each have separate state) ggml_tensor * conv_states_all = mctx_cur->get_r_l(il); cb(conv_states_all, "conv_states_all", il); - ggml_tensor * conv_state_all = build_rs(inp_rs, conv_states_all, hparams.n_embd_r(), n_seqs); +- ggml_tensor * q_in, * k_in, * v_in; + ggml_tensor * conv_state_all = build_rs(inp_rs, conv_states_all, hparams.n_embd_r(), n_seqs, skippy_state_kind::recurrent_conv, il); - ggml_tensor * q_in = cur, * k_in = cur, * v_in = cur; - ggml_tensor * q_w = layer.wq, * k_w = layer.wk, * v_w = layer.wv; ++ ggml_tensor * q_in = cur, * k_in = cur, * v_in = cur; ++ ggml_tensor * q_w = layer.wq, * k_w = layer.wk, * v_w = layer.wv; if (layer.wqkv) { -@@ -339,7 +340,7 @@ llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : + ggml_tensor * qkv = build_lora_mm(layer.wqkv, cur); + const int64_t d_inner = head_dim * n_head; +@@ -338,7 +340,7 @@ llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : // Get SSM state and compute KDA recurrence using ggml_kda_scan ggml_tensor * ssm_states_all = mctx_cur->get_s_l(il); @@ -3458,7 +3486,7 @@ index 2190df8c9..ad454067e 100644 state = ggml_reshape_4d(ctx0, state, head_dim, head_dim, n_head, n_seqs); -@@ -356,10 +357,11 @@ llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : +@@ -355,10 +357,11 @@ llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : cb(new_state, "new_state", il); // Update the recurrent states @@ -3475,7 +3503,7 @@ index 2190df8c9..ad454067e 100644 // Output gating g2 = g_b(g_a(x)) ggml_tensor * cur_2d = ggml_reshape_2d(ctx0, cur, cur->ne[0], n_seq_tokens * n_seqs); diff --git a/src/models/lfm-base.cpp b/src/models/lfm-base.cpp -index 03e59bd09..454c3e733 100644 +index 03bf1c063ede1f0795e06d087fada6e204024077..599e24bbf3f4edc3bcb9be1e4d1b4f568e92b4e9 100644 --- a/src/models/lfm-base.cpp +++ b/src/models/lfm-base.cpp @@ -37,7 +37,7 @@ ggml_tensor * llm_build_lfm_base::build_lfm_shortconv(const llama_memory_recurre @@ -3497,7 +3525,7 @@ index 03e59bd09..454c3e733 100644 auto * conv_kernel = model.layers[il].shortconv.conv; auto * conv_out = ggml_ssm_conv(ctx0, bx, conv_kernel); diff --git a/src/models/mamba-base.cpp b/src/models/mamba-base.cpp -index 4e16f18aa..a0664ce16 100644 +index 11ec79c76a0df5bcf588f08770b88dae1b2b3d7c..49b3eda7157830b966bd5ea0acf3bb3c7bf9e38f 100644 --- a/src/models/mamba-base.cpp +++ b/src/models/mamba-base.cpp @@ -36,7 +36,8 @@ ggml_tensor * llm_build_mamba_base::build_mamba_layer(llm_graph_input_rs * inp, @@ -3559,7 +3587,7 @@ index 4e16f18aa..a0664ce16 100644 + y = ggml_swiglu_split(ctx0, z_cont, y); // {d_inner, n_embd} @ {d_inner, n_seq_tokens, n_seqs} => {n_embd, n_seq_tokens, n_seqs} - cur = build_lora_mm(layer.ssm_out, y, layer.ssm_out_s); + cur = build_lora_mm(layer.ssm_out, y); @@ -179,7 +188,7 @@ ggml_tensor * llm_build_mamba_base::build_mamba2_layer(llm_graph_input_rs * inp, ggml_tensor * ssm_states_all = mctx_cur->get_s_l(il); const int64_t state_slots = ssm_states_all->ne[1]; @@ -3628,7 +3656,7 @@ index 4e16f18aa..a0664ce16 100644 // grouped RMS norm if (model.layers[il].ssm_norm) { diff --git a/src/models/mimo2.cpp b/src/models/mimo2.cpp -index 4fa97ff5b..ac36e6664 100644 +index 06f0adf00f7cf0f34b35a59b56ea30cac016fc79..5f1512eddfd7e520c90176cab5ef1a3c199c686c 100644 --- a/src/models/mimo2.cpp +++ b/src/models/mimo2.cpp @@ -9,6 +9,9 @@ void llama_model_mimo2::load_arch_hparams(llama_model_loader & ml) { @@ -3670,7 +3698,7 @@ index 4fa97ff5b..ac36e6664 100644 ggml_tensor * head_norm_w = layer.nextn.shared_head_norm ? layer.nextn.shared_head_norm diff --git a/src/models/minicpm3.cpp b/src/models/minicpm3.cpp -index 67c8d6708..0cfe0d5ab 100644 +index 5c182d91d3f0e3bb00ba94c41d72805601618104..6db9fcc00de5aeb7d46375cc5b3c3a85dc986ee1 100644 --- a/src/models/minicpm3.cpp +++ b/src/models/minicpm3.cpp @@ -171,8 +171,8 @@ llama_model_minicpm3::graph::graph(const llm_graph_params & params) : llm_graph_ @@ -3685,7 +3713,7 @@ index 67c8d6708..0cfe0d5ab 100644 cur = build_attn(inp_attn, diff --git a/src/models/minimax-01.cpp b/src/models/minimax-01.cpp -index 08268e0f3..2ca70e8ef 100644 +index 14df1bfb4c676ffd78d0ec691bcf45522c14b0da..eed269ac59a73ae28a54b374069a17da3d4aaccb 100644 --- a/src/models/minimax-01.cpp +++ b/src/models/minimax-01.cpp @@ -273,7 +273,7 @@ llama_model_minimax_01::graph::graph(const llm_graph_params & params) : llm_grap @@ -3723,7 +3751,7 @@ index 08268e0f3..2ca70e8ef 100644 qkv = ggml_cont(ctx0, ggml_permute(ctx0, qkv, 0, 2, 1, 3)); cb(qkv, "qkv_permuted", il); diff --git a/src/models/minimax-m3.cpp b/src/models/minimax-m3.cpp -index 8560c710a..313c8301d 100644 +index 92c7ca757e0479752e6d7541597e16157d75b7d4..af245931e4462bb80fc8afc643c632bfc0f7a950 100644 --- a/src/models/minimax-m3.cpp +++ b/src/models/minimax-m3.cpp @@ -18,11 +18,13 @@ void llama_model_minimax_m3::load_arch_hparams(llama_model_loader & ml) { @@ -3826,7 +3854,7 @@ index 8560c710a..313c8301d 100644 msa_mf = ggml_cast(ctx0, msa_kqm, GGML_TYPE_F32); } diff --git a/src/models/models.h b/src/models/models.h -index 85b97dda0..f1ac8e402 100644 +index 128722e69d2ced73080c2370c9652a83e3d43efe..322f2286ef5a047d9d6848b13d080ceb1c16ff16 100644 --- a/src/models/models.h +++ b/src/models/models.h @@ -3310,6 +3310,11 @@ struct llama_model_kimi_k3 : public llama_model_base { @@ -3842,7 +3870,7 @@ index 85b97dda0..f1ac8e402 100644 llm_graph_input_attn_k * inp_attn_k, llm_graph_input_attn_kv * inp_attn_kv, diff --git a/src/models/nemotron-h-moe.cpp b/src/models/nemotron-h-moe.cpp -index 3aa385379..055b95dee 100644 +index 05a02322315f8f1a080a10215908e8aa99bfb887..90d07963c1d5ee19aeff6f22f60d3cf7f978d639 100644 --- a/src/models/nemotron-h-moe.cpp +++ b/src/models/nemotron-h-moe.cpp @@ -22,8 +22,13 @@ llama_model_nemotron_h_moe::graph_mtp::graph_mtp(const llm_graph_params & params @@ -3866,16 +3894,16 @@ index 3aa385379..055b95dee 100644 cb(router_logits, "mtp_ffn_moe_logits", il); - ggml_tensor * ffn_shexp = build_ffn(cur, -- layer.ffn_up_shexp, NULL, layer.ffn_up_shexp_s, -- NULL, NULL, NULL, -- layer.ffn_down_shexp, NULL, layer.ffn_down_shexp_s, +- layer.ffn_up_shexp, NULL, +- NULL, NULL, +- layer.ffn_down_shexp, NULL, - NULL, - LLM_FFN_RELU_SQR, LLM_FFN_PAR, il); - cb(ffn_shexp, "mtp_ffn_shexp", il); - + ggml_tensor * inp_latent = cur; if (layer.ffn_latent_down) { -- cur = ggml_mul_mat(ctx0, layer.ffn_latent_down, cur); +- cur = build_lora_mm(layer.ffn_latent_down, cur); + inp_latent = ggml_mul_mat(ctx0, layer.ffn_latent_down, cur); } @@ -3885,17 +3913,19 @@ index 3aa385379..055b95dee 100644 layer.ffn_gate_inp, layer.ffn_up_exps, nullptr, // no gate -@@ -123,8 +121,17 @@ llama_model_nemotron_h_moe::graph_mtp::graph_mtp(const llm_graph_params & params +@@ -122,9 +120,18 @@ llama_model_nemotron_h_moe::graph_mtp::graph_mtp(const llm_graph_params & params + cb(moe_out, "mtp_ffn_moe_out", il); if (layer.ffn_latent_up) { - moe_out = ggml_mul_mat(ctx0, layer.ffn_latent_up, moe_out); +- moe_out = build_lora_mm(layer.ffn_latent_up, moe_out); ++ moe_out = ggml_mul_mat(ctx0, layer.ffn_latent_up, moe_out); + cb(moe_out, "mtp_ffn_moe_latent_up", il); } + ggml_tensor * ffn_shexp = build_ffn(cur, -+ layer.ffn_up_shexp, NULL, layer.ffn_up_shexp_s, -+ NULL, NULL, NULL, -+ layer.ffn_down_shexp, NULL, layer.ffn_down_shexp_s, ++ layer.ffn_up_shexp, NULL, ++ NULL, NULL, ++ layer.ffn_down_shexp, NULL, + NULL, + LLM_FFN_RELU_SQR, LLM_FFN_PAR, il); + cb(ffn_shexp, "mtp_ffn_shexp", il); @@ -3903,25 +3933,24 @@ index 3aa385379..055b95dee 100644 cur = ggml_add(ctx0, moe_out, ffn_shexp); cb(cur, "mtp_ffn_out", il); } -@@ -144,9 +151,13 @@ llama_model_nemotron_h_moe::graph_mtp::graph_mtp(const llm_graph_params & params +@@ -144,9 +151,12 @@ llama_model_nemotron_h_moe::graph_mtp::graph_mtp(const llm_graph_params & params } // LM head - ggml_tensor * head_w = layer.nextn.shared_head_head ? layer.nextn.shared_head_head : model.output; -- ggml_tensor * head_s = layer.nextn.shared_head_head ? layer.nextn.shared_head_head_s : model.output_s; - GGML_ASSERT(head_w != nullptr && "NEMOTRON_H_MOE MTP requires an output projection"); +- cur = build_lora_mm(head_w, cur); + ggml_tensor * head_w = layer.nextn.shared_head_head ? layer.nextn.shared_head_head + : (model.output ? model.output + : (trunk ? trunk->output : nullptr)); -+ ggml_tensor * head_s = layer.nextn.shared_head_head ? layer.nextn.shared_head_head_s -+ : (model.output_s ? model.output_s -+ : (trunk ? trunk->output_s : nullptr)); ++ ggml_tensor * head_s = head_w ? get_weight_scale(head_w) : nullptr; + GGML_ASSERT(head_w != nullptr && "NEMOTRON_H_MOE MTP requires an output projection (own or shared trunk)"); - cur = build_lora_mm(head_w, cur, head_s); ++ cur = build_lora_mm(head_w, cur, head_s); cb(cur, "result_output", -1); + res->t_logits = cur; diff --git a/src/models/nemotron-h.cpp b/src/models/nemotron-h.cpp -index 18e45320a..ab312b370 100644 +index 3b8760343e3cf08ca777f3bb1cc2865d8c48287a..813c10954061222ba0961a495ae724810242118b 100644 --- a/src/models/nemotron-h.cpp +++ b/src/models/nemotron-h.cpp @@ -64,14 +64,16 @@ void llama_model_nemotron_h::load_arch_tensors(llama_model_loader & ml) { @@ -3955,7 +3984,7 @@ index 18e45320a..ab312b370 100644 layer.ffn_latent_up = create_tensor(tn(LLM_TENSOR_FFN_LATENT_UP, "weight", i), {moe_n_embd, n_embd}, mtp_flags | TENSOR_NOT_REQUIRED); layer.ffn_down_exps = create_tensor(tn(LLM_TENSOR_FFN_DOWN_EXPS, "weight", i), {n_ff_exp, moe_n_embd, n_expert}, mtp_flags); diff --git a/src/models/qwen2moe.cpp b/src/models/qwen2moe.cpp -index e24919bc6..256c91a8f 100644 +index abb2f5a8c510c5ad14a2a7e109b70684c10b8f32..56f137b97304abc9d1942cfaf25e6aa05a9b23c1 100644 --- a/src/models/qwen2moe.cpp +++ b/src/models/qwen2moe.cpp @@ -20,7 +20,10 @@ void llama_model_qwen2moe::load_arch_tensors(llama_model_loader &) { @@ -3971,7 +4000,7 @@ index e24919bc6..256c91a8f 100644 for (int i = 0; i < n_layer; ++i) { auto & layer = layers[i]; diff --git a/src/models/qwen35.cpp b/src/models/qwen35.cpp -index 5b05fc63f..6c71af445 100644 +index 542e150cbe086984aa884ae8a2eb5388ea652bb5..883e3c03460375dde17a86809591decc84f50557 100644 --- a/src/models/qwen35.cpp +++ b/src/models/qwen35.cpp @@ -418,7 +418,7 @@ ggml_tensor * llama_model_qwen35::graph::build_layer_attn_linear( @@ -3992,7 +4021,7 @@ index 5b05fc63f..6c71af445 100644 cb(k_conv, "k_conv", il); cb(v_conv, "v_conv", il); diff --git a/src/models/qwen35moe.cpp b/src/models/qwen35moe.cpp -index c92b84d9d..5874868b9 100644 +index cf6dd9e747219ec86e11f791092eb65dc94ec8c2..1b926691a406fd1cf7fa80967bfe482be550a3f3 100644 --- a/src/models/qwen35moe.cpp +++ b/src/models/qwen35moe.cpp @@ -393,7 +393,7 @@ ggml_tensor * llama_model_qwen35moe::graph::build_layer_attn_linear( @@ -4013,7 +4042,7 @@ index c92b84d9d..5874868b9 100644 cb(k_conv, "k_conv", il); cb(v_conv, "v_conv", il); diff --git a/src/models/qwen3next.cpp b/src/models/qwen3next.cpp -index 208aa49d2..b1327f9a7 100644 +index 2c093cd09ff3c33e869924e166dea37bf521063f..8ddd339b383d2271a48d15b779a636bc2dfaebd8 100644 --- a/src/models/qwen3next.cpp +++ b/src/models/qwen3next.cpp @@ -264,6 +264,7 @@ ggml_tensor * llama_model_qwen3next::graph::build_layer_attn( @@ -4050,12 +4079,12 @@ index 208aa49d2..b1327f9a7 100644 cb(k_conv, "k_conv", il); cb(v_conv, "v_conv", il); diff --git a/src/models/qwen3vl.cpp b/src/models/qwen3vl.cpp -index 1bc56e7f4..a0bc450f7 100644 +index 3873cb5ea36063d531ed3cb26fe226b74f92378d..2c31f2090668b45129279c2db8a7a64e577088f6 100644 --- a/src/models/qwen3vl.cpp +++ b/src/models/qwen3vl.cpp @@ -169,7 +169,8 @@ llama_model_qwen3vl::graph::graph(const llm_graph_params & params) : llm_graph_c // lm_head - cur = build_lora_mm(model.output, cur, model.output_s); + cur = build_lora_mm(model.output, cur); - int64_t n_vocab_in = model.tok_embd->ne[1]; + int64_t n_vocab_in = model.tok_embd ? model.tok_embd->ne[1] @@ -4064,7 +4093,7 @@ index 1bc56e7f4..a0bc450f7 100644 if (n_vocab_in > n_vocab_out) { // case: output head smaller than vocab, see load_arch_tensors diff --git a/src/models/qwen4exp.cpp b/src/models/qwen4exp.cpp -index f77e6f509..9bc67bddf 100644 +index 6f672e9e2049db9594307152568d84004e7099db..a3cd1cb97f4ad80806144c4a19924e752c72e22b 100644 --- a/src/models/qwen4exp.cpp +++ b/src/models/qwen4exp.cpp @@ -805,6 +805,15 @@ llama_model_qwen4exp::llm_graph_input_kpool * llama_model_qwen4exp::graph::build @@ -4119,7 +4148,7 @@ index f77e6f509..9bc67bddf 100644 res->add_input(std::move(ple_inp)); diff --git a/src/models/rwkv6-base.cpp b/src/models/rwkv6-base.cpp -index 68efec666..6c2466e0f 100644 +index 7eb917d1de7d04cb2f767670b546d963fee2a19e..8c88dd6dc02c9740e8964772dfb1e6814498b812 100644 --- a/src/models/rwkv6-base.cpp +++ b/src/models/rwkv6-base.cpp @@ -129,7 +129,7 @@ ggml_tensor * llm_build_rwkv6_base::build_rwkv6_time_mix(llm_graph_input_rs * in @@ -4147,7 +4176,7 @@ index 68efec666..6c2466e0f 100644 if (!is_qrwkv) { // group norm with head_count groups diff --git a/src/models/rwkv6.cpp b/src/models/rwkv6.cpp -index 4cb5bce64..c6df75ae5 100644 +index 2a6ac3769f4440d7d711b327acd5e27814fc2f53..ea92a377df830755c3c50c414fa792089bbcae1e 100644 --- a/src/models/rwkv6.cpp +++ b/src/models/rwkv6.cpp @@ -62,7 +62,7 @@ void llama_model_rwkv6::load_arch_tensors(llama_model_loader &) { @@ -4160,7 +4189,7 @@ index 4cb5bce64..c6df75ae5 100644 layer.time_mix_first = create_tensor(tn(LLM_TENSOR_TIME_MIX_FIRST, "weight", i), {head_size, n_embd / head_size}, 0); layer.time_mix_decay = create_tensor(tn(LLM_TENSOR_TIME_MIX_DECAY, "weight", i), {n_embd}, 0); diff --git a/src/models/rwkv7-base.cpp b/src/models/rwkv7-base.cpp -index 3300822d2..c764b0d53 100644 +index fdcead7c063e93590bf5b6727f91be6e27b77d7e..94012ec5a9b7030adae33b99c2a5d33bf70b0cce 100644 --- a/src/models/rwkv7-base.cpp +++ b/src/models/rwkv7-base.cpp @@ -101,16 +101,17 @@ ggml_tensor * llm_build_rwkv7_base::build_rwkv7_time_mix(llm_graph_input_rs * in @@ -4186,7 +4215,7 @@ index 3300822d2..c764b0d53 100644 if (layer.time_mix_ln && layer.time_mix_ln_b) { // group norm with head_count groups diff --git a/src/skippy/stage_realization.cpp b/src/skippy/stage_realization.cpp -index 4a91e986b..481528345 100644 +index 4a91e986b7383b52c10e198babb502074e65dcb5..481528345e1e9f936ab159cd78e6c901f0b794ec 100644 --- a/src/skippy/stage_realization.cpp +++ b/src/skippy/stage_realization.cpp @@ -277,14 +277,13 @@ void skippy_realize_stage_graph( @@ -4211,6 +4240,3 @@ index 4a91e986b..481528345 100644 } std::unordered_map replacements; --- -2.56.1 - diff --git a/llama_cpp/patches/0005-build-skippy-wire-native-runtime-and-backend-support.patch b/llama_cpp/patches/0005-build-skippy-wire-native-runtime-and-backend-support.patch index 47d7a8a5..74b86641 100644 --- a/llama_cpp/patches/0005-build-skippy-wire-native-runtime-and-backend-support.patch +++ b/llama_cpp/patches/0005-build-skippy-wire-native-runtime-and-backend-support.patch @@ -1,4 +1,4 @@ -From a3f811db2eb7f2aa16af512b98ad31758388672b Mon Sep 17 00:00:00 2001 +From ece37662ff992bdbb02f6796399445ec875619db Mon Sep 17 00:00:00 2001 From: James Dumay Date: Tue, 13 Oct 2026 22:06:42 +1100 Subject: [PATCH] build(skippy): wire native runtime and backend support @@ -42,7 +42,7 @@ Subject: [PATCH] build(skippy): wire native runtime and backend support create mode 100644 ggml/src/ggml-metal/kernels/cachegen.metal diff --git a/CMakeLists.txt b/CMakeLists.txt -index 93543defd..190e3f31f 100644 +index 93543defd9fd8498ae2b660c8d1b6c7077b1a6b8..190e3f31f4873b55d968704904e7e0f9ed373e66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,18 @@ cmake_minimum_required(VERSION 3.14...3.28) # for add_link_options and implicit @@ -84,7 +84,7 @@ index 93543defd..190e3f31f 100644 if (LLAMA_BUILD_COMMON) install(TARGETS llama-common LIBRARY) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt -index c454f6bb3..3c2b9b7ba 100644 +index c454f6bb3c60ea339b2f8f5ed2177056691eae2a..3c2b9b7ba752008c4c743369db74ff9d309f1f3d 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -90,10 +90,7 @@ add_library(${TARGET} @@ -159,7 +159,7 @@ index c454f6bb3..3c2b9b7ba 100644 if (CMAKE_SYSTEM_NAME MATCHES "AIX") diff --git a/common/chat-auto-parser-generator.cpp b/common/chat-auto-parser-generator.cpp -index d3e0a7f11..65e4f9b3b 100644 +index d3e0a7f1102cbd806075a57f6d5f4f9bb977d2c8..65e4f9b3b82839b2c827d08d9cb9d0d42cd59aba 100644 --- a/common/chat-auto-parser-generator.cpp +++ b/common/chat-auto-parser-generator.cpp @@ -13,6 +13,18 @@ @@ -247,7 +247,7 @@ index d3e0a7f11..65e4f9b3b 100644 if (!arguments.start.empty()) { diff --git a/common/chat-diff-analyzer.cpp b/common/chat-diff-analyzer.cpp -index a7e370578..39ffa20f1 100644 +index a7e370578fd9290f9516b87dc5f0515820748629..39ffa20f1237560369296c80297e5c1f1d5d4df5 100644 --- a/common/chat-diff-analyzer.cpp +++ b/common/chat-diff-analyzer.cpp @@ -484,7 +484,8 @@ void analyze_reasoning::compare_reasoning_presence() { @@ -288,7 +288,7 @@ index a7e370578..39ffa20f1 100644 template_params params_content_only; diff --git a/common/chat-peg-parser.cpp b/common/chat-peg-parser.cpp -index 51c64abec..556688f1c 100644 +index 51c64abec3cad2677373459fc6da43bf67b96adf..556688f1cf4e1784e082646fdf33ea2932205064 100644 --- a/common/chat-peg-parser.cpp +++ b/common/chat-peg-parser.cpp @@ -393,11 +393,12 @@ void common_chat_peg_mapper::map(const common_peg_ast_node & node) { @@ -348,7 +348,7 @@ index 51c64abec..556688f1c 100644 // Build ID parsers if keys are provided common_peg_parser id_parser = eps(); diff --git a/common/chat-peg-parser.h b/common/chat-peg-parser.h -index 62ae5b8fe..a99c4e037 100644 +index 62ae5b8fe20e61d8c47f03842f3fc860d0d96506..a99c4e03781dfd6a935ef7bb9726adc859fff895 100644 --- a/common/chat-peg-parser.h +++ b/common/chat-peg-parser.h @@ -5,6 +5,7 @@ @@ -368,7 +368,7 @@ index 62ae5b8fe..a99c4e037 100644 common_peg_parser permute(const std::string & rule_prefix, const std::vector & parsers); diff --git a/common/chat.cpp b/common/chat.cpp -index 9e810d6d0..c144697de 100644 +index 9e810d6d098b3990a21b8e9aa6e3a8122b65720c..c144697de6ee5b3485c7a60066bbbbec8bbd9e39 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -204,6 +204,11 @@ json common_chat_msg::to_json_oaicompat(bool concat_typed_text) const { @@ -450,7 +450,7 @@ index 9e810d6d0..c144697de 100644 if (!template_tool_use_src.empty()) { default_template_src = template_tool_use_src; diff --git a/common/chat.h b/common/chat.h -index f80ef4ed2..c799a04ee 100644 +index f80ef4ed203b981e109c17473882a12dc1e836ef..c799a04ee0990f452c46923413b5933d89d69011 100644 --- a/common/chat.h +++ b/common/chat.h @@ -98,6 +98,9 @@ struct common_chat_msg { @@ -474,7 +474,7 @@ index f80ef4ed2..c799a04ee 100644 bool operator!=(const common_chat_msg & other) const { return !(*this == other); } diff --git a/common/ngram-cache.cpp b/common/ngram-cache.cpp -index 419a0ebc9..2c844ba2f 100644 +index 419a0ebc9833bde8e660dd582ae0c0273924066a..2c844ba2fd06817f315b7a527309813faad80102 100644 --- a/common/ngram-cache.cpp +++ b/common/ngram-cache.cpp @@ -1,14 +1,161 @@ @@ -681,7 +681,7 @@ index 419a0ebc9..2c844ba2f 100644 if (drafted_token == LLAMA_TOKEN_NULL) { drafted_token = try_draft(nc_static, ngram_static); diff --git a/common/peg-parser.cpp b/common/peg-parser.cpp -index 924289097..8de366170 100644 +index 924289097752d23d05cd344f4b27673e82a71f19..8de366170c33d2fbac6c5a49e01526c3e8ba8bb4 100644 --- a/common/peg-parser.cpp +++ b/common/peg-parser.cpp @@ -2255,6 +2255,401 @@ void common_peg_arena::build_grammar(const common_grammar_builder & builder, boo @@ -1087,7 +1087,7 @@ index 924289097..8de366170 100644 common_peg_parser_builder builder; builder.set_root(fn(builder)); diff --git a/common/peg-parser.h b/common/peg-parser.h -index b7e97083b..fbf4b6f7b 100644 +index b7e97083b386d9880b253e66125c961ac477f085..fbf4b6f7b91a0a30a9efc0cbe434b30b4c2e63d1 100644 --- a/common/peg-parser.h +++ b/common/peg-parser.h @@ -404,6 +404,14 @@ class common_peg_arena { @@ -1106,7 +1106,7 @@ index b7e97083b..fbf4b6f7b 100644 private: diff --git a/common/reasoning-budget.cpp b/common/reasoning-budget.cpp -index ac2cd261d..674bb914d 100644 +index ac2cd261db08b0726a8c57385986483b0f2cd83e..674bb914d5de942e18c0f0fb270d91c81f21406f 100644 --- a/common/reasoning-budget.cpp +++ b/common/reasoning-budget.cpp @@ -1,9 +1,4 @@ @@ -1408,7 +1408,7 @@ index ac2cd261d..674bb914d 100644 return true; } diff --git a/common/reasoning-budget.h b/common/reasoning-budget.h -index 1b89a04c4..85d5c35dc 100644 +index 1b89a04c42e8056d6450d3266e4f0c1e2a561d2e..85d5c35dc42e95dbed1a489216f28708230fd54d 100644 --- a/common/reasoning-budget.h +++ b/common/reasoning-budget.h @@ -2,8 +2,6 @@ @@ -1450,7 +1450,7 @@ index 1b89a04c4..85d5c35dc 100644 +LLAMA_API bool common_reasoning_budget_force(struct llama_sampler * smpl); diff --git a/common/stage-chat.cpp b/common/stage-chat.cpp new file mode 100644 -index 000000000..c3362e2a7 +index 0000000000000000000000000000000000000000..c3362e2a7f9a1d233ae734dc0329bd79c560da6b --- /dev/null +++ b/common/stage-chat.cpp @@ -0,0 +1,363 @@ @@ -1818,7 +1818,7 @@ index 000000000..c3362e2a7 + return skippy_common_success(out_error); +} diff --git a/ggml/cmake/common.cmake b/ggml/cmake/common.cmake -index 39c1fbb48..bc4790fb8 100644 +index 39c1fbb489820bbd87256e3213a08c799d954973..bc4790fb876b8d391164fcadaac7f4783669ff60 100644 --- a/ggml/cmake/common.cmake +++ b/ggml/cmake/common.cmake @@ -99,8 +99,13 @@ function(ggml_cuda_fattn_instances DIR OUT_SRCS) @@ -1838,7 +1838,7 @@ index 39c1fbb48..bc4790fb8 100644 foreach (TYPE_K IN LISTS FA_TYPES) if ("${TYPE_K}-${TYPE_V}" IN_LIST FA_COMBINATIONS) diff --git a/ggml/include/ggml-backend.h b/ggml/include/ggml-backend.h -index a077e221e..cc98ce7a4 100644 +index 58e771d42180ef92eaa79018d635a33add61ea44..60096c0df2d86f735355acb9744d3c1e4115c711 100644 --- a/ggml/include/ggml-backend.h +++ b/ggml/include/ggml-backend.h @@ -243,6 +243,33 @@ extern "C" { @@ -1876,7 +1876,7 @@ index a077e221e..cc98ce7a4 100644 // Backend registry // diff --git a/ggml/src/ggml-backend.cpp b/ggml/src/ggml-backend.cpp -index 9a12391bb..c8c05e442 100644 +index 9a12391bb6e36aa6e45939e4e7a82c6da8198f35..c8c05e442267e3b40d5afedefee364911fb82486 100644 --- a/ggml/src/ggml-backend.cpp +++ b/ggml/src/ggml-backend.cpp @@ -1500,14 +1500,30 @@ void ggml_backend_sched_split_graph(ggml_backend_sched_t sched, struct ggml_cgra @@ -1926,7 +1926,7 @@ index 9a12391bb..c8c05e442 100644 sched->splits = (ggml_backend_sched_split *) calloc(initial_splits_capacity, sizeof(sched->splits[0])); diff --git a/ggml/src/ggml-cuda/cachegen.cu b/ggml/src/ggml-cuda/cachegen.cu new file mode 100644 -index 000000000..394c1d45e +index 0000000000000000000000000000000000000000..394c1d45ed6961466c41b40a8022a32c8b78d199 --- /dev/null +++ b/ggml/src/ggml-cuda/cachegen.cu @@ -0,0 +1,223 @@ @@ -2155,7 +2155,7 @@ index 000000000..394c1d45e +#endif // !defined(GGML_USE_MUSA) diff --git a/ggml/src/ggml-cuda/cachegen.cuh b/ggml/src/ggml-cuda/cachegen.cuh new file mode 100644 -index 000000000..7118c9aa9 +index 0000000000000000000000000000000000000000..7118c9aa9617988b26a0f14d57dda6855346e54b --- /dev/null +++ b/ggml/src/ggml-cuda/cachegen.cuh @@ -0,0 +1,27 @@ @@ -2187,7 +2187,7 @@ index 000000000..7118c9aa9 + +#endif // !defined(GGML_USE_MUSA) diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu -index 754b1033d..aa6fb297f 100644 +index 8bae601333115f689e18b25bbae0c0f9fc8574d0..4700191f7754f1975494130141c7244ac2b2dda2 100644 --- a/ggml/src/ggml-cuda/ggml-cuda.cu +++ b/ggml/src/ggml-cuda/ggml-cuda.cu @@ -12,6 +12,7 @@ @@ -2198,7 +2198,7 @@ index 754b1033d..aa6fb297f 100644 #include "ggml-cuda/clamp.cuh" #include "ggml-cuda/col2im-1d.cuh" #include "ggml-cuda/concat.cuh" -@@ -91,6 +92,7 @@ +@@ -88,6 +89,7 @@ #include #include #include @@ -2206,7 +2206,7 @@ index 754b1033d..aa6fb297f 100644 #include #include #include -@@ -6671,7 +6673,12 @@ static bool ggml_backend_cuda_device_supports_op(ggml_backend_dev_t dev, const g +@@ -4418,7 +4420,12 @@ static bool ggml_backend_cuda_device_supports_op(ggml_backend_dev_t dev, const g return false; } case GGML_OP_DUP: @@ -2220,7 +2220,7 @@ index 754b1033d..aa6fb297f 100644 case GGML_OP_ARGMAX: case GGML_OP_COUNT_EQUAL: return true; -@@ -7041,7 +7048,12 @@ static ggml_backend_feature * ggml_backend_cuda_get_features(ggml_backend_reg_t +@@ -4788,7 +4795,12 @@ static ggml_backend_feature * ggml_backend_cuda_get_features(ggml_backend_reg_t #endif #ifdef GGML_CUDA_FA_QUANTS @@ -2234,7 +2234,7 @@ index 754b1033d..aa6fb297f 100644 #endif { -@@ -7076,6 +7088,329 @@ static ggml_backend_feature * ggml_backend_cuda_get_features(ggml_backend_reg_t +@@ -4823,6 +4835,329 @@ static ggml_backend_feature * ggml_backend_cuda_get_features(ggml_backend_reg_t GGML_UNUSED(reg); } @@ -2564,7 +2564,7 @@ index 754b1033d..aa6fb297f 100644 static void * ggml_backend_cuda_reg_get_proc_address(ggml_backend_reg_t reg, const char * name) { GGML_UNUSED(reg); if (strcmp(name, "ggml_backend_comm_init") == 0) { -@@ -7101,6 +7436,11 @@ static void * ggml_backend_cuda_reg_get_proc_address(ggml_backend_reg_t reg, con +@@ -4848,6 +5183,11 @@ static void * ggml_backend_cuda_reg_get_proc_address(ggml_backend_reg_t reg, con if (strcmp(name, "ggml_backend_get_features") == 0) { return (void *)ggml_backend_cuda_get_features; } @@ -2577,7 +2577,7 @@ index 754b1033d..aa6fb297f 100644 } diff --git a/ggml/src/ggml-cuda/vendors/hip.h b/ggml/src/ggml-cuda/vendors/hip.h -index a43814799..ed061411c 100644 +index a97233c1e658609d1e5090caf7a01f8f1c4137e5..1ccfe1669da4ee6f9da72cb02a2cce20c34eb1b0 100644 --- a/ggml/src/ggml-cuda/vendors/hip.h +++ b/ggml/src/ggml-cuda/vendors/hip.h @@ -32,6 +32,12 @@ typedef uint64_t ggml_cuda_thread_mask_t; @@ -2594,7 +2594,7 @@ index a43814799..ed061411c 100644 #define cublasCreate hipblasCreate #define cublasDestroy hipblasDestroy diff --git a/ggml/src/ggml-metal/CMakeLists.txt b/ggml/src/ggml-metal/CMakeLists.txt -index 0ecc07c45..14168ffec 100644 +index 0ecc07c45fff692ea42cfb8acc7b24ca119cf0c3..14168ffec1516f46f2f0f4cfd2585643bc3fc159 100644 --- a/ggml/src/ggml-metal/CMakeLists.txt +++ b/ggml/src/ggml-metal/CMakeLists.txt @@ -37,6 +37,7 @@ set(METALLIB_KERNELS_FA_SHARED @@ -2606,7 +2606,7 @@ index 0ecc07c45..14168ffec 100644 kernels/fa_f16.metal kernels/fa_f32.metal diff --git a/ggml/src/ggml-metal/ggml-metal-device.h b/ggml/src/ggml-metal/ggml-metal-device.h -index c0466d62f..fa3e364bc 100644 +index c370ce9a798cd8097ec0f79650ba22ba6b16f187..009b4ce2ef4dc9757a061d0e7784a2395c4a0a43 100644 --- a/ggml/src/ggml-metal/ggml-metal-device.h +++ b/ggml/src/ggml-metal/ggml-metal-device.h @@ -1,6 +1,7 @@ @@ -2617,7 +2617,7 @@ index c0466d62f..fa3e364bc 100644 #ifdef __cplusplus extern "C" { -@@ -381,6 +382,12 @@ void ggml_metal_buffer_clear (ggml_metal_buffer_t buf, uint8_t value); +@@ -382,6 +383,12 @@ void ggml_metal_buffer_clear (ggml_metal_buffer_t buf, uint8_t value); // struct ggml_metal_buffer_id ggml_metal_buffer_get_id(ggml_metal_buffer_t buf, const struct ggml_tensor * t); @@ -2631,7 +2631,7 @@ index c0466d62f..fa3e364bc 100644 } #endif diff --git a/ggml/src/ggml-metal/ggml-metal-device.m b/ggml/src/ggml-metal/ggml-metal-device.m -index f7f05b6bb..b03b925c6 100644 +index f7f05b6bbcbf3e621c411ed3f75e7a8563a69466..b03b925c650ca5ab45c9f6b49280a5e8742a8fcf 100644 --- a/ggml/src/ggml-metal/ggml-metal-device.m +++ b/ggml/src/ggml-metal/ggml-metal-device.m @@ -11,6 +11,8 @@ @@ -3253,7 +3253,7 @@ index f7f05b6bb..b03b925c6 100644 + return true; +} diff --git a/ggml/src/ggml-metal/ggml-metal.cpp b/ggml/src/ggml-metal/ggml-metal.cpp -index bcd70c797..ad7573851 100644 +index bcd70c797f54b41eb9c6c291c6282a22a30719f5..ad75738511e1ea131b394c6953d57b7cafbdeef4 100644 --- a/ggml/src/ggml-metal/ggml-metal.cpp +++ b/ggml/src/ggml-metal/ggml-metal.cpp @@ -1021,6 +1021,9 @@ static void * ggml_backend_metal_get_proc_address(ggml_backend_reg_t reg, const @@ -3268,7 +3268,7 @@ index bcd70c797..ad7573851 100644 } diff --git a/ggml/src/ggml-metal/kernels/cachegen.metal b/ggml/src/ggml-metal/kernels/cachegen.metal new file mode 100644 -index 000000000..728899e4b +index 0000000000000000000000000000000000000000..728899e4b43bbdd273c6f9b562ecce49f59918c7 --- /dev/null +++ b/ggml/src/ggml-metal/kernels/cachegen.metal @@ -0,0 +1,195 @@ @@ -3468,7 +3468,7 @@ index 000000000..728899e4b + } +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 426c48741..2bc7d6f6e 100644 +index 426c487411eeead95e75076f936ab4c1e2518e2a..2bc7d6f6e49c99171722661daf308d435d260b6a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ @@ -4174,7 +4174,7 @@ index 426c48741..2bc7d6f6e 100644 + target_link_libraries(llama PRIVATE ${SKIPPY_ACCELERATE_FRAMEWORK}) +endif() diff --git a/tools/mtmd/mtmd-audio.h b/tools/mtmd/mtmd-audio.h -index 269e78cc4..7ca00190c 100644 +index 269e78cc40f5b43086973aa0dad3b7e561afe208..7ca00190cf7a7e39b8f0660ad48a997035d8a2a8 100644 --- a/tools/mtmd/mtmd-audio.h +++ b/tools/mtmd/mtmd-audio.h @@ -75,6 +75,7 @@ struct mtmd_audio_mel_config { @@ -4186,7 +4186,7 @@ index 269e78cc4..7ca00190c 100644 const mtmd_audio_cache * cache = nullptr; diff --git a/tools/mtmd/mtmd-helper.cpp b/tools/mtmd/mtmd-helper.cpp -index 165936d80..9a27d955a 100644 +index 165936d80c1a79b1ab5f1c5c5f649f209889975b..9a27d955abe90557e3c504b29f0de7be5f1f95de 100644 --- a/tools/mtmd/mtmd-helper.cpp +++ b/tools/mtmd/mtmd-helper.cpp @@ -132,6 +132,11 @@ int32_t mtmd_helper_decode_image_chunk( @@ -4279,7 +4279,7 @@ index 165936d80..9a27d955a 100644 LOG_ERR("failed to decode %s\n", name); return ret; diff --git a/tools/mtmd/mtmd-helper.h b/tools/mtmd/mtmd-helper.h -index c20cb0a20..6f8c7475f 100644 +index c20cb0a20bbd3ca672517a4d03cb2d4160e372dc..6f8c7475fa41a9a2ca5912b95405dd0ed6c655be 100644 --- a/tools/mtmd/mtmd-helper.h +++ b/tools/mtmd/mtmd-helper.h @@ -183,6 +183,35 @@ MTMD_API int32_t mtmd_helper_eval_chunk_single(mtmd_context * ctx, @@ -4319,7 +4319,7 @@ index c20cb0a20..6f8c7475f 100644 struct mtmd_helper_embd_batch { int32_t n_tokens; diff --git a/tools/mtmd/mtmd-subcontext.cpp b/tools/mtmd/mtmd-subcontext.cpp -index 640950c5c..4ea2217d0 100644 +index 640950c5c8324987a1fcbb157477887af66e9845..4ea2217d04bb1d4d5de91cc05b81ac70c94e5b0a 100644 --- a/tools/mtmd/mtmd-subcontext.cpp +++ b/tools/mtmd/mtmd-subcontext.cpp @@ -323,6 +323,10 @@ bool mtmd_audio_log_mel(const mtmd_audio_mel_config & config, const float * samp @@ -4333,6 +4333,3 @@ index 640950c5c..4ea2217d0 100644 if (config.use_magnitude) { cur = ggml_sqrt(ctx0, cur); } --- -2.56.1 - diff --git a/llama_cpp/patches/0006-test-skippy-cover-live-graph-and-state-contracts.patch b/llama_cpp/patches/0006-test-skippy-cover-live-graph-and-state-contracts.patch index a19ba301..95ac9b0b 100644 --- a/llama_cpp/patches/0006-test-skippy-cover-live-graph-and-state-contracts.patch +++ b/llama_cpp/patches/0006-test-skippy-cover-live-graph-and-state-contracts.patch @@ -1,4 +1,4 @@ -From 8ba62ae065dbf777d8cf48ccd998aefd6bcf105f Mon Sep 17 00:00:00 2001 +From 62df298ca530d31b8772ace3f538ec549317d451 Mon Sep 17 00:00:00 2001 From: James Dumay Date: Tue, 13 Oct 2026 22:06:43 +1100 Subject: [PATCH] test(skippy): cover live graph and state contracts @@ -30,7 +30,7 @@ Subject: [PATCH] test(skippy): cover live graph and state contracts tests/test-deepseek4-mtp.h | 88 + tests/test-graph-contract-fixture.h | 155 ++ tests/test-jinja.cpp | 5 + - tests/test-llama-archs.cpp | 362 +++- + tests/test-llama-archs.cpp | 361 +++- tests/test-reasoning-budget.cpp | 24 + tests/test-skippy-activation-validation.cpp | 18 + tests/test-skippy-cachegen-import.cpp | 347 ++++ @@ -42,7 +42,7 @@ Subject: [PATCH] test(skippy): cover live graph and state contracts tests/test-skippy-rerank-template.cpp | 34 + tests/test-skippy-sampling-suppress.cpp | 90 + ...st-skippy-verify-checkpoint-retirement.cpp | 26 + - 38 files changed, 10271 insertions(+), 30 deletions(-) + 38 files changed, 10270 insertions(+), 30 deletions(-) create mode 100644 src/skippy/tests/cast_destination_regression.h create mode 100644 src/skippy/tests/embedding_input_regression.h create mode 100644 src/skippy/tests/graph_build_inputs.cpp @@ -78,7 +78,7 @@ Subject: [PATCH] test(skippy): cover live graph and state contracts diff --git a/src/skippy/tests/cast_destination_regression.h b/src/skippy/tests/cast_destination_regression.h new file mode 100644 -index 000000000..84da82c91 +index 0000000000000000000000000000000000000000..84da82c91140944ce7c2b4e6cb9aaa7f4d1b555c --- /dev/null +++ b/src/skippy/tests/cast_destination_regression.h @@ -0,0 +1,27 @@ @@ -111,7 +111,7 @@ index 000000000..84da82c91 +} diff --git a/src/skippy/tests/embedding_input_regression.h b/src/skippy/tests/embedding_input_regression.h new file mode 100644 -index 000000000..803489be0 +index 0000000000000000000000000000000000000000..803489be0755fc4e731a9efe9afcf3bf4ebaa889 --- /dev/null +++ b/src/skippy/tests/embedding_input_regression.h @@ -0,0 +1,91 @@ @@ -208,7 +208,7 @@ index 000000000..803489be0 +} diff --git a/src/skippy/tests/graph_build_inputs.cpp b/src/skippy/tests/graph_build_inputs.cpp new file mode 100644 -index 000000000..f1a028195 +index 0000000000000000000000000000000000000000..f1a028195e12723dc09efd6b2dcdddaebd4251a4 --- /dev/null +++ b/src/skippy/tests/graph_build_inputs.cpp @@ -0,0 +1,948 @@ @@ -1162,7 +1162,7 @@ index 000000000..f1a028195 +} diff --git a/src/skippy/tests/graph_contract_cases.cmake b/src/skippy/tests/graph_contract_cases.cmake new file mode 100644 -index 000000000..4ee862411 +index 0000000000000000000000000000000000000000..4ee862411340737eaf63fe9bbd3e3268b444d413 --- /dev/null +++ b/src/skippy/tests/graph_contract_cases.cmake @@ -0,0 +1,120 @@ @@ -1288,7 +1288,7 @@ index 000000000..4ee862411 + FIXTURES_REQUIRED contract-glm53-synthetic TIMEOUT 900) diff --git a/src/skippy/tests/graph_contract_checks.h b/src/skippy/tests/graph_contract_checks.h new file mode 100644 -index 000000000..69844b1f8 +index 0000000000000000000000000000000000000000..69844b1f896bf4b4b40cc5202246f195b5668220 --- /dev/null +++ b/src/skippy/tests/graph_contract_checks.h @@ -0,0 +1,138 @@ @@ -1432,7 +1432,7 @@ index 000000000..69844b1f8 +} diff --git a/src/skippy/tests/graph_contract_models.cpp b/src/skippy/tests/graph_contract_models.cpp new file mode 100644 -index 000000000..5dd31d608 +index 0000000000000000000000000000000000000000..5dd31d608d3b35896992a24eabb984893505ddd9 --- /dev/null +++ b/src/skippy/tests/graph_contract_models.cpp @@ -0,0 +1,223 @@ @@ -1661,7 +1661,7 @@ index 000000000..5dd31d608 +} diff --git a/src/skippy/tests/hardware_application_probe.cpp b/src/skippy/tests/hardware_application_probe.cpp new file mode 100644 -index 000000000..cfc17776b +index 0000000000000000000000000000000000000000..cfc17776b8f58f26654a160d4ee75deb88f4ee67 --- /dev/null +++ b/src/skippy/tests/hardware_application_probe.cpp @@ -0,0 +1,78 @@ @@ -1745,7 +1745,7 @@ index 000000000..cfc17776b +} diff --git a/src/skippy/tests/input_capabilities.cpp b/src/skippy/tests/input_capabilities.cpp new file mode 100644 -index 000000000..e4902c3d2 +index 0000000000000000000000000000000000000000..e4902c3d26ef99e1618630726bfc4132470ec7fa --- /dev/null +++ b/src/skippy/tests/input_capabilities.cpp @@ -0,0 +1,80 @@ @@ -1831,7 +1831,7 @@ index 000000000..e4902c3d2 +} diff --git a/src/skippy/tests/input_leaf_state_regression.h b/src/skippy/tests/input_leaf_state_regression.h new file mode 100644 -index 000000000..33d3faca9 +index 0000000000000000000000000000000000000000..33d3faca9f56b6926fcd7bb05e4470b2cd53b592 --- /dev/null +++ b/src/skippy/tests/input_leaf_state_regression.h @@ -0,0 +1,49 @@ @@ -1886,7 +1886,7 @@ index 000000000..33d3faca9 +} diff --git a/src/skippy/tests/live_graph_reference.h b/src/skippy/tests/live_graph_reference.h new file mode 100644 -index 000000000..73129bf07 +index 0000000000000000000000000000000000000000..73129bf076f48002e9f7010fbfef16c9a438f654 --- /dev/null +++ b/src/skippy/tests/live_graph_reference.h @@ -0,0 +1,194 @@ @@ -2086,7 +2086,7 @@ index 000000000..73129bf07 +}; diff --git a/src/skippy/tests/log_gate.h b/src/skippy/tests/log_gate.h new file mode 100644 -index 000000000..afafe0565 +index 0000000000000000000000000000000000000000..afafe0565442231095fd877319f2304bf6799ea9 --- /dev/null +++ b/src/skippy/tests/log_gate.h @@ -0,0 +1,138 @@ @@ -2230,7 +2230,7 @@ index 000000000..afafe0565 +} // namespace skippy::log_gate diff --git a/src/skippy/tests/noalloc_graph_planning.cpp b/src/skippy/tests/noalloc_graph_planning.cpp new file mode 100644 -index 000000000..7470f3309 +index 0000000000000000000000000000000000000000..7470f33093c372d6ba12826d1f45500d0a527ea0 --- /dev/null +++ b/src/skippy/tests/noalloc_graph_planning.cpp @@ -0,0 +1,1139 @@ @@ -3375,7 +3375,7 @@ index 000000000..7470f3309 +} diff --git a/src/skippy/tests/profile_residency.cpp b/src/skippy/tests/profile_residency.cpp new file mode 100644 -index 000000000..c63f518c6 +index 0000000000000000000000000000000000000000..c63f518c6628b7258babf9b077ec36da71367e3a --- /dev/null +++ b/src/skippy/tests/profile_residency.cpp @@ -0,0 +1,232 @@ @@ -3613,7 +3613,7 @@ index 000000000..c63f518c6 +} diff --git a/src/skippy/tests/renamed_multishard_planning.cpp b/src/skippy/tests/renamed_multishard_planning.cpp new file mode 100644 -index 000000000..720ba457a +index 0000000000000000000000000000000000000000..720ba457a714f33af14b6a234f6b563da5e5846d --- /dev/null +++ b/src/skippy/tests/renamed_multishard_planning.cpp @@ -0,0 +1,1667 @@ @@ -5286,7 +5286,7 @@ index 000000000..720ba457a +} diff --git a/src/skippy/tests/residual_checkpoint_regression.h b/src/skippy/tests/residual_checkpoint_regression.h new file mode 100644 -index 000000000..31734bf56 +index 0000000000000000000000000000000000000000..31734bf5660b7b3c6db41785425e6eb2b2da3e44 --- /dev/null +++ b/src/skippy/tests/residual_checkpoint_regression.h @@ -0,0 +1,52 @@ @@ -5344,7 +5344,7 @@ index 000000000..31734bf56 +} diff --git a/src/skippy/tests/runtime_events.cpp b/src/skippy/tests/runtime_events.cpp new file mode 100644 -index 000000000..d764514ed +index 0000000000000000000000000000000000000000..d764514ed16b47c3177cb3641d7686a9de7e05ba --- /dev/null +++ b/src/skippy/tests/runtime_events.cpp @@ -0,0 +1,697 @@ @@ -6047,7 +6047,7 @@ index 000000000..d764514ed +} diff --git a/src/skippy/tests/sampling_history.cpp b/src/skippy/tests/sampling_history.cpp new file mode 100644 -index 000000000..b191ecf34 +index 0000000000000000000000000000000000000000..b191ecf34eb520294c09efe517676db6d9ab16bb --- /dev/null +++ b/src/skippy/tests/sampling_history.cpp @@ -0,0 +1,520 @@ @@ -6573,7 +6573,7 @@ index 000000000..b191ecf34 +} diff --git a/src/skippy/tests/stage_plan_header.c b/src/skippy/tests/stage_plan_header.c new file mode 100644 -index 000000000..2e5a5e1a6 +index 0000000000000000000000000000000000000000..2e5a5e1a6926cab5c1d6469ed319d58cc50112b6 --- /dev/null +++ b/src/skippy/tests/stage_plan_header.c @@ -0,0 +1,10 @@ @@ -6589,7 +6589,7 @@ index 000000000..2e5a5e1a6 +} diff --git a/src/skippy/tests/stage_plan_header.cpp b/src/skippy/tests/stage_plan_header.cpp new file mode 100644 -index 000000000..beb86aaae +index 0000000000000000000000000000000000000000..beb86aaae57619dba877196b08ddd78b33167e79 --- /dev/null +++ b/src/skippy/tests/stage_plan_header.cpp @@ -0,0 +1,13 @@ @@ -6608,7 +6608,7 @@ index 000000000..beb86aaae +} diff --git a/src/skippy/tests/stage_slice_plan.cpp b/src/skippy/tests/stage_slice_plan.cpp new file mode 100644 -index 000000000..21f659cbd +index 0000000000000000000000000000000000000000..21f659cbd3ba2c14ae0cbf24417334da3d32a791 --- /dev/null +++ b/src/skippy/tests/stage_slice_plan.cpp @@ -0,0 +1,1200 @@ @@ -7813,7 +7813,7 @@ index 000000000..21f659cbd + return result; +} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 2e0edcb49..742ca1737 100644 +index 46fd38d5f585170bceae9e6a648850dfdfa90fc5..3f6218e13f75152185292df3dfb6b5bb662ddd24 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -181,7 +181,16 @@ set(LLAMA_CONTEXT_TEST_SRC @@ -7833,7 +7833,7 @@ index 2e0edcb49..742ca1737 100644 # these tests are disabled on Windows because they use internal functions not exported with LLAMA_API (when building with shared libraries) llama_build_and_test(test-unicode.cpp LABEL behavior LINK llama) llama_build_and_test(test-sampling.cpp LABEL behavior LINK llama) -@@ -257,6 +266,24 @@ set_tests_properties(test-generate-models PROPERTIES +@@ -263,6 +272,24 @@ set_tests_properties(test-generate-models PROPERTIES FIXTURES_SETUP generate-models ) @@ -7858,7 +7858,7 @@ index 2e0edcb49..742ca1737 100644 # Target model for test-speculative-rejection-sampling set(SPEC_TARGET_DIR "${CMAKE_CURRENT_BINARY_DIR}/test-speculative-models/target") file(MAKE_DIRECTORY "${SPEC_TARGET_DIR}") -@@ -294,6 +321,10 @@ llama_build(test-fusion.cpp) +@@ -300,6 +327,10 @@ llama_build(test-fusion.cpp) llama_build_and_test(test-chat-peg-parser.cpp peg-parser/simple-tokenize.cpp LABEL behavior) llama_build_and_test(test-jinja.cpp LABEL behavior) llama_test(test-jinja NAME test-jinja-py ARGS -py LABEL "python behavior") @@ -7869,7 +7869,7 @@ index 2e0edcb49..742ca1737 100644 llama_test_cmd(python3 NAME test-conversion-fp8 LABEL "python behavior" -@@ -309,6 +340,10 @@ llama_test_cmd(python3 +@@ -315,6 +346,10 @@ llama_test_cmd(python3 llama_build_and_test(test-json-schema.cpp LABEL behavior) llama_build_and_test(test-chat-auto-parser.cpp LABEL behavior WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) llama_build_and_test(test-chat-template.cpp LABEL behavior) @@ -7881,7 +7881,7 @@ index 2e0edcb49..742ca1737 100644 llama_build(test-chat-analysis.cpp) llama_build_and_test(test-log.cpp LABEL behavior) diff --git a/tests/test-chat-auto-parser.cpp b/tests/test-chat-auto-parser.cpp -index b9a407182..7cc5c57f6 100644 +index b9a40718276b3c7aafd7b890f07ffaaef7486f12..7cc5c57f686508d742da92a12380a98c80cd557e 100644 --- a/tests/test-chat-auto-parser.cpp +++ b/tests/test-chat-auto-parser.cpp @@ -74,9 +74,11 @@ static void test_laguna_s_preserve_reasoning(testing & t); @@ -7962,7 +7962,7 @@ index b9a407182..7cc5c57f6 100644 static void test_cohere_reasoning_detection(testing & t) { diff --git a/tests/test-chat.cpp b/tests/test-chat.cpp -index 83c11cc2d..291b7a753 100644 +index cb075a75e86f114825d8379b247a8a5200650376..49d9417d4c88bed9351ce53beeea46bae6088f58 100644 --- a/tests/test-chat.cpp +++ b/tests/test-chat.cpp @@ -518,6 +518,21 @@ static common_chat_tool special_function_tool{ @@ -8161,7 +8161,7 @@ index 83c11cc2d..291b7a753 100644 "\n"; bool got_runtime_error = false; -@@ -8643,6 +8765,41 @@ static void test_template_generation_prompt() { +@@ -8659,6 +8781,41 @@ static void test_template_generation_prompt() { check(tmpls, continuation_content(), "<|im_start|>assistant\n\nI'm thinking\n\n\nHello, "); check(tmpls, continuation_reasoning(), "<|im_start|>assistant\n\nI'm"); } @@ -8203,7 +8203,7 @@ index 83c11cc2d..291b7a753 100644 } // Test the developer role to system workaround with a simple mock template -@@ -9441,6 +9598,7 @@ static void test_msg_diffs_compute() { +@@ -9457,6 +9614,7 @@ static void test_msg_diffs_compute() { int main(int argc, char ** argv) { bool detailed_debug = false; bool only_run_filtered = false; @@ -8211,7 +8211,7 @@ index 83c11cc2d..291b7a753 100644 // Check for --template and --detailed flags for (int i = 1; i < argc; i++) { -@@ -9458,9 +9616,19 @@ int main(int argc, char ** argv) { +@@ -9474,9 +9632,19 @@ int main(int argc, char ** argv) { g_force_reconstruction_test = true; only_run_filtered = true; } @@ -8233,7 +8233,7 @@ index 83c11cc2d..291b7a753 100644 return 0; diff --git a/tests/test-deepseek4-mtp.h b/tests/test-deepseek4-mtp.h new file mode 100644 -index 000000000..87a499031 +index 0000000000000000000000000000000000000000..87a499031677d9714425c58c06d984017497757f --- /dev/null +++ b/tests/test-deepseek4-mtp.h @@ -0,0 +1,88 @@ @@ -8327,7 +8327,7 @@ index 000000000..87a499031 +} diff --git a/tests/test-graph-contract-fixture.h b/tests/test-graph-contract-fixture.h new file mode 100644 -index 000000000..c45915888 +index 0000000000000000000000000000000000000000..c45915888339575d44e94e5b62514dd7906cc3d8 --- /dev/null +++ b/tests/test-graph-contract-fixture.h @@ -0,0 +1,155 @@ @@ -8487,7 +8487,7 @@ index 000000000..c45915888 + return 0; +} diff --git a/tests/test-jinja.cpp b/tests/test-jinja.cpp -index 624542838..fe4869cc1 100644 +index 624542838540c8aa47c6446cabc07b3a65983dab..fe4869cc1998f001712009ae9f4a7f6f0ec235b3 100644 --- a/tests/test-jinja.cpp +++ b/tests/test-jinja.cpp @@ -3363,6 +3363,11 @@ sys.stdout.buffer.write(result.encode()) @@ -8503,7 +8503,7 @@ index 624542838..fe4869cc1 100644 const size_t pos = path.find_last_of("/\\"); return (pos == std::string::npos ? std::string(".") : path.substr(0, pos)) + "/../scripts/chat_tts_norm.py"; diff --git a/tests/test-llama-archs.cpp b/tests/test-llama-archs.cpp -index e9e7a6cbf..bc15ea0da 100644 +index d7ecf29bf519f8d69419a42ee37d533b138349e5..f4c09dc492b8a092b4e5f2f2a38d7a7bf9257bf1 100644 --- a/tests/test-llama-archs.cpp +++ b/tests/test-llama-archs.cpp @@ -7,12 +7,14 @@ @@ -8521,7 +8521,7 @@ index e9e7a6cbf..bc15ea0da 100644 #include #include #include -@@ -24,6 +26,28 @@ +@@ -25,6 +27,28 @@ #include #include @@ -8550,15 +8550,15 @@ index e9e7a6cbf..bc15ea0da 100644 static bool arch_matches(const std::string & filter, llm_arch arch) { if (filter.empty()) { return true; -@@ -177,6 +201,7 @@ static void usage(char ** argv) { - LOG(" -v Set log verbosity level\n"); +@@ -179,6 +203,7 @@ static void usage(char ** argv) { LOG(" -b, --backend Run only on the given backend device\n"); + LOG(" --rpc Add RPC servers (comma-separated host:port), must precede -b\n"); LOG(" --kv-shift Check K-shift against a decode at the shifted positions (CPU only)\n"); + LOG(" -t, --text-only Save models with empty rope dimension sections (text-only fixtures)\n"); LOG(" -h, --help Show this help message\n\n"); LOG("Examples:\n"); LOG(" %s\n", argv[0]); -@@ -247,10 +272,27 @@ struct kv_writer { +@@ -249,10 +274,27 @@ struct kv_writer { } }; @@ -8588,7 +8588,7 @@ index e9e7a6cbf..bc15ea0da 100644 uint32_t n_vocab = 128; uint32_t n_embd = 256; -@@ -278,7 +320,7 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const +@@ -280,7 +322,7 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const n_embd = 512; n_head = 8; n_ff = 1024; @@ -8597,7 +8597,7 @@ index e9e7a6cbf..bc15ea0da 100644 } else if (arch == LLM_ARCH_DEEPSEEK41) { // window-only, Engram, ratio-2 and ratio-1 sources, top-k reuse and a candidate-masked index layer n_embd = 512; -@@ -338,6 +380,16 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const +@@ -340,6 +382,16 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const n_layer = 3; } @@ -8614,7 +8614,7 @@ index e9e7a6cbf..bc15ea0da 100644 uint32_t n_head_kv = n_head; if (arch == LLM_ARCH_QWEN3) { n_head_kv = 1; // MQA coverage -@@ -360,7 +412,10 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const +@@ -362,7 +414,10 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const ms.add_kv(LLM_KV_EMBEDDING_LENGTH, n_embd); ms.add_kv(LLM_KV_FEATURES_LENGTH, n_embd); ms.add_kv(LLM_KV_BLOCK_COUNT, n_layer); @@ -8626,7 +8626,7 @@ index e9e7a6cbf..bc15ea0da 100644 if (arch == LLM_ARCH_K2_HORIZON) { ms.add_kv(LLM_KV_ROPE_SCALING_YARN_BETA_FAST, 128.0f); -@@ -432,7 +487,7 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const +@@ -434,7 +489,7 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const if (arch == LLM_ARCH_DEEPSEEK4 || arch == LLM_ARCH_DEEPSEEK41) { ms.add_kv(LLM_KV_ATTENTION_KEY_LENGTH, n_embd_head); ms.add_kv(LLM_KV_ATTENTION_VALUE_LENGTH, n_embd_head); @@ -8635,7 +8635,7 @@ index e9e7a6cbf..bc15ea0da 100644 } else if (arch == LLM_ARCH_DEEPSEEK2 || arch == LLM_ARCH_DEEPSEEK32 || arch == LLM_ARCH_GLM_DSA -@@ -601,12 +656,45 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const +@@ -603,12 +658,45 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const // note: using a realistic top-k here makes the results unstable and hard to match between CPU and GPU // a large value makes things deterministic since all data is selected by the indexer //ms.add_kv(LLM_KV_ATTENTION_INDEXER_TOP_K, uint32_t(8)); @@ -8682,7 +8682,7 @@ index e9e7a6cbf..bc15ea0da 100644 // mrope sections count rope pairs; Ling 3.0 VL files carry [t, h, w] sections // summing to n_rot / 2 (n_rot is 64 in this fixture) if (arch == LLM_ARCH_BAILINGMOE3) { -@@ -617,7 +705,6 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const +@@ -619,7 +707,6 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const } else { ms.add_kv(LLM_KV_ROPE_DIMENSION_SECTIONS, std::vector({n_embd_head/4, n_embd_head/4, n_embd_head/4, n_embd_head/4})); } @@ -8690,7 +8690,7 @@ index e9e7a6cbf..bc15ea0da 100644 if (arch == LLM_ARCH_HY_V4) { ms.add_kv(LLM_KV_HYPER_CONNECTION_COUNT, uint32_t(4)); ms.add_kv(LLM_KV_HYPER_CONNECTION_EPSILON, 1.0e-6f); -@@ -690,13 +777,15 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const +@@ -692,13 +779,15 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const } if (arch == LLM_ARCH_DEEPSEEK4) { @@ -8713,7 +8713,7 @@ index e9e7a6cbf..bc15ea0da 100644 ms.add_kv(LLM_KV_HASH_LAYER_COUNT, uint32_t(0)); ms.add_kv(LLM_KV_SWIGLU_CLAMP_EXP, 10.0f); ms.add_kv(LLM_KV_EXPERT_WEIGHTS_SCALE, 1.0f); -@@ -931,6 +1020,16 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const +@@ -933,6 +1022,16 @@ static gguf_context_ptr get_gguf_ctx(const llm_arch arch, const bool moe, const ggml_format_name(&t, "convnext.%" PRIu32 ".dw.weight", il); gguf_add_tensor(ms.gguf_ctx, &t); } @@ -8730,7 +8730,7 @@ index e9e7a6cbf..bc15ea0da 100644 return ret; } -@@ -938,6 +1037,61 @@ static bool silent_model_load_progress(float /*progress*/, void * /*user_data*/) +@@ -940,6 +1039,61 @@ static bool silent_model_load_progress(float /*progress*/, void * /*user_data*/) return true; } @@ -8792,7 +8792,7 @@ index e9e7a6cbf..bc15ea0da 100644 static std::string get_tmp_gguf_path() { static size_t id = 0; return (std::filesystem::temp_directory_path() / ("test-llama-archs-" + std::to_string(++id) + ".gguf")).string(); -@@ -971,7 +1125,9 @@ static std::pair get_model_and_ctx( +@@ -973,7 +1127,9 @@ static std::pair get_model_and_ctx( struct gguf_context * gguf_ctx, FILE * file, const size_t seed, const float stdev, const std::vector & devs, const llama_split_mode split_mode = LLAMA_SPLIT_MODE_LAYER, bool encode = false, @@ -8803,7 +8803,7 @@ index e9e7a6cbf..bc15ea0da 100644 llama_model_ptr model = get_model(gguf_ctx, file, seed, stdev, devs, split_mode, tensor_buft_overrides); llama_context_params ctx_params = llama_context_default_params(); -@@ -986,6 +1142,9 @@ static std::pair get_model_and_ctx( +@@ -988,6 +1144,9 @@ static std::pair get_model_and_ctx( ctx_params.moe_cache_size = moe_cache_size; ctx_params.n_ubatch = 2; } @@ -8813,7 +8813,7 @@ index e9e7a6cbf..bc15ea0da 100644 llama_context_ptr lctx(llama_init_from_model(model.get(), ctx_params)); if (!lctx) { -@@ -994,6 +1153,17 @@ static std::pair get_model_and_ctx( +@@ -996,6 +1155,17 @@ static std::pair get_model_and_ctx( return std::make_pair(std::move(model), std::move(lctx)); } @@ -8831,7 +8831,7 @@ index e9e7a6cbf..bc15ea0da 100644 static std::vector get_logits( llama_model * model, llama_context * lctx, const std::vector & tokens, bool encode = false) { const uint32_t n_vocab = llama_vocab_n_tokens(llama_model_get_vocab(model)); -@@ -1313,7 +1483,21 @@ static bool arch_supported(const llm_arch arch) { +@@ -1316,7 +1486,21 @@ static bool arch_supported(const llm_arch arch) { return true; } @@ -8854,7 +8854,7 @@ index e9e7a6cbf..bc15ea0da 100644 struct user_data_t { struct { ggml_log_callback callback; -@@ -1357,11 +1541,20 @@ static int save_models(const std::string & arch_filter, const size_t seed, const +@@ -1360,11 +1544,20 @@ static int save_models(const std::string & arch_filter, const size_t seed, const LOG_INF("%s: %s model (%s) is unsupported, skipping\n", __func__, llama_arch_name(arch), moe ? "MoE" : "dense"); continue; } @@ -8876,7 +8876,7 @@ index e9e7a6cbf..bc15ea0da 100644 const std::uintmax_t size = std::filesystem::file_size(path); LOG_CNT(" (%.2f MB)\n", (double) size / (1024.0 * 1024.0)); } -@@ -1538,6 +1731,12 @@ static int test_backends(const std::string & arch_filter, const size_t seed, con +@@ -1541,6 +1734,12 @@ static int test_backends(const std::string & arch_filter, const size_t seed, con char mixed_str[12] = {0}; bool skip = !arch_supported(arch) || (dc.split_mode == LLAMA_SPLIT_MODE_TENSOR && dc.devs.empty()); @@ -8889,17 +8889,16 @@ index e9e7a6cbf..bc15ea0da 100644 bool test_executed = false; bool test_ok = true; if (!skip) { -@@ -1982,6 +2181,9 @@ static int test_kv_shift(const std::string & arch_filter, const size_t seed, con - return n_failed == 0 ? 0 : 1; +@@ -2014,6 +2213,8 @@ static bool add_rpc_devices(const std::string & endpoints) { + } + return true; } - +#include "test-deepseek4-mtp.h" +#include "test-graph-contract-fixture.h" -+ + int main(int argc, char ** argv) { // init the logger at max verbosity. filter with a custom callback respecting the user-configure verbosity - common_log_set_verbosity_thold(LOG_LEVEL_DEBUG); -@@ -1996,11 +2198,50 @@ int main(int argc, char ** argv) { +@@ -2029,11 +2230,50 @@ int main(int argc, char ** argv) { std::string out; const char * target_backend = nullptr; bool kv_shift = false; @@ -8952,7 +8951,7 @@ index e9e7a6cbf..bc15ea0da 100644 usage(argv); return 0; } else if (strcmp(argv[i], "-a") == 0 || strcmp(argv[i], "--arch") == 0) { -@@ -2080,8 +2321,89 @@ int main(int argc, char ** argv) { +@@ -2123,8 +2363,89 @@ int main(int argc, char ** argv) { init_normal_pool(seed, stdev); try { @@ -9044,7 +9043,7 @@ index e9e7a6cbf..bc15ea0da 100644 if (kv_shift) { return test_kv_shift(arch_filter, seed, stdev, verbosity); diff --git a/tests/test-reasoning-budget.cpp b/tests/test-reasoning-budget.cpp -index a50a10824..e87e0b064 100644 +index a50a10824db72654ee93c61cec753551e290cf72..e87e0b064b88b88e5e29f93b8c26ba6f1c508648 100644 --- a/tests/test-reasoning-budget.cpp +++ b/tests/test-reasoning-budget.cpp @@ -1,5 +1,6 @@ @@ -9086,7 +9085,7 @@ index a50a10824..e87e0b064 100644 auto * sampler = common_reasoning_budget_init(nullptr, start, end, {102}, 0, REASONING_BUDGET_FORCING); diff --git a/tests/test-skippy-activation-validation.cpp b/tests/test-skippy-activation-validation.cpp new file mode 100644 -index 000000000..7466f03c1 +index 0000000000000000000000000000000000000000..7466f03c119202b9501d3042adc95c2ec48cb84a --- /dev/null +++ b/tests/test-skippy-activation-validation.cpp @@ -0,0 +1,18 @@ @@ -9110,7 +9109,7 @@ index 000000000..7466f03c1 +} diff --git a/tests/test-skippy-cachegen-import.cpp b/tests/test-skippy-cachegen-import.cpp new file mode 100644 -index 000000000..43cc3f7d6 +index 0000000000000000000000000000000000000000..43cc3f7d6b6c06ffda668a68544d7585db66b32c --- /dev/null +++ b/tests/test-skippy-cachegen-import.cpp @@ -0,0 +1,347 @@ @@ -9463,7 +9462,7 @@ index 000000000..43cc3f7d6 +} diff --git a/tests/test-skippy-cachegen-metal.cpp b/tests/test-skippy-cachegen-metal.cpp new file mode 100644 -index 000000000..b15b5e53a +index 0000000000000000000000000000000000000000..b15b5e53a6918b43d72d4ad7aedf531282214bdd --- /dev/null +++ b/tests/test-skippy-cachegen-metal.cpp @@ -0,0 +1,399 @@ @@ -9868,7 +9867,7 @@ index 000000000..b15b5e53a +} diff --git a/tests/test-skippy-kv-cells-contiguous.cpp b/tests/test-skippy-kv-cells-contiguous.cpp new file mode 100644 -index 000000000..0e95c35b2 +index 0000000000000000000000000000000000000000..0e95c35b29ff81c65f0a4fef6de24ae2e4b2a597 --- /dev/null +++ b/tests/test-skippy-kv-cells-contiguous.cpp @@ -0,0 +1,20 @@ @@ -9894,7 +9893,7 @@ index 000000000..0e95c35b2 +} diff --git a/tests/test-skippy-kv-page-export.cpp b/tests/test-skippy-kv-page-export.cpp new file mode 100644 -index 000000000..30c88b490 +index 0000000000000000000000000000000000000000..30c88b49028395dea438ab6697a578463457d1b8 --- /dev/null +++ b/tests/test-skippy-kv-page-export.cpp @@ -0,0 +1,367 @@ @@ -10267,7 +10266,7 @@ index 000000000..30c88b490 +} diff --git a/tests/test-skippy-model-loader-accounting.cpp b/tests/test-skippy-model-loader-accounting.cpp new file mode 100644 -index 000000000..22b92c0a8 +index 0000000000000000000000000000000000000000..22b92c0a8513c9ea5c1983d942aba98dcd0acee0 --- /dev/null +++ b/tests/test-skippy-model-loader-accounting.cpp @@ -0,0 +1,320 @@ @@ -10593,7 +10592,7 @@ index 000000000..22b92c0a8 +} diff --git a/tests/test-skippy-recurrent-state-roundtrip.cpp b/tests/test-skippy-recurrent-state-roundtrip.cpp new file mode 100644 -index 000000000..0fae7bbd4 +index 0000000000000000000000000000000000000000..0fae7bbd4efbd65e862972e7bbed24e41a378753 --- /dev/null +++ b/tests/test-skippy-recurrent-state-roundtrip.cpp @@ -0,0 +1,160 @@ @@ -10759,7 +10758,7 @@ index 000000000..0fae7bbd4 +} diff --git a/tests/test-skippy-rerank-template.cpp b/tests/test-skippy-rerank-template.cpp new file mode 100644 -index 000000000..d6f9570ba +index 0000000000000000000000000000000000000000..d6f9570ba4631f77a672fe080ff1d5709764602d --- /dev/null +++ b/tests/test-skippy-rerank-template.cpp @@ -0,0 +1,34 @@ @@ -10799,7 +10798,7 @@ index 000000000..d6f9570ba +} diff --git a/tests/test-skippy-sampling-suppress.cpp b/tests/test-skippy-sampling-suppress.cpp new file mode 100644 -index 000000000..3f797cbe8 +index 0000000000000000000000000000000000000000..3f797cbe8a9a07892f15172786c654352786f750 --- /dev/null +++ b/tests/test-skippy-sampling-suppress.cpp @@ -0,0 +1,90 @@ @@ -10895,7 +10894,7 @@ index 000000000..3f797cbe8 +} diff --git a/tests/test-skippy-verify-checkpoint-retirement.cpp b/tests/test-skippy-verify-checkpoint-retirement.cpp new file mode 100644 -index 000000000..d09acccb4 +index 0000000000000000000000000000000000000000..d09acccb4434eb7fbc05f3bf09a88763f4532450 --- /dev/null +++ b/tests/test-skippy-verify-checkpoint-retirement.cpp @@ -0,0 +1,26 @@ @@ -10925,6 +10924,3 @@ index 000000000..d09acccb4 + if (skippy_retire_verify_checkpoint_exact(checkpoints, 10, 3)) return 6; + return 0; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0007-fix-skippy-keep-native-MTP-state-across-verify-trims.patch b/llama_cpp/patches/0007-fix-skippy-keep-native-MTP-state-across-verify-trims.patch index 3362d7a0..36ad7c30 100644 --- a/llama_cpp/patches/0007-fix-skippy-keep-native-MTP-state-across-verify-trims.patch +++ b/llama_cpp/patches/0007-fix-skippy-keep-native-MTP-state-across-verify-trims.patch @@ -1,4 +1,4 @@ -From f3d1a74d0868e97679227e706985adf6c092f245 Mon Sep 17 00:00:00 2001 +From 4b425d26ff07b67e59783a57899fe84fcfcb25d6 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Sat, 10 Oct 2026 17:10:06 +0100 Subject: [PATCH] fix(skippy): keep native MTP state across verify trims @@ -29,7 +29,7 @@ resumes. Callers that discard drafts from rejected windows are unaffected. 6 files changed, 144 insertions(+), 8 deletions(-) diff --git a/src/skippy/runtime_support.h b/src/skippy/runtime_support.h -index d7e991307..8ba595623 100644 +index d7e99130754c2447fac040b6af979b687b59241b..8ba5956234e4e322463d515d93f18271a3d94a84 100644 --- a/src/skippy/runtime_support.h +++ b/src/skippy/runtime_support.h @@ -36,6 +36,7 @@ void skippy_mark_context_synchronized(skippy_model * model); @@ -41,7 +41,7 @@ index d7e991307..8ba595623 100644 bool skippy_verify_window_can_roll_back_in_place( const skippy_session * session, diff --git a/src/skippy/runtime_types.h b/src/skippy/runtime_types.h -index f19a25b76..38ebae8d7 100644 +index f19a25b76a54088ef1cf49c27ac75a22f88514cd..38ebae8d74ec710d59ed3d07ccded0a42836b7af 100644 --- a/src/skippy/runtime_types.h +++ b/src/skippy/runtime_types.h @@ -177,6 +177,11 @@ struct skippy_session { @@ -57,7 +57,7 @@ index f19a25b76..38ebae8d7 100644 bool reset_required = false; std::vector verify_checkpoints; diff --git a/src/skippy/speculative_decoding.cpp b/src/skippy/speculative_decoding.cpp -index 3d15111fb..7f55c0d88 100644 +index 3d15111fb304c38341aade0a9e44e09962f55c87..7f55c0d88d493f9d9aae9245877dd208bbfcf54e 100644 --- a/src/skippy/speculative_decoding.cpp +++ b/src/skippy/speculative_decoding.cpp @@ -91,6 +91,8 @@ void skippy_mtp_clear_session_state(skippy_session * session) { @@ -200,7 +200,7 @@ index 3d15111fb..7f55c0d88 100644 + return status; +} diff --git a/src/skippy/speculative_internal.h b/src/skippy/speculative_internal.h -index d8276944d..3a147d14d 100644 +index d8276944dea03fc64c202fa184213d47a73cfcf3..3a147d14d8c87f44fe73b84dd7296183ba3f60eb 100644 --- a/src/skippy/speculative_internal.h +++ b/src/skippy/speculative_internal.h @@ -30,3 +30,15 @@ enum skippy_status skippy_mtp_propose_next( @@ -220,7 +220,7 @@ index d8276944d..3a147d14d 100644 + skippy_native_mtp_draft * out_mtp_draft, + skippy_error ** out_error); diff --git a/src/skippy/state.cpp b/src/skippy/state.cpp -index f035ea13f..15c48419d 100644 +index f035ea13fdcfd88fb0681918f3acf389199bc81b..15c48419d05f9c1ea36751e793de609c37e7ad06 100644 --- a/src/skippy/state.cpp +++ b/src/skippy/state.cpp @@ -852,7 +852,7 @@ enum skippy_status skippy_trim_session( @@ -233,7 +233,7 @@ index f035ea13f..15c48419d 100644 session->ctx->synchronize(); diff --git a/src/skippy/verification.cpp b/src/skippy/verification.cpp -index 0812485d7..bb3c0e621 100644 +index 0812485d71dfedc65a8760fe682ab8b89c3771a0..bb3c0e6214fcae24ae75193ee1dbbf31f4a2670c 100644 --- a/src/skippy/verification.cpp +++ b/src/skippy/verification.cpp @@ -230,13 +230,24 @@ enum skippy_status skippy_verify_tokens_frame_sampled( @@ -268,6 +268,3 @@ index 0812485d7..bb3c0e621 100644 if (status != SKIPPY_STATUS_OK) { return status; } --- -2.56.1 - diff --git a/llama_cpp/patches/0008-fix-skippy-stop-re-attaching-backend-samplers-betwee.patch b/llama_cpp/patches/0008-fix-skippy-stop-re-attaching-backend-samplers-betwee.patch index d3fefa12..8521d9f0 100644 --- a/llama_cpp/patches/0008-fix-skippy-stop-re-attaching-backend-samplers-betwee.patch +++ b/llama_cpp/patches/0008-fix-skippy-stop-re-attaching-backend-samplers-betwee.patch @@ -1,4 +1,4 @@ -From 44c5b53bb9b9f8db31fb9a68a2598dfd3787b252 Mon Sep 17 00:00:00 2001 +From 4fe4735053162b25c6b771932088a7b33c9bd42b Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Sat, 10 Oct 2026 18:34:14 +0100 Subject: [PATCH] fix(skippy): stop re-attaching backend samplers between @@ -23,7 +23,7 @@ resets, instead of attaching rebuilt chains to the backend. 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/skippy/runtime_types.h b/src/skippy/runtime_types.h -index 38ebae8d7..f44e874d9 100644 +index 38ebae8d74ec710d59ed3d07ccded0a42836b7af..f44e874d9f33529cbf4a62b2c2cf6070556d44cf 100644 --- a/src/skippy/runtime_types.h +++ b/src/skippy/runtime_types.h @@ -158,6 +158,11 @@ struct skippy_session { @@ -39,7 +39,7 @@ index 38ebae8d7..f44e874d9 100644 uint64_t sampling_rebuild_count = 0; skippy_sampling_config sampling_config = {}; diff --git a/src/skippy/sampling.cpp b/src/skippy/sampling.cpp -index 6fd1240e3..de5fa6ba5 100644 +index 6fd1240e375eb08280bdc303ff6ce90a1e8ccf67..de5fa6ba5b7eaab955cd2bc4169b38e6830e797f 100644 --- a/src/skippy/sampling.cpp +++ b/src/skippy/sampling.cpp @@ -138,6 +138,7 @@ enum skippy_status skippy_verify_token_batch( @@ -61,7 +61,7 @@ index 6fd1240e3..de5fa6ba5 100644 // scheduler may reset and reuse the same chain on every iteration; // attaching it again violates llama_sampler_chain's one-shot init diff --git a/src/skippy/session.cpp b/src/skippy/session.cpp -index f1de95cc5..36c972d92 100644 +index f1de95cc5290334672181cdda2ce7c7796e772c5..36c972d921626cc32f1411d43ae2bf99630d80d4 100644 --- a/src/skippy/session.cpp +++ b/src/skippy/session.cpp @@ -392,6 +392,7 @@ enum skippy_status skippy_session_reset( @@ -73,7 +73,7 @@ index f1de95cc5..36c972d92 100644 session->reset_required = false; session->verify_checkpoints.clear(); diff --git a/src/skippy/tests/runtime_events.cpp b/src/skippy/tests/runtime_events.cpp -index d764514ed..4bceea3cd 100644 +index d764514ed16b47c3177cb3641d7686a9de7e05ba..4bceea3cdb3072a2e86627a40781c1a7947289ae 100644 --- a/src/skippy/tests/runtime_events.cpp +++ b/src/skippy/tests/runtime_events.cpp @@ -500,9 +500,19 @@ int test_native_model_load_production(const char * fixture_path) { @@ -97,7 +97,7 @@ index d764514ed..4bceea3cd 100644 // Embedding and rerank batches request every output row. Their shared diff --git a/src/skippy/verification.cpp b/src/skippy/verification.cpp -index bb3c0e621..2e9b20c48 100644 +index bb3c0e6214fcae24ae75193ee1dbbf31f4a2670c..2e9b20c48db9a617880c692499079ee1652f1a78 100644 --- a/src/skippy/verification.cpp +++ b/src/skippy/verification.cpp @@ -138,6 +138,7 @@ enum skippy_status skippy_verify_tokens_frame_sampled( @@ -108,6 +108,3 @@ index bb3c0e621..2e9b20c48 100644 const bool activation_input = skippy_is_filtered(session) && session->stage_model->config.layer_start > 0; status = skippy_checkpoint_verify_window( --- -2.56.1 - diff --git a/llama_cpp/patches/0009-server-use-a-secure-RNG-for-generated-IDs.patch b/llama_cpp/patches/0009-server-use-a-secure-RNG-for-generated-IDs.patch index 9bc15eae..40e7e185 100644 --- a/llama_cpp/patches/0009-server-use-a-secure-RNG-for-generated-IDs.patch +++ b/llama_cpp/patches/0009-server-use-a-secure-RNG-for-generated-IDs.patch @@ -1,4 +1,4 @@ -From 60b601f6388b86d04578e5b94ab09af54010342f Mon Sep 17 00:00:00 2001 +From d98c60b727be7a04ea071c9c91336cec36ad913c Mon Sep 17 00:00:00 2001 From: benthecarman Date: Wed, 7 Oct 2026 14:42:10 -0500 Subject: [PATCH] server: use a secure RNG for generated IDs @@ -18,7 +18,7 @@ size. 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/server/server-common.cpp b/tools/server/server-common.cpp -index 8bceea6aa..5721a7bed 100644 +index 8bceea6aaa733290a77a861c1d4626a05078f579..5721a7bedc7ee3ccd2fc1bf1110de23b46d4a2b0 100644 --- a/tools/server/server-common.cpp +++ b/tools/server/server-common.cpp @@ -175,12 +175,12 @@ std::string random_string() { @@ -36,6 +36,3 @@ index 8bceea6aa..5721a7bed 100644 } return result; --- -2.56.1 - diff --git a/llama_cpp/patches/0010-feat-skippy-read-selected-token-scores-in-causal-bat.patch b/llama_cpp/patches/0010-feat-skippy-read-selected-token-scores-in-causal-bat.patch index df1a09e2..87c7b287 100644 --- a/llama_cpp/patches/0010-feat-skippy-read-selected-token-scores-in-causal-bat.patch +++ b/llama_cpp/patches/0010-feat-skippy-read-selected-token-scores-in-causal-bat.patch @@ -1,4 +1,4 @@ -From 26c6c57e40e040c47aeaac0457db8ebf4f50691e Mon Sep 17 00:00:00 2001 +From 9507f9671c900095db714613576fc3ce6afd4468 Mon Sep 17 00:00:00 2001 From: IvGolovach <20299097+IvGolovach@users.noreply.github.com> Date: Fri, 23 Oct 2026 12:00:00 -0700 Subject: [PATCH] feat(skippy): read selected token scores in causal batches @@ -17,7 +17,7 @@ Readouts do not invoke samplers or advance generation history. create mode 100644 src/skippy/tests/selected_logits.cpp diff --git a/include/skippy/execution.h b/include/skippy/execution.h -index 7098677d8..bf9fb497c 100644 +index 7098677d8bf27a333c7438dc4895d1859fc8eab4..bf9fb497cfc4a9c78d9e6f7af065cf8ca0303641 100644 --- a/include/skippy/execution.h +++ b/include/skippy/execution.h @@ -15,6 +15,23 @@ @@ -54,7 +54,7 @@ index 7098677d8..bf9fb497c 100644 /** diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 2bc7d6f6e..05108ad38 100644 +index 2bc7d6f6e49c99171722661daf308d435d260b6a..05108ad3894886d92e0e376bc2e3b40c296965a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -168,6 +168,10 @@ endif() @@ -69,7 +69,7 @@ index 2bc7d6f6e..05108ad38 100644 skippy/tests/hardware_application_probe.cpp) target_include_directories(skippy-hardware-application-probe PRIVATE .) diff --git a/src/skippy/execution-batch.cpp b/src/skippy/execution-batch.cpp -index 2b9593e0c..86ea1ed55 100644 +index 2b9593e0cfc957c583a5c4c9d2679f8ab4c70d9a..86ea1ed55749ec66d964197a68eaa1437e53a4e8 100644 --- a/src/skippy/execution-batch.cpp +++ b/src/skippy/execution-batch.cpp @@ -5,6 +5,7 @@ @@ -168,7 +168,7 @@ index 2b9593e0c..86ea1ed55 100644 // sparse output-row translation internally. diff --git a/src/skippy/selected_logits.h b/src/skippy/selected_logits.h new file mode 100644 -index 000000000..0fa526e5d +index 0000000000000000000000000000000000000000..0fa526e5d8bf3ec8cbebf9caceba774562a82287 --- /dev/null +++ b/src/skippy/selected_logits.h @@ -0,0 +1,43 @@ @@ -217,7 +217,7 @@ index 000000000..0fa526e5d +#endif diff --git a/src/skippy/tests/selected_logits.cpp b/src/skippy/tests/selected_logits.cpp new file mode 100644 -index 000000000..d33237d1a +index 0000000000000000000000000000000000000000..d33237d1a62c4200d6659f14b13488f4c04f726c --- /dev/null +++ b/src/skippy/tests/selected_logits.cpp @@ -0,0 +1,25 @@ @@ -246,6 +246,3 @@ index 000000000..d33237d1a + if (skippy_selected_log_probabilities(inf.data(), inf.size(), selected.data() + 1, 1, result.data())) return 8; + return 0; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0011-grammar-match-literal-lazy-triggers-without-regex.patch b/llama_cpp/patches/0011-grammar-match-literal-lazy-triggers-without-regex.patch index 8cf261a8..95c8a93e 100644 --- a/llama_cpp/patches/0011-grammar-match-literal-lazy-triggers-without-regex.patch +++ b/llama_cpp/patches/0011-grammar-match-literal-lazy-triggers-without-regex.patch @@ -1,4 +1,4 @@ -From 3cf3c99e3b8dacd2f451d8402c5abbab4f3fc658 Mon Sep 17 00:00:00 2001 +From f3416779a6cda73c5dc5d854c28132ab05107e95 Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Wed, 28 Oct 2026 20:57:15 +1300 Subject: [PATCH] grammar: match literal lazy triggers without regex @@ -11,7 +11,7 @@ Subject: [PATCH] grammar: match literal lazy triggers without regex create mode 100644 tests/test-grammar-trigger-patterns.cpp diff --git a/src/llama-grammar.cpp b/src/llama-grammar.cpp -index 21a018c8c..40eca5a1e 100644 +index 21a018c8c7096e1a26f5e7f1ae01ef1c3e70b2ea..40eca5a1e4146a7946939475d3ad9c91a4a33096 100644 --- a/src/llama-grammar.cpp +++ b/src/llama-grammar.cpp @@ -440,6 +440,16 @@ static void print_rule( @@ -32,7 +32,7 @@ index 21a018c8c..40eca5a1e 100644 // get from the first matched capturing group to the end of the string size_t start = std::string::npos; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 742ca1737..c1faa202f 100644 +index 3f6218e13f75152185292df3dfb6b5bb662ddd24..2e017268d51396c450c2d12b672f6ea29ff962db 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -196,6 +196,7 @@ if (NOT WIN32 OR NOT BUILD_SHARED_LIBS) @@ -45,7 +45,7 @@ index 742ca1737..c1faa202f 100644 llama_build_and_test(test-batch-alloc.cpp LABEL behavior LINK llama) diff --git a/tests/test-grammar-trigger-patterns.cpp b/tests/test-grammar-trigger-patterns.cpp new file mode 100644 -index 000000000..6df57b5c6 +index 0000000000000000000000000000000000000000..6df57b5c68256a142e3d28400f7ca49a5292d915 --- /dev/null +++ b/tests/test-grammar-trigger-patterns.cpp @@ -0,0 +1,72 @@ @@ -121,6 +121,3 @@ index 000000000..6df57b5c6 + assert(insensitive.find("WORD") == 0); + return 0; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0012-feat-skippy-place-routed-experts-of-a-block-range-in.patch b/llama_cpp/patches/0012-feat-skippy-place-routed-experts-of-a-block-range-in.patch index 9e7c2559..01a78f97 100644 --- a/llama_cpp/patches/0012-feat-skippy-place-routed-experts-of-a-block-range-in.patch +++ b/llama_cpp/patches/0012-feat-skippy-place-routed-experts-of-a-block-range-in.patch @@ -1,4 +1,4 @@ -From a5765972b266c4322c828ba05a25aaed00d2e62d Mon Sep 17 00:00:00 2001 +From 7d636470577be394a914c8e31f03a196dd6ac9c8 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Fri, 16 Oct 2026 19:21:00 +0300 Subject: [PATCH] feat(skippy): place routed experts of a block range in host @@ -24,7 +24,7 @@ object because llama.cpp borrows both until the load call returns. 7 files changed, 109 insertions(+), 1 deletion(-) diff --git a/include/skippy/common.h b/include/skippy/common.h -index b9b5259af..df831c43e 100644 +index b9b5259afe44fe588e485a3abeccb8bc58bf0ed8..df831c43ebf0be1038278eddf6c7d68596c01082 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -37,7 +37,7 @@ index b9b5259af..df831c43e 100644 #if defined(_MSC_VER) #define SKIPPY_DEPRECATED(message) __declspec(deprecated(message)) diff --git a/include/skippy/runtime.h b/include/skippy/runtime.h -index 799bdca2d..bc4da9a07 100644 +index 799bdca2dadf1ef102ea5b207827ffda1ef8abf0..bc4da9a07b869c11b4ec8d6e04c447632d7423eb 100644 --- a/include/skippy/runtime.h +++ b/include/skippy/runtime.h @@ -117,6 +117,12 @@ struct skippy_runtime_config { @@ -54,7 +54,7 @@ index 799bdca2d..bc4da9a07 100644 /** @brief Returns a C-safe runtime configuration with all derived-default controls set to auto. */ diff --git a/src/skippy/model_load_config.cpp b/src/skippy/model_load_config.cpp -index 2e8d3c4ed..5a5834038 100644 +index 2e8d3c4ed6d312e4ce618d04eddf18dae7782c5b..5a5834038f40888da049a5d22e5bbd24de69ad93 100644 --- a/src/skippy/model_load_config.cpp +++ b/src/skippy/model_load_config.cpp @@ -176,6 +176,39 @@ void skippy_apply_model_load_memory_config( @@ -98,7 +98,7 @@ index 2e8d3c4ed..5a5834038 100644 const struct skippy_runtime_config * config, llama_context_params & params) { diff --git a/src/skippy/model_load_config_internal.h b/src/skippy/model_load_config_internal.h -index 554d2bdd3..e3649e713 100644 +index 554d2bdd3be1a734c30fdd53ae7ef05658fb45e4..e3649e7135d8ae215f67e20a00896747bcbcdfc3 100644 --- a/src/skippy/model_load_config_internal.h +++ b/src/skippy/model_load_config_internal.h @@ -6,6 +6,7 @@ @@ -132,7 +132,7 @@ index 554d2bdd3..e3649e713 100644 const skippy_runtime_config * config, llama_context_params & params); diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp -index 60a27669f..7305cc529 100644 +index 60a27669fb6a2ef80651e41bc79de1da494a43a8..7305cc5298062b5c70b2c38136a14afbfda8805e 100644 --- a/src/skippy/model_loading.cpp +++ b/src/skippy/model_loading.cpp @@ -962,10 +962,12 @@ enum skippy_status skippy_model_open_impl( @@ -174,7 +174,7 @@ index 60a27669f..7305cc529 100644 llama_backend_init(); diff --git a/src/skippy/model_source.cpp b/src/skippy/model_source.cpp -index 02ad771ad..2b91f2b71 100644 +index 02ad771ade0bac7dddfc4d31eff27247fbadd207..2b91f2b71bb228cec598aab02dc0585c128b8bad 100644 --- a/src/skippy/model_source.cpp +++ b/src/skippy/model_source.cpp @@ -393,9 +393,11 @@ static enum skippy_status skippy_model_open_from_source_impl( @@ -190,7 +190,7 @@ index 02ad771ad..2b91f2b71 100644 llama_backend_init(); if (!ggml_backend_reg_count()) { diff --git a/src/skippy/tests/hardware_application_probe.cpp b/src/skippy/tests/hardware_application_probe.cpp -index cfc17776b..417c07dbb 100644 +index cfc17776b8f58f26654a160d4ee75deb88f4ee67..417c07dbb40f00a408913ff5fa41f37154be7d0c 100644 --- a/src/skippy/tests/hardware_application_probe.cpp +++ b/src/skippy/tests/hardware_application_probe.cpp @@ -4,6 +4,7 @@ static const skippy::log_gate::installer skippy_log_gate_installer{}; @@ -251,6 +251,3 @@ index cfc17776b..417c07dbb 100644 + return passed ? 0 : 1; } --- -2.56.1 - diff --git a/llama_cpp/patches/0013-fix-skippy-take-the-argmax-path-for-temperature-0-ch.patch b/llama_cpp/patches/0013-fix-skippy-take-the-argmax-path-for-temperature-0-ch.patch index 68348d6d..a9cb94fb 100644 --- a/llama_cpp/patches/0013-fix-skippy-take-the-argmax-path-for-temperature-0-ch.patch +++ b/llama_cpp/patches/0013-fix-skippy-take-the-argmax-path-for-temperature-0-ch.patch @@ -1,4 +1,4 @@ -From f3b8b1a047359256739c46d9a7f77eb02a29e0bb Mon Sep 17 00:00:00 2001 +From aa530bbd0e840eae5f0eb64dc3639b4920b332cb Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Thu, 29 Oct 2026 19:55:52 -0400 Subject: [PATCH] fix(skippy): take the argmax path for temperature-0 chains @@ -17,7 +17,7 @@ Subject: [PATCH] fix(skippy): take the argmax path for temperature-0 chains create mode 100644 src/skippy/sampling_argmax.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 05108ad38..ead5ea4b4 100644 +index 05108ad3894886d92e0e376bc2e3b40c296965a1..ead5ea4b4527ab884a792174afa50a75aef32eb4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,6 +50,7 @@ add_library(llama @@ -38,7 +38,7 @@ index 05108ad38..ead5ea4b4 100644 COMMAND skippy-sampling-history "${SKIPPY_MODEL_FIXTURE_DIR}/${family}-dense.gguf" ${mode} ${state}) diff --git a/src/skippy/chat_sampling.cpp b/src/skippy/chat_sampling.cpp -index 3c9fc758b..2d266fbb7 100644 +index 3c9fc758bdae343a7ae9581a32bb95b436d5de28..2d266fbb71755be7e27aeed0f756f6b0f19ba364 100644 --- a/src/skippy/chat_sampling.cpp +++ b/src/skippy/chat_sampling.cpp @@ -5,6 +5,7 @@ @@ -106,7 +106,7 @@ index 3c9fc758b..2d266fbb7 100644 skippy_mark_context_synchronized(session->stage_model); const auto * candidates = common_sampler_get_candidates(session->sampler, false); diff --git a/src/skippy/runtime_types.h b/src/skippy/runtime_types.h -index f44e874d9..46e907aa0 100644 +index f44e874d9f33529cbf4a62b2c2cf6070556d44cf..46e907aa0d03e2b8eeb1cfbaf70e4ab845026390 100644 --- a/src/skippy/runtime_types.h +++ b/src/skippy/runtime_types.h @@ -1,6 +1,7 @@ @@ -128,7 +128,7 @@ index f44e874d9..46e907aa0 100644 bool sampling_config_valid = false; std::string chat_sampling_metadata; diff --git a/src/skippy/sampling.cpp b/src/skippy/sampling.cpp -index de5fa6ba5..6a1352271 100644 +index de5fa6ba5b7eaab955cd2bc4169b38e6830e797f..6a13522711cd8119231df0dad8aa64219ca8e6a7 100644 --- a/src/skippy/sampling.cpp +++ b/src/skippy/sampling.cpp @@ -331,6 +331,7 @@ void skippy_clear_chat_sampling(skippy_session * session) { @@ -149,7 +149,7 @@ index de5fa6ba5..6a1352271 100644 static void skippy_log_sampling_cache_metrics( diff --git a/src/skippy/sampling_argmax.cpp b/src/skippy/sampling_argmax.cpp new file mode 100644 -index 000000000..42e777f89 +index 0000000000000000000000000000000000000000..42e777f8991ee8a1b4034652aaee7ab66be2346f --- /dev/null +++ b/src/skippy/sampling_argmax.cpp @@ -0,0 +1,136 @@ @@ -291,7 +291,7 @@ index 000000000..42e777f89 +} diff --git a/src/skippy/sampling_argmax.h b/src/skippy/sampling_argmax.h new file mode 100644 -index 000000000..d06000f11 +index 0000000000000000000000000000000000000000..d06000f1149c0d43ac1ce340136f1614ef394bda --- /dev/null +++ b/src/skippy/sampling_argmax.h @@ -0,0 +1,42 @@ @@ -338,7 +338,7 @@ index 000000000..d06000f11 + int32_t n_vocab, + const skippy_argmax_plan & plan); diff --git a/src/skippy/tests/sampling_history.cpp b/src/skippy/tests/sampling_history.cpp -index b191ecf34..5ae8e15b4 100644 +index b191ecf34eb520294c09efe517676db6d9ab16bb..5ae8e15b4b0bf31f2cd3b15ce96ac8a6a8463de1 100644 --- a/src/skippy/tests/sampling_history.cpp +++ b/src/skippy/tests/sampling_history.cpp @@ -1,5 +1,7 @@ @@ -485,6 +485,3 @@ index b191ecf34..5ae8e15b4 100644 } else { for (const bool full : {false, true}) { if (grammar) { --- -2.56.1 - diff --git a/llama_cpp/patches/0014-skippy-size-recurrent-rollback-for-speculative-verif.patch b/llama_cpp/patches/0014-skippy-size-recurrent-rollback-for-speculative-verif.patch index e0d73ad3..a4a434ba 100644 --- a/llama_cpp/patches/0014-skippy-size-recurrent-rollback-for-speculative-verif.patch +++ b/llama_cpp/patches/0014-skippy-size-recurrent-rollback-for-speculative-verif.patch @@ -1,4 +1,4 @@ -From 16282df487cc033c757299b3c6608573947ab6a7 Mon Sep 17 00:00:00 2001 +From 0044d1c94f1bf536e856ea03249ab9e3450f6026 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Wed, 28 Oct 2026 14:17:38 +1100 Subject: [PATCH] skippy: size recurrent rollback for speculative verify @@ -23,7 +23,7 @@ backend-sampling output limit is restored. 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/skippy/runtime.h b/include/skippy/runtime.h -index bc4da9a07..b570682ef 100644 +index bc4da9a07b869c11b4ec8d6e04c447632d7423eb..b570682ef1a9559bd0d76429908bd06de34dc84b 100644 --- a/include/skippy/runtime.h +++ b/include/skippy/runtime.h @@ -123,6 +123,10 @@ struct skippy_runtime_config { @@ -38,10 +38,10 @@ index bc4da9a07..b570682ef 100644 /** @brief Returns a C-safe runtime configuration with all derived-default controls set to auto. */ diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index 5e5a6f526..6d32d444d 100644 +index 52dfe91c75de4526f662d73b692346d23423fdf0..2657085306eae301b88dde6fa09f57c6e0cbf571 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp -@@ -2352,9 +2352,10 @@ int llama_context::decode( +@@ -2339,9 +2339,10 @@ int llama_context::decode( // are limited to one output row; a sampler on some other // sequence of this context must not reject a multi-output // batch (e.g. speculative verification) for this one. @@ -56,7 +56,7 @@ index 5e5a6f526..6d32d444d 100644 } } diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp -index 7305cc529..db5a69e38 100644 +index 7305cc5298062b5c70b2c38136a14afbfda8805e..db5a69e38f4f32163ce796436501cfed76db1065 100644 --- a/src/skippy/model_loading.cpp +++ b/src/skippy/model_loading.cpp @@ -733,7 +733,13 @@ enum skippy_status skippy_finish_model_open( @@ -75,7 +75,7 @@ index 7305cc529..db5a69e38 100644 } // Multi-lane activation exports rely on the shared KV pool's batch order. diff --git a/src/skippy/sampling.cpp b/src/skippy/sampling.cpp -index 6a1352271..b688fce73 100644 +index 6a13522711cd8119231df0dad8aa64219ca8e6a7..b688fce731da6af004ad3d6444cd9d679a890324 100644 --- a/src/skippy/sampling.cpp +++ b/src/skippy/sampling.cpp @@ -325,7 +325,9 @@ void skippy_clear_chat_sampling(skippy_session * session) { @@ -90,7 +90,7 @@ index 6a1352271..b688fce73 100644 session->sampling_config_valid = false; session->chat_sampling_metadata.clear(); diff --git a/src/skippy/session.cpp b/src/skippy/session.cpp -index 36c972d92..4741f55cb 100644 +index 36c972d921626cc32f1411d43ae2bf99630d80d4..4741f55cb5271c78b2947596ae987bed1c0b19f5 100644 --- a/src/skippy/session.cpp +++ b/src/skippy/session.cpp @@ -390,6 +390,7 @@ enum skippy_status skippy_session_reset( @@ -101,6 +101,3 @@ index 36c972d92..4741f55cb 100644 } skippy_mtp_clear_session_state(session); session->sampling_backend_verifying = false; --- -2.56.1 - diff --git a/llama_cpp/patches/0015-skippy-roll-back-staged-verify-windows-in-place.patch b/llama_cpp/patches/0015-skippy-roll-back-staged-verify-windows-in-place.patch index b89da45d..f220e11b 100644 --- a/llama_cpp/patches/0015-skippy-roll-back-staged-verify-windows-in-place.patch +++ b/llama_cpp/patches/0015-skippy-roll-back-staged-verify-windows-in-place.patch @@ -1,4 +1,4 @@ -From c860ad89a65d326cdcf51bf048b2cd34cf0f50b3 Mon Sep 17 00:00:00 2001 +From 973a3878cf49a7b6a20d9793f520a387ae747025 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Thu, 29 Oct 2026 21:32:31 +1100 Subject: [PATCH] skippy: roll back staged verify windows in place @@ -71,7 +71,7 @@ rewind must be refused as unsupported. create mode 100644 src/skippy/verify_window.h diff --git a/include/skippy/common.h b/include/skippy/common.h -index df831c43e..3448095a1 100644 +index df831c43ebf0be1038278eddf6c7d68596c01082..3448095a1935d0d2ba3a12ca72f4d178c3f317e5 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -84,7 +84,7 @@ index df831c43e..3448095a1 100644 #if defined(_MSC_VER) #define SKIPPY_DEPRECATED(message) __declspec(deprecated(message)) diff --git a/include/skippy/state.h b/include/skippy/state.h -index 1cfaaa5c6..e8d0874a1 100644 +index 1cfaaa5c69329eb0d21307c72cb7629267002be3..e8d0874a1bf45a002f86c2459af75a426efcc05e 100644 --- a/include/skippy/state.h +++ b/include/skippy/state.h @@ -173,6 +173,21 @@ LLAMA_API enum skippy_status skippy_retire_verify_checkpoint( @@ -110,7 +110,7 @@ index 1cfaaa5c6..e8d0874a1 100644 LLAMA_API enum skippy_status skippy_export_kv_page( struct skippy_session * session, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index ead5ea4b4..bb9de46af 100644 +index ead5ea4b4527ab884a792174afa50a75aef32eb4..bb9de46afbefd642f11c7bf4e3d9ed3d4b87e29b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -59,6 +59,7 @@ add_library(llama @@ -149,7 +149,7 @@ index ead5ea4b4..bb9de46af 100644 target_include_directories(skippy-sampling-history PRIVATE .) target_compile_features(skippy-sampling-history PRIVATE cxx_std_17) diff --git a/src/skippy-verify-checkpoint.h b/src/skippy-verify-checkpoint.h -index 8793000c1..f6ce0295e 100644 +index 8793000c101ace2fa78b5ae4356c4bed9393fcb9..f6ce0295e9badcb850bcb7feccd5781e2dc0b7a5 100644 --- a/src/skippy-verify-checkpoint.h +++ b/src/skippy-verify-checkpoint.h @@ -2,13 +2,17 @@ @@ -182,7 +182,7 @@ index 8793000c1..f6ce0295e 100644 return true; } diff --git a/src/skippy/activation.cpp b/src/skippy/activation.cpp -index d1c094548..7167e5f7a 100644 +index d1c094548c7c3e0273366d2fb067c037d1878255..7167e5f7a49541628823aee6dd5a695ec183f4d4 100644 --- a/src/skippy/activation.cpp +++ b/src/skippy/activation.cpp @@ -6,6 +6,7 @@ @@ -450,7 +450,7 @@ index d1c094548..7167e5f7a 100644 false, SKIPPY_GLM_DSA_PHASE_HINT_VERIFY, diff --git a/src/skippy/execution-batch.cpp b/src/skippy/execution-batch.cpp -index 86ea1ed55..40faff815 100644 +index 86ea1ed55749ec66d964197a68eaa1437e53a4e8..40faff815be00b44a316945bcf7d345cb008b9ce 100644 --- a/src/skippy/execution-batch.cpp +++ b/src/skippy/execution-batch.cpp @@ -393,6 +393,13 @@ enum skippy_status skippy_iteration_batch_sampled( @@ -468,7 +468,7 @@ index 86ea1ed55..40faff815 100644 &first->stage_model->config, SKIPPY_GLM_DSA_PHASE_HINT_AUTO); std::vector> frontier_storage; diff --git a/src/skippy/execution-single.cpp b/src/skippy/execution-single.cpp -index 4ce3d4ba9..8a1b320ff 100644 +index 4ce3d4ba92e3a572bc8bc229d41f84eef8c36b61..8a1b320ff3e5fe0d410aa82c4b86d67d70dd4b89 100644 --- a/src/skippy/execution-single.cpp +++ b/src/skippy/execution-single.cpp @@ -210,6 +210,11 @@ enum skippy_status skippy_decode_batch_sampled( @@ -484,7 +484,7 @@ index 4ce3d4ba9..8a1b320ff 100644 batch.pos[i] = session->n_past; batch.n_seq_id[i] = 1; diff --git a/src/skippy/runtime_support.h b/src/skippy/runtime_support.h -index 8ba595623..bbba808a3 100644 +index 8ba5956234e4e322463d515d93f18271a3d94a84..bbba808a303ae0d2be2fc680f140db069ce7e58d 100644 --- a/src/skippy/runtime_support.h +++ b/src/skippy/runtime_support.h @@ -41,6 +41,13 @@ void skippy_clear_chat_sampling(skippy_session * session); @@ -502,7 +502,7 @@ index 8ba595623..bbba808a3 100644 skippy_session * session, uint64_t token_count, diff --git a/src/skippy/runtime_types.h b/src/skippy/runtime_types.h -index 46e907aa0..ec9fb94b1 100644 +index 46e907aa0d03e2b8eeb1cfbaf70e4ab845026390..ec9fb94b1b65e552d016527984f588f79296ea56 100644 --- a/src/skippy/runtime_types.h +++ b/src/skippy/runtime_types.h @@ -121,6 +121,11 @@ struct skippy_verify_checkpoint { @@ -535,7 +535,7 @@ index 46e907aa0..ec9fb94b1 100644 + uint64_t verify_windows_checkpointed = 0; }; diff --git a/src/skippy/session.cpp b/src/skippy/session.cpp -index 4741f55cb..9d0ba6ee5 100644 +index 4741f55cb5271c78b2947596ae987bed1c0b19f5..9d0ba6ee54f0cd039ee1615923f11f55ad6846b8 100644 --- a/src/skippy/session.cpp +++ b/src/skippy/session.cpp @@ -190,7 +190,7 @@ int32_t skippy_session_batch_size( @@ -580,7 +580,7 @@ index 4741f55cb..9d0ba6ee5 100644 SKIPPY_RUNTIME_EVENT_KIND_KV_PRESSURE_CLEARED, static_cast(session->seq_id), diff --git a/src/skippy/state.cpp b/src/skippy/state.cpp -index 15c48419d..44b924b0b 100644 +index 15c48419d05f9c1ea36751e793de609c37e7ad06..44b924b0b45ce004e3ea3408f024d2f5185d6edd 100644 --- a/src/skippy/state.cpp +++ b/src/skippy/state.cpp @@ -74,7 +74,7 @@ static void skippy_update_session_state_after_import( @@ -708,7 +708,7 @@ index 15c48419d..44b924b0b 100644 } diff --git a/src/skippy/tests/sampling_history.cpp b/src/skippy/tests/sampling_history.cpp -index 5ae8e15b4..0c81c9d47 100644 +index 5ae8e15b4b0bf31f2cd3b15ce96ac8a6a8463de1..0c81c9d473c504fe540c0b1a2b79ef1f9aa54443 100644 --- a/src/skippy/tests/sampling_history.cpp +++ b/src/skippy/tests/sampling_history.cpp @@ -3,6 +3,7 @@ @@ -783,7 +783,7 @@ index 5ae8e15b4..0c81c9d47 100644 } diff --git a/src/skippy/tests/verify_rollback.cpp b/src/skippy/tests/verify_rollback.cpp new file mode 100644 -index 000000000..f479a8e4e +index 0000000000000000000000000000000000000000..f479a8e4ec0bb387d0f17c96d9319b7ec2976892 --- /dev/null +++ b/src/skippy/tests/verify_rollback.cpp @@ -0,0 +1,392 @@ @@ -1181,7 +1181,7 @@ index 000000000..f479a8e4e +} diff --git a/src/skippy/verify_window.cpp b/src/skippy/verify_window.cpp new file mode 100644 -index 000000000..c578edf61 +index 0000000000000000000000000000000000000000..c578edf61ba776fd452d795c21b66239eace38c5 --- /dev/null +++ b/src/skippy/verify_window.cpp @@ -0,0 +1,229 @@ @@ -1416,7 +1416,7 @@ index 000000000..c578edf61 +} diff --git a/src/skippy/verify_window.h b/src/skippy/verify_window.h new file mode 100644 -index 000000000..45bb92cba +index 0000000000000000000000000000000000000000..45bb92cbab5ddd38cc29d2a805d11ea89ed6c084 --- /dev/null +++ b/src/skippy/verify_window.h @@ -0,0 +1,38 @@ @@ -1459,7 +1459,7 @@ index 000000000..45bb92cba + std::vector & state, + skippy_error ** out_error); diff --git a/tests/test-skippy-verify-checkpoint-retirement.cpp b/tests/test-skippy-verify-checkpoint-retirement.cpp -index d09acccb4..8d68604c3 100644 +index d09acccb4434eb7fbc05f3bf09a88763f4532450..8d68604c31b4bed3c1660cfe1033e87ecc3cc386 100644 --- a/tests/test-skippy-verify-checkpoint-retirement.cpp +++ b/tests/test-skippy-verify-checkpoint-retirement.cpp @@ -7,6 +7,7 @@ struct checkpoint { @@ -1484,6 +1484,3 @@ index d09acccb4..8d68604c3 100644 + if (skippy_retire_verify_checkpoint_exact(checkpoints, 30, 4, &retired)) return 10; return 0; } --- -2.56.1 - diff --git a/llama_cpp/patches/0016-skippy-report-which-layer-inputs-a-graph-publishes.patch b/llama_cpp/patches/0016-skippy-report-which-layer-inputs-a-graph-publishes.patch index 3386445b..5d5f5374 100644 --- a/llama_cpp/patches/0016-skippy-report-which-layer-inputs-a-graph-publishes.patch +++ b/llama_cpp/patches/0016-skippy-report-which-layer-inputs-a-graph-publishes.patch @@ -1,4 +1,4 @@ -From ca42ae64d6ff7c13ea75c2da89d2a225717b6bce Mon Sep 17 00:00:00 2001 +From 78878c7d68e1f334f8d798bf17c0be70a2498091 Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Thu, 29 Oct 2026 19:55:52 -0400 Subject: [PATCH] skippy: report published layer inputs including head input @@ -10,7 +10,7 @@ Subject: [PATCH] skippy: report published layer inputs including head input 3 files changed, 104 insertions(+), 1 deletion(-) diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index 6d32d444d..9ea8710eb 100644 +index 2657085306eae301b88dde6fa09f57c6e0cbf571..2bdbaed596961785e4915919ff33d969ec3a0b98 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -25,6 +25,7 @@ @@ -21,7 +21,7 @@ index 6d32d444d..9ea8710eb 100644 #include #include #include -@@ -1532,9 +1533,10 @@ void llama_context::set_embeddings_nextn(bool value, bool masked) { +@@ -1519,9 +1520,10 @@ void llama_context::set_embeddings_nextn(bool value, bool masked) { } void llama_context::set_embeddings_layer_inp(uint32_t lid, bool enable) { @@ -33,7 +33,7 @@ index 6d32d444d..9ea8710eb 100644 if (cparams.embeddings_layer_inp[lid] == enable) return; ++computation_generation; -@@ -2291,6 +2293,7 @@ int llama_context::decode(const llama_batch_ext & batch_inp) { +@@ -2278,6 +2280,7 @@ int llama_context::decode(const llama_batch_ext & batch_inp) { int llama_context::decode( const llama_batch_ext & batch_inp, const skippy_graph_build_inputs & graph_build_inputs) { @@ -41,7 +41,7 @@ index 6d32d444d..9ea8710eb 100644 if (!memory) { LLAMA_LOG_DEBUG("%s: cannot decode batches with this context (calling encode() instead)\n", __func__); return encode(batch_inp, graph_build_inputs); -@@ -3203,6 +3206,43 @@ bool llama_context::get_input_activation_frontier(std::vectorset_embeddings_layer_inp(lid, value); } @@ -97,7 +97,7 @@ index 6d32d444d..9ea8710eb 100644 ctx->set_nextn_layer_offset(offset); } diff --git a/src/llama-context.h b/src/llama-context.h -index c26fdd615..75cea4e84 100644 +index c26fdd61584b9ae677f530871d7b0a401bf25da7..75cea4e84b48484ab40020c4508219d9ee97acb3 100644 --- a/src/llama-context.h +++ b/src/llama-context.h @@ -14,6 +14,7 @@ @@ -129,7 +129,7 @@ index c26fdd615..75cea4e84 100644 const skippy_graph_build_inputs graph_build_inputs; uint64_t computation_generation = 0; diff --git a/src/llama-ext.h b/src/llama-ext.h -index e5f2e6c91..f9c4b0c65 100644 +index e5f2e6c919019ad07667c8cd6b54b993a5ea2d54..f9c4b0c65f5a937fc555318978103c7818199e44 100644 --- a/src/llama-ext.h +++ b/src/llama-ext.h @@ -152,6 +152,58 @@ LLAMA_API bool llama_batch_ext_set_decision_group(struct llama_batch_ext * batch @@ -191,6 +191,3 @@ index e5f2e6c91..f9c4b0c65 100644 // // model/context data extraction // --- -2.56.1 - diff --git a/llama_cpp/patches/0017-skippy-retain-fatal-CUDA-diagnostics.patch b/llama_cpp/patches/0017-skippy-retain-fatal-CUDA-diagnostics.patch index efac9217..9beb1a3d 100644 --- a/llama_cpp/patches/0017-skippy-retain-fatal-CUDA-diagnostics.patch +++ b/llama_cpp/patches/0017-skippy-retain-fatal-CUDA-diagnostics.patch @@ -1,4 +1,4 @@ -From 32014527b202a369520951f192eb39fd460fdd9b Mon Sep 17 00:00:00 2001 +From 41e455ce88047dd92c318db85018cebe9762185d Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Tue, 17 Nov 2026 21:32:09 +1100 Subject: [PATCH] skippy: retain fatal CUDA diagnostics during quiet device @@ -9,10 +9,10 @@ Subject: [PATCH] skippy: retain fatal CUDA diagnostics during quiet device 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu -index aa6fb297f..5086bcde6 100644 +index 4700191f7754f1975494130141c7244ac2b2dda2..c35b4a1db70556643cdc607d049ac6be78ecc5fc 100644 --- a/ggml/src/ggml-cuda/ggml-cuda.cu +++ b/ggml/src/ggml-cuda/ggml-cuda.cu -@@ -118,7 +118,10 @@ void ggml_cuda_error(const char * stmt, const char * func, const char * file, in +@@ -115,7 +115,10 @@ void ggml_cuda_error(const char * stmt, const char * func, const char * file, in GGML_LOG_ERROR(" current device: %d, in function %s at %s:%d\n", id, func, file, line); GGML_LOG_ERROR(" %s\n", stmt); // abort with GGML_ABORT to get a stack trace @@ -24,6 +24,3 @@ index aa6fb297f..5086bcde6 100644 } // map a (possibly virtual) device id to the physical CUDA device that backs it --- -2.56.1 - diff --git a/llama_cpp/patches/0018-test-bound-synthetic-MiMo2-KV-geometry.patch b/llama_cpp/patches/0018-test-bound-synthetic-MiMo2-KV-geometry.patch index 456503cc..dd02e8df 100644 --- a/llama_cpp/patches/0018-test-bound-synthetic-MiMo2-KV-geometry.patch +++ b/llama_cpp/patches/0018-test-bound-synthetic-MiMo2-KV-geometry.patch @@ -1,4 +1,4 @@ -From 802d48d103eabf055002cab1687c36e6ecc9f9b0 Mon Sep 17 00:00:00 2001 +From 92add8dd859638c1678c0b585b3d36eeec795d89 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Tue, 17 Nov 2026 22:14:38 +1100 Subject: [PATCH] test: bound MiMo2 KV geometry and derive fused MTP shape from @@ -10,7 +10,7 @@ Subject: [PATCH] test: bound MiMo2 KV geometry and derive fused MTP shape from 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test-graph-contract-fixture.h b/tests/test-graph-contract-fixture.h -index c45915888..3a520bdda 100644 +index c45915888339575d44e94e5b62514dd7906cc3d8..3a520bddaab136148b7734df7cf12f9826322b39 100644 --- a/tests/test-graph-contract-fixture.h +++ b/tests/test-graph-contract-fixture.h @@ -135,7 +135,11 @@ static int save_graph_contract_fixture(llm_arch arch, const std::string & out, u @@ -27,10 +27,10 @@ index c45915888..3a520bdda 100644 gguf_add_tensor(output.get(), qkv); } diff --git a/tests/test-llama-archs.cpp b/tests/test-llama-archs.cpp -index bc15ea0da..24f3e36f8 100644 +index f4c09dc492b8a092b4e5f2f2a38d7a7bf9257bf1..37115641bb4cd65b42d531f6939621c5061a2bef 100644 --- a/tests/test-llama-archs.cpp +++ b/tests/test-llama-archs.cpp -@@ -398,6 +398,13 @@ static gguf_context_ptr get_gguf_ctx( +@@ -400,6 +400,13 @@ static gguf_context_ptr get_gguf_ctx( arch == LLM_ARCH_ZAYA1) { n_head_kv = 2; // GQA coverage } @@ -44,6 +44,3 @@ index bc15ea0da..24f3e36f8 100644 if (arch == LLM_ARCH_BEAM) { n_head = 4; n_head_kv = 2; --- -2.56.1 - diff --git a/llama_cpp/patches/0019-skippy-release-temporary-MTP-planning-contexts.patch b/llama_cpp/patches/0019-skippy-release-temporary-MTP-planning-contexts.patch index 38434d47..ebc7bfa8 100644 --- a/llama_cpp/patches/0019-skippy-release-temporary-MTP-planning-contexts.patch +++ b/llama_cpp/patches/0019-skippy-release-temporary-MTP-planning-contexts.patch @@ -1,4 +1,4 @@ -From 8310c16daa3b3f9f900b96a377f51848f783398f Mon Sep 17 00:00:00 2001 +From d77c0428c3b1a7f44bd1b3e824727fd3ad3ddb06 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Tue, 17 Nov 2026 22:23:21 +1100 Subject: [PATCH] skippy: release temporary MTP planning contexts @@ -8,7 +8,7 @@ Subject: [PATCH] skippy: release temporary MTP planning contexts 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/skippy/stage_plan.cpp b/src/skippy/stage_plan.cpp -index 380e1eaad..0c4ab443b 100644 +index 380e1eaad93d222fd8f9ab318a5c34c3ae26059e..0c4ab443bfffbbb5a9ab6b501f46b076edd82b3e 100644 --- a/src/skippy/stage_plan.cpp +++ b/src/skippy/stage_plan.cpp @@ -402,7 +402,9 @@ bool add_mtp_profiles( @@ -22,6 +22,3 @@ index 380e1eaad..0c4ab443b 100644 } } plan.guarded.resident_parameter_identities.assign(residents.begin(), residents.end()); --- -2.56.1 - diff --git a/llama_cpp/patches/0020-skippy-restore-resident-prefixes-as-shared-cells-plu.patch b/llama_cpp/patches/0020-skippy-restore-resident-prefixes-as-shared-cells-plu.patch index 4c06a4f7..06572888 100644 --- a/llama_cpp/patches/0020-skippy-restore-resident-prefixes-as-shared-cells-plu.patch +++ b/llama_cpp/patches/0020-skippy-restore-resident-prefixes-as-shared-cells-plu.patch @@ -1,4 +1,4 @@ -From 69926199af887bc2006c856e542aa398a95b45df Mon Sep 17 00:00:00 2001 +From ca08167b5e6a52e9deec0f9dddcec08c67ebf12c Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Tue, 10 Nov 2026 21:00:00 +1100 Subject: [PATCH] skippy: restore resident prefixes as shared cells plus @@ -69,7 +69,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y create mode 100644 src/skippy/tests/resident_checkpoint_writer.cpp diff --git a/include/skippy/common.h b/include/skippy/common.h -index 3448095a1..cbba91849 100644 +index 3448095a1935d0d2ba3a12ca72f4d178c3f317e5..cbba9184990715d863c59a19fa68a3a08f72d591 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -82,7 +82,7 @@ index 3448095a1..cbba91849 100644 #if defined(_MSC_VER) #define SKIPPY_DEPRECATED(message) __declspec(deprecated(message)) diff --git a/include/skippy/runtime.h b/include/skippy/runtime.h -index b570682ef..856c98f97 100644 +index b570682ef1a9559bd0d76429908bd06de34dc84b..856c98f97a4ff9853d7777eec51183f48c5039e6 100644 --- a/include/skippy/runtime.h +++ b/include/skippy/runtime.h @@ -96,7 +96,7 @@ struct skippy_runtime_config { @@ -95,7 +95,7 @@ index b570682ef..856c98f97 100644 /** @brief Whether sliding-window-attention layers use a full, unshifted cache window (mirrors upstream `swa_full`). */ int32_t swa_full; diff --git a/include/skippy/state.h b/include/skippy/state.h -index e8d0874a1..6d9028a18 100644 +index e8d0874a1bf45a002f86c2459af75a426efcc05e..6d9028a18e72dc4c6b0ee19f5110e91afe837afb 100644 --- a/include/skippy/state.h +++ b/include/skippy/state.h @@ -17,6 +17,10 @@ enum skippy_memory_cache_capability { @@ -186,7 +186,7 @@ index e8d0874a1..6d9028a18 100644 LLAMA_API enum skippy_status skippy_session_memory_used_cells( struct skippy_session * session, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index bb9de46af..2e85dbfe1 100644 +index bb9de46afbefd642f11c7bf4e3d9ed3d4b87e29b..2e85dbfe12ae83a942324304529a6c3c7959d725 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -89,6 +89,7 @@ add_library(llama @@ -218,10 +218,10 @@ index bb9de46af..2e85dbfe1 100644 COMMAND skippy-sampling-history "${SKIPPY_MODEL_FIXTURE_DIR}/${family}-dense.gguf" ${mode} ${state}) diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index 9ea8710eb..61aea8a12 100644 +index 2bdbaed596961785e4915919ff33d969ec3a0b98..9b1c1a4df93182f4634e7c798f3ddc4fcd883c29 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp -@@ -3789,6 +3789,10 @@ private: +@@ -3777,6 +3777,10 @@ private: std::vector winfos; }; @@ -233,7 +233,7 @@ index 9ea8710eb..61aea8a12 100644 public: llama_io_read_host(const uint8_t * p, size_t len) : ptr(p), base_ptr(p), buf_size(len) {} diff --git a/src/llama-io.h b/src/llama-io.h -index 0aca73310..72aa58718 100644 +index 0aca7331074d4a4a6d8ed99dc8901b02790d77a0..72aa587182dc81ec24718fae3e4a0e14506f5e4d 100644 --- a/src/llama-io.h +++ b/src/llama-io.h @@ -2,6 +2,7 @@ @@ -254,7 +254,7 @@ index 0aca73310..72aa58718 100644 +// which completes the deferred tensor reads before returning. +std::unique_ptr llama_io_write_host_create(uint8_t * dst, size_t size); diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp -index db5a69e38..5bfd47c93 100644 +index db5a69e38f4f32163ce796436501cfed76db1065..5bfd47c93c06128b7a0a4f00f81e2abf1931ca6e 100644 --- a/src/skippy/model_loading.cpp +++ b/src/skippy/model_loading.cpp @@ -692,7 +692,8 @@ enum skippy_status skippy_finish_model_open( @@ -286,7 +286,7 @@ index db5a69e38..5bfd47c93 100644 ctx_params.offload_kqv = skippy_resolve_tristate(config->kv_offload, ctx_params.offload_kqv); diff --git a/src/skippy/resident_prefix.cpp b/src/skippy/resident_prefix.cpp new file mode 100644 -index 000000000..317c96b46 +index 0000000000000000000000000000000000000000..317c96b46e2670cfaab9b5460d258b28f7b1abb9 --- /dev/null +++ b/src/skippy/resident_prefix.cpp @@ -0,0 +1,438 @@ @@ -729,7 +729,7 @@ index 000000000..317c96b46 + +} // extern "C" diff --git a/src/skippy/runtime_types.h b/src/skippy/runtime_types.h -index ec9fb94b1..3a2e3147e 100644 +index ec9fb94b1b65e552d016527984f588f79296ea56..3a2e3147e92af58ae1d11c844e5c3410e12b6dc0 100644 --- a/src/skippy/runtime_types.h +++ b/src/skippy/runtime_types.h @@ -10,6 +10,7 @@ @@ -774,7 +774,7 @@ index ec9fb94b1..3a2e3147e 100644 std::vector signal_history; std::vector prefill_positions; diff --git a/src/skippy/session.cpp b/src/skippy/session.cpp -index 9d0ba6ee5..d5ac795e9 100644 +index 9d0ba6ee54f0cd039ee1615923f11f55ad6846b8..d5ac795e95f2bd41947b282f02aa53583ac39d9a 100644 --- a/src/skippy/session.cpp +++ b/src/skippy/session.cpp @@ -147,9 +147,6 @@ enum skippy_status skippy_session_create( @@ -814,7 +814,7 @@ index 9d0ba6ee5..d5ac795e9 100644 skippy_clear_chat_sampling(session); if (!session->borrowed_sequence) { diff --git a/src/skippy/state.cpp b/src/skippy/state.cpp -index 44b924b0b..a36c31925 100644 +index 44b924b0b45ce004e3ea3408f024d2f5185d6edd..a36c31925ab4906d3dd1e5d59a216c497914d598 100644 --- a/src/skippy/state.cpp +++ b/src/skippy/state.cpp @@ -18,6 +18,7 @@ @@ -1280,7 +1280,7 @@ index 44b924b0b..a36c31925 100644 - } // extern "C" diff --git a/src/skippy/state_memory.cpp b/src/skippy/state_memory.cpp -index e271852ff..806e79d72 100644 +index e271852ff0286fde08f61bdc18565c19b063d5a2..806e79d72ec960d12571d2acd2c5ecb22229c49b 100644 --- a/src/skippy/state_memory.cpp +++ b/src/skippy/state_memory.cpp @@ -56,16 +56,16 @@ uint32_t skippy_memory_cache_capabilities(llama_memory_t memory) { @@ -1342,7 +1342,7 @@ index e271852ff..806e79d72 100644 } diff --git a/src/skippy/tests/resident_checkpoint_gpu.cpp b/src/skippy/tests/resident_checkpoint_gpu.cpp new file mode 100644 -index 000000000..691e92c37 +index 0000000000000000000000000000000000000000..691e92c37c28e0254a97ed306de7476968e7efd1 --- /dev/null +++ b/src/skippy/tests/resident_checkpoint_gpu.cpp @@ -0,0 +1,287 @@ @@ -1635,7 +1635,7 @@ index 000000000..691e92c37 +} diff --git a/src/skippy/tests/resident_checkpoint_writer.cpp b/src/skippy/tests/resident_checkpoint_writer.cpp new file mode 100644 -index 000000000..d08029062 +index 0000000000000000000000000000000000000000..d08029062144aa15c421dbd6d845bfc8c4229f1b --- /dev/null +++ b/src/skippy/tests/resident_checkpoint_writer.cpp @@ -0,0 +1,126 @@ @@ -1766,7 +1766,7 @@ index 000000000..d08029062 + return 0; +} diff --git a/src/skippy/tests/sampling_history.cpp b/src/skippy/tests/sampling_history.cpp -index 0c81c9d47..4c7c891e1 100644 +index 0c81c9d473c504fe540c0b1a2b79ef1f9aa54443..4c7c891e168e59765050bdb322b0bd425b30767f 100644 --- a/src/skippy/tests/sampling_history.cpp +++ b/src/skippy/tests/sampling_history.cpp @@ -5,26 +5,115 @@ @@ -2224,6 +2224,3 @@ index 0c81c9d47..4c7c891e1 100644 + } return 0; } --- -2.56.1 - diff --git a/llama_cpp/patches/0021-skippy-open-models-without-rollback-snapshots-unless.patch b/llama_cpp/patches/0021-skippy-open-models-without-rollback-snapshots-unless.patch index 7265587d..9aa01492 100644 --- a/llama_cpp/patches/0021-skippy-open-models-without-rollback-snapshots-unless.patch +++ b/llama_cpp/patches/0021-skippy-open-models-without-rollback-snapshots-unless.patch @@ -1,4 +1,4 @@ -From 9dcf436aae694fbafdc9cf1e5f173f3af77df181 Mon Sep 17 00:00:00 2001 +From 038023133b1e453a199b6bd92dcaa9ef46851faa Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Tue, 10 Nov 2026 21:05:00 +1100 Subject: [PATCH] skippy: open models without rollback snapshots unless a plan @@ -45,7 +45,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y create mode 100644 src/skippy/tests/recurrent_retention.cpp diff --git a/include/skippy/runtime.h b/include/skippy/runtime.h -index 856c98f97..10ea60e7c 100644 +index 856c98f97a4ff9853d7777eec51183f48c5039e6..10ea60e7c436c9483b821149f72b582da3733cc7 100644 --- a/include/skippy/runtime.h +++ b/include/skippy/runtime.h @@ -125,11 +125,11 @@ struct skippy_runtime_config { @@ -63,7 +63,7 @@ index 856c98f97..10ea60e7c 100644 /** @brief Sentinel for `skippy_runtime_config` tri-state fields: keep the derived default. */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 2e85dbfe1..fb1c5b560 100644 +index 2e85dbfe12ae83a942324304529a6c3c7959d725..fb1c5b560dadc653821969f338d32bf0d5a51a15 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -435,6 +435,33 @@ if (LLAMA_STAGE_BUILD_TESTS) @@ -101,7 +101,7 @@ index 2e85dbfe1..fb1c5b560 100644 skippy/tests/sampling_history.cpp skippy/tests/resident_checkpoint_gpu.cpp diff --git a/src/skippy/execution-single.cpp b/src/skippy/execution-single.cpp -index 8a1b320ff..965880071 100644 +index 8a1b320ff3e5fe0d410aa82c4b86d67d70dd4b89..9658800712be5cf26a689ecdd871bae6db0b6345 100644 --- a/src/skippy/execution-single.cpp +++ b/src/skippy/execution-single.cpp @@ -195,6 +195,17 @@ enum skippy_status skippy_decode_batch_sampled( @@ -123,7 +123,7 @@ index 8a1b320ff..965880071 100644 llama_batch batch = llama_batch_init(n_tokens, 0, 1); batch.n_tokens = n_tokens; diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp -index 5bfd47c93..bbc1c2d42 100644 +index 5bfd47c93c06128b7a0a4f00f81e2abf1931ca6e..bbc1c2d4204ec72a331fab992a8abce333e5eeec 100644 --- a/src/skippy/model_loading.cpp +++ b/src/skippy/model_loading.cpp @@ -590,6 +590,7 @@ struct skippy_runtime_config skippy_runtime_config_default(void) { @@ -170,7 +170,7 @@ index 5bfd47c93..bbc1c2d42 100644 if (stage_model->mtp_ctx != nullptr) { diff --git a/src/skippy/tests/backend_sample_capacity.cpp b/src/skippy/tests/backend_sample_capacity.cpp new file mode 100644 -index 000000000..b234872a7 +index 0000000000000000000000000000000000000000..b234872a70e8e97d211ecd317fbb3c317d77a1f9 --- /dev/null +++ b/src/skippy/tests/backend_sample_capacity.cpp @@ -0,0 +1,251 @@ @@ -427,7 +427,7 @@ index 000000000..b234872a7 +} diff --git a/src/skippy/tests/recurrent_retention.cpp b/src/skippy/tests/recurrent_retention.cpp new file mode 100644 -index 000000000..f78090f2c +index 0000000000000000000000000000000000000000..f78090f2cb1983e0fb8f725d72440a7fa7455021 --- /dev/null +++ b/src/skippy/tests/recurrent_retention.cpp @@ -0,0 +1,338 @@ @@ -769,6 +769,3 @@ index 000000000..f78090f2c + std::fprintf(stderr, "RECURRENT_RETENTION defaults=2 explicit_off=0 positive=1 teacher_steps=32 PASS\n"); + return 0; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0022-skippy-report-native-trace-spans-and-GPU-command-tim.patch b/llama_cpp/patches/0022-skippy-report-native-trace-spans-and-GPU-command-tim.patch index f8d07d8a..11069c71 100644 --- a/llama_cpp/patches/0022-skippy-report-native-trace-spans-and-GPU-command-tim.patch +++ b/llama_cpp/patches/0022-skippy-report-native-trace-spans-and-GPU-command-tim.patch @@ -1,4 +1,4 @@ -From 607d31984687e4f404c56d134aaf7fbcd85ad5ba Mon Sep 17 00:00:00 2001 +From d736fc4aa2e40b8924fc944fb4f6ce5ace1537d2 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Mon, 2 Nov 2026 09:00:00 +1100 Subject: [PATCH] skippy: report native trace spans and GPU command timing @@ -110,7 +110,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y create mode 100644 tests/test-skippy-tracing.cpp diff --git a/ggml/include/ggml-backend.h b/ggml/include/ggml-backend.h -index cc98ce7a4..830ffa1df 100644 +index 60096c0df2d86f735355acb9744d3c1e4115c711..c73210ab5baa4c10e76e8e6ea330c83dd47cf6d5 100644 --- a/ggml/include/ggml-backend.h +++ b/ggml/include/ggml-backend.h @@ -270,6 +270,111 @@ extern "C" { @@ -226,7 +226,7 @@ index cc98ce7a4..830ffa1df 100644 // Backend registry // diff --git a/ggml/src/ggml-metal/CMakeLists.txt b/ggml/src/ggml-metal/CMakeLists.txt -index 14168ffec..bcd43abd6 100644 +index 14168ffec1516f46f2f0f4cfd2585643bc3fc159..bcd43abd6e35245b4e18b1856d6de8d70e8c6575 100644 --- a/ggml/src/ggml-metal/CMakeLists.txt +++ b/ggml/src/ggml-metal/CMakeLists.txt @@ -12,6 +12,7 @@ ggml_add_backend_library(ggml-metal @@ -238,7 +238,7 @@ index 14168ffec..bcd43abd6 100644 ) diff --git a/ggml/src/ggml-metal/ggml-metal-context.m b/ggml/src/ggml-metal/ggml-metal-context.m -index b35067724..539aca161 100644 +index b3506772427d512633115a6fed61f87dc1255fdd..539aca1614ccb4f4dc6d3cef94ffd8333765bf5a 100644 --- a/ggml/src/ggml-metal/ggml-metal-context.m +++ b/ggml/src/ggml-metal/ggml-metal-context.m @@ -7,6 +7,7 @@ @@ -462,7 +462,7 @@ index b35067724..539aca161 100644 [cmd_buf commit]; } diff --git a/ggml/src/ggml-metal/ggml-metal-device.m b/ggml/src/ggml-metal/ggml-metal-device.m -index b03b925c6..52fe84b04 100644 +index b03b925c650ca5ab45c9f6b49280a5e8742a8fcf..52fe84b044002cc9d90810c3735790323e176412 100644 --- a/ggml/src/ggml-metal/ggml-metal-device.m +++ b/ggml/src/ggml-metal/ggml-metal-device.m @@ -5,6 +5,7 @@ @@ -562,7 +562,7 @@ index b03b925c6..52fe84b04 100644 struct ggml_metal_buffer_id bid_src = ggml_metal_buffer_get_id(buf, tensor); diff --git a/ggml/src/ggml-metal/ggml-metal-timing.cpp b/ggml/src/ggml-metal/ggml-metal-timing.cpp new file mode 100644 -index 000000000..8bf274932 +index 0000000000000000000000000000000000000000..8bf274932ded2425d57ff2ffc503a52f11d50d1f --- /dev/null +++ b/ggml/src/ggml-metal/ggml-metal-timing.cpp @@ -0,0 +1,529 @@ @@ -1097,7 +1097,7 @@ index 000000000..8bf274932 +} diff --git a/ggml/src/ggml-metal/ggml-metal-timing.h b/ggml/src/ggml-metal/ggml-metal-timing.h new file mode 100644 -index 000000000..3cbe29099 +index 0000000000000000000000000000000000000000..3cbe29099d2d332bdaf4fdac4d0192b8eb64eeae --- /dev/null +++ b/ggml/src/ggml-metal/ggml-metal-timing.h @@ -0,0 +1,102 @@ @@ -1204,7 +1204,7 @@ index 000000000..3cbe29099 +} +#endif diff --git a/ggml/src/ggml-metal/ggml-metal.cpp b/ggml/src/ggml-metal/ggml-metal.cpp -index ad7573851..c54e571c8 100644 +index ad75738511e1ea131b394c6953d57b7cafbdeef4..c54e571c84e773c65b6a880628a2a729880ad04d 100644 --- a/ggml/src/ggml-metal/ggml-metal.cpp +++ b/ggml/src/ggml-metal/ggml-metal.cpp @@ -7,6 +7,7 @@ @@ -1232,7 +1232,7 @@ index ad7573851..c54e571c8 100644 return (void *)ggml_backend_metal_tuning_set_fa_vec_override; } diff --git a/include/skippy.h b/include/skippy.h -index dc8cbb431..8d710ed64 100644 +index dc8cbb431d31b21358507ce9136debd0fbe1fbbf..8d710ed646eb00880f69437e5a2130d6ab423047 100644 --- a/include/skippy.h +++ b/include/skippy.h @@ -12,6 +12,7 @@ @@ -1244,7 +1244,7 @@ index dc8cbb431..8d710ed64 100644 #include "skippy/runtime.h" #include "skippy/model_source.h" diff --git a/include/skippy/common.h b/include/skippy/common.h -index cbba91849..0e7b4f8a2 100644 +index cbba9184990715d863c59a19fa68a3a08f72d591..0e7b4f8a2bd23f59f547d121309f79ac66dee349 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -102,6 +102,8 @@ enum skippy_feature { @@ -1258,7 +1258,7 @@ index cbba91849..0e7b4f8a2 100644 #define SKIPPY_FEATURE_NON_CHAT_WORKLOADS ((uint64_t)1 << 37) diff --git a/include/skippy/tracing.h b/include/skippy/tracing.h new file mode 100644 -index 000000000..e9e57357c +index 0000000000000000000000000000000000000000..e9e57357c8c752581566e1cfa902f6c44b60eee3 --- /dev/null +++ b/include/skippy/tracing.h @@ -0,0 +1,197 @@ @@ -1460,7 +1460,7 @@ index 000000000..e9e57357c + +#endif // SKIPPY_TRACING_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index fb1c5b560..9321a2102 100644 +index fb1c5b560dadc653821969f338d32bf0d5a51a15..9321a210276735bd66baaf3fac66c17aec3b47a9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,6 +64,7 @@ add_library(llama @@ -1472,7 +1472,7 @@ index fb1c5b560..9321a2102 100644 skippy/graph_dependencies.cpp skippy/graph_identity.cpp diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index 61aea8a12..c4230801d 100644 +index 9b1c1a4df93182f4634e7c798f3ddc4fcd883c29..26e1a100cc67977e07f6cc0793ad1d96d5b33624 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -17,6 +17,7 @@ @@ -1483,7 +1483,7 @@ index 61aea8a12..c4230801d 100644 #include #include -@@ -522,6 +523,7 @@ llama_context::llama_context( +@@ -509,6 +510,7 @@ llama_context::llama_context( } if (!hparams.vocab_only) { @@ -1491,7 +1491,7 @@ index 61aea8a12..c4230801d 100644 // GPU backends for (const auto & dev : model.devices) { ggml_backend_t backend = ggml_backend_dev_init(dev.dev, nullptr); -@@ -603,6 +605,8 @@ llama_context::llama_context( +@@ -590,6 +592,8 @@ llama_context::llama_context( /*.no_alloc =*/ model.no_alloc(), }; @@ -1500,7 +1500,7 @@ index 61aea8a12..c4230801d 100644 memory.reset(model.create_memory(params_mem, cparams, graph_build_inputs.selection)); } -@@ -863,6 +867,8 @@ void llama_context::sched_reserve(const skippy_graph_build_inputs & graph_build_ +@@ -850,6 +854,8 @@ void llama_context::sched_reserve(const skippy_graph_build_inputs & graph_build_ return; } @@ -1509,7 +1509,7 @@ index 61aea8a12..c4230801d 100644 sched_need_reserve = false; ++sched_reserve_count; -@@ -1032,7 +1038,11 @@ void llama_context::synchronize() { +@@ -1019,7 +1025,11 @@ void llama_context::synchronize() { return; } @@ -1522,7 +1522,7 @@ index 61aea8a12..c4230801d 100644 // FIXME: if multiple single tokens are evaluated without a synchronization, // the stats will be added to the prompt evaluation stats -@@ -1150,6 +1160,8 @@ bool llama_context::memory_update( +@@ -1137,6 +1147,8 @@ bool llama_context::memory_update( } } @@ -1531,7 +1531,7 @@ index 61aea8a12..c4230801d 100644 // reset the previous graph results to make sure that they won't be reused // TODO: make mctx->apply() report if a graph reserve is needed, then reset graph results only if the memory module reset the scheduler for (auto & res : gf_res_prev) { -@@ -1933,7 +1945,13 @@ llm_graph_result * llama_context::process_ubatch( +@@ -1920,7 +1932,13 @@ llm_graph_result * llama_context::process_ubatch( llama_memory_context_i * mctx, ggml_status & ret, const skippy_graph_build_inputs & graph_build_inputs) { @@ -1546,7 +1546,7 @@ index 61aea8a12..c4230801d 100644 LLAMA_LOG_ERROR("%s: failed to apply memory context\n", __func__); ret = GGML_STATUS_FAILED; return nullptr; -@@ -1948,6 +1966,7 @@ llm_graph_result * llama_context::process_ubatch( +@@ -1935,6 +1953,7 @@ llm_graph_result * llama_context::process_ubatch( if (!graph_reuse_disable && gf_res_prev_active == res && res->can_reuse(gparams)) { //LLAMA_LOG_DEBUG("%s: reusing previous graph\n", __func__); @@ -1554,7 +1554,7 @@ index 61aea8a12..c4230801d 100644 n_reused++; } else { -@@ -1959,7 +1978,10 @@ llm_graph_result * llama_context::process_ubatch( +@@ -1946,7 +1965,10 @@ llm_graph_result * llama_context::process_ubatch( //const auto t_start_us = ggml_time_us(); @@ -1565,7 +1565,7 @@ index 61aea8a12..c4230801d 100644 //LLAMA_LOG_INFO("graph build time: %.3f ms\n", (ggml_time_us() - t_start_us)/1000.0); -@@ -1979,11 +2001,13 @@ llm_graph_result * llama_context::process_ubatch( +@@ -1966,11 +1988,13 @@ llm_graph_result * llama_context::process_ubatch( return nullptr; } @@ -1579,7 +1579,7 @@ index 61aea8a12..c4230801d 100644 gf_res_prev_active = res; } -@@ -1993,12 +2017,16 @@ llm_graph_result * llama_context::process_ubatch( +@@ -1980,12 +2004,16 @@ llm_graph_result * llama_context::process_ubatch( //const auto t_start_us = ggml_time_us(); // FIXME this call causes a crash if any model inputs were not used in the graph and were therefore not allocated @@ -1596,7 +1596,7 @@ index 61aea8a12..c4230801d 100644 if (status != GGML_STATUS_SUCCESS) { LLAMA_LOG_ERROR("%s: failed to compute graph, compute status: %d\n", __func__, status); ret = status; -@@ -2299,6 +2327,8 @@ int llama_context::decode( +@@ -2286,6 +2314,8 @@ int llama_context::decode( return encode(batch_inp, graph_build_inputs); } @@ -1605,7 +1605,7 @@ index 61aea8a12..c4230801d 100644 if (batch_inp.tokens.empty()) { LLAMA_LOG_ERROR("%s: n_tokens == 0\n", __func__); return -1; -@@ -2365,12 +2395,14 @@ int llama_context::decode( +@@ -2352,12 +2382,14 @@ int llama_context::decode( } } @@ -1620,7 +1620,7 @@ index 61aea8a12..c4230801d 100644 const uint32_t n_tokens_all = balloc->get_n_tokens(); const uint32_t n_outputs_all = balloc->get_n_outputs(); -@@ -2411,6 +2443,8 @@ int llama_context::decode( +@@ -2398,6 +2430,8 @@ int llama_context::decode( llama_memory_context_ptr mctx; @@ -1629,7 +1629,7 @@ index 61aea8a12..c4230801d 100644 while (true) { mctx = memory->init_batch(*balloc, cparams.n_ubatch, embd_all); if (!mctx) { -@@ -2454,11 +2488,15 @@ int llama_context::decode( +@@ -2441,11 +2475,15 @@ int llama_context::decode( break; } @@ -1645,7 +1645,7 @@ index 61aea8a12..c4230801d 100644 int64_t n_outputs_prev = 0; int64_t n_tokens_prev = 0; -@@ -2561,6 +2599,9 @@ int llama_context::decode( +@@ -2548,6 +2586,9 @@ int llama_context::decode( // ggml_graph_dump_dot(gf, NULL, "llama.dot"); //} @@ -1655,7 +1655,7 @@ index 61aea8a12..c4230801d 100644 auto * t_logits = res->get_logits(); auto * t_embd = cparams.embeddings ? res->get_embd() : nullptr; auto * t_h_nextn = cparams.embeddings_nextn ? res->get_h_nextn() : nullptr; -@@ -2700,10 +2741,13 @@ int llama_context::decode( +@@ -2687,10 +2728,13 @@ int llama_context::decode( copy_tensor_async_rows(res->t_candidates, sampling.candidates, stride, n_outputs_prev, sched.get(), &sampling.candidates_count); } @@ -1669,7 +1669,7 @@ index 61aea8a12..c4230801d 100644 ggml_backend_sched_synchronize(sched.get()); } } while (mctx->next()); -@@ -3255,6 +3299,8 @@ ggml_cgraph * llama_context::graph_reserve(uint32_t n_t +@@ -3242,6 +3286,8 @@ ggml_cgraph * llama_context::graph_reserve(uint32_t n_t LLAMA_LOG_DEBUG("%s: reserving a graph for ubatch with n_tokens = %4u, n_seqs = %2u, n_outputs = %4u\n", __func__, n_tokens, n_seqs, n_outputs); GGML_ASSERT(n_outputs >= 1); @@ -1678,7 +1678,7 @@ index 61aea8a12..c4230801d 100644 if (n_tokens % n_seqs != 0) { n_tokens = ((n_tokens + (n_seqs - 1)) / n_seqs) * n_seqs; // round to next multiple of n_seqs LLAMA_LOG_DEBUG("%s: making n_tokens a multiple of n_seqs - n_tokens = %u, n_seqs = %u, n_outputs = %u\n", __func__, n_tokens, n_seqs, n_outputs); -@@ -4281,6 +4327,7 @@ size_t llama_context::state_seq_get_size(llama_seq_id seq_id, llama_state_seq_fl +@@ -4269,6 +4315,7 @@ size_t llama_context::state_seq_get_size(llama_seq_id seq_id, llama_state_seq_fl } size_t llama_context::state_seq_get_data(llama_seq_id seq_id, uint8_t * dst, size_t size, llama_state_seq_flags flags) { @@ -1686,7 +1686,7 @@ index 61aea8a12..c4230801d 100644 std::unique_ptr io; if (flags & LLAMA_STATE_SEQ_FLAGS_ON_DEVICE) { io = std::make_unique(dst, size, mem_storage[seq_id]); -@@ -4300,6 +4347,7 @@ size_t llama_context::state_seq_get_data(llama_seq_id seq_id, uint8_t * dst, siz +@@ -4288,6 +4335,7 @@ size_t llama_context::state_seq_get_data(llama_seq_id seq_id, uint8_t * dst, siz } size_t llama_context::state_seq_set_data(llama_seq_id seq_id, const uint8_t * src, size_t size, llama_state_seq_flags flags) { @@ -1695,7 +1695,7 @@ index 61aea8a12..c4230801d 100644 try { diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index 4d734dd71..c6a0c792a 100644 +index 8d1e65c6d13dda36a1ca3312400b556face77afc..da0994238f7aae8591bd9ad1e6098dbeb8a585d1 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -1,4 +1,5 @@ @@ -1760,7 +1760,7 @@ index 4d734dd71..c6a0c792a 100644 if (input == nullptr) { error = "input payload is required"; return false; -@@ -3692,6 +3700,7 @@ ggml_cgraph * llama_kv_cache::build_graph_shift(llm_graph_result * res, llama_co +@@ -3689,6 +3697,7 @@ ggml_cgraph * llama_kv_cache::build_graph_shift(llm_graph_result * res, llama_co } void llama_kv_cache::state_write(llama_io_write_i & io, llama_seq_id seq_id, llama_state_seq_flags flags) const { @@ -1768,7 +1768,7 @@ index 4d734dd71..c6a0c792a 100644 // TODO: refactor [TAG_KV_CACHE_SHARE_CELLS] if (other) { return; -@@ -3764,6 +3773,7 @@ void llama_kv_cache::state_write(llama_io_write_i & io, llama_seq_id seq_id, lla +@@ -3761,6 +3770,7 @@ void llama_kv_cache::state_write(llama_io_write_i & io, llama_seq_id seq_id, lla } void llama_kv_cache::state_read(llama_io_read_i & io, llama_seq_id seq_id, llama_state_seq_flags flags) { @@ -1777,7 +1777,7 @@ index 4d734dd71..c6a0c792a 100644 } diff --git a/src/llama-memory-recurrent.cpp b/src/llama-memory-recurrent.cpp -index 4947973df..5ec143b97 100644 +index 5c0e32e03749fade7af0bb042bd656e061b9d517..3f4e7a9d64d9b890ec585b45361dc2ce3025bdb5 100644 --- a/src/llama-memory-recurrent.cpp +++ b/src/llama-memory-recurrent.cpp @@ -1,4 +1,5 @@ @@ -1786,7 +1786,7 @@ index 4947973df..5ec143b97 100644 #include "ggml-backend.h" #include "llama-impl.h" -@@ -215,6 +216,7 @@ llama_memory_recurrent::llama_memory_recurrent( +@@ -231,6 +232,7 @@ llama_memory_recurrent::llama_memory_recurrent( } void llama_memory_recurrent::clear(bool data) { @@ -1794,7 +1794,7 @@ index 4947973df..5ec143b97 100644 for (int32_t i = 0; i < (int32_t) size; ++i) { cells[i].pos = -1; cells[i].seq_id.clear(); -@@ -238,6 +240,7 @@ void llama_memory_recurrent::clear(bool data) { +@@ -254,6 +256,7 @@ void llama_memory_recurrent::clear(bool data) { } bool llama_memory_recurrent::seq_rm(llama_seq_id seq_id, llama_pos p0, llama_pos p1) { @@ -1802,7 +1802,7 @@ index 4947973df..5ec143b97 100644 uint32_t new_head = size; if (p0 < 0) { -@@ -341,6 +344,7 @@ bool llama_memory_recurrent::seq_rm(llama_seq_id seq_id, llama_pos p0, llama_pos +@@ -357,6 +360,7 @@ bool llama_memory_recurrent::seq_rm(llama_seq_id seq_id, llama_pos p0, llama_pos } void llama_memory_recurrent::seq_cp(llama_seq_id seq_id_src, llama_seq_id seq_id_dst, llama_pos p0, llama_pos p1) { @@ -1810,7 +1810,7 @@ index 4947973df..5ec143b97 100644 if (seq_id_src == seq_id_dst) { return; } -@@ -378,6 +382,7 @@ void llama_memory_recurrent::seq_cp(llama_seq_id seq_id_src, llama_seq_id seq_id +@@ -394,6 +398,7 @@ void llama_memory_recurrent::seq_cp(llama_seq_id seq_id_src, llama_seq_id seq_id } void llama_memory_recurrent::seq_keep(llama_seq_id seq_id) { @@ -1818,7 +1818,7 @@ index 4947973df..5ec143b97 100644 uint32_t new_head = size; for (uint32_t i = 0; i < size; ++i) { -@@ -410,6 +415,7 @@ void llama_memory_recurrent::seq_keep(llama_seq_id seq_id) { +@@ -426,6 +431,7 @@ void llama_memory_recurrent::seq_keep(llama_seq_id seq_id) { } void llama_memory_recurrent::seq_add(llama_seq_id seq_id, llama_pos p0, llama_pos p1, llama_pos shift) { @@ -1826,7 +1826,7 @@ index 4947973df..5ec143b97 100644 if (shift == 0) { return; } -@@ -882,6 +888,7 @@ size_t llama_memory_recurrent::size_p_bytes() const { +@@ -898,6 +904,7 @@ size_t llama_memory_recurrent::size_p_bytes() const { } void llama_memory_recurrent::state_write(llama_io_write_i & io, llama_seq_id seq_id, llama_state_seq_flags flags) const { @@ -1834,7 +1834,7 @@ index 4947973df..5ec143b97 100644 GGML_UNUSED(flags); std::vector> cell_ranges; // ranges, from inclusive, to exclusive -@@ -963,6 +970,7 @@ void llama_memory_recurrent::state_write(llama_io_write_i & io, llama_seq_id seq +@@ -979,6 +986,7 @@ void llama_memory_recurrent::state_write(llama_io_write_i & io, llama_seq_id seq } void llama_memory_recurrent::state_read(llama_io_read_i & io, llama_seq_id seq_id, llama_state_seq_flags flags) { @@ -1843,7 +1843,7 @@ index 4947973df..5ec143b97 100644 uint32_t cell_count; diff --git a/src/llama-model.cpp b/src/llama-model.cpp -index 970f18f98..0042d5def 100644 +index 6fb12e12793b8d63e700a15fa48f0c1e9ddd3676..f522436951c2f5d15b97d2d0d268e461c85418a4 100644 --- a/src/llama-model.cpp +++ b/src/llama-model.cpp @@ -1,4 +1,5 @@ @@ -1852,7 +1852,7 @@ index 970f18f98..0042d5def 100644 #include "llama-arch.h" #include "llama-ext.h" -@@ -2379,11 +2380,13 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { +@@ -2202,11 +2203,13 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) { } // load tensor data @@ -1867,7 +1867,7 @@ index 970f18f98..0042d5def 100644 if (use_mmap_buffer) { for (auto & mapping : ml.mappings) { diff --git a/src/llama-sampler.cpp b/src/llama-sampler.cpp -index d8cd441a5..e52a94cd3 100644 +index d8cd441a55838e9b5b53ecf23a0f2be901787504..e52a94cd385e78ece504140bed8ef07c4189146d 100644 --- a/src/llama-sampler.cpp +++ b/src/llama-sampler.cpp @@ -1,4 +1,5 @@ @@ -1911,7 +1911,7 @@ index d8cd441a5..e52a94cd3 100644 } } diff --git a/src/llama-vocab.cpp b/src/llama-vocab.cpp -index 674daaa23..6f168fa55 100644 +index 674daaa23fd7a78c06705d1e5f79ec2520083a6b..6f168fa5535c55014f8d5103ae37ec6a572f877a 100644 --- a/src/llama-vocab.cpp +++ b/src/llama-vocab.cpp @@ -1,4 +1,5 @@ @@ -1929,7 +1929,7 @@ index 674daaa23..6f168fa55 100644 } diff --git a/src/llama.cpp b/src/llama.cpp -index 10beaeed4..bad9730ba 100644 +index 10beaeed437b806f70d4cf4382ef41a5b09334ee..bad9730ba0830c202cce3eb77225131aa8db4812 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -1,4 +1,5 @@ @@ -1980,7 +1980,7 @@ index 10beaeed4..bad9730ba 100644 return {0, model_ptr.release()}; } catch (const std::exception & err) { diff --git a/src/skippy/abi.cpp b/src/skippy/abi.cpp -index ceed6e5d3..15c5c343b 100644 +index ceed6e5d36ca9521bbba0d32a176defb2a425b3b..15c5c343bc42e295cb01a435d71b6d3b59096c3f 100644 --- a/src/skippy/abi.cpp +++ b/src/skippy/abi.cpp @@ -43,6 +43,7 @@ uint64_t skippy_abi_features(void) { @@ -1992,7 +1992,7 @@ index ceed6e5d3..15c5c343b 100644 SKIPPY_FEATURE_UNLOAD_EVENTS | SKIPPY_FEATURE_NON_CHAT_WORKLOADS | diff --git a/src/skippy/activation.cpp b/src/skippy/activation.cpp -index 7167e5f7a..885b602e9 100644 +index 7167e5f7a49541628823aee6dd5a695ec183f4d4..885b602e99b087b474437767e086e536f819a2a5 100644 --- a/src/skippy/activation.cpp +++ b/src/skippy/activation.cpp @@ -7,6 +7,7 @@ @@ -2020,7 +2020,7 @@ index 7167e5f7a..885b602e9 100644 int32_t rc = 0; const bool decoded = skippy_contain_native_failure( diff --git a/src/skippy/execution-batch.cpp b/src/skippy/execution-batch.cpp -index 40faff815..a31540652 100644 +index 40faff815be00b44a316945bcf7d345cb008b9ce..a3154065215415d29def38414375bcb7dcc2ff05 100644 --- a/src/skippy/execution-batch.cpp +++ b/src/skippy/execution-batch.cpp @@ -6,6 +6,7 @@ @@ -2058,7 +2058,7 @@ index 40faff815..a31540652 100644 for (size_t request_index = 0; request_index < request_count; ++request_index) { const auto & request = requests[request_index]; diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp -index bbc1c2d42..a4bf2a475 100644 +index bbc1c2d4204ec72a331fab992a8abce333e5eeec..a4bf2a4756970f79ae7ea59680de0f49da59dd17 100644 --- a/src/skippy/model_loading.cpp +++ b/src/skippy/model_loading.cpp @@ -22,6 +22,7 @@ @@ -2153,7 +2153,7 @@ index bbc1c2d42..a4bf2a475 100644 enum skippy_status device_status = skippy_apply_selected_backend_device(config, model_params, selected_devices, out_error); if (device_status != SKIPPY_STATUS_OK) { diff --git a/src/skippy/sampling.cpp b/src/skippy/sampling.cpp -index b688fce73..671ccbb3c 100644 +index b688fce731da6af004ad3d6444cd9d679a890324..671ccbb3cc487caff8774de0420d26c5fb43063d 100644 --- a/src/skippy/sampling.cpp +++ b/src/skippy/sampling.cpp @@ -7,6 +7,7 @@ @@ -2173,7 +2173,7 @@ index b688fce73..671ccbb3c 100644 session->stage_model == nullptr || session->stage_model->model == nullptr) { return LLAMA_TOKEN_NULL; diff --git a/src/skippy/speculative_decoding.cpp b/src/skippy/speculative_decoding.cpp -index 7f55c0d88..3fb86667d 100644 +index 7f55c0d88d493f9d9aae9245877dd208bbfcf54e..3fb86667d61e1c68748faa9133a7952ebd4af596 100644 --- a/src/skippy/speculative_decoding.cpp +++ b/src/skippy/speculative_decoding.cpp @@ -6,6 +6,7 @@ @@ -2194,7 +2194,7 @@ index 7f55c0d88..3fb86667d 100644 return SKIPPY_STATUS_INVALID_ARGUMENT; diff --git a/src/skippy/trace_scope.h b/src/skippy/trace_scope.h new file mode 100644 -index 000000000..b64d9da37 +index 0000000000000000000000000000000000000000..b64d9da37e7f08800fee12329d90e6835b7e7d43 --- /dev/null +++ b/src/skippy/trace_scope.h @@ -0,0 +1,61 @@ @@ -2261,7 +2261,7 @@ index 000000000..b64d9da37 +} // namespace skippy_trace diff --git a/src/skippy/tracing.cpp b/src/skippy/tracing.cpp new file mode 100644 -index 000000000..9aa48e08c +index 0000000000000000000000000000000000000000..9aa48e08c0710174796a9bf7c1303810361a833d --- /dev/null +++ b/src/skippy/tracing.cpp @@ -0,0 +1,272 @@ @@ -2538,7 +2538,7 @@ index 000000000..9aa48e08c + } +} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index c1faa202f..41513426b 100644 +index 2e017268d51396c450c2d12b672f6ea29ff962db..c152c27d5de2d8a5f0ef291a14d7b04254004525 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -185,6 +185,9 @@ llama_build_and_test(test-skippy-rerank-template.cpp) @@ -2551,7 +2551,7 @@ index c1faa202f..41513426b 100644 llama_build_and_test(test-skippy-cachegen-import.cpp) llama_build_and_test(test-skippy-sampling-suppress.cpp) llama_build_and_test(test-skippy-kv-page-export.cpp) -@@ -344,6 +347,7 @@ llama_build_and_test(test-chat-template.cpp LABEL behavior) +@@ -350,6 +353,7 @@ llama_build_and_test(test-chat-template.cpp LABEL behavior) if (GGML_METAL) llama_build_and_test(test-skippy-cachegen-metal.cpp) @@ -2561,7 +2561,7 @@ index c1faa202f..41513426b 100644 llama_build(test-chat-analysis.cpp) diff --git a/tests/test-skippy-tracing-metal.cpp b/tests/test-skippy-tracing-metal.cpp new file mode 100644 -index 000000000..365052e0e +index 0000000000000000000000000000000000000000..365052e0ed4accc3789f38664163f2c90798d943 --- /dev/null +++ b/tests/test-skippy-tracing-metal.cpp @@ -0,0 +1,155 @@ @@ -2722,7 +2722,7 @@ index 000000000..365052e0e +} diff --git a/tests/test-skippy-tracing.cpp b/tests/test-skippy-tracing.cpp new file mode 100644 -index 000000000..804c2f7e0 +index 0000000000000000000000000000000000000000..804c2f7e0405196fc1f2bc665f0471335b90d6ae --- /dev/null +++ b/tests/test-skippy-tracing.cpp @@ -0,0 +1,306 @@ @@ -3032,6 +3032,3 @@ index 000000000..804c2f7e0 + std::printf("ok\n"); + return 0; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0023-skippy-sample-a-batch-s-requests-concurrently.patch b/llama_cpp/patches/0023-skippy-sample-a-batch-s-requests-concurrently.patch index 16b31371..01c0b80b 100644 --- a/llama_cpp/patches/0023-skippy-sample-a-batch-s-requests-concurrently.patch +++ b/llama_cpp/patches/0023-skippy-sample-a-batch-s-requests-concurrently.patch @@ -1,4 +1,4 @@ -From 0ce0c9361073f4887b6ddf1e0a22d594ec003355 Mon Sep 17 00:00:00 2001 +From 6c0921cf784408859f1be351a216a8f30b917b47 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Thu, 5 Nov 2026 01:00:00 +1100 Subject: [PATCH] skippy: sample a batch's requests concurrently @@ -35,20 +35,19 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y src/CMakeLists.txt | 12 ++ src/llama-context.cpp | 23 ++- src/llama-context.h | 33 +++++ - src/llama-graph.h | 2 +- src/skippy/batch_sampling.cpp | 91 ++++++++++++ src/skippy/batch_sampling.h | 20 +++ src/skippy/execution-batch.cpp | 25 ++-- src/skippy/sampling.cpp | 42 +++++- src/skippy/sampling_internal.h | 6 + src/skippy/tests/concurrent_sampling.cpp | 175 +++++++++++++++++++++++ - 10 files changed, 412 insertions(+), 17 deletions(-) + 9 files changed, 411 insertions(+), 16 deletions(-) create mode 100644 src/skippy/batch_sampling.cpp create mode 100644 src/skippy/batch_sampling.h create mode 100644 src/skippy/tests/concurrent_sampling.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 9321a2102..e17e72c31 100644 +index 9321a210276735bd66baaf3fac66c17aec3b47a9..e17e72c3154184acc50b205442799487d1c2f6aa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -82,6 +82,7 @@ add_library(llama @@ -78,10 +77,10 @@ index 9321a2102..e17e72c31 100644 NAME skippy_generate_qwen3_fixture COMMAND skippy-model-fixture-generator diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index c4230801d..fd08598b2 100644 +index 26e1a100cc67977e07f6cc0793ad1d96d5b33624..8e53a0d5f3e8b6fe91ee2d105954316df0c4ed07 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp -@@ -1033,8 +1033,26 @@ void llama_context::sched_reserve(const skippy_graph_build_inputs & graph_build_ +@@ -1020,8 +1020,26 @@ void llama_context::sched_reserve(const skippy_graph_build_inputs & graph_build_ __func__, (t_end_us - t_start_us)/1000.0, ggml_backend_sched_get_n_copies(sched.get())); } @@ -109,7 +108,7 @@ index c4230801d..fd08598b2 100644 return; } -@@ -3035,6 +3053,9 @@ bool llama_context::extract_layer_inputs(const llm_graph_result * res, size_t to +@@ -3022,6 +3040,9 @@ bool llama_context::extract_layer_inputs(const llm_graph_result * res, size_t to } void llama_context::output_reorder() { @@ -120,7 +119,7 @@ index c4230801d..fd08598b2 100644 const uint64_t n_embd = model.hparams.n_embd; const uint64_t n_embd_out = model.hparams.n_embd_out(); diff --git a/src/llama-context.h b/src/llama-context.h -index 75cea4e84..e09428d41 100644 +index 75cea4e84b48484ab40020c4508219d9ee97acb3..e09428d41be74052aadb0b914977b376c7b3e6be 100644 --- a/src/llama-context.h +++ b/src/llama-context.h @@ -66,6 +66,36 @@ struct llama_memory_buffer { @@ -170,22 +169,9 @@ index 75cea4e84..e09428d41 100644 const llama_model & get_model() const; const llama_cparams & get_cparams() const; const skippy_graph_build_inputs & get_graph_build_inputs() const; -diff --git a/src/llama-graph.h b/src/llama-graph.h -index e1cc92a17..9c68abc0c 100644 ---- a/src/llama-graph.h -+++ b/src/llama-graph.h -@@ -1802,7 +1802,7 @@ struct llm_graph_context { - int32_t state_size, - int32_t n_seqs, - skippy_state_kind kind, int il, -- const llm_graph_get_rows_fn & get_state_rows = ggml_get_rows) const; -+ const llm_graph_get_rows_fn & get_state_rows = nullptr) const; - - ggml_tensor * build_rwkv_token_shift_load( - llm_graph_input_rs * inp, diff --git a/src/skippy/batch_sampling.cpp b/src/skippy/batch_sampling.cpp new file mode 100644 -index 000000000..e59c89857 +index 0000000000000000000000000000000000000000..e59c898575ea262476bad7c3719119d3f45d9440 --- /dev/null +++ b/src/skippy/batch_sampling.cpp @@ -0,0 +1,91 @@ @@ -282,7 +268,7 @@ index 000000000..e59c89857 +} diff --git a/src/skippy/batch_sampling.h b/src/skippy/batch_sampling.h new file mode 100644 -index 000000000..0c253ca71 +index 0000000000000000000000000000000000000000..0c253ca71c614dffa4e31d6665c3d14336f7535e --- /dev/null +++ b/src/skippy/batch_sampling.h @@ -0,0 +1,20 @@ @@ -307,7 +293,7 @@ index 000000000..0c253ca71 +// same time, one thread each; the rest sample first, on this thread. +std::vector skippy_sample_requests(const std::vector & requests); diff --git a/src/skippy/execution-batch.cpp b/src/skippy/execution-batch.cpp -index a31540652..83c290ee2 100644 +index a3154065215415d29def38414375bcb7dcc2ff05..83c290ee273c9c104a67d9345404f10e485adee8 100644 --- a/src/skippy/execution-batch.cpp +++ b/src/skippy/execution-batch.cpp @@ -1,5 +1,6 @@ @@ -358,7 +344,7 @@ index a31540652..83c290ee2 100644 } diff --git a/src/skippy/sampling.cpp b/src/skippy/sampling.cpp -index 671ccbb3c..d9f980c39 100644 +index 671ccbb3cc487caff8774de0420d26c5fb43063d..d9f980c394c805284bc274f28ad940f723f6a255 100644 --- a/src/skippy/sampling.cpp +++ b/src/skippy/sampling.cpp @@ -545,6 +545,40 @@ static bool skippy_ensure_plain_sampling_chain( @@ -421,7 +407,7 @@ index 671ccbb3c..d9f980c39 100644 } if (skippy_ensure_plain_sampling_chain(session, sampling)) { diff --git a/src/skippy/sampling_internal.h b/src/skippy/sampling_internal.h -index 7bbf16016..38621b6e9 100644 +index 7bbf160164aa3c25d33ab90dcad39d63f5250847..38621b6e923e0b588baa08ee486d9b86f0114d0d 100644 --- a/src/skippy/sampling_internal.h +++ b/src/skippy/sampling_internal.h @@ -64,4 +64,10 @@ llama_token skippy_sample_token_ith( @@ -437,7 +423,7 @@ index 7bbf16016..38621b6e9 100644 llama_token skippy_sample_token(skippy_session * session, const skippy_sampling_config * sampling); diff --git a/src/skippy/tests/concurrent_sampling.cpp b/src/skippy/tests/concurrent_sampling.cpp new file mode 100644 -index 000000000..0e19dbce5 +index 0000000000000000000000000000000000000000..0e19dbce58746265b7ac566eb6a126f3c95e42fa --- /dev/null +++ b/src/skippy/tests/concurrent_sampling.cpp @@ -0,0 +1,175 @@ @@ -616,6 +602,3 @@ index 000000000..0e19dbce5 + std::printf("ok\n"); + return 0; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0024-skippy-trace-K-V-row-list-runs.patch b/llama_cpp/patches/0024-skippy-trace-K-V-row-list-runs.patch index ea808d62..9c57362d 100644 --- a/llama_cpp/patches/0024-skippy-trace-K-V-row-list-runs.patch +++ b/llama_cpp/patches/0024-skippy-trace-K-V-row-list-runs.patch @@ -1,4 +1,4 @@ -From a6852ef879dabce3ed96112d1af31a7bf6a0a4de Mon Sep 17 00:00:00 2001 +From 7c5c8a419219716fc1c0e1244380474d462c0f8f Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sat, 7 Nov 2026 19:12:33 +1100 Subject: [PATCH] skippy: trace K/V row-list runs @@ -26,7 +26,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y create mode 100644 src/skippy/kv_rows_trace.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index e17e72c31..c6675d944 100644 +index e17e72c3154184acc50b205442799487d1c2f6aa..c6675d944001872c468294ca87bddb4f3b1d7a5b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,6 +65,7 @@ add_library(llama @@ -38,7 +38,7 @@ index e17e72c31..c6675d944 100644 skippy/graph_dependencies.cpp skippy/graph_identity.cpp diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index c6a0c792a..b935162d2 100644 +index da0994238f7aae8591bd9ad1e6098dbeb8a585d1..389b920d860cbfa3717a974ef0730650be001c92 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -1,4 +1,5 @@ @@ -47,7 +47,7 @@ index c6a0c792a..b935162d2 100644 #include "skippy/trace_scope.h" #include "llama-impl.h" -@@ -3223,6 +3224,7 @@ void llama_kv_cache::set_input_attn_mask(const llm_attn_mask & attn_mask, const +@@ -3219,6 +3220,7 @@ void llama_kv_cache::set_input_attn_mask(const llm_attn_mask & attn_mask, const int32_t * data = (int32_t *) attn_mask.rows->data; cells.get_seq_cells(get_kv_rows_slices(*ubatch, n_slices, n_swa, swa_type), data, n_rows); @@ -57,7 +57,7 @@ index c6a0c792a..b935162d2 100644 // the mask is left unallocated when the graph only stores K/V without attending diff --git a/src/skippy/kv_rows_trace.cpp b/src/skippy/kv_rows_trace.cpp new file mode 100644 -index 000000000..e5f06b614 +index 0000000000000000000000000000000000000000..e5f06b61424c05d1d396932737f36ff1f2dc8df8 --- /dev/null +++ b/src/skippy/kv_rows_trace.cpp @@ -0,0 +1,41 @@ @@ -104,7 +104,7 @@ index 000000000..e5f06b614 +} diff --git a/src/skippy/kv_rows_trace.h b/src/skippy/kv_rows_trace.h new file mode 100644 -index 000000000..537a4f4cd +index 0000000000000000000000000000000000000000..537a4f4cd2a742b0268801eb0572c42cbfd73095 --- /dev/null +++ b/src/skippy/kv_rows_trace.h @@ -0,0 +1,7 @@ @@ -116,7 +116,7 @@ index 000000000..537a4f4cd +// `n_slices` lists of `n_per_slice` cell indices each, -1 where padded. +void skippy_trace_kv_rows(const int32_t * data, int64_t n_per_slice, int64_t n_slices); diff --git a/src/skippy/trace_scope.h b/src/skippy/trace_scope.h -index b64d9da37..6e6641571 100644 +index b64d9da37e7f08800fee12329d90e6835b7e7d43..6e6641571bd6d7baa47e824b058b31ac75c1ad3c 100644 --- a/src/skippy/trace_scope.h +++ b/src/skippy/trace_scope.h @@ -44,6 +44,9 @@ class scope { @@ -130,7 +130,7 @@ index b64d9da37..6e6641571 100644 // on another thread's behalf joins that thread's trace. class adopt { diff --git a/src/skippy/tracing.cpp b/src/skippy/tracing.cpp -index 9aa48e08c..29e9047b1 100644 +index 9aa48e08c0710174796a9bf7c1303810361a833d..29e9047b1efd97cd7087aa8953c5a50aff7661bf 100644 --- a/src/skippy/tracing.cpp +++ b/src/skippy/tracing.cpp @@ -199,6 +199,10 @@ uint64_t current_parent() noexcept { @@ -144,6 +144,3 @@ index 9aa48e08c..29e9047b1 100644 adopt::adopt(uint64_t parent) noexcept : previous_(t_current) { if (parent != 0) { t_current = parent; --- -2.56.1 - diff --git a/llama_cpp/patches/0025-ggml-metal-read-consecutive-row-list-blocks-like-den.patch b/llama_cpp/patches/0025-ggml-metal-read-consecutive-row-list-blocks-like-den.patch index 53830bce..f4fea78e 100644 --- a/llama_cpp/patches/0025-ggml-metal-read-consecutive-row-list-blocks-like-den.patch +++ b/llama_cpp/patches/0025-ggml-metal-read-consecutive-row-list-blocks-like-den.patch @@ -1,4 +1,4 @@ -From 0b50da72c8370645c621c997d368d0996daeb38e Mon Sep 17 00:00:00 2001 +From 2b80360c802553d74f57ca63e5af60a859aad5c4 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sat, 7 Nov 2026 21:19:15 +1100 Subject: [PATCH] ggml-metal: read consecutive row-list blocks like dense @@ -22,7 +22,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/ggml/src/ggml-metal/kernels/fa_vec_common.metal b/ggml/src/ggml-metal/kernels/fa_vec_common.metal -index cf37e4924..a67106b83 100644 +index cf37e492442b2088b41947c3692954fd94b6de6d..a67106b832d69820bb3ea350f06a61e92c15792a 100644 --- a/ggml/src/ggml-metal/kernels/fa_vec_common.metal +++ b/ggml/src/ggml-metal/kernels/fa_vec_common.metal @@ -237,8 +237,23 @@ kernel void kernel_flash_attn_ext_vec( @@ -107,6 +107,3 @@ index cf37e4924..a67106b83 100644 FOR_UNROLL (short ii = 0; ii < DV4/NL; ++ii) { const short i = ii*NL + tx; --- -2.56.1 - diff --git a/llama_cpp/patches/0026-llama-keep-a-sequence-s-unified-pool-cells-in-chunks.patch b/llama_cpp/patches/0026-llama-keep-a-sequence-s-unified-pool-cells-in-chunks.patch index a8c9e416..da3034fd 100644 --- a/llama_cpp/patches/0026-llama-keep-a-sequence-s-unified-pool-cells-in-chunks.patch +++ b/llama_cpp/patches/0026-llama-keep-a-sequence-s-unified-pool-cells-in-chunks.patch @@ -1,4 +1,4 @@ -From 751c9ca7542d404fddb5d5e6f0dedcc88e5ca7a5 Mon Sep 17 00:00:00 2001 +From 0be2345ac17c5d59c486d753b77fc36aa5371a65 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sat, 7 Nov 2026 21:27:50 +1100 Subject: [PATCH] llama: keep a sequence's unified-pool cells in chunks @@ -20,7 +20,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 3 files changed, 115 insertions(+) diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index b935162d2..d16641afa 100644 +index 389b920d860cbfa3717a974ef0730650be001c92..fea9e839c997fe2af3ec8de6b98851ed0d59a93b 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -9,6 +9,7 @@ @@ -129,7 +129,7 @@ index b935162d2..d16641afa 100644 // for continuous slots, we test that all tokens in the ubatch fit, starting from the current head diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index 0d683ec3e..a6da0bf9b 100644 +index 0d683ec3e0630c7e3f353837686216752ab7ee71..a6da0bf9b2064f5a1d27ec3344b3fcb64a1793d4 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -275,6 +275,13 @@ public: @@ -147,7 +147,7 @@ index 0d683ec3e..a6da0bf9b 100644 void apply_ubatch(const slot_info & sinfo, const llama_ubatch & ubatch); diff --git a/src/llama-kv-cells.h b/src/llama-kv-cells.h -index 4fcb33d16..6b15791a4 100644 +index 4fcb33d167cce985bd5d1a487578b8fc27f204ec..6b15791a4b42a7ac740be481a328382fe8295d4c 100644 --- a/src/llama-kv-cells.h +++ b/src/llama-kv-cells.h @@ -42,6 +42,17 @@ static inline int ctz64(uint64_t x) { @@ -188,6 +188,3 @@ index 4fcb33d16..6b15791a4 100644 // note: call only if the cell is not empty llama_pos pos_get(uint32_t i) const { assert(i < pos.size()); --- -2.56.1 - diff --git a/llama_cpp/patches/0027-ggml-metal-compile-a-gather-free-row-list-attention-.patch b/llama_cpp/patches/0027-ggml-metal-compile-a-gather-free-row-list-attention-.patch index 4c0ad475..c690d7a8 100644 --- a/llama_cpp/patches/0027-ggml-metal-compile-a-gather-free-row-list-attention-.patch +++ b/llama_cpp/patches/0027-ggml-metal-compile-a-gather-free-row-list-attention-.patch @@ -1,4 +1,4 @@ -From 905d8414afa3a3de888ce498627694ce09d87e48 Mon Sep 17 00:00:00 2001 +From 329a5234e153a812e9a18ec1c0799708f764f898 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sun, 8 Nov 2026 10:55:48 +1100 Subject: [PATCH] ggml-metal: compile a gather-free row-list attention variant @@ -23,10 +23,10 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/ggml/src/ggml-metal/ggml-metal-device.cpp b/ggml/src/ggml-metal/ggml-metal-device.cpp -index 47a1b7c07..cf674213f 100644 +index c3d4f8ef585a865b87a90c6a4c2744feb23440f2..77dbbe7a04cf21f354c8955a93bb5db979bb1526 100644 --- a/ggml/src/ggml-metal/ggml-metal-device.cpp +++ b/ggml/src/ggml-metal/ggml-metal-device.cpp -@@ -2074,6 +2074,7 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_attn_ext_v +@@ -2085,6 +2085,7 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_attn_ext_v bool has_kvpad, bool has_sparse, bool has_rows, @@ -34,7 +34,7 @@ index 47a1b7c07..cf674213f 100644 int32_t nqpsg, int32_t ne, int32_t nsg, -@@ -2103,7 +2104,7 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_attn_ext_v +@@ -2114,7 +2115,7 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_attn_ext_v dv, qne_suffix); @@ -43,7 +43,7 @@ index 47a1b7c07..cf674213f 100644 base, has_mask, has_sinks, -@@ -2112,6 +2113,7 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_attn_ext_v +@@ -2123,6 +2124,7 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_attn_ext_v has_kvpad, has_sparse, has_rows, @@ -51,7 +51,7 @@ index 47a1b7c07..cf674213f 100644 ns10, ns20, nsg, nwg); -@@ -2127,6 +2129,7 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_attn_ext_v +@@ -2138,6 +2140,7 @@ ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_attn_ext_v ggml_metal_cv_set_bool(cv, has_kvpad, FC_FLASH_ATTN_EXT_VEC + 4); ggml_metal_cv_set_bool(cv, has_sparse, FC_FLASH_ATTN_EXT_VEC + 5); ggml_metal_cv_set_bool(cv, has_rows, FC_FLASH_ATTN_EXT_VEC + 6); @@ -60,10 +60,10 @@ index 47a1b7c07..cf674213f 100644 ggml_metal_cv_set_int32(cv, ns10, FC_FLASH_ATTN_EXT_VEC + 20); ggml_metal_cv_set_int32(cv, ns20, FC_FLASH_ATTN_EXT_VEC + 21); diff --git a/ggml/src/ggml-metal/ggml-metal-device.h b/ggml/src/ggml-metal/ggml-metal-device.h -index fa3e364bc..0b821bafb 100644 +index 009b4ce2ef4dc9757a061d0e7784a2395c4a0a43..2bbead4b54ccde59ed531fff960277ec98244deb 100644 --- a/ggml/src/ggml-metal/ggml-metal-device.h +++ b/ggml/src/ggml-metal/ggml-metal-device.h -@@ -240,6 +240,7 @@ struct ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_att +@@ -241,6 +241,7 @@ struct ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_flash_att bool has_kvpad, bool has_sparse, bool has_rows, @@ -72,10 +72,10 @@ index fa3e364bc..0b821bafb 100644 int32_t ne, int32_t nsg, diff --git a/ggml/src/ggml-metal/ggml-metal-ops.cpp b/ggml/src/ggml-metal/ggml-metal-ops.cpp -index c4c4f94dd..3448e8b12 100644 +index 81b6237acf5a98219017c764ce08a46e93ddcd8b..9d177288dc3f3657bfbe8b7193e1f7325628b1fc 100644 --- a/ggml/src/ggml-metal/ggml-metal-ops.cpp +++ b/ggml/src/ggml-metal/ggml-metal-ops.cpp -@@ -3626,6 +3626,25 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { +@@ -3685,6 +3685,25 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { GGML_ASSERT(!has_rows || ne11_attn % OP_FLASH_ATTN_EXT_NCPSG == 0); GGML_ASSERT(!has_rows || ne11_attn % OP_FLASH_ATTN_EXT_VEC_NCPSG == 0); @@ -101,7 +101,7 @@ index c4c4f94dd..3448e8b12 100644 float scale; float max_bias; float logit_softcap; -@@ -4223,7 +4242,7 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { +@@ -4282,7 +4301,7 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { auto fa_vec_smem = [&](int64_t nsg, int32_t nqptg) -> size_t { const size_t smem_half = (size_t) (dk_pad + 4*ncpsg + 2*dv_pad)*nqptg*nsg; @@ -110,7 +110,7 @@ index c4c4f94dd..3448e8b12 100644 }; int64_t nsg = 1; -@@ -4304,7 +4323,7 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { +@@ -4363,7 +4382,7 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { /*.n_kv_max_padded =*/ n_kv_max_padded, }; @@ -120,7 +120,7 @@ index c4c4f94dd..3448e8b12 100644 GGML_ASSERT(nsg*32 <= ggml_metal_pipeline_max_theads_per_threadgroup(pipeline)); diff --git a/ggml/src/ggml-metal/kernels/fa_vec_common.metal b/ggml/src/ggml-metal/kernels/fa_vec_common.metal -index a67106b83..adfe8d816 100644 +index a67106b832d69820bb3ea350f06a61e92c15792a..adfe8d816940266332789bdd9e25aa11f8d780bf 100644 --- a/ggml/src/ggml-metal/kernels/fa_vec_common.metal +++ b/ggml/src/ggml-metal/kernels/fa_vec_common.metal @@ -14,6 +14,8 @@ constant int32_t FC_flash_attn_ext_vec_nsg [[function_constant(FC_FLASH_ATTN_EX @@ -156,6 +156,3 @@ index a67106b83..adfe8d816 100644 const int icr = rows_base >= 0 ? rows_base : ic; // load the KV row indices of a gathered block into shared memory --- -2.56.1 - diff --git a/llama_cpp/patches/0028-ggml-metal-let-GGML_METAL_CAPTURE_DIR-choose-where-a.patch b/llama_cpp/patches/0028-ggml-metal-let-GGML_METAL_CAPTURE_DIR-choose-where-a.patch index 83f28207..d19f6db4 100644 --- a/llama_cpp/patches/0028-ggml-metal-let-GGML_METAL_CAPTURE_DIR-choose-where-a.patch +++ b/llama_cpp/patches/0028-ggml-metal-let-GGML_METAL_CAPTURE_DIR-choose-where-a.patch @@ -1,4 +1,4 @@ -From 251de2bf0b0b3c173a61c5fe338e285e3bc3cbc4 Mon Sep 17 00:00:00 2001 +From 76a33df3f2aae5785ac0febe1b6545aa7eda36d8 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sun, 8 Nov 2026 11:03:23 +1100 Subject: [PATCH] ggml-metal: let GGML_METAL_CAPTURE_DIR choose where a capture @@ -15,7 +15,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-metal/ggml-metal-context.m b/ggml/src/ggml-metal/ggml-metal-context.m -index 539aca161..fdaf0fc14 100644 +index 539aca1614ccb4f4dc6d3cef94ffd8333765bf5a..fdaf0fc14d977c1e657720ad3d042dea2e643462 100644 --- a/ggml/src/ggml-metal/ggml-metal-context.m +++ b/ggml/src/ggml-metal/ggml-metal-context.m @@ -642,7 +642,10 @@ enum ggml_status ggml_metal_graph_compute(ggml_metal_t ctx, struct ggml_cgraph * @@ -30,6 +30,3 @@ index 539aca161..fdaf0fc14 100644 GGML_LOG_WARN("%s: capturing graph in %s\n", __func__, [path UTF8String]); --- -2.56.1 - diff --git a/llama_cpp/patches/0029-tests-per-call-cost-of-ordinary-vs-row-list-decode-a.patch b/llama_cpp/patches/0029-tests-per-call-cost-of-ordinary-vs-row-list-decode-a.patch index 479d5adf..2545506a 100644 --- a/llama_cpp/patches/0029-tests-per-call-cost-of-ordinary-vs-row-list-decode-a.patch +++ b/llama_cpp/patches/0029-tests-per-call-cost-of-ordinary-vs-row-list-decode-a.patch @@ -1,4 +1,4 @@ -From 883f61b0356913268ea08a3553c383e3d8b3f2d6 Mon Sep 17 00:00:00 2001 +From 4db755deb0237e0ededd0004ec0480bf67c40372 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sun, 8 Nov 2026 11:52:39 +1100 Subject: [PATCH] tests: per-call cost of ordinary vs row-list decode attention @@ -18,10 +18,10 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y create mode 100644 tests/test-flash-attn-rows-perf.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 41513426b..b4656519d 100644 +index c152c27d5de2d8a5f0ef291a14d7b04254004525..71349552962c849a6d496de7d6ddbc1cf3ab5a56 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt -@@ -410,6 +410,8 @@ llama_build(test-backend-ops.cpp LINK ggml Threads::Threads) +@@ -416,6 +416,8 @@ llama_build(test-backend-ops.cpp LINK ggml Threads::Threads) llama_build_and_test(test-backend-tensor.cpp LINK ggml) llama_build_and_test(test-sleep.cpp LINK ggml) llama_build_and_test(test-backend-sched.cpp LINK ggml) @@ -32,7 +32,7 @@ index 41513426b..b4656519d 100644 llama_build_and_test(test-llama-mmap.cpp ${PROJECT_SOURCE_DIR}/src/llama-impl.cpp ${PROJECT_SOURCE_DIR}/src/llama-mmap.cpp LABEL behavior) diff --git a/tests/test-flash-attn-rows-perf.cpp b/tests/test-flash-attn-rows-perf.cpp new file mode 100644 -index 000000000..dbffc27e4 +index 0000000000000000000000000000000000000000..dbffc27e441d894f78b036194c52cf53b08cb8d1 --- /dev/null +++ b/tests/test-flash-attn-rows-perf.cpp @@ -0,0 +1,294 @@ @@ -330,6 +330,3 @@ index 000000000..dbffc27e4 + return 1; + } +} --- -2.56.1 - diff --git a/llama_cpp/patches/0030-llama-ggml-metal-start-every-row-list-run-on-an-atte.patch b/llama_cpp/patches/0030-llama-ggml-metal-start-every-row-list-run-on-an-atte.patch index 6a0f539e..2b581529 100644 --- a/llama_cpp/patches/0030-llama-ggml-metal-start-every-row-list-run-on-an-atte.patch +++ b/llama_cpp/patches/0030-llama-ggml-metal-start-every-row-list-run-on-an-atte.patch @@ -1,4 +1,4 @@ -From f8442155749d16f1d8391a989b3a32186d853064 Mon Sep 17 00:00:00 2001 +From 6ae3a2ab4464a3f9478fb17607c3aa79919ea98e Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sun, 8 Nov 2026 12:17:27 +1100 Subject: [PATCH] llama, ggml-metal: start every row-list run on an attention @@ -33,10 +33,10 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y create mode 100644 tests/test-skippy-kv-rows-aligned.cpp diff --git a/ggml/src/ggml-metal/ggml-metal-ops.cpp b/ggml/src/ggml-metal/ggml-metal-ops.cpp -index 3448e8b12..cd1acf45d 100644 +index 9d177288dc3f3657bfbe8b7193e1f7325628b1fc..f1886e9722541e33363a38a810ac7d56d1fd9f39 100644 --- a/ggml/src/ggml-metal/ggml-metal-ops.cpp +++ b/ggml/src/ggml-metal/ggml-metal-ops.cpp -@@ -3626,19 +3626,29 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { +@@ -3685,19 +3685,29 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { GGML_ASSERT(!has_rows || ne11_attn % OP_FLASH_ATTN_EXT_NCPSG == 0); GGML_ASSERT(!has_rows || ne11_attn % OP_FLASH_ATTN_EXT_VEC_NCPSG == 0); @@ -73,7 +73,7 @@ index 3448e8b12..cd1acf45d 100644 } } diff --git a/ggml/src/ggml-metal/kernels/fa_vec_common.metal b/ggml/src/ggml-metal/kernels/fa_vec_common.metal -index adfe8d816..f61b0b919 100644 +index adfe8d816940266332789bdd9e25aa11f8d780bf..f61b0b919a879b5f1a49d6e77fef3e742e65f131 100644 --- a/ggml/src/ggml-metal/kernels/fa_vec_common.metal +++ b/ggml/src/ggml-metal/kernels/fa_vec_common.metal @@ -246,8 +246,12 @@ kernel void kernel_flash_attn_ext_vec( @@ -91,7 +91,7 @@ index adfe8d816..f61b0b919 100644 const int first = rows_list[ic]; const int last = rows_list[ic + C - 1]; diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index d16641afa..6097c870e 100644 +index fea9e839c997fe2af3ec8de6b98851ed0d59a93b..38215348adae1acaf466db01fd0ef68e35a237ca 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -2696,6 +2696,22 @@ uint32_t llama_kv_cache::get_n_kv_rows(const llama_ubatch & ubatch) const { @@ -117,7 +117,7 @@ index d16641afa..6097c870e 100644 for (uint32_t s = 0; s < n_slices; ++s) { // a cell shared by several sequences of the slice is counted once per sequence, an upper bound is enough uint32_t n = 0; -@@ -3307,7 +3323,12 @@ void llama_kv_cache::set_input_attn_mask(const llm_attn_mask & attn_mask, const +@@ -3303,7 +3319,12 @@ void llama_kv_cache::set_input_attn_mask(const llm_attn_mask & attn_mask, const const auto & cells = v_cells[0]; int32_t * data = (int32_t *) attn_mask.rows->data; @@ -132,7 +132,7 @@ index d16641afa..6097c870e 100644 } diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index a6da0bf9b..631adf9d4 100644 +index a6da0bf9b2064f5a1d27ec3344b3fcb64a1793d4..631adf9d4b826ed1f0131d10b913bccca72e43ba 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -278,6 +278,9 @@ public: @@ -146,7 +146,7 @@ index a6da0bf9b..631adf9d4 100644 std::vector find_chunked_cells( const llama_ubatch & ubatch, const llama_kv_cells & cells, uint32_t head_cur) const; diff --git a/src/llama-kv-cells.h b/src/llama-kv-cells.h -index 6b15791a4..8775a4e6b 100644 +index 6b15791a4b42a7ac740be481a328382fe8295d4c..8775a4e6bb52842f4e2e8efd4c8728ae01697002 100644 --- a/src/llama-kv-cells.h +++ b/src/llama-kv-cells.h @@ -511,6 +511,101 @@ public: @@ -252,7 +252,7 @@ index 6b15791a4..8775a4e6b 100644 // return -1 if the sequence is not present llama_pos seq_pos_min(llama_seq_id seq_id) const { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index b4656519d..dba88877a 100644 +index 71349552962c849a6d496de7d6ddbc1cf3ab5a56..26fe9aa16111bcb8d91f7bf0428fbd8a19650a24 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -193,6 +193,7 @@ if (NOT WIN32 OR NOT BUILD_SHARED_LIBS) @@ -264,7 +264,7 @@ index b4656519d..dba88877a 100644 # these tests are disabled on Windows because they use internal functions not exported with LLAMA_API (when building with shared libraries) llama_build_and_test(test-unicode.cpp LABEL behavior LINK llama) diff --git a/tests/test-flash-attn-rows-perf.cpp b/tests/test-flash-attn-rows-perf.cpp -index dbffc27e4..fd3179a06 100644 +index dbffc27e441d894f78b036194c52cf53b08cb8d1..fd3179a06e78cc0b9fd9aeac4a08800f4777cb50 100644 --- a/tests/test-flash-attn-rows-perf.cpp +++ b/tests/test-flash-attn-rows-perf.cpp @@ -37,7 +37,7 @@ constexpr int64_t kv_heads = 4; @@ -318,7 +318,7 @@ index dbffc27e4..fd3179a06 100644 } diff --git a/tests/test-skippy-kv-rows-aligned.cpp b/tests/test-skippy-kv-rows-aligned.cpp new file mode 100644 -index 000000000..5cc440ab3 +index 0000000000000000000000000000000000000000..5cc440ab3bd5988faa6e460d224c3b621ea8ed81 --- /dev/null +++ b/tests/test-skippy-kv-rows-aligned.cpp @@ -0,0 +1,106 @@ @@ -428,6 +428,3 @@ index 000000000..5cc440ab3 + std::printf("%s\n", failures ? "FAILED" : "aligned row lists: all checks passed"); + return failures != 0; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0031-ggml-metal-GGML_METAL_ROWS_DEBUG-counts-the-row-atte.patch b/llama_cpp/patches/0031-ggml-metal-GGML_METAL_ROWS_DEBUG-counts-the-row-atte.patch index 59742cc0..7ec81bbb 100644 --- a/llama_cpp/patches/0031-ggml-metal-GGML_METAL_ROWS_DEBUG-counts-the-row-atte.patch +++ b/llama_cpp/patches/0031-ggml-metal-GGML_METAL_ROWS_DEBUG-counts-the-row-atte.patch @@ -1,4 +1,4 @@ -From 3b049010669cbf0c1ef634bf5089cdebc12b63cc Mon Sep 17 00:00:00 2001 +From 09c7a9f3078ac4770bf68506f1a6e7ecbf908dbe Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sun, 8 Nov 2026 13:07:18 +1100 Subject: [PATCH] ggml-metal: GGML_METAL_ROWS_DEBUG counts the row-attention @@ -15,7 +15,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/ggml/src/ggml-metal/ggml-metal-ops.cpp b/ggml/src/ggml-metal/ggml-metal-ops.cpp -index cd1acf45d..99538d0ca 100644 +index f1886e9722541e33363a38a810ac7d56d1fd9f39..1ddc52ed6303a7c9ac46b9ced8d38762f1f7a704 100644 --- a/ggml/src/ggml-metal/ggml-metal-ops.cpp +++ b/ggml/src/ggml-metal/ggml-metal-ops.cpp @@ -12,6 +12,8 @@ @@ -27,7 +27,7 @@ index cd1acf45d..99538d0ca 100644 #include #include -@@ -3630,8 +3632,21 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { +@@ -3689,8 +3691,21 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { // consecutive range (possibly ending in padding) or all padding. a run ascends, so its ends // decide; the lists are readable from the host whenever their Metal buffer is shared or // mapped (every buffer type but private) @@ -51,7 +51,7 @@ index cd1acf45d..99538d0ca 100644 [&] { constexpr int64_t C = OP_FLASH_ATTN_EXT_VEC_NCPSG; const int32_t * lists = (const int32_t *) kv_rows->data; -@@ -3649,11 +3664,20 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { +@@ -3708,11 +3723,20 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { const int64_t live = tail - block; if (tail == block + C || block[live - 1] != first + live - 1 || first + C > n_cache_rows || std::any_of(tail, block + C, [](int32_t row) { return row >= 0; })) { @@ -72,6 +72,3 @@ index cd1acf45d..99538d0ca 100644 float scale; float max_bias; --- -2.56.1 - diff --git a/llama_cpp/patches/0032-ggml-skippy-report-every-backend-buffer-s-life-as-a-.patch b/llama_cpp/patches/0032-ggml-skippy-report-every-backend-buffer-s-life-as-a-.patch index fccf85e5..78c5cfdb 100644 --- a/llama_cpp/patches/0032-ggml-skippy-report-every-backend-buffer-s-life-as-a-.patch +++ b/llama_cpp/patches/0032-ggml-skippy-report-every-backend-buffer-s-life-as-a-.patch @@ -1,4 +1,4 @@ -From cea225ff603d5f916a2826f561ab91cc1ed1812d Mon Sep 17 00:00:00 2001 +From 67c6ff50d5b6a241090fa3d1901e90c50fb5af71 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sun, 8 Nov 2026 19:48:49 +1100 Subject: [PATCH] ggml, skippy: report every backend buffer's life as a trace @@ -19,7 +19,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 3 files changed, 132 insertions(+) diff --git a/ggml/include/ggml-backend.h b/ggml/include/ggml-backend.h -index 830ffa1df..208e129c2 100644 +index c73210ab5baa4c10e76e8e6ea330c83dd47cf6d5..83ad19bea934f83f6d9e2921475925986ae35b77 100644 --- a/ggml/include/ggml-backend.h +++ b/ggml/include/ggml-backend.h @@ -375,6 +375,35 @@ extern "C" { @@ -59,7 +59,7 @@ index 830ffa1df..208e129c2 100644 // Backend registry // diff --git a/ggml/src/ggml-backend.cpp b/ggml/src/ggml-backend.cpp -index c8c05e442..7b4d3a6d0 100644 +index c8c05e442267e3b40d5afedefee364911fb82486..7b4d3a6d0da3fdc5435a8c9a52969256aa216dd0 100644 --- a/ggml/src/ggml-backend.cpp +++ b/ggml/src/ggml-backend.cpp @@ -20,6 +20,7 @@ @@ -165,7 +165,7 @@ index c8c05e442..7b4d3a6d0 100644 } diff --git a/src/skippy/tracing.cpp b/src/skippy/tracing.cpp -index 29e9047b1..48d827d34 100644 +index 29e9047b1efd97cd7087aa8953c5a50aff7661bf..48d827d34436ed1e2bb9515e3da7d34490137c5f 100644 --- a/src/skippy/tracing.cpp +++ b/src/skippy/tracing.cpp @@ -6,6 +6,7 @@ @@ -225,6 +225,3 @@ index 29e9047b1..48d827d34 100644 // Skippy and llama report their own spans with or without a backend. return SKIPPY_STATUS_OK; --- -2.56.1 - diff --git a/llama_cpp/patches/0033-llama-zero-KV-pool-cells-as-the-high-water-mark-adva.patch b/llama_cpp/patches/0033-llama-zero-KV-pool-cells-as-the-high-water-mark-adva.patch index a2e2c35a..04ab211f 100644 --- a/llama_cpp/patches/0033-llama-zero-KV-pool-cells-as-the-high-water-mark-adva.patch +++ b/llama_cpp/patches/0033-llama-zero-KV-pool-cells-as-the-high-water-mark-adva.patch @@ -1,4 +1,4 @@ -From 5ab7d5111a34b8ebdc300069dd050cfcf4276621 Mon Sep 17 00:00:00 2001 +From 481d210cd4e86058bc8b8d0086e3793573603b15 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Sun, 8 Nov 2026 20:18:33 +1100 Subject: [PATCH] llama: zero KV pool cells as the high-water mark advances, @@ -34,7 +34,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 6 files changed, 103 insertions(+), 5 deletions(-) diff --git a/ggml/include/ggml-backend.h b/ggml/include/ggml-backend.h -index 208e129c2..284543ee0 100644 +index 83ad19bea934f83f6d9e2921475925986ae35b77..968afd56cdce04506a7c80de360411de9e069117 100644 --- a/ggml/include/ggml-backend.h +++ b/ggml/include/ggml-backend.h @@ -64,6 +64,8 @@ extern "C" { @@ -47,7 +47,7 @@ index 208e129c2..284543ee0 100644 GGML_API enum ggml_backend_buffer_usage ggml_backend_buffer_get_usage (ggml_backend_buffer_t buffer); GGML_API ggml_backend_buffer_type_t ggml_backend_buffer_get_type (ggml_backend_buffer_t buffer); diff --git a/ggml/src/ggml-backend.cpp b/ggml/src/ggml-backend.cpp -index 7b4d3a6d0..bf76ab6cc 100644 +index 7b4d3a6d0da3fdc5435a8c9a52969256aa216dd0..bf76ab6cce0c8da2daf3619bea0590d1b65bd27c 100644 --- a/ggml/src/ggml-backend.cpp +++ b/ggml/src/ggml-backend.cpp @@ -386,6 +386,10 @@ size_t ggml_backend_buffer_get_alloc_size(ggml_backend_buffer_t buffer, const st @@ -62,7 +62,7 @@ index 7b4d3a6d0..bf76ab6cc 100644 return ggml_backend_buft_is_host(ggml_backend_buffer_get_type(buffer)); } diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index 6097c870e..ebbe8b8f6 100644 +index 38215348adae1acaf466db01fd0ef68e35a237ca..569aa54b4d950ec6711af877fa1549a0861b080e 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -62,6 +62,14 @@ static void ggml_gen_hadamard(ggml_tensor * tensor) { @@ -187,7 +187,7 @@ index 6097c870e..ebbe8b8f6 100644 for (uint32_t ii = 0; ii < sinfo.size(); ++ii) { const uint32_t i = s*sinfo.size() + ii; diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index 631adf9d4..7f0ba31ba 100644 +index 631adf9d4b826ed1f0131d10b913bccca72e43ba..7f0ba31bac728c4d17e20c4ee232b109ce9299b1 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -285,6 +285,21 @@ public: @@ -213,7 +213,7 @@ index 631adf9d4..7f0ba31ba 100644 void apply_ubatch(const slot_info & sinfo, const llama_ubatch & ubatch); diff --git a/src/llama-memory.cpp b/src/llama-memory.cpp -index 80099e76a..46f1697af 100644 +index 80099e76ac6c59a77a6ec9cc8741e9536ca764db..46f1697af42c5ef3a66a9eab40eb3b30b86105de 100644 --- a/src/llama-memory.cpp +++ b/src/llama-memory.cpp @@ -86,11 +86,13 @@ ggml_backend_buffer_ptr llama_memory_bufs::alloc_buf(ggml_context * ctx, ggml_ba @@ -233,7 +233,7 @@ index 80099e76a..46f1697af 100644 bufs.emplace_back(std::move(ctx), std::move(buf)); diff --git a/src/llama-memory.h b/src/llama-memory.h -index 37d01ed11..b6b84c315 100644 +index 37d01ed116d2162e0bf96e51e8487d7c059bf708..b6b84c3159d4e08ae54f6826501b24a454e02035 100644 --- a/src/llama-memory.h +++ b/src/llama-memory.h @@ -37,8 +37,9 @@ struct llama_memory_bufs { @@ -247,6 +247,3 @@ index 37d01ed11..b6b84c315 100644 // the memory used by the tensors: the buffer sizes, or the simulated sizes if no_alloc is set std::map memory_breakdown() const; --- -2.56.1 - diff --git a/llama_cpp/patches/0034-llama-give-the-pages-of-freed-KV-chunks-back-to-the-.patch b/llama_cpp/patches/0034-llama-give-the-pages-of-freed-KV-chunks-back-to-the-.patch index 101a1a86..72c0a393 100644 --- a/llama_cpp/patches/0034-llama-give-the-pages-of-freed-KV-chunks-back-to-the-.patch +++ b/llama_cpp/patches/0034-llama-give-the-pages-of-freed-KV-chunks-back-to-the-.patch @@ -1,4 +1,4 @@ -From 1f99a1d526ac30ca0c59e43e2cd919b5dbea1b4f Mon Sep 17 00:00:00 2001 +From 61e0d42ee958d76a1129e1ddf7524651eaa3b8b0 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Mon, 9 Nov 2026 10:27:08 +1100 Subject: [PATCH] llama: give the pages of freed KV chunks back to the kernel @@ -28,7 +28,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 3 files changed, 177 insertions(+), 1 deletion(-) diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index ebbe8b8f6..023ca671d 100644 +index 569aa54b4d950ec6711af877fa1549a0861b080e..1053cebfe58bf82c484e90ca9518d6bfecf28bec 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -15,13 +15,66 @@ @@ -254,7 +254,7 @@ index ebbe8b8f6..023ca671d 100644 for (uint32_t s = 0; s < sinfo.n_stream(); ++s) { diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index 7f0ba31ba..21c2e18e5 100644 +index 7f0ba31bac728c4d17e20c4ee232b109ce9299b1..21c2e18e5b84fa62bd271135567ce9a84a7d5f79 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -5,6 +5,7 @@ @@ -289,7 +289,7 @@ index 7f0ba31ba..21c2e18e5 100644 void apply_ubatch(const slot_info & sinfo, const llama_ubatch & ubatch); diff --git a/src/llama-kv-cells.h b/src/llama-kv-cells.h -index 8775a4e6b..94caf7c83 100644 +index 8775a4e6bb52842f4e2e8efd4c8728ae01697002..94caf7c83d2f13b6e879905d3f0de2658a027362 100644 --- a/src/llama-kv-cells.h +++ b/src/llama-kv-cells.h @@ -139,6 +139,13 @@ public: @@ -306,6 +306,3 @@ index 8775a4e6b..94caf7c83 100644 uint32_t get_used() const { return used.size(); } --- -2.56.1 - diff --git a/llama_cpp/patches/0035-skippy-size-the-unified-KV-pool-and-choose-its-memor.patch b/llama_cpp/patches/0035-skippy-size-the-unified-KV-pool-and-choose-its-memor.patch index d50a9bd7..80642c0d 100644 --- a/llama_cpp/patches/0035-skippy-size-the-unified-KV-pool-and-choose-its-memor.patch +++ b/llama_cpp/patches/0035-skippy-size-the-unified-KV-pool-and-choose-its-memor.patch @@ -1,4 +1,4 @@ -From 763a4ca6f43b96baee274f0dd579d40aefc85ad2 Mon Sep 17 00:00:00 2001 +From 769b71543d74850115787774d7d239a186eea804 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Tue, 10 Nov 2026 17:05:21 +1100 Subject: [PATCH] skippy: size the unified KV pool and choose its memory @@ -56,7 +56,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 9 files changed, 94 insertions(+), 6 deletions(-) diff --git a/include/skippy/common.h b/include/skippy/common.h -index 0e7b4f8a2..b16229b1b 100644 +index 0e7b4f8a2bd23f59f547d121309f79ac66dee349..b16229b1b78c2df981ca9870f6e4c7357b885af9 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -69,7 +69,7 @@ index 0e7b4f8a2..b16229b1b 100644 #if defined(_MSC_VER) #define SKIPPY_DEPRECATED(message) __declspec(deprecated(message)) diff --git a/include/skippy/runtime.h b/include/skippy/runtime.h -index 10ea60e7c..31ce347ea 100644 +index 10ea60e7c436c9483b821149f72b582da3733cc7..31ce347ea8fda1aec0c350c5d92341968ccfcb85 100644 --- a/include/skippy/runtime.h +++ b/include/skippy/runtime.h @@ -101,6 +101,16 @@ struct skippy_runtime_config { @@ -90,7 +90,7 @@ index 10ea60e7c..31ce347ea 100644 // config. /** @brief Whether the backend offloads host tensor operations to device (mirrors upstream `op_offload`). SKIPPY_TRISTATE_AUTO preserves llama.cpp's derived default (enabled); FALSE/TRUE force the value. */ diff --git a/include/skippy/state.h b/include/skippy/state.h -index 6d9028a18..fc5dcd389 100644 +index 6d9028a18e72dc4c6b0ee19f5110e91afe837afb..fc5dcd3894938bfe35a9957d8295b95ba93a4910 100644 --- a/include/skippy/state.h +++ b/include/skippy/state.h @@ -30,6 +30,9 @@ enum skippy_memory_cache_capability { @@ -104,7 +104,7 @@ index 6d9028a18..fc5dcd389 100644 SKIPPY_KV_PAGE_FLAG_V_TRANSPOSED = 1 << 0, SKIPPY_KV_PAGE_FLAG_HAS_K_IDX = 1 << 1, diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index fd08598b2..144a3e603 100644 +index 8e53a0d5f3e8b6fe91ee2d105954316df0c4ed07..87cf979cf606f6e0fe2eb85efa7bdf52ddf41c14 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -426,9 +426,11 @@ llama_context::llama_context( @@ -121,10 +121,10 @@ index fd08598b2..144a3e603 100644 LLAMA_LOG_INFO("%s: LLAMA_KV_ROWS_DISABLE set, disabling kv_rows\n", __func__); cparams.auto_fkvr = false; diff --git a/src/llama-graph.h b/src/llama-graph.h -index 9c68abc0c..b6833e580 100644 +index 60ae9769df9cedf980d5f759045e631ac08d522f..7422c0e5bf3461c83cb96e7a0e68ef9010be5368 100644 --- a/src/llama-graph.h +++ b/src/llama-graph.h -@@ -101,6 +101,9 @@ struct skippy_graph_build_inputs { +@@ -102,6 +102,9 @@ struct skippy_graph_build_inputs { std::vector activation_export_bindings; std::vector resident_tensor_names; std::string execution_contract; @@ -135,7 +135,7 @@ index 9c68abc0c..b6833e580 100644 bool topology_equal(const skippy_graph_build_inputs & other) const; }; diff --git a/src/skippy/graph_build_inputs.h b/src/skippy/graph_build_inputs.h -index c08f2d510..d5f13eaf2 100644 +index c08f2d510d27cd1ee0ec0bc022c1a34df305692c..d5f13eaf2373b9c85e03770c21fe530c4db227f1 100644 --- a/src/skippy/graph_build_inputs.h +++ b/src/skippy/graph_build_inputs.h @@ -15,6 +15,7 @@ inline skippy_graph_build_inputs skippy_graph_build_inputs_from_config( @@ -147,7 +147,7 @@ index c08f2d510..d5f13eaf2 100644 if ((config != nullptr && (skippy_runtime_has_stage_plan(config) || config->glm_dsa_policy_profile != 0)) || has_phase_hint) { diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp -index a4bf2a475..5f100aa46 100644 +index a4bf2a4756970f79ae7ea59680de0f49da59dd17..5f100aa461bc9b0f2dfd47e84d681b016c052551 100644 --- a/src/skippy/model_loading.cpp +++ b/src/skippy/model_loading.cpp @@ -22,6 +22,7 @@ @@ -238,7 +238,7 @@ index a4bf2a475..5f100aa46 100644 llama_set_embeddings_nextn(target_model->ctx, true, false); target_model->mtp_model = draft_model; diff --git a/src/skippy/state_memory.cpp b/src/skippy/state_memory.cpp -index 806e79d72..c62b1e629 100644 +index 806e79d72ec960d12571d2acd2c5ecb22229c49b..c62b1e62991bbaf60386786c4538a49e8b1e28e6 100644 --- a/src/skippy/state_memory.cpp +++ b/src/skippy/state_memory.cpp @@ -1,5 +1,6 @@ @@ -310,7 +310,7 @@ index 806e79d72..c62b1e629 100644 uint32_t capabilities = model && model->ctx ? model->ctx->admit_skippy_cache_capabilities( diff --git a/src/skippy/state_memory.h b/src/skippy/state_memory.h -index 4875cf398..84e5d9c61 100644 +index 4875cf39855d72989869e0f492de01cdf5a320d3..84e5d9c61654dd2bc27d2606ef39a485e7709fb9 100644 --- a/src/skippy/state_memory.h +++ b/src/skippy/state_memory.h @@ -13,4 +13,10 @@ llama_kv_cache * skippy_memory_kv_adapter(llama_memory_t memory); @@ -324,6 +324,3 @@ index 4875cf398..84e5d9c61 100644 +// controls. A null configuration keeps what each cache chose for itself. +void skippy_apply_kv_memory_config(llama_memory_t memory, const skippy_runtime_config * config); uint32_t skippy_graph_cache_capabilities(const llm_graph_result & result); --- -2.56.1 - diff --git a/llama_cpp/patches/0036-llama-place-each-request-s-share-of-a-batch-together.patch b/llama_cpp/patches/0036-llama-place-each-request-s-share-of-a-batch-together.patch index d4fa6b38..45d81a36 100644 --- a/llama_cpp/patches/0036-llama-place-each-request-s-share-of-a-batch-together.patch +++ b/llama_cpp/patches/0036-llama-place-each-request-s-share-of-a-batch-together.patch @@ -1,4 +1,4 @@ -From 2ab5653543191d5561ca7a731b4918ae3894534c Mon Sep 17 00:00:00 2001 +From 30dd8fb5e2529173c8c878fe58c05844e6eec51e Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Thu, 12 Nov 2026 08:42:32 +1100 Subject: [PATCH] llama: place each request's share of a batch together in the @@ -31,7 +31,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y create mode 100644 tests/test-skippy-kv-place-together.cpp diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index 023ca671d..c28ac5f1f 100644 +index 1053cebfe58bf82c484e90ca9518d6bfecf28bec..cb016ab007eba72cf073c43a1ed5ce59d0b7a692 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -1251,79 +1251,18 @@ bool llama_kv_cache::update(llama_context * lctx, bool do_shift, const stream_co @@ -125,7 +125,7 @@ index 023ca671d..c28ac5f1f 100644 llama_kv_cache::slot_info llama_kv_cache::find_slot(const llama_ubatch & ubatch, bool cont) const { diff --git a/src/llama-kv-cells.h b/src/llama-kv-cells.h -index 94caf7c83..d30090efd 100644 +index 94caf7c83d2f13b6e879905d3f0de2658a027362..d30090efd63eb042f97f5dafd00d4870fd586b27 100644 --- a/src/llama-kv-cells.h +++ b/src/llama-kv-cells.h @@ -4,12 +4,14 @@ @@ -266,7 +266,7 @@ index 94caf7c83..d30090efd 100644 // note: call only if the cell is not empty diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index dba88877a..25b8bab5f 100644 +index 26fe9aa16111bcb8d91f7bf0428fbd8a19650a24..4189d102dead13cc2a14bf48e8d76d67ae1dc9ba 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -194,6 +194,7 @@ if (NOT WIN32 OR NOT BUILD_SHARED_LIBS) @@ -279,7 +279,7 @@ index dba88877a..25b8bab5f 100644 llama_build_and_test(test-unicode.cpp LABEL behavior LINK llama) diff --git a/tests/test-skippy-kv-place-together.cpp b/tests/test-skippy-kv-place-together.cpp new file mode 100644 -index 000000000..b7c50f142 +index 0000000000000000000000000000000000000000..b7c50f142b4007e2a5fe88373876c1952da40677 --- /dev/null +++ b/tests/test-skippy-kv-place-together.cpp @@ -0,0 +1,200 @@ @@ -483,6 +483,3 @@ index 000000000..b7c50f142 + } + return failures == 0 ? 0 : 1; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0037-skippy-sample-a-wave-through-a-configurable-executor.patch b/llama_cpp/patches/0037-skippy-sample-a-wave-through-a-configurable-executor.patch index eb1daf7a..e6072f63 100644 --- a/llama_cpp/patches/0037-skippy-sample-a-wave-through-a-configurable-executor.patch +++ b/llama_cpp/patches/0037-skippy-sample-a-wave-through-a-configurable-executor.patch @@ -1,4 +1,4 @@ -From 1d3374f843d1076d856c09118306f2697c3ff406 Mon Sep 17 00:00:00 2001 +From 9506f72ca424c0a5896d6791a824dfb38a07f0b8 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Thu, 12 Nov 2026 12:25:11 +1100 Subject: [PATCH] skippy: sample a wave through a configurable executor @@ -44,7 +44,7 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y create mode 100644 tests/test-skippy-task-pool.cpp diff --git a/include/skippy/common.h b/include/skippy/common.h -index b16229b1b..557ba5169 100644 +index b16229b1b78c2df981ca9870f6e4c7357b885af9..557ba51694839de1611ef2b33a7cce90437e8b84 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -57,7 +57,7 @@ index b16229b1b..557ba5169 100644 #if defined(_MSC_VER) #define SKIPPY_DEPRECATED(message) __declspec(deprecated(message)) diff --git a/include/skippy/runtime.h b/include/skippy/runtime.h -index 31ce347ea..58b157319 100644 +index 31ce347ea8fda1aec0c350c5d92341968ccfcb85..58b157319bd5fba131d5212bde7cc5810e4213ac 100644 --- a/include/skippy/runtime.h +++ b/include/skippy/runtime.h @@ -111,6 +111,9 @@ struct skippy_runtime_config { @@ -71,7 +71,7 @@ index 31ce347ea..58b157319 100644 // config. /** @brief Whether the backend offloads host tensor operations to device (mirrors upstream `op_offload`). SKIPPY_TRISTATE_AUTO preserves llama.cpp's derived default (enabled); FALSE/TRUE force the value. */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index c6675d944..cd6340976 100644 +index c6675d944001872c468294ca87bddb4f3b1d7a5b..cd6340976c2ef21c2972b2e0c77b4756f480c028 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -84,6 +84,8 @@ add_library(llama @@ -84,7 +84,7 @@ index c6675d944..cd6340976 100644 skippy/chat_sampling.cpp skippy/sampling_vocab.cpp diff --git a/src/skippy/batch_sampling.cpp b/src/skippy/batch_sampling.cpp -index e59c89857..0b01db542 100644 +index e59c898575ea262476bad7c3719119d3f45d9440..0b01db542d9f6485db56ca4bfbe50951c15da7b2 100644 --- a/src/skippy/batch_sampling.cpp +++ b/src/skippy/batch_sampling.cpp @@ -3,13 +3,12 @@ @@ -151,7 +151,7 @@ index e59c89857..0b01db542 100644 bool share_context( diff --git a/src/skippy/sample_executor.cpp b/src/skippy/sample_executor.cpp new file mode 100644 -index 000000000..614074d52 +index 0000000000000000000000000000000000000000..614074d522f3b55a8dd79138d63aad2cb6b5d484 --- /dev/null +++ b/src/skippy/sample_executor.cpp @@ -0,0 +1,17 @@ @@ -174,7 +174,7 @@ index 000000000..614074d52 +} diff --git a/src/skippy/sample_executor.h b/src/skippy/sample_executor.h new file mode 100644 -index 000000000..7eeb5937c +index 0000000000000000000000000000000000000000..7eeb5937c9453482a41009a70a39e396336e0726 --- /dev/null +++ b/src/skippy/sample_executor.h @@ -0,0 +1,50 @@ @@ -230,7 +230,7 @@ index 000000000..7eeb5937c +} diff --git a/src/skippy/task_pool.cpp b/src/skippy/task_pool.cpp new file mode 100644 -index 000000000..88f8d3b59 +index 0000000000000000000000000000000000000000..88f8d3b5990bd0410e92acd9b6f53e3b35e69894 --- /dev/null +++ b/src/skippy/task_pool.cpp @@ -0,0 +1,97 @@ @@ -333,7 +333,7 @@ index 000000000..88f8d3b59 +} diff --git a/src/skippy/task_pool.h b/src/skippy/task_pool.h new file mode 100644 -index 000000000..e33523ea7 +index 0000000000000000000000000000000000000000..e33523ea799a63f4278b88af650d5c9b2fe72cb1 --- /dev/null +++ b/src/skippy/task_pool.h @@ -0,0 +1,59 @@ @@ -397,7 +397,7 @@ index 000000000..e33523ea7 + std::vector threads; // grown by run() under `turn` +}; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 25b8bab5f..35dda15c4 100644 +index 4189d102dead13cc2a14bf48e8d76d67ae1dc9ba..18134816d471fad63570f3140ebeeb952065a0b3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -195,6 +195,8 @@ if (NOT WIN32 OR NOT BUILD_SHARED_LIBS) @@ -411,7 +411,7 @@ index 25b8bab5f..35dda15c4 100644 llama_build_and_test(test-unicode.cpp LABEL behavior LINK llama) diff --git a/tests/test-skippy-task-pool.cpp b/tests/test-skippy-task-pool.cpp new file mode 100644 -index 000000000..e9b9284e0 +index 0000000000000000000000000000000000000000..e9b9284e0ab5b403f5dee0e2fb19920b8aa75b53 --- /dev/null +++ b/tests/test-skippy-task-pool.cpp @@ -0,0 +1,171 @@ @@ -586,6 +586,3 @@ index 000000000..e9b9284e0 + } + return failures == 0 ? 0 : 1; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0038-tests-check-row-list-attention-over-the-lists-a-unif.patch b/llama_cpp/patches/0038-tests-check-row-list-attention-over-the-lists-a-unif.patch index c703de57..50bd5f51 100644 --- a/llama_cpp/patches/0038-tests-check-row-list-attention-over-the-lists-a-unif.patch +++ b/llama_cpp/patches/0038-tests-check-row-list-attention-over-the-lists-a-unif.patch @@ -1,4 +1,4 @@ -From 9e4d9e67ba23c1853ae917cb4e385d05a4de3eda Mon Sep 17 00:00:00 2001 +From fc9cea0f543b86882868b3c4b5df7d3f8d63e38a Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Thu, 12 Nov 2026 15:55:33 +1100 Subject: [PATCH] tests: check row-list attention over the lists a unified KV @@ -31,10 +31,10 @@ Claude-Session: https://claude.ai/code/session_01QA3dWey3RBtBgDz1Tery9Y 2 files changed, 113 insertions(+), 5 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 35dda15c4..868abee4e 100644 +index 18134816d471fad63570f3140ebeeb952065a0b3..b3f0cce27e22cf9cf3db64db19f2fb69c3f36499 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt -@@ -410,6 +410,11 @@ if (GGML_METAL AND NOT GGML_BACKEND_DL) +@@ -416,6 +416,11 @@ if (GGML_METAL AND NOT GGML_BACKEND_DL) endif() llama_build(test-backend-ops.cpp LINK ggml Threads::Threads) @@ -47,10 +47,10 @@ index 35dda15c4..868abee4e 100644 llama_build_and_test(test-backend-tensor.cpp LINK ggml) llama_build_and_test(test-sleep.cpp LINK ggml) diff --git a/tests/test-backend-ops.cpp b/tests/test-backend-ops.cpp -index 084037eeb..f14ba7db5 100644 +index 0d0d020feec0c62c08016e3cec59ffb44fc6cf9b..4830797213db7a017712d882ab9cf5487250c90f 100644 --- a/tests/test-backend-ops.cpp +++ b/tests/test-backend-ops.cpp -@@ -10112,11 +10112,8 @@ struct test_flash_attn_ext_kv_rows : public test_case { +@@ -10485,11 +10485,8 @@ struct test_flash_attn_ext_kv_rows : public test_case { return out; } @@ -64,7 +64,7 @@ index 084037eeb..f14ba7db5 100644 std::vector order(n_cells); for (int64_t s = 0; s < n_slices; ++s) { for (int64_t i = 0; i < n_cells; ++i) { -@@ -10128,6 +10125,13 @@ struct test_flash_attn_ext_kv_rows : public test_case { +@@ -10501,6 +10498,13 @@ struct test_flash_attn_ext_kv_rows : public test_case { rows[s*kv + i] = order[i]; } } @@ -78,7 +78,7 @@ index 084037eeb..f14ba7db5 100644 for (ggml_tensor * t = ggml_get_first_tensor(ctx); t != NULL; t = ggml_get_next_tensor(ctx, t)) { if (t->view_src) { -@@ -10275,6 +10279,91 @@ struct test_flash_attn_ext_indexed_bias : public test_case { +@@ -10679,6 +10683,91 @@ struct test_flash_attn_ext_indexed_bias : public test_case { } }; @@ -170,9 +170,9 @@ index 084037eeb..f14ba7db5 100644 // GGML_OP_CROSS_ENTROPY_LOSS struct test_cross_entropy_loss : public test_case { const ggml_type type; -@@ -14521,6 +14610,20 @@ static std::vector> make_test_cases_eval() { - } - } +@@ -15024,6 +15113,20 @@ static std::vector> make_test_cases_eval() { + test_cases.emplace_back(new test_flash_attn_ext_indexed_bias(128, 8, 3, 1100, 256, 2, 33, false, true, GGML_TYPE_F16, 0.0f, false, true)); + test_cases.emplace_back(new test_flash_attn_ext_indexed_bias(128, 2, 3, 1100, 7, 2, 33, false, true, GGML_TYPE_Q8_0)); + // the same op over lists of consecutive runs in blocks of 32 entries + for (auto layout : { test_flash_attn_ext_kv_rows_runs::LAYOUT_CONSECUTIVE, @@ -191,6 +191,3 @@ index 084037eeb..f14ba7db5 100644 // sparse mask with large batch size test_cases.emplace_back(new test_flash_attn_ext(512, 512, 1, { 8, 1}, 4096, 64, true, false, 0, 0, GGML_PREC_F32, GGML_TYPE_F16, GGML_TYPE_F16, {0, 1, 2, 3}, true, false, 512)); test_cases.emplace_back(new test_flash_attn_ext(512, 512, 1, { 8, 1}, 4096, 64, true, false, 0, 0, GGML_PREC_F32, GGML_TYPE_F16, GGML_TYPE_F16, {0, 1, 2, 3}, true, false, 2048)); --- -2.56.1 - diff --git a/llama_cpp/patches/0039-llama-reclaim-released-chunks-before-compaction-copi.patch b/llama_cpp/patches/0039-llama-reclaim-released-chunks-before-compaction-copi.patch index a4995a7d..81fb53c3 100644 --- a/llama_cpp/patches/0039-llama-reclaim-released-chunks-before-compaction-copi.patch +++ b/llama_cpp/patches/0039-llama-reclaim-released-chunks-before-compaction-copi.patch @@ -1,4 +1,4 @@ -From 2ee510f8a21b6757513aff4d332554799ebcfbaf Mon Sep 17 00:00:00 2001 +From 7f43bd2ba1539a76c30d790f410aea336a11707c Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Wed, 18 Nov 2026 20:03:10 +1100 Subject: [PATCH] llama: reclaim released chunks before compaction copies rows @@ -26,7 +26,7 @@ moved rows. create mode 100644 tests/test-skippy-kv-release-compact.cpp diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index c28ac5f1f..a06758f9d 100644 +index cb016ab007eba72cf073c43a1ed5ce59d0b7a692..1962d3a7ab74342658ea406fd901189e03c6853e 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -675,6 +675,20 @@ void llama_kv_cache::reclaim_chunks(uint32_t stream, const std::vector @@ -60,7 +60,7 @@ index c28ac5f1f..a06758f9d 100644 LLAMA_LOG_DEBUG("%s: compacted %zu KV cells\n", __func__, moves.size()); } diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index 21c2e18e5..6d5eccaf7 100644 +index 21c2e18e5b84fa62bd271135567ce9a84a7d5f79..6d5eccaf72a510e8b42f67bc7f20f646b2b8c8b3 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -313,6 +313,7 @@ public: @@ -72,7 +72,7 @@ index 21c2e18e5..6d5eccaf7 100644 void for_each_chunk_range(uint32_t stream, uint32_t chunk0, uint32_t chunk1, const std::function & fn) const; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 868abee4e..0ca07a326 100644 +index b3f0cce27e22cf9cf3db64db19f2fb69c3f36499..d79157d7f77ff6a82835efa8ad9627c0762ee343 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -195,6 +195,7 @@ if (NOT WIN32 OR NOT BUILD_SHARED_LIBS) @@ -85,7 +85,7 @@ index 868abee4e..0ca07a326 100644 llama_build_and_test(test-skippy-recurrent-state-roundtrip.cpp) diff --git a/tests/test-skippy-kv-release-compact.cpp b/tests/test-skippy-kv-release-compact.cpp new file mode 100644 -index 000000000..9ea25b89f +index 0000000000000000000000000000000000000000..9ea25b89fc5a28c566969bd33bdecb08c67bc67e --- /dev/null +++ b/tests/test-skippy-kv-release-compact.cpp @@ -0,0 +1,120 @@ @@ -209,6 +209,3 @@ index 000000000..9ea25b89f + std::printf("OK\n"); + return 0; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0040-ggml-metal-check-every-row-list-entry-before-reading.patch b/llama_cpp/patches/0040-ggml-metal-check-every-row-list-entry-before-reading.patch index aa42737b..a6f9d710 100644 --- a/llama_cpp/patches/0040-ggml-metal-check-every-row-list-entry-before-reading.patch +++ b/llama_cpp/patches/0040-ggml-metal-check-every-row-list-entry-before-reading.patch @@ -1,4 +1,4 @@ -From c2f1887d4a6372bf69f3c6286644ac33a11bd76d Mon Sep 17 00:00:00 2001 +From 57b4757ec79dd1abe6baf8b1a838388df4701dd6 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Wed, 18 Nov 2026 20:04:35 +1100 Subject: [PATCH] ggml-metal: check every row-list entry before reading a block @@ -29,7 +29,7 @@ well as on the gather-free variant. 3 files changed, 74 insertions(+), 33 deletions(-) diff --git a/ggml/src/ggml-metal/ggml-metal-ops.cpp b/ggml/src/ggml-metal/ggml-metal-ops.cpp -index 99538d0ca..67508b687 100644 +index 1ddc52ed6303a7c9ac46b9ced8d38762f1f7a704..e853e57d65fe396c155b3f8089521e223e59334c 100644 --- a/ggml/src/ggml-metal/ggml-metal-ops.cpp +++ b/ggml/src/ggml-metal/ggml-metal-ops.cpp @@ -16,6 +16,7 @@ @@ -99,7 +99,7 @@ index 99538d0ca..67508b687 100644 }; ggml_metal_op_t ggml_metal_op_init( -@@ -3629,9 +3668,8 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { +@@ -3688,9 +3727,8 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { GGML_ASSERT(!has_rows || ne11_attn % OP_FLASH_ATTN_EXT_VEC_NCPSG == 0); // the vec kernel compiles without gather code when every block of every list is one @@ -111,7 +111,7 @@ index 99538d0ca..67508b687 100644 // GGML_METAL_ROWS_DEBUG=1 reports, at exit, how often the gather-free variant was chosen and // prints the first blocks that disqualified a list static const bool rows_debug = getenv("GGML_METAL_ROWS_DEBUG") != nullptr; -@@ -3649,31 +3687,15 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { +@@ -3708,31 +3746,15 @@ int ggml_metal_op_flash_attn_ext(ggml_metal_op_t ctx, int idx) { const bool rows_dense = rows_shared && [&] { constexpr int64_t C = OP_FLASH_ATTN_EXT_VEC_NCPSG; @@ -151,7 +151,7 @@ index 99538d0ca..67508b687 100644 if (rows_shared) { (rows_dense ? rows_dense_hits : rows_dense_misses)++; diff --git a/ggml/src/ggml-metal/kernels/fa_vec_common.metal b/ggml/src/ggml-metal/kernels/fa_vec_common.metal -index f61b0b919..4535bc4d6 100644 +index f61b0b919a879b5f1a49d6e77fef3e742e65f131..4535bc4d6731ffaeb0cf233e0050c3e413c8b20c 100644 --- a/ggml/src/ggml-metal/kernels/fa_vec_common.metal +++ b/ggml/src/ggml-metal/kernels/fa_vec_common.metal @@ -240,9 +240,9 @@ kernel void kernel_flash_attn_ext_vec( @@ -186,10 +186,10 @@ index f61b0b919..4535bc4d6 100644 } diff --git a/tests/test-backend-ops.cpp b/tests/test-backend-ops.cpp -index f14ba7db5..88a180979 100644 +index 4830797213db7a017712d882ab9cf5487250c90f..3b73bb057d2914439459bc034f1b4ac2e29dcea5 100644 --- a/tests/test-backend-ops.cpp +++ b/tests/test-backend-ops.cpp -@@ -10295,6 +10295,10 @@ struct test_flash_attn_ext_kv_rows_runs : public test_flash_attn_ext_kv_rows { +@@ -10699,6 +10699,10 @@ struct test_flash_attn_ext_kv_rows_runs : public test_flash_attn_ext_kv_rows { LAYOUT_RUN_AT_CACHE_END, // consecutive blocks and scattered blocks in the same list LAYOUT_MIXED, @@ -200,7 +200,7 @@ index f14ba7db5..88a180979 100644 }; const layout_t layout; -@@ -10302,7 +10306,7 @@ struct test_flash_attn_ext_kv_rows_runs : public test_flash_attn_ext_kv_rows { +@@ -10706,7 +10710,7 @@ struct test_flash_attn_ext_kv_rows_runs : public test_flash_attn_ext_kv_rows { static const int64_t block = 32; std::string vars() override { @@ -209,7 +209,7 @@ index f14ba7db5..88a180979 100644 return test_flash_attn_ext_kv_rows::vars() + ",layout=" + names[layout]; } -@@ -10359,6 +10363,14 @@ struct test_flash_attn_ext_kv_rows_runs : public test_flash_attn_ext_kv_rows { +@@ -10763,6 +10767,14 @@ struct test_flash_attn_ext_kv_rows_runs : public test_flash_attn_ext_kv_rows { } } } break; @@ -224,7 +224,7 @@ index f14ba7db5..88a180979 100644 } } } -@@ -14614,7 +14626,8 @@ static std::vector> make_test_cases_eval() { +@@ -15117,7 +15129,8 @@ static std::vector> make_test_cases_eval() { for (auto layout : { test_flash_attn_ext_kv_rows_runs::LAYOUT_CONSECUTIVE, test_flash_attn_ext_kv_rows_runs::LAYOUT_RUNS_PADDED, test_flash_attn_ext_kv_rows_runs::LAYOUT_RUN_AT_CACHE_END, @@ -234,6 +234,3 @@ index f14ba7db5..88a180979 100644 for (int64_t nb : {1, 4, 64}) { for (int64_t n_slices : {1, 4}) { test_cases.emplace_back(new test_flash_attn_ext_kv_rows_runs(layout, 128, 8, 4, 4096, 512, nb, n_slices)); --- -2.56.1 - diff --git a/llama_cpp/patches/0041-skippy-a-helper-takes-a-run-s-tasks-only-while-that-.patch b/llama_cpp/patches/0041-skippy-a-helper-takes-a-run-s-tasks-only-while-that-.patch index 2b04e5d9..f68cdaeb 100644 --- a/llama_cpp/patches/0041-skippy-a-helper-takes-a-run-s-tasks-only-while-that-.patch +++ b/llama_cpp/patches/0041-skippy-a-helper-takes-a-run-s-tasks-only-while-that-.patch @@ -1,4 +1,4 @@ -From 3d5cf0139546378726bdb58c88569ea1ac8a5ffd Mon Sep 17 00:00:00 2001 +From 8d4d3df2392f37c7edaf5afee206ed824022bfbd Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Wed, 18 Nov 2026 20:05:26 +1100 Subject: [PATCH] skippy: a helper takes a run's tasks only while that run @@ -24,7 +24,7 @@ likely, not certain, to occur in one pass. 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/skippy/task_pool.cpp b/src/skippy/task_pool.cpp -index 88f8d3b59..c1e1bf517 100644 +index 88f8d3b5990bd0410e92acd9b6f53e3b35e69894..c1e1bf5174acd91dc88678ccc32753b6e974cf36 100644 --- a/src/skippy/task_pool.cpp +++ b/src/skippy/task_pool.cpp @@ -50,7 +50,7 @@ void skippy_task_pool::run(size_t n, const task_fn & fn, size_t max_helpers) { @@ -68,7 +68,7 @@ index 88f8d3b59..c1e1bf517 100644 } } diff --git a/src/skippy/task_pool.h b/src/skippy/task_pool.h -index e33523ea7..efc147f01 100644 +index e33523ea799a63f4278b88af650d5c9b2fe72cb1..efc147f01792e4a1cee67013a53358a3ea6dac2b 100644 --- a/src/skippy/task_pool.h +++ b/src/skippy/task_pool.h @@ -9,6 +9,7 @@ @@ -90,7 +90,7 @@ index e33523ea7..efc147f01 100644 const size_t limit; diff --git a/tests/test-skippy-task-pool.cpp b/tests/test-skippy-task-pool.cpp -index e9b9284e0..677658b96 100644 +index e9b9284e0ab5b403f5dee0e2fb19920b8aa75b53..677658b967b99082ebde44b35ca14345cf5272cb 100644 --- a/tests/test-skippy-task-pool.cpp +++ b/tests/test-skippy-task-pool.cpp @@ -136,6 +136,30 @@ static void the_pool_grows_to_demand_and_honours_each_runs_limit() { @@ -132,6 +132,3 @@ index e9b9284e0..677658b96 100644 sample_threads_select_the_executor(); CHECK(skippy_task_pool::shared().helpers() <= skippy_task_pool::shared().ceiling()); if (failures == 0) { --- -2.56.1 - diff --git a/llama_cpp/patches/0042-skippy-apply-the-KV-memory-options-to-every-attentio.patch b/llama_cpp/patches/0042-skippy-apply-the-KV-memory-options-to-every-attentio.patch index b5c52acd..8a9a84f1 100644 --- a/llama_cpp/patches/0042-skippy-apply-the-KV-memory-options-to-every-attentio.patch +++ b/llama_cpp/patches/0042-skippy-apply-the-KV-memory-options-to-every-attentio.patch @@ -1,4 +1,4 @@ -From 1cec01daf71acdc9aea5cc904614f538169d2036 Mon Sep 17 00:00:00 2001 +From 1cdcf1d2baeac5bc0f90ecc96663ed5ee655beb7 Mon Sep 17 00:00:00 2001 From: Jared Wyles Date: Wed, 18 Nov 2026 20:05:54 +1100 Subject: [PATCH] skippy: apply the KV memory options to every attention cache @@ -17,7 +17,7 @@ CSA, HCA and indexer caches. 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/skippy/state_memory.cpp b/src/skippy/state_memory.cpp -index c62b1e629..a8a3757ca 100644 +index c62b1e62991bbaf60386786c4538a49e8b1e28e6..a8a3757cadb42e1afdca0e996961b15b00dbec71 100644 --- a/src/skippy/state_memory.cpp +++ b/src/skippy/state_memory.cpp @@ -5,6 +5,9 @@ @@ -55,6 +55,3 @@ index c62b1e629..a8a3757ca 100644 if (auto * iswa = skippy_memory_iswa_adapter(memory)) { return { iswa->get_base(), iswa->get_swa() }; } --- -2.56.1 - diff --git a/llama_cpp/patches/0043-test-skippy-restore-hybrid-checkpoint-components.patch b/llama_cpp/patches/0043-test-skippy-restore-hybrid-checkpoint-components.patch index 806cfc10..514f1742 100644 --- a/llama_cpp/patches/0043-test-skippy-restore-hybrid-checkpoint-components.patch +++ b/llama_cpp/patches/0043-test-skippy-restore-hybrid-checkpoint-components.patch @@ -1,4 +1,4 @@ -From ca823a396c5ab3260b773e469d663a51e68e886f Mon Sep 17 00:00:00 2001 +From ea652a16b320fdf5f2f562986b2d1876ad9c30b6 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Fri, 20 Nov 2026 07:55:59 +1100 Subject: [PATCH] test-skippy: restore both hybrid checkpoint components @@ -8,7 +8,7 @@ Subject: [PATCH] test-skippy: restore both hybrid checkpoint components 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/skippy/tests/sampling_history.cpp b/src/skippy/tests/sampling_history.cpp -index 4c7c891e1..1e636d0f3 100644 +index 4c7c891e168e59765050bdb322b0bd425b30767f..1e636d0f3d17323962140fec935f3bfa6841d88d 100644 --- a/src/skippy/tests/sampling_history.cpp +++ b/src/skippy/tests/sampling_history.cpp @@ -568,6 +568,10 @@ std::vector export_page(skippy_session * session, size_t token_count) { @@ -88,6 +88,3 @@ index 4c7c891e1..1e636d0f3 100644 prefill(warm, suffix); const auto warm_logits = decode_logits(warm, suffix.back()); release(warm); --- -2.56.1 - diff --git a/llama_cpp/patches/0044-test-skippy-admit-separate-resident-capability-components.patch b/llama_cpp/patches/0044-test-skippy-admit-separate-resident-capability-components.patch index 290ea88f..b99d02cf 100644 --- a/llama_cpp/patches/0044-test-skippy-admit-separate-resident-capability-components.patch +++ b/llama_cpp/patches/0044-test-skippy-admit-separate-resident-capability-components.patch @@ -1,4 +1,4 @@ -From 86f2dd22077d77a670b378f66a7c7854199ec0bf Mon Sep 17 00:00:00 2001 +From f762cb766cba9251128094e26767c9ef75d18318 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Fri, 20 Nov 2026 08:08:55 +1100 Subject: [PATCH] test-skippy: admit separate resident capability components @@ -8,7 +8,7 @@ Subject: [PATCH] test-skippy: admit separate resident capability components 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/test-skippy-kv-page-export.cpp b/tests/test-skippy-kv-page-export.cpp -index 30c88b490..d5e26d984 100644 +index 30c88b49028395dea438ab6697a578463457d1b8..d5e26d9849a985ae6ae29a1c7011bf7ab61ec0a2 100644 --- a/tests/test-skippy-kv-page-export.cpp +++ b/tests/test-skippy-kv-page-export.cpp @@ -38,12 +38,15 @@ static bool graph_cache_capabilities_cover_complete_state() { @@ -51,6 +51,3 @@ index 30c88b490..d5e26d984 100644 skippy_model_memory_cache_capabilities(nullptr) != 0) { return 1; } --- -2.56.1 - diff --git a/llama_cpp/patches/0045-ggml-metal-classify-empty-command-buffers-as-other-work.patch b/llama_cpp/patches/0045-ggml-metal-classify-empty-command-buffers-as-other-work.patch index ee9cabc2..150ee435 100644 --- a/llama_cpp/patches/0045-ggml-metal-classify-empty-command-buffers-as-other-work.patch +++ b/llama_cpp/patches/0045-ggml-metal-classify-empty-command-buffers-as-other-work.patch @@ -1,4 +1,4 @@ -From f2d8f5b742fcb438262ca4c0c5b95301d2d089c2 Mon Sep 17 00:00:00 2001 +From 77a959357abc2486fac607529ba8a1ca115c075e Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Fri, 20 Nov 2026 08:08:56 +1100 Subject: [PATCH] ggml-metal: classify empty command buffers as other work @@ -9,7 +9,7 @@ Subject: [PATCH] ggml-metal: classify empty command buffers as other work 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ggml/src/ggml-metal/ggml-metal-timing.cpp b/ggml/src/ggml-metal/ggml-metal-timing.cpp -index 8bf274932..477058b20 100644 +index 8bf274932ded2425d57ff2ffc503a52f11d50d1f..477058b20450bb922f72d502181a5bfecfd2d373 100644 --- a/ggml/src/ggml-metal/ggml-metal-timing.cpp +++ b/ggml/src/ggml-metal/ggml-metal-timing.cpp @@ -314,11 +314,17 @@ void ggml_metal_timing_account( @@ -32,7 +32,7 @@ index 8bf274932..477058b20 100644 ggml_tensor ** first = gf->nodes + start; ggml_tensor ** last = gf->nodes + std::min(end, gf->n_nodes); diff --git a/tests/test-skippy-tracing-metal.cpp b/tests/test-skippy-tracing-metal.cpp -index 365052e0e..dc9cacbcc 100644 +index 365052e0ed4accc3789f38664163f2c90798d943..dc9cacbcc2a022c6005a6cb1dbb15c207da96d9c 100644 --- a/tests/test-skippy-tracing-metal.cpp +++ b/tests/test-skippy-tracing-metal.cpp @@ -122,9 +122,12 @@ int main() { @@ -49,6 +49,3 @@ index 365052e0e..dc9cacbcc 100644 other_nodes += t.other_nodes; CHECK(std::strcmp(t.op_class, "other") == 0); CHECK(t.attention_nodes == 0 && t.matmul_nodes == 0 && t.recurrent_nodes == 0 && t.kv_write_nodes == 0); --- -2.56.1 - diff --git a/llama_cpp/patches/0046-skip-clearing-fully-overwritten-kv-import-chunks.patch b/llama_cpp/patches/0046-skip-clearing-fully-overwritten-kv-import-chunks.patch index 5fb991d9..9aaece1e 100644 --- a/llama_cpp/patches/0046-skip-clearing-fully-overwritten-kv-import-chunks.patch +++ b/llama_cpp/patches/0046-skip-clearing-fully-overwritten-kv-import-chunks.patch @@ -1,4 +1,4 @@ -From ea2d499bfaea083c5ed3a38182a5f8c9bdd18e7c Mon Sep 17 00:00:00 2001 +From 0bd715e4b351b6a11c4e156281714f490323be3c Mon Sep 17 00:00:00 2001 From: Skippy contributors Date: Mon, 23 Nov 2026 13:51:35 +1100 Subject: [PATCH] Skip clearing reclaimed KV chunks fully overwritten by raw @@ -12,7 +12,7 @@ Subject: [PATCH] Skip clearing reclaimed KV chunks fully overwritten by raw 4 files changed, 88 insertions(+), 14 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index cd6340976..86e25d60f 100644 +index cd6340976c2ef21c2972b2e0c77b4756f480c028..86e25d60fa8197e71399745e012a6b13b61ab38d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -486,6 +486,12 @@ if (LLAMA_STAGE_BUILD_TESTS) @@ -29,7 +29,7 @@ index cd6340976..86e25d60f 100644 add_skippy_sampling_history_tests(granitehybrid skippy-noalloc-granite-hybrid-fixture recurrent) diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index a06758f9d..0099261f9 100644 +index 1962d3a7ab74342658ea406fd901189e03c6853e..e4ea262935b2f644aea7c79afd1646f205cb31d6 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -645,7 +645,7 @@ void llama_kv_cache::release_free_chunks(uint32_t stream) { @@ -123,7 +123,7 @@ index a06758f9d..0099261f9 100644 const auto cell_runs = llama_kv_cache_cell_runs(sinfo.idxs[0]); const char * src = static_cast(input); diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index 6d5eccaf7..1343a605f 100644 +index 6d5eccaf72a510e8b42f67bc7f20f646b2b8c8b3..1343a605fd045875eafcba8e032ecc06836252ed 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -304,7 +304,7 @@ public: @@ -153,7 +153,7 @@ index 6d5eccaf7..1343a605f 100644 // move used cells toward the beginning of each stream and copy the backing KV rows std::vector compact_cells(); diff --git a/src/skippy/tests/sampling_history.cpp b/src/skippy/tests/sampling_history.cpp -index 1e636d0f3..db4a27bd2 100644 +index 1e636d0f3d17323962140fec935f3bfa6841d88d..db4a27bd227e6b84c29ae9b5628ab3dcc356f391 100644 --- a/src/skippy/tests/sampling_history.cpp +++ b/src/skippy/tests/sampling_history.cpp @@ -623,6 +623,37 @@ std::vector decode_logits(skippy_session * session, llama_token token) { @@ -226,6 +226,3 @@ index 1e636d0f3..db4a27bd2 100644 } else { for (const bool full : {false, true}) { if (grammar) { --- -2.56.1 - diff --git a/llama_cpp/patches/0047-test-align-fused-operation-diagnostics-with-upstream.patch b/llama_cpp/patches/0047-test-align-fused-operation-diagnostics-with-upstream.patch index 46ebfe39..85bcc794 100644 --- a/llama_cpp/patches/0047-test-align-fused-operation-diagnostics-with-upstream.patch +++ b/llama_cpp/patches/0047-test-align-fused-operation-diagnostics-with-upstream.patch @@ -1,4 +1,4 @@ -From 1b3d6e6cca3bf7017c4e6ff89dd85b610f43af92 Mon Sep 17 00:00:00 2001 +From 993302ec6d0676abe353bf51835e13f1395b192b Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:18:03 +1100 Subject: [PATCH] test: align fused operation diagnostics with upstream @@ -8,7 +8,7 @@ Subject: [PATCH] test: align fused operation diagnostics with upstream 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/skippy/tests/graph_build_inputs.cpp b/src/skippy/tests/graph_build_inputs.cpp -index f1a028195..5aab920cd 100644 +index f1a028195e12723dc09efd6b2dcdddaebd4251a4..5aab920cd04436d65dbfa384c325f04ed8ea0806 100644 --- a/src/skippy/tests/graph_build_inputs.cpp +++ b/src/skippy/tests/graph_build_inputs.cpp @@ -569,7 +569,8 @@ static int check_sched_reserve_and_memory_update(const char * model_path) { @@ -21,6 +21,3 @@ index f1a028195..5aab920cd 100644 case LLM_FUSED_OP_DSV4_HC_PRE: return "DeepSeek V4 HC pre"; case LLM_FUSED_OP_DSV4_HC_COMB: return "DeepSeek V4 HC comb"; case LLM_FUSED_OP_DSV4_HC_POST: return "DeepSeek V4 HC post"; --- -2.56.1 - diff --git a/llama_cpp/patches/0048-cuda-initialize-devices-without-optional-nvml-headers.patch b/llama_cpp/patches/0048-cuda-initialize-devices-without-optional-nvml-headers.patch index 85ec4950..da3d8f73 100644 --- a/llama_cpp/patches/0048-cuda-initialize-devices-without-optional-nvml-headers.patch +++ b/llama_cpp/patches/0048-cuda-initialize-devices-without-optional-nvml-headers.patch @@ -1,4 +1,4 @@ -From 1fa5f31673367e91dbb49873ebbf42a8cefe02fe Mon Sep 17 00:00:00 2001 +From 082c5d62dad41bfe4baf7e9788ec91fc9c3c79c4 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:18:03 +1100 Subject: [PATCH] cuda: retain device initialization without optional NVML @@ -9,10 +9,10 @@ Subject: [PATCH] cuda: retain device initialization without optional NVML 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu -index 5086bcde6..655cfd31a 100644 +index c35b4a1db70556643cdc607d049ac6be78ecc5fc..c7f2e5dd79037ff9b809ed6e868ae20c839b619f 100644 --- a/ggml/src/ggml-cuda/ggml-cuda.cu +++ b/ggml/src/ggml-cuda/ggml-cuda.cu -@@ -100,8 +100,11 @@ +@@ -97,8 +97,11 @@ #include #if !defined(GGML_USE_HIP) && !defined(GGML_USE_MUSA) @@ -24,7 +24,7 @@ index 5086bcde6..655cfd31a 100644 #endif // !defined(GGML_USE_HIP) && !defined(GGML_USE_MUSA) static_assert(sizeof(half) == sizeof(ggml_fp16_t), "wrong fp16 size"); -@@ -321,6 +324,7 @@ static ggml_cuda_device_info ggml_cuda_init() { +@@ -318,6 +321,7 @@ static ggml_cuda_device_info ggml_cuda_init() { total_vram = 0; #if !defined(GGML_USE_HIP) && !defined(GGML_USE_MUSA) @@ -32,7 +32,7 @@ index 5086bcde6..655cfd31a 100644 #if defined(_WIN32) // NVML is installed by the driver; its NVSMI directory is not added to PATH on Windows. dl_handle_ptr library(LoadLibraryExW(L"nvml.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32)); -@@ -354,10 +358,13 @@ static ggml_cuda_device_info ggml_cuda_init() { +@@ -351,10 +355,13 @@ static ggml_cuda_device_info ggml_cuda_init() { const auto get_brand = reinterpret_cast(get_symbol("nvmlDeviceGetBrand")); const bool nvml_initialized = init && shutdown && get_device && get_brand && init() == NVML_SUCCESS; @@ -46,7 +46,7 @@ index 5086bcde6..655cfd31a 100644 if (!fast_bf16_hardware_available(cc) || !nvml_initialized) { return false; } -@@ -375,6 +382,13 @@ static ggml_cuda_device_info ggml_cuda_init() { +@@ -372,6 +379,13 @@ static ggml_cuda_device_info ggml_cuda_init() { brand == NVML_BRAND_NVIDIA_RTX; } return prefer_fp32_acc; @@ -60,7 +60,7 @@ index 5086bcde6..655cfd31a 100644 }; #endif // !defined(GGML_USE_HIP) && !defined(GGML_USE_MUSA) -@@ -477,7 +491,7 @@ static ggml_cuda_device_info ggml_cuda_init() { +@@ -475,7 +489,7 @@ static ggml_cuda_device_info ggml_cuda_init() { #endif // defined(GGML_USE_HIP) } @@ -69,6 +69,3 @@ index 5086bcde6..655cfd31a 100644 if (nvml_initialized) { (void) shutdown(); } --- -2.56.1 - diff --git a/llama_cpp/patches/0049-skippy-track-upstream-in-place-state-fill-effects.patch b/llama_cpp/patches/0049-skippy-track-upstream-in-place-state-fill-effects.patch index 5db02726..84f9c00a 100644 --- a/llama_cpp/patches/0049-skippy-track-upstream-in-place-state-fill-effects.patch +++ b/llama_cpp/patches/0049-skippy-track-upstream-in-place-state-fill-effects.patch @@ -1,4 +1,4 @@ -From a8df076a1f54f911bf1e8503d3c3f2766d7eeae3 Mon Sep 17 00:00:00 2001 +From fc16088634df1efe3f781968167faa462e657521 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:22:58 +1100 Subject: [PATCH] skippy: track upstream in-place state fill effects @@ -11,7 +11,7 @@ Subject: [PATCH] skippy: track upstream in-place state fill effects create mode 100644 src/skippy/tests/fill_state_regression.h diff --git a/src/skippy/state_effects.cpp b/src/skippy/state_effects.cpp -index b33ed2d5d..3b5690fc3 100644 +index b33ed2d5d881faa7aaff49767c907944c83069c8..3b5690fc348052f6282c5c90082bf04978a67180 100644 --- a/src/skippy/state_effects.cpp +++ b/src/skippy/state_effects.cpp @@ -150,6 +150,7 @@ static const ggml_tensor * write_destination(const ggml_tensor * node) { @@ -44,7 +44,7 @@ index b33ed2d5d..3b5690fc3 100644 const ggml_tensor * storage = skippy_state_canonical_storage(write_destination(node)); diff --git a/src/skippy/tests/fill_state_regression.h b/src/skippy/tests/fill_state_regression.h new file mode 100644 -index 000000000..460e175a5 +index 0000000000000000000000000000000000000000..460e175a5a3c7f4b87b72983b48fe8a9cf961c26 --- /dev/null +++ b/src/skippy/tests/fill_state_regression.h @@ -0,0 +1,56 @@ @@ -105,7 +105,7 @@ index 000000000..460e175a5 + return 0; +} diff --git a/src/skippy/tests/stage_slice_plan.cpp b/src/skippy/tests/stage_slice_plan.cpp -index 21f659cbd..ec3878c1a 100644 +index 21f659cbd3ba2c14ae0cbf24417334da3d32a791..ec3878c1a18ba3978656eda3b0a5da489c032412 100644 --- a/src/skippy/tests/stage_slice_plan.cpp +++ b/src/skippy/tests/stage_slice_plan.cpp @@ -1177,9 +1177,11 @@ static int check_auxiliary_graph_parameter_closure() { @@ -120,6 +120,3 @@ index 21f659cbd..ec3878c1a 100644 if (!result) { result = check_input_leaf_state_inference(); } if (!result) { result = check_raw_embedding_checkpoint(); } if (!result) { result = check_semantic_identities(); } --- -2.56.1 - diff --git a/llama_cpp/patches/0050-sampling-begin-each-logical-batch-transaction.patch b/llama_cpp/patches/0050-sampling-begin-each-logical-batch-transaction.patch index 691fd084..33c6339a 100644 --- a/llama_cpp/patches/0050-sampling-begin-each-logical-batch-transaction.patch +++ b/llama_cpp/patches/0050-sampling-begin-each-logical-batch-transaction.patch @@ -1,4 +1,4 @@ -From ff2b4695f7fca5869989ccb8df28cf9f0c0acc28 Mon Sep 17 00:00:00 2001 +From d1d1be7b94cf8d62c7b73bb79f6c1badc36212a2 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] sampling: begin each logical batch transaction @@ -11,10 +11,10 @@ Subject: [PATCH] sampling: begin each logical batch transaction create mode 100644 src/skippy/tests/backend_transaction_regression.h diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index 144a3e603..0edcdb5e9 100644 +index 87cf979cf606f6e0fe2eb85efa7bdf52ddf41c14..706b35ce07d944745076181e4ceee66ddb186b63 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp -@@ -2518,6 +2518,12 @@ int llama_context::decode( +@@ -2505,6 +2505,12 @@ int llama_context::decode( }; output_trace.end(); @@ -28,7 +28,7 @@ index 144a3e603..0edcdb5e9 100644 int64_t n_tokens_prev = 0; diff --git a/src/skippy/tests/backend_sample_capacity.cpp b/src/skippy/tests/backend_sample_capacity.cpp -index b234872a7..f0341b7b0 100644 +index b234872a70e8e97d211ecd317fbb3c317d77a1f9..f0341b7b02fd8db2ed61102dbb66f67b89002bc5 100644 --- a/src/skippy/tests/backend_sample_capacity.cpp +++ b/src/skippy/tests/backend_sample_capacity.cpp @@ -211,6 +211,8 @@ void readout_detaches_only_its_lane(skippy_session * a, skippy_session * b) { @@ -50,7 +50,7 @@ index b234872a7..f0341b7b0 100644 auto * a = create(model); diff --git a/src/skippy/tests/backend_transaction_regression.h b/src/skippy/tests/backend_transaction_regression.h new file mode 100644 -index 000000000..7f4e8fce7 +index 0000000000000000000000000000000000000000..7f4e8fce706e026d78d8965726a487055c7d8180 --- /dev/null +++ b/src/skippy/tests/backend_transaction_regression.h @@ -0,0 +1,61 @@ @@ -115,6 +115,3 @@ index 000000000..7f4e8fce7 + llama_sampler_sample(b_sampler.get(), b.get(), 0)); + } +} --- -2.56.1 - diff --git a/llama_cpp/patches/0051-lora-retain-the-primal-activation-for-adapter-deltas.patch b/llama_cpp/patches/0051-lora-retain-the-primal-activation-for-adapter-deltas.patch index fd62817f..c1bd0111 100644 --- a/llama_cpp/patches/0051-lora-retain-the-primal-activation-for-adapter-deltas.patch +++ b/llama_cpp/patches/0051-lora-retain-the-primal-activation-for-adapter-deltas.patch @@ -1,4 +1,4 @@ -From 2c511c6b2796ebb6653b1f92a5065a0981071b70 Mon Sep 17 00:00:00 2001 +From c0930d2cd7dda529a6637551ee13f4f67b44e0e6 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] lora: retain the primal activation for adapter deltas @@ -8,20 +8,17 @@ Subject: [PATCH] lora: retain the primal activation for adapter deltas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp -index 344deff6c..2eab7af70 100644 +index 4b4f73e2f9c6962a98f3e52aa6a5556a468efb03..4d55697185aae35ea4cb0183deb23b913b94f43f 100644 --- a/src/llama-graph.cpp +++ b/src/llama-graph.cpp -@@ -2331,8 +2331,8 @@ ggml_tensor * llm_graph_context::build_lora_mm( +@@ -2357,8 +2357,8 @@ ggml_tensor * llm_graph_context::build_lora_mm( } // a Hadamard-folded weight reads the transformed input; a LoRA delta lives in the primal basis and reads `cur` - cur = build_hadamard_input(w, cur); -- ggml_tensor * res = ggml_mul_mat(ctx0, w, cur); +- ggml_tensor * res = ggml_mul_mat_ext(ctx0, w, cur, w_s, get_input_scale(w)); + ggml_tensor * cur_mm = build_hadamard_input(w, cur); -+ ggml_tensor * res = ggml_mul_mat(ctx0, w, cur_mm); ++ ggml_tensor * res = ggml_mul_mat_ext(ctx0, w, cur_mm, w_s, get_input_scale(w)); if (w->type == GGML_TYPE_NVFP4) { ggml_prec_set_acc(res, GGML_PREC_BF16); --- -2.56.1 - diff --git a/llama_cpp/patches/0052-cachegen-import-only-into-empty-kv-cells.patch b/llama_cpp/patches/0052-cachegen-import-only-into-empty-kv-cells.patch index 14b6c713..c9b2d1bb 100644 --- a/llama_cpp/patches/0052-cachegen-import-only-into-empty-kv-cells.patch +++ b/llama_cpp/patches/0052-cachegen-import-only-into-empty-kv-cells.patch @@ -1,4 +1,4 @@ -From 962143862b7b63f53ec1b78827ff9c06169aea69 Mon Sep 17 00:00:00 2001 +From 7be24198f8fd0bcc7be6e64c086a86ac55aac644 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] cachegen: import only into empty KV cells @@ -10,7 +10,7 @@ Subject: [PATCH] cachegen: import only into empty KV cells 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index 0099261f9..deed32cbb 100644 +index e4ea262935b2f644aea7c79afd1646f205cb31d6..e86784f5ac618bfc895c919118bf01ad412d2dd2 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -1298,7 +1298,7 @@ std::vector llama_kv_cache::find_chunked_cells( @@ -43,7 +43,7 @@ index 0099261f9..deed32cbb 100644 error = "failed to allocate KV cache cells for CacheGen page"; return false; diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index 1343a605f..52c06ffa4 100644 +index 1343a605fd045875eafcba8e032ecc06836252ed..52c06ffa44be8c62c2eab7b3671006d33a0702b6 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -274,7 +274,7 @@ public: @@ -56,7 +56,7 @@ index 1343a605f..52c06ffa4 100644 // cells a sequence claims at a time in the unified pool; a multiple of the // row-attention kernels' 32-row block diff --git a/tests/test-skippy-cachegen-import.cpp b/tests/test-skippy-cachegen-import.cpp -index 43cc3f7d6..f0d28e15c 100644 +index 43cc3f7d6b6c06ffda668a68544d7585db66b32c..f0d28e15c1f714cc9e772a8a53de24071ce49be6 100644 --- a/tests/test-skippy-cachegen-import.cpp +++ b/tests/test-skippy-cachegen-import.cpp @@ -121,7 +121,7 @@ llama_hparams make_hparams(bool mla) { @@ -124,6 +124,3 @@ index 43cc3f7d6..f0d28e15c 100644 const llama_hparams mla_hparams = make_hparams(true); std::unique_ptr mla_kv = make_cache(*model, mla_hparams); if (!populate(*mla_kv, page_token_count)) { --- -2.56.1 - diff --git a/llama_cpp/patches/0053-cache-restore-composite-attention-occupancy-reporting.patch b/llama_cpp/patches/0053-cache-restore-composite-attention-occupancy-reporting.patch index e545a569..dc0741b7 100644 --- a/llama_cpp/patches/0053-cache-restore-composite-attention-occupancy-reporting.patch +++ b/llama_cpp/patches/0053-cache-restore-composite-attention-occupancy-reporting.patch @@ -1,4 +1,4 @@ -From bdecd9d73a4f04ba0b5ca0f8f9942f09aab7632c Mon Sep 17 00:00:00 2001 +From d0ddc98f2aa5523ffa03f396dae8ad48cf0c11cd Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] cache: restore composite attention occupancy reporting @@ -8,7 +8,7 @@ Subject: [PATCH] cache: restore composite attention occupancy reporting 1 file changed, 26 insertions(+) diff --git a/src/skippy/resident_prefix.cpp b/src/skippy/resident_prefix.cpp -index 317c96b46..57b1d78ac 100644 +index 317c96b46e2670cfaab9b5460d258b28f7b1abb9..57b1d78acff050502af87b8a49bb9c15482f15ab 100644 --- a/src/skippy/resident_prefix.cpp +++ b/src/skippy/resident_prefix.cpp @@ -7,6 +7,10 @@ @@ -51,6 +51,3 @@ index 317c96b46..57b1d78ac 100644 if (auto * kv = dynamic_cast(memory)) { *cells = kv->get_used_cells(); return true; --- -2.56.1 - diff --git a/llama_cpp/patches/0054-test-expect-fill-in-recurrent-planning-proofs.patch b/llama_cpp/patches/0054-test-expect-fill-in-recurrent-planning-proofs.patch index f664cbf4..359392f6 100644 --- a/llama_cpp/patches/0054-test-expect-fill-in-recurrent-planning-proofs.patch +++ b/llama_cpp/patches/0054-test-expect-fill-in-recurrent-planning-proofs.patch @@ -1,4 +1,4 @@ -From 26bb46bc23807710f57c27b51c4640a84dd8a5e4 Mon Sep 17 00:00:00 2001 +From 502b82e9197f810cbb86e16fd8a76dc929b2a014 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 08:16:42 +1100 Subject: [PATCH] test: expect native fill operations in recurrent planning @@ -10,7 +10,7 @@ Subject: [PATCH] test: expect native fill operations in recurrent planning 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/skippy/tests/noalloc_graph_planning.cpp b/src/skippy/tests/noalloc_graph_planning.cpp -index 7470f3309..19c998e6a 100644 +index 7470f33093c372d6ba12826d1f45500d0a527ea0..19c998e6a9aa71d8d3146620e7943e08fdee98de 100644 --- a/src/skippy/tests/noalloc_graph_planning.cpp +++ b/src/skippy/tests/noalloc_graph_planning.cpp @@ -731,7 +731,7 @@ static bool check_state_effects( @@ -23,7 +23,7 @@ index 7470f3309..19c998e6a 100644 if (node->op != expected) { std::fprintf(stderr, "metadata-only %s state write uses op %d, expected %d\n", diff --git a/src/skippy/tests/renamed_multishard_planning.cpp b/src/skippy/tests/renamed_multishard_planning.cpp -index 720ba457a..9dbebc7b3 100644 +index 720ba457a714f33af14b6a234f6b563da5e5846d..9dbebc7b3c148cdb328ddd0a0782c1f9817bb8cc 100644 --- a/src/skippy/tests/renamed_multishard_planning.cpp +++ b/src/skippy/tests/renamed_multishard_planning.cpp @@ -726,7 +726,7 @@ bool build_profile( @@ -44,6 +44,3 @@ index 720ba457a..9dbebc7b3 100644 rollback_conv ? GGML_OP_SET_ROWS : GGML_OP_CPY; if (node->op != expect) { error = "delta-net state write at layer " + std::to_string(il) + --- -2.56.1 - diff --git a/llama_cpp/patches/0055-skippy-preserve-loader-progress-and-position-contracts.patch b/llama_cpp/patches/0055-skippy-preserve-loader-progress-and-position-contracts.patch index ad1eed3f..c1c5e0b2 100644 --- a/llama_cpp/patches/0055-skippy-preserve-loader-progress-and-position-contracts.patch +++ b/llama_cpp/patches/0055-skippy-preserve-loader-progress-and-position-contracts.patch @@ -1,4 +1,4 @@ -From 2131355cb1b6f70223bf87f743f610f50c761dbc Mon Sep 17 00:00:00 2001 +From 312d12aebbb0d73645ca3c87234e204237b5bdb6 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 11:11:17 +1100 Subject: [PATCH] skippy: preserve loader, sampling and position contracts @@ -18,7 +18,7 @@ Subject: [PATCH] skippy: preserve loader, sampling and position contracts 11 files changed, 182 insertions(+), 13 deletions(-) diff --git a/include/skippy/state.h b/include/skippy/state.h -index fc5dcd389..6f8a93484 100644 +index fc5dcd3894938bfe35a9957d8295b95ba93a4910..6f8a934844112295a656a7bd33f7326d2ae1cc2e 100644 --- a/include/skippy/state.h +++ b/include/skippy/state.h @@ -36,6 +36,8 @@ LLAMA_API uint32_t skippy_model_kv_pool_cells(const struct skippy_model * model) @@ -31,10 +31,10 @@ index fc5dcd389..6f8a93484 100644 enum skippy_kv_page_codec { diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index 0edcdb5e9..f042c2109 100644 +index 706b35ce07d944745076181e4ceee66ddb186b63..5d106837bf2cd451fa5f2339ebb7dcf128577a8d 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp -@@ -2440,11 +2440,6 @@ int llama_context::decode( +@@ -2427,11 +2427,6 @@ int llama_context::decode( GGML_ASSERT((cparams.causal_attn || cparams.n_ubatch >= n_tokens_all) && "non-causal attention requires n_ubatch >= n_tokens"); @@ -46,7 +46,7 @@ index 0edcdb5e9..f042c2109 100644 // TODO: this clear of the buffer can easily be forgotten - need something better // sync first so any in-flight async copies into embd_seq complete before it is freed if (!embd_seq.empty()) { -@@ -2454,6 +2449,12 @@ int llama_context::decode( +@@ -2441,6 +2436,12 @@ int llama_context::decode( output_swaps.clear(); embd_batch_idxs.clear(); @@ -59,7 +59,7 @@ index 0edcdb5e9..f042c2109 100644 sched_reserve(graph_build_inputs); bool did_optimize = false; -@@ -5088,7 +5089,7 @@ llama_context * llama_init_from_model_with_graph_inputs( +@@ -5076,7 +5077,7 @@ llama_context * llama_init_from_model_with_graph_inputs( } if (params.ctx_type == LLAMA_CONTEXT_TYPE_MTP && @@ -69,7 +69,7 @@ index 0edcdb5e9..f042c2109 100644 return nullptr; } diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index deed32cbb..4b47eaf96 100644 +index e86784f5ac618bfc895c919118bf01ad412d2dd2..c030afcfe3822f9baf928f957f71cb88f20e7df2 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -2000,6 +2000,18 @@ bool llama_kv_cache::stage_export_kv_page( @@ -113,10 +113,10 @@ index deed32cbb..4b47eaf96 100644 desc.layer_end <= desc.layer_start || static_cast(desc.layer_end) > hparams.n_layer_all || diff --git a/src/llama-model-loader.cpp b/src/llama-model-loader.cpp -index 0e1fe9f27..9db5329d9 100644 +index 783705c0e3533c7284d60c806ddd0f942be37e2d..4da8cde42878f662f3472a84d9cfac374396a7f4 100644 --- a/src/llama-model-loader.cpp +++ b/src/llama-model-loader.cpp -@@ -1701,7 +1701,10 @@ void llama_model_loader::init_mappings(bool prefetch, llama_mlocks * mlock_mmaps +@@ -1788,7 +1788,10 @@ void llama_model_loader::init_mappings(bool prefetch, llama_mlocks * mlock_mmaps // unmap weights that a later context still has to upload. size_data = 0; if (!ctx_map.empty()) { @@ -129,7 +129,7 @@ index 0e1fe9f27..9db5329d9 100644 tensor != nullptr; tensor = ggml_get_next_tensor(ctx.get(), tensor)) { diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp -index 5f100aa46..364ae850e 100644 +index 5f100aa461bc9b0f2dfd47e84d681b016c052551..364ae850e8455830c3d9b12b5be119239d86b5ea 100644 --- a/src/skippy/model_loading.cpp +++ b/src/skippy/model_loading.cpp @@ -534,7 +534,7 @@ static bool skippy_should_create_native_mtp_sidecar( @@ -142,7 +142,7 @@ index 5f100aa46..364ae850e 100644 } diff --git a/src/skippy/sampling_config.cpp b/src/skippy/sampling_config.cpp -index 6be5559e2..32b36bdcd 100644 +index 6be5559e23d9db28d07485eeefefd8d2af5891e4..32b36bdcd413a58b384e5e5dd483569b815452cc 100644 --- a/src/skippy/sampling_config.cpp +++ b/src/skippy/sampling_config.cpp @@ -102,6 +102,11 @@ static common_params_sampling sampling_params(const skippy_sampling_config * con @@ -158,7 +158,7 @@ index 6be5559e2..32b36bdcd 100644 params.grammar = {COMMON_GRAMMAR_TYPE_TOOL_CALLS, grammar}; } diff --git a/src/skippy/tests/sampling_history.cpp b/src/skippy/tests/sampling_history.cpp -index db4a27bd2..9d465e25f 100644 +index db4a27bd227e6b84c29ae9b5628ab3dcc356f391..9d465e25f0336754cd56a19bd3cc21a6eb116072 100644 --- a/src/skippy/tests/sampling_history.cpp +++ b/src/skippy/tests/sampling_history.cpp @@ -8,6 +8,7 @@ @@ -205,7 +205,7 @@ index db4a27bd2..9d465e25f 100644 if (grammar) { for (const bool lazy : {false, true}) { diff --git a/tests/test-batch-alloc.cpp b/tests/test-batch-alloc.cpp -index 93f8e4ef5..2636db5ae 100644 +index 93f8e4ef5ee64bec5fe9aff304cff8a9a56896bc..2636db5aed57d43b7d856b13a1809ce206d11810 100644 --- a/tests/test-batch-alloc.cpp +++ b/tests/test-batch-alloc.cpp @@ -926,6 +926,36 @@ static void test_mrope(testing & t) { @@ -246,7 +246,7 @@ index 93f8e4ef5..2636db5ae 100644 mock_memory mem; mem.ranges[0] = {0, 24}; diff --git a/tests/test-graph-contract-fixture.h b/tests/test-graph-contract-fixture.h -index 3a520bdda..252811ec1 100644 +index 3a520bddaab136148b7734df7cf12f9826322b39..252811ec1bea4a60d618eb7c32fa2a03138ae225 100644 --- a/tests/test-graph-contract-fixture.h +++ b/tests/test-graph-contract-fixture.h @@ -41,6 +41,10 @@ static int save_graph_contract_fixture(llm_arch arch, const std::string & out, u @@ -297,7 +297,7 @@ index 3a520bdda..252811ec1 100644 } if (arch == LLM_ARCH_MIMO2 && mtp_layers) { diff --git a/tests/test-skippy-cachegen-import.cpp b/tests/test-skippy-cachegen-import.cpp -index f0d28e15c..3dcc05c64 100644 +index f0d28e15c1f714cc9e772a8a53de24071ce49be6..3dcc05c647edd80e43483290ce45f8ab41798bc8 100644 --- a/tests/test-skippy-cachegen-import.cpp +++ b/tests/test-skippy-cachegen-import.cpp @@ -143,8 +143,9 @@ std::unique_ptr make_cache(const llama_model & model, const llam @@ -383,7 +383,7 @@ index f0d28e15c..3dcc05c64 100644 std::unique_ptr mla_kv = make_cache(*model, mla_hparams); if (!populate(*mla_kv, page_token_count)) { diff --git a/tests/test-skippy-model-loader-accounting.cpp b/tests/test-skippy-model-loader-accounting.cpp -index 22b92c0a8..4145b5b0b 100644 +index 22b92c0a8513c9ea5c1983d942aba98dcd0acee0..4145b5b0bb8bbd9efed37b876f5d110bf9ba9687 100644 --- a/tests/test-skippy-model-loader-accounting.cpp +++ b/tests/test-skippy-model-loader-accounting.cpp @@ -1,5 +1,7 @@ @@ -437,6 +437,3 @@ index 22b92c0a8..4145b5b0b 100644 !check_contextless_fallback(argv[1]) || !check_exact_resident_selection(argv[1]) || !check_multilane_context_capacity(argv[1])) { --- -2.56.1 - diff --git a/llama_cpp/patches/0056-skippy-preserve-text-chat-parser-contract.patch b/llama_cpp/patches/0056-skippy-preserve-text-chat-parser-contract.patch index 04c8f949..ce84ec29 100644 --- a/llama_cpp/patches/0056-skippy-preserve-text-chat-parser-contract.patch +++ b/llama_cpp/patches/0056-skippy-preserve-text-chat-parser-contract.patch @@ -1,4 +1,4 @@ -From dbab80d3a0c3da7e43c7f878b57b77fd282f5d88 Mon Sep 17 00:00:00 2001 +From ad5949bb6ae8a5e12078587bffb52d1d0021e549 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 13:04:07 +1100 Subject: [PATCH] skippy: keep the text chat bridge compatible with token-aware @@ -14,7 +14,7 @@ Subject: [PATCH] skippy: keep the text chat bridge compatible with token-aware create mode 100644 tests/test-skippy-chat.cpp diff --git a/common/chat.cpp b/common/chat.cpp -index c144697de..5a44cec44 100644 +index c144697de6ee5b3485c7a60066bbbbec8bbd9e39..5a44cec445069f962c31b371ff6b7664512b32b9 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -391,6 +391,19 @@ common_chat_tool_choice common_chat_tool_choice_parse_oaicompat(const common_jso @@ -38,7 +38,7 @@ index c144697de..5a44cec44 100644 common_chat_templates_inputs inputs; inputs.reasoning_format = COMMON_REASONING_FORMAT_DEEPSEEK; diff --git a/common/chat.h b/common/chat.h -index c799a04ee..41875db07 100644 +index c799a04ee0990f452c46923413b5933d89d69011..41875db07e4a7a0b610005d64fce4c4d414fef80 100644 --- a/common/chat.h +++ b/common/chat.h @@ -486,6 +486,7 @@ const char * common_reasoning_format_name(common_reasoning_format for @@ -50,7 +50,7 @@ index c799a04ee..41875db07 100644 bool common_chat_templates_support_enable_thinking(const common_chat_templates * chat_templates); diff --git a/common/stage-chat.cpp b/common/stage-chat.cpp -index c3362e2a7..d357342da 100644 +index c3362e2a7f9a1d233ae734dc0329bd79c560da6b..d357342da14572a16fa4f27e49aca5def7f5d40a 100644 --- a/common/stage-chat.cpp +++ b/common/stage-chat.cpp @@ -276,6 +276,8 @@ extern "C" SKIPPY_COMMON_API enum skippy_status skippy_apply_chat_template_json( @@ -63,10 +63,10 @@ index c3362e2a7..d357342da 100644 if (grammar != nullptr && grammar[0] != '\0') { params.grammar = grammar; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 0ca07a326..436407741 100644 +index d79157d7f77ff6a82835efa8ad9627c0762ee343..64e6f1cca01e06c50eafdff2bea7fe950f123079 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt -@@ -349,6 +349,11 @@ llama_test_cmd(python3 +@@ -355,6 +355,11 @@ llama_test_cmd(python3 llama_build_and_test(test-json-schema.cpp LABEL behavior) llama_build_and_test(test-chat-auto-parser.cpp LABEL behavior WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) llama_build_and_test(test-chat-template.cpp LABEL behavior) @@ -80,7 +80,7 @@ index 0ca07a326..436407741 100644 llama_build_and_test(test-skippy-cachegen-metal.cpp) diff --git a/tests/test-skippy-chat.cpp b/tests/test-skippy-chat.cpp new file mode 100644 -index 000000000..62f23eb09 +index 0000000000000000000000000000000000000000..62f23eb0982769bb74b59acbb7aead4604fe7522 --- /dev/null +++ b/tests/test-skippy-chat.cpp @@ -0,0 +1,101 @@ @@ -185,6 +185,3 @@ index 000000000..62f23eb09 + return 1; + } +} --- -2.56.1 - diff --git a/llama_cpp/patches/0057-test-retain-cachegen-fixture-parameters.patch b/llama_cpp/patches/0057-test-retain-cachegen-fixture-parameters.patch index d4df535d..ce391293 100644 --- a/llama_cpp/patches/0057-test-retain-cachegen-fixture-parameters.patch +++ b/llama_cpp/patches/0057-test-retain-cachegen-fixture-parameters.patch @@ -1,4 +1,4 @@ -From d9f08c76b06083ef157e96a5bac6455f25cb821b Mon Sep 17 00:00:00 2001 +From 49205b58f0f10cb9d1da3223ebeda8ad16a8c868 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 13:13:03 +1100 Subject: [PATCH] test: retain CacheGen fixture parameters through cache @@ -9,7 +9,7 @@ Subject: [PATCH] test: retain CacheGen fixture parameters through cache 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test-skippy-cachegen-import.cpp b/tests/test-skippy-cachegen-import.cpp -index 3dcc05c64..094ec9769 100644 +index 3dcc05c647edd80e43483290ce45f8ab41798bc8..094ec976915501394d10d665e3f034b4d61c1a8c 100644 --- a/tests/test-skippy-cachegen-import.cpp +++ b/tests/test-skippy-cachegen-import.cpp @@ -189,7 +189,8 @@ bool populate(llama_kv_cache & kv, uint32_t n_tokens, bool spatial = false, bool @@ -22,6 +22,3 @@ index 3dcc05c64..094ec9769 100644 if (!populate(*kv, kv_capacity)) { return false; } llama_pos pos = kv_capacity; llama_seq_id seq = 1; --- -2.56.1 - diff --git a/llama_cpp/patches/0058-graph-preserve-registered-expert-scales.patch b/llama_cpp/patches/0058-graph-preserve-registered-expert-scales.patch index d785b186..70a94bfd 100644 --- a/llama_cpp/patches/0058-graph-preserve-registered-expert-scales.patch +++ b/llama_cpp/patches/0058-graph-preserve-registered-expert-scales.patch @@ -1,4 +1,4 @@ -From 316ad71e65fe1da2aec16dd7dda28dfa4b348610 Mon Sep 17 00:00:00 2001 +From 770a542ca72c2bb8a3277a75ad6d5e6859a195da Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Thu, 26 Nov 2026 14:39:36 +1100 Subject: [PATCH] graph: preserve registered expert scales in explicit overload @@ -7,12 +7,12 @@ Subject: [PATCH] graph: preserve registered expert scales in explicit overload src/CMakeLists.txt | 7 +++ src/llama-graph.cpp | 4 ++ src/llama-graph.h | 1 + - src/skippy/tests/expert_scales.cpp | 94 ++++++++++++++++++++++++++++++ - 4 files changed, 106 insertions(+) + src/skippy/tests/expert_scales.cpp | 95 ++++++++++++++++++++++++++++++ + 4 files changed, 107 insertions(+) create mode 100644 src/skippy/tests/expert_scales.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 86e25d60f..37542b3ce 100644 +index 86e25d60fa8197e71399745e012a6b13b61ab38d..37542b3ce4202c5af3d0df2eef01f8f98cde1c13 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -384,12 +384,19 @@ if (LLAMA_STAGE_BUILD_TESTS) @@ -36,25 +36,25 @@ index 86e25d60f..37542b3ce 100644 add_test(NAME skippy_decode_input_width COMMAND skippy-graph-build-inputs --input-width) diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp -index 2eab7af70..7deb06595 100644 +index 4d55697185aae35ea4cb0183deb23b913b94f43f..2ff79debfbf52afb9404a8d4884bcfb90fff5bc6 100644 --- a/src/llama-graph.cpp +++ b/src/llama-graph.cpp -@@ -2467,6 +2467,10 @@ ggml_tensor * llm_graph_context::build_lora_mm_id( +@@ -2483,6 +2483,10 @@ ggml_tensor * llm_graph_context::build_lora_mm_id( ggml_tensor * w_s, ggml_tensor * slots, bool cached) const { + if (!w_s) { -+ w_s = model.get_w_scale(w); ++ w_s = model.w_scales.get(w); + } + // as in build_lora_mm: the folded weight reads the transformed input, the LoRA delta reads `cur` ggml_tensor * cur_mm = build_hadamard_input(w, cur); // the experts in the MoE cache are selected by their slots diff --git a/src/llama-graph.h b/src/llama-graph.h -index b6833e580..2071b8bd0 100644 +index 7422c0e5bf3461c83cb96e7a0e68ef9010be5368..8f2faf06cb6a6fb4690379156e40af0430bbdec3 100644 --- a/src/llama-graph.h +++ b/src/llama-graph.h -@@ -1400,6 +1400,7 @@ struct llm_graph_context { +@@ -1412,6 +1412,7 @@ struct llm_graph_context { ggml_tensor * ids, ggml_tensor * slots = nullptr, bool cached = true) const; @@ -64,10 +64,10 @@ index b6833e580..2071b8bd0 100644 ggml_tensor * cur, // ggml_tensor * b diff --git a/src/skippy/tests/expert_scales.cpp b/src/skippy/tests/expert_scales.cpp new file mode 100644 -index 000000000..ac9a7824e +index 0000000000000000000000000000000000000000..0d9a7ee8e4dcc1df6f8184dfd7d39302e2c18fdb --- /dev/null +++ b/src/skippy/tests/expert_scales.cpp -@@ -0,0 +1,94 @@ +@@ -0,0 +1,95 @@ +#include "llama-adapter.h" +#include "llama-graph.h" +#include "llama-model.h" @@ -96,6 +96,7 @@ index 000000000..ac9a7824e + params.res = &result; + params.loras = &loras; + params.ubatch.n_tokens = 2; ++ params.w_scales = &model->w_scales; + llm_graph_context graph(params); + ggml_context * ctx = result.get_ctx(); + @@ -105,13 +106,13 @@ index 000000000..ac9a7824e + auto * slots = use_slots ? ggml_new_tensor_2d(ctx, GGML_TYPE_I32, 1, 2) : nullptr; + auto * registered = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 3); + auto * explicit_scale = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 3); -+ model->w_scales.emplace(weight, registered); ++ model->w_scales.scale.emplace(weight, registered); + -+ // The null explicit scale must agree with the ordinary helper's registered scale. -+ auto * ordinary = graph.build_lora_mm_id(weight, input, ids, slots, false); ++ // The null explicit scale falls back to the model's registered per-expert scale. ++ auto * ordinary = graph.build_lora_mm_id(weight, input, ids, nullptr, slots, false); + auto * fallback = graph.build_lora_mm_id(weight, input, ids, nullptr, slots, false); + auto * override = graph.build_lora_mm_id(weight, input, ids, explicit_scale, slots, false); -+ model->w_scales.clear(); ++ model->w_scales.scale.clear(); + auto * unscaled = graph.build_lora_mm_id(weight, input, ids, nullptr, slots, false); + for (auto * output : {ordinary, fallback, override, unscaled}) { + ggml_build_forward_expand(result.get_gf(), output); @@ -162,6 +163,3 @@ index 000000000..ac9a7824e +int main() { + return check_expert_scales(false) && check_expert_scales(true) ? 0 : 1; +} --- -2.56.1 - diff --git a/llama_cpp/patches/0059-graph-share-moe-routing-with-scaled-projections.patch b/llama_cpp/patches/0059-graph-share-moe-routing-with-scaled-projections.patch index ce6cde34..0cb64d0f 100644 --- a/llama_cpp/patches/0059-graph-share-moe-routing-with-scaled-projections.patch +++ b/llama_cpp/patches/0059-graph-share-moe-routing-with-scaled-projections.patch @@ -1,4 +1,4 @@ -From d74c6d38ac18339128e9ab8534095118cb457954 Mon Sep 17 00:00:00 2001 +From e8a2be8936858b0421e1c7121b477e7ca83ecdb3 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Thu, 26 Nov 2026 14:49:56 +1100 Subject: [PATCH] graph: share MoE routing across optional projection scales @@ -6,11 +6,11 @@ Subject: [PATCH] graph: share MoE routing across optional projection scales --- src/CMakeLists.txt | 1 + src/llama-graph.cpp | 432 +++-------------------------- - src/skippy/tests/expert_scales.cpp | 96 ++++++- - 3 files changed, 133 insertions(+), 396 deletions(-) + src/skippy/tests/expert_scales.cpp | 97 ++++++- + 3 files changed, 134 insertions(+), 396 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 37542b3ce..1985b193a 100644 +index 37542b3ce4202c5af3d0df2eef01f8f98cde1c13..1985b193a40d2ab166dd58cf983c70a7ded75fe8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -389,6 +389,7 @@ if (LLAMA_STAGE_BUILD_TESTS) @@ -22,10 +22,10 @@ index 37542b3ce..1985b193a 100644 add_executable(skippy-graph-build-inputs skippy/tests/graph_build_inputs.cpp) diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp -index 7deb06595..faa236a96 100644 +index 2ff79debfbf52afb9404a8d4884bcfb90fff5bc6..4bb2489eb84cfddc7f78bba201fee272f31a3b74 100644 --- a/src/llama-graph.cpp +++ b/src/llama-graph.cpp -@@ -2926,394 +2926,23 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -2939,394 +2939,23 @@ ggml_tensor * llm_graph_context::build_moe_ffn( ggml_tensor * selected_experts_in, ggml_tensor * post_exp_norm, float post_exp_norm_eps) const { @@ -437,7 +437,7 @@ index 7deb06595..faa236a96 100644 } ggml_tensor * llm_graph_context::build_moe_ffn( -@@ -3404,10 +3033,6 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -3417,10 +3046,6 @@ ggml_tensor * llm_graph_context::build_moe_ffn( if (probs_in == nullptr) { logits = build_lora_mm(gate_inp, cur); // [n_expert, n_tokens] @@ -448,7 +448,7 @@ index 7deb06595..faa236a96 100644 cb(logits, "ffn_moe_logits", il); } else { logits = probs_in; -@@ -3522,6 +3147,8 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -3535,6 +3160,8 @@ ggml_tensor * llm_graph_context::build_moe_ffn( if (arch == LLM_ARCH_DEEPSEEK41) { // model.py Gate.forward: weights / (sum + 1e-20); the sum can fall below the F16 clamp below weights_sum = ggml_scale_bias(ctx0, weights_sum, 1.0f, 1e-20f); @@ -457,7 +457,7 @@ index 7deb06595..faa236a96 100644 } else { // Avoid division by zero, clamp to smallest number representable by F16 weights_sum = ggml_clamp(ctx0, weights_sum, 6.103515625e-5, INFINITY); -@@ -3541,6 +3168,20 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -3554,6 +3181,20 @@ ggml_tensor * llm_graph_context::build_moe_ffn( //call early so that topk-moe can be used ggml_build_forward_expand(gf, weights); @@ -478,7 +478,7 @@ index 7deb06595..faa236a96 100644 // compute the expert input before the slot lookup, so that the scheduler prefetches it for the CPU part (the router can read a different tensor) ggml_build_forward_expand(gf, cur); -@@ -3621,7 +3262,7 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -3634,7 +3275,7 @@ ggml_tensor * llm_graph_context::build_moe_ffn( const float limit = hparams.swiglu_clamp_exp[il]; constexpr float eps = 1e-6f; if (limit > eps) { @@ -487,7 +487,7 @@ index 7deb06595..faa236a96 100644 cur = ggml_swiglu_clamp(ctx0, cur, up, limit); } else { up = ggml_clamp(ctx0, up, -limit, limit); -@@ -3701,15 +3342,16 @@ ggml_tensor * llm_graph_context::build_moe_ffn( +@@ -3714,15 +3355,16 @@ ggml_tensor * llm_graph_context::build_moe_ffn( // ggml_prec_set_src(experts, GGML_PREC_BF16, 1); // the amax op cannot be split across devices, so these architectures are denied -sm tensor [TAG_MOE_AMAX_SCALE] // ref: https://github.com/ggml-org/llama.cpp/pull/30656#issuecomment-6269597922 @@ -507,7 +507,7 @@ index 7deb06595..faa236a96 100644 if (amax_src1.scale_s) { diff --git a/src/skippy/tests/expert_scales.cpp b/src/skippy/tests/expert_scales.cpp -index ac9a7824e..43bdac4fa 100644 +index 0d9a7ee8e4dcc1df6f8184dfd7d39302e2c18fdb..c268725c802f8940a755c4036b041cc763db96cf 100644 --- a/src/skippy/tests/expert_scales.cpp +++ b/src/skippy/tests/expert_scales.cpp @@ -8,6 +8,7 @@ @@ -518,7 +518,7 @@ index ac9a7824e..43bdac4fa 100644 #include static bool check_expert_scales(bool use_slots) { -@@ -89,6 +90,99 @@ static bool check_expert_scales(bool use_slots) { +@@ -90,6 +91,100 @@ static bool check_expert_scales(bool use_slots) { return true; } @@ -541,6 +541,7 @@ index ac9a7824e..43bdac4fa 100644 + params.loras = &loras; + params.ubatch.n_tokens = 2; + params.cparams.moe_random_routing = random_routing; ++ params.w_scales = &model->w_scales; + llm_graph_context graph(params); + ggml_context * ctx = result.get_ctx(); + auto * input = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 2, 2); @@ -550,8 +551,8 @@ index ac9a7824e..43bdac4fa 100644 + auto * ids = ggml_new_tensor_2d(ctx, GGML_TYPE_I32, 1, 2); + auto * up_scale = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 3); + auto * down_scale = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 3); -+ model->w_scales.emplace(up, up_scale); -+ model->w_scales.emplace(down, down_scale); ++ model->w_scales.scale.emplace(up, up_scale); ++ model->w_scales.scale.emplace(down, down_scale); + auto * ordinary = graph.build_moe_ffn(input, nullptr, up, nullptr, down, nullptr, + 3, 1, LLM_FFN_RELU, true, 0.0f, LLAMA_EXPERT_GATING_FUNC_TYPE_SIGMOID, + 0, logits, nullptr, ids); @@ -619,6 +620,3 @@ index ac9a7824e..43bdac4fa 100644 + if (argc != 1) return 2; return check_expert_scales(false) && check_expert_scales(true) ? 0 : 1; } --- -2.56.1 - diff --git a/llama_cpp/patches/0060-metal-trace-chunked-graph-submission.patch b/llama_cpp/patches/0060-metal-trace-chunked-graph-submission.patch index 5b189441..23938d2d 100644 --- a/llama_cpp/patches/0060-metal-trace-chunked-graph-submission.patch +++ b/llama_cpp/patches/0060-metal-trace-chunked-graph-submission.patch @@ -1,4 +1,4 @@ -From bb465d61c666859668d6688e3553b07d3e4baad8 Mon Sep 17 00:00:00 2001 +From 50b85fcd4fdb39b4ad84bdc20ec683361e6956d4 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Sat, 28 Nov 2026 03:43:53 +1100 Subject: [PATCH] metal: trace command buffers in chunked graph submission @@ -11,7 +11,7 @@ Subject: [PATCH] metal: trace command buffers in chunked graph submission 4 files changed, 60 insertions(+), 21 deletions(-) diff --git a/ggml/src/ggml-metal/ggml-metal-context.m b/ggml/src/ggml-metal/ggml-metal-context.m -index fdaf0fc14..423606e34 100644 +index fdaf0fc14d977c1e657720ad3d042dea2e643462..423606e34ea44139753f4503e6ad4773e5945899 100644 --- a/ggml/src/ggml-metal/ggml-metal-context.m +++ b/ggml/src/ggml-metal/ggml-metal-context.m @@ -579,6 +579,15 @@ static enum ggml_status ggml_metal_graph_compute_by_class(ggml_metal_t ctx, stru @@ -74,7 +74,7 @@ index fdaf0fc14..423606e34 100644 // checked and released by ggml_metal_synchronize diff --git a/ggml/src/ggml-metal/ggml-metal-timing.cpp b/ggml/src/ggml-metal/ggml-metal-timing.cpp -index 477058b20..89e7db442 100644 +index 477058b20450bb922f72d502181a5bfecfd2d373..89e7db442c1e97f7fd82aaa1c017b24a005732fa 100644 --- a/ggml/src/ggml-metal/ggml-metal-timing.cpp +++ b/ggml/src/ggml-metal/ggml-metal-timing.cpp @@ -280,14 +280,18 @@ uint32_t ggml_metal_timing_next_context_id(void) { @@ -99,7 +99,7 @@ index 477058b20..89e7db442 100644 } diff --git a/ggml/src/ggml-metal/ggml-metal-timing.h b/ggml/src/ggml-metal/ggml-metal-timing.h -index 3cbe29099..d370b42dc 100644 +index 3cbe29099d2d332bdaf4fdac4d0192b8eb64eeae..d370b42dc7eeae066930c25fc211f9b95c49de71 100644 --- a/ggml/src/ggml-metal/ggml-metal-timing.h +++ b/ggml/src/ggml-metal/ggml-metal-timing.h @@ -20,6 +20,8 @@ typedef struct ggml_metal_timing_record * ggml_metal_timing_record_t; @@ -112,7 +112,7 @@ index 3cbe29099..d370b42dc 100644 // captures the calling thread's tag ggml_metal_timing_record_t ggml_metal_timing_begin( diff --git a/tests/test-skippy-tracing-metal.cpp b/tests/test-skippy-tracing-metal.cpp -index dc9cacbcc..9806a373d 100644 +index dc9cacbcc2a022c6005a6cb1dbb15c207da96d9c..9806a373d267cb0258a59432bae6e6a832bd9e2a 100644 --- a/tests/test-skippy-tracing-metal.cpp +++ b/tests/test-skippy-tracing-metal.cpp @@ -13,6 +13,7 @@ @@ -214,6 +214,3 @@ index dc9cacbcc..9806a373d 100644 for (const auto & t : received) { CHECK(t.tag == TAG); CHECK(std::strcmp(t.backend_name, backend_name) == 0); --- -2.56.0 - diff --git a/llama_cpp/patches/0061-test-pass-recurrent-replay-policy.patch b/llama_cpp/patches/0061-test-pass-recurrent-replay-policy.patch index 462c0e0a..05ed18c2 100644 --- a/llama_cpp/patches/0061-test-pass-recurrent-replay-policy.patch +++ b/llama_cpp/patches/0061-test-pass-recurrent-replay-policy.patch @@ -1,4 +1,4 @@ -From 34118338cc81a0e7aed4d141e726f553f06ddf19 Mon Sep 17 00:00:00 2001 +From 2f48a26b7404a3f6c23b30161d9a338cb85e10d8 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Sat, 28 Nov 2026 09:10:53 +1100 Subject: [PATCH] test: pass recurrent replay policy in state round trip @@ -8,7 +8,7 @@ Subject: [PATCH] test: pass recurrent replay policy in state round trip 1 file changed, 1 insertion(+) diff --git a/tests/test-skippy-recurrent-state-roundtrip.cpp b/tests/test-skippy-recurrent-state-roundtrip.cpp -index 0fae7bbd4..a8a52c17b 100644 +index 0fae7bbd4efbd65e862972e7bbed24e41a378753..a8a52c17bfd351440a2412a341bba6c0afb3fea9 100644 --- a/tests/test-skippy-recurrent-state-roundtrip.cpp +++ b/tests/test-skippy-recurrent-state-roundtrip.cpp @@ -72,6 +72,7 @@ static llama_memory_recurrent make_memory(const llama_model & model) { @@ -19,6 +19,3 @@ index 0fae7bbd4..a8a52c17b 100644 {}); } --- -2.56.0 - diff --git a/llama_cpp/patches/0062-build-shorten-vulkan-shader-generator-paths.patch b/llama_cpp/patches/0062-build-shorten-vulkan-shader-generator-paths.patch index 68a5b769..f52bdead 100644 --- a/llama_cpp/patches/0062-build-shorten-vulkan-shader-generator-paths.patch +++ b/llama_cpp/patches/0062-build-shorten-vulkan-shader-generator-paths.patch @@ -1,4 +1,4 @@ -From c8bf63a8a73e1de07b097280f8134a9dbfe4de61 Mon Sep 17 00:00:00 2001 +From 0878d7b339f79126240145a6e17099b5f7460ae0 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Sat, 28 Nov 2026 09:44:05 +1100 Subject: [PATCH] build: shorten Vulkan shader-generator build paths @@ -8,7 +8,7 @@ Subject: [PATCH] build: shorten Vulkan shader-generator build paths 1 file changed, 3 insertions(+) diff --git a/ggml/src/ggml-vulkan/CMakeLists.txt b/ggml/src/ggml-vulkan/CMakeLists.txt -index d8fa6ef40..84b236a5c 100644 +index d8fa6ef409bbd5b4eef71ad599d1ec128d434d74..84b236a5ca065610330ef0a778a2148949db1c60 100644 --- a/ggml/src/ggml-vulkan/CMakeLists.txt +++ b/ggml/src/ggml-vulkan/CMakeLists.txt @@ -199,6 +199,9 @@ if (Vulkan_FOUND) diff --git a/llama_cpp/patches/generated/0001-family-afmoe.patch b/llama_cpp/patches/generated/0001-family-afmoe.patch index 8f298d11..b41c66af 100644 --- a/llama_cpp/patches/generated/0001-family-afmoe.patch +++ b/llama_cpp/patches/generated/0001-family-afmoe.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/afmoe.cpp b/src/models/afmoe.cpp -index 0eb208f6338b907add814f70f4503c87feb673eb..23c6a91c3d1afa6191fbdfd8338b82046a67e431 100644 +index edd6160350cf36822739632b46ff28b11ac430c7..faaf4e3621740c6b02ca8583691e6e0c166d1cc1 100644 --- a/src/models/afmoe.cpp +++ b/src/models/afmoe.cpp @@ -130,6 +130,8 @@ llama_model_afmoe::graph::graph(const llm_graph_params & params) : llm_graph_con diff --git a/llama_cpp/patches/generated/0002-family-apertus.patch b/llama_cpp/patches/generated/0002-family-apertus.patch index 53636d16..b81bae70 100644 --- a/llama_cpp/patches/generated/0002-family-apertus.patch +++ b/llama_cpp/patches/generated/0002-family-apertus.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/apertus.cpp b/src/models/apertus.cpp -index c0bb23659b898d203baf2d8d1bfec27bf552031c..dd89464b7dc10c1184867f033849bb852a7d20b5 100644 +index ed42d1c6ff817721c9b8a9351663d911cd088280..5c966621a23491c6d43046a725da5d412fbea27a 100644 --- a/src/models/apertus.cpp +++ b/src/models/apertus.cpp @@ -77,6 +77,8 @@ llama_model_apertus::graph::graph(const llm_graph_params & params) : llm_graph_c diff --git a/llama_cpp/patches/generated/0003-family-arcee.patch b/llama_cpp/patches/generated/0003-family-arcee.patch index c7152952..02b1c32f 100644 --- a/llama_cpp/patches/generated/0003-family-arcee.patch +++ b/llama_cpp/patches/generated/0003-family-arcee.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/arcee.cpp b/src/models/arcee.cpp -index 58607d82e7cfd0f63a3af0b5891b8861175bb301..ef5d67a021ff827bcba77a476c471745ea1afc04 100644 +index 13d29e9219cc8523a015c44b5d17df9cdcc6db72..16def47d83fc604c99c846ca426ddbcb3515abd9 100644 --- a/src/models/arcee.cpp +++ b/src/models/arcee.cpp @@ -66,6 +66,8 @@ llama_model_arcee::graph::graph(const llm_graph_params & params) : llm_graph_con diff --git a/llama_cpp/patches/generated/0004-family-arwkv7--rwkv7.patch b/llama_cpp/patches/generated/0004-family-arwkv7--rwkv7.patch index 4d9e2eae..5fe860e0 100644 --- a/llama_cpp/patches/generated/0004-family-arwkv7--rwkv7.patch +++ b/llama_cpp/patches/generated/0004-family-arwkv7--rwkv7.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/arwkv7.cpp b/src/models/arwkv7.cpp -index 022a6738ff1d4254d131d62606326a7154c9afad..0232bfec56f4f25c60b5a5abea74701a1c2c9e2b 100644 +index a2a47fd657c84e0f6d8d1a034732cdb55dac8e78..56beb00ca43e19316aeff37b062c50337cf9851f 100644 --- a/src/models/arwkv7.cpp +++ b/src/models/arwkv7.cpp @@ -135,6 +135,8 @@ llama_model_arwkv7::graph::graph(const llm_graph_params & params) : llm_build_rw diff --git a/llama_cpp/patches/generated/0005-family-bailingmoe2.patch b/llama_cpp/patches/generated/0005-family-bailingmoe2.patch index cf170e4b..f8a97c11 100644 --- a/llama_cpp/patches/generated/0005-family-bailingmoe2.patch +++ b/llama_cpp/patches/generated/0005-family-bailingmoe2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/bailingmoe2.cpp b/src/models/bailingmoe2.cpp -index 651623e0e3847dee83741e197894058370d3d75a..826123abd9812934688ad2f070adc4691c960704 100644 +index 6bdcded016f63e02c860c2a93f58c2cd9efdb5c7..5fbafe96c7bf0b6b82ff56a234ac3671af1edc8e 100644 --- a/src/models/bailingmoe2.cpp +++ b/src/models/bailingmoe2.cpp @@ -106,6 +106,8 @@ llama_model_bailingmoe2::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0006-family-bailingmoe3.patch b/llama_cpp/patches/generated/0006-family-bailingmoe3.patch index 6a554af8..18168514 100644 --- a/llama_cpp/patches/generated/0006-family-bailingmoe3.patch +++ b/llama_cpp/patches/generated/0006-family-bailingmoe3.patch @@ -9,10 +9,10 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/bailingmoe3.cpp b/src/models/bailingmoe3.cpp -index 30dcf61c31c06c696ac72e36471cf1bebe546eff..44549295c6064a43450e73ae2b84bf5722b256e0 100644 +index 06295e71b6fad4e07c6599e1205a3dedbcc4004a..4a3a9cbc9ab0cba608b515fcb7c5f8467deea224 100644 --- a/src/models/bailingmoe3.cpp +++ b/src/models/bailingmoe3.cpp -@@ -224,6 +224,8 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : +@@ -225,6 +225,8 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : GGML_ASSERT(ubatch.n_tokens == n_seq_tokens * n_seqs); for (int il = 0; il < n_layer; ++il) { @@ -21,7 +21,7 @@ index 30dcf61c31c06c696ac72e36471cf1bebe546eff..44549295c6064a43450e73ae2b84bf57 res->t_layer_inp[il] = inpL; const auto & layer = model.layers[il]; -@@ -366,6 +368,7 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : +@@ -367,6 +369,7 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : cur = build_cvec(cur, il); cb(cur, "l_out", il); inpL = cur; diff --git a/llama_cpp/patches/generated/0007-family-bloom.patch b/llama_cpp/patches/generated/0007-family-bloom.patch index a39253c2..9f2c1cf7 100644 --- a/llama_cpp/patches/generated/0007-family-bloom.patch +++ b/llama_cpp/patches/generated/0007-family-bloom.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/bloom.cpp b/src/models/bloom.cpp -index 076927e0d513d9510d1f117f9b5c83d896a5b69e..48e3f3a10bf8f06fcae645e043a618bd5c91be50 100644 +index cc4e7ce8af90c6f4b3aca2a9a8c0a5625844d9de..f316b822ad313a166a30c9a1458ce67e8b188358 100644 --- a/src/models/bloom.cpp +++ b/src/models/bloom.cpp @@ -83,6 +83,8 @@ llama_model_bloom::graph::graph(const llm_graph_params & params) : llm_graph_con diff --git a/llama_cpp/patches/generated/0008-family-chameleon.patch b/llama_cpp/patches/generated/0008-family-chameleon.patch index d99300fa..0a133b7c 100644 --- a/llama_cpp/patches/generated/0008-family-chameleon.patch +++ b/llama_cpp/patches/generated/0008-family-chameleon.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/chameleon.cpp b/src/models/chameleon.cpp -index 23402da4ab2ed1fed57f5502c6cd25735d345c7f..8f44cdd2f07c5e72ba7c88e38ff51d1fc61d5a4c 100644 +index 9dc6644d24c063ec8a36f497813bfc5794374315..9cddce74b7145194cceefa8bad1d85de56f3ebe0 100644 --- a/src/models/chameleon.cpp +++ b/src/models/chameleon.cpp @@ -69,6 +69,8 @@ llama_model_chameleon::graph::graph(const llm_graph_params & params) : llm_graph diff --git a/llama_cpp/patches/generated/0009-family-cohere2.patch b/llama_cpp/patches/generated/0009-family-cohere2.patch index efab6609..caa33c51 100644 --- a/llama_cpp/patches/generated/0009-family-cohere2.patch +++ b/llama_cpp/patches/generated/0009-family-cohere2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/cohere2.cpp b/src/models/cohere2.cpp -index 251b2da62d05f1edfcc40ca089ebea922a3fae15..d5267bc05cb735bb8da39548054c46a4c1b1d23b 100644 +index 6acbaef738c65b8a9038ba2b800a79f56a83de2e..5ac692bfe2ac5f51c895aba78e34ae90012d9484 100644 --- a/src/models/cohere2.cpp +++ b/src/models/cohere2.cpp @@ -78,6 +78,8 @@ llama_model_cohere2::graph::graph(const llm_graph_params & params) : llm_graph_c diff --git a/llama_cpp/patches/generated/0010-family-deepseek2--glm47-flash--mistral4.patch b/llama_cpp/patches/generated/0010-family-deepseek2--glm47-flash--mistral4.patch index f80ebbb1..f841382f 100644 --- a/llama_cpp/patches/generated/0010-family-deepseek2--glm47-flash--mistral4.patch +++ b/llama_cpp/patches/generated/0010-family-deepseek2--glm47-flash--mistral4.patch @@ -9,10 +9,10 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/deepseek2.cpp b/src/models/deepseek2.cpp -index 96c628ff73dee6b48b2a0c7e16ee0cbc31ae7069..dd51eea2e837c504c3bbca7cac2e4ecd2e082c37 100644 +index b8f6073ec23e84d8f92392cf847a586585fabb64..e96145cdf0ff4d647384c509f854600859be8d4b 100644 --- a/src/models/deepseek2.cpp +++ b/src/models/deepseek2.cpp -@@ -451,6 +451,8 @@ llama_model_deepseek2::graph::graph(const llm_graph_params & params) : +@@ -447,6 +447,8 @@ llama_model_deepseek2::graph::graph(const llm_graph_params & params) : ggml_tensor * inp_out_ids = build_inp_out_ids(); for (int il = 0; il < n_layer; ++il) { @@ -21,7 +21,7 @@ index 96c628ff73dee6b48b2a0c7e16ee0cbc31ae7069..dd51eea2e837c504c3bbca7cac2e4ecd ggml_tensor * inpSA = inpL; // norm -@@ -672,6 +674,7 @@ llama_model_deepseek2::graph::graph(const llm_graph_params & params) : +@@ -668,6 +670,7 @@ llama_model_deepseek2::graph::graph(const llm_graph_params & params) : // input for next layer inpL = cur; diff --git a/llama_cpp/patches/generated/0011-family-deepseek32.patch b/llama_cpp/patches/generated/0011-family-deepseek32.patch index 22448b11..a6d83ac2 100644 --- a/llama_cpp/patches/generated/0011-family-deepseek32.patch +++ b/llama_cpp/patches/generated/0011-family-deepseek32.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/deepseek32.cpp b/src/models/deepseek32.cpp -index 314e6d3dd8ec9cf182ab168cba24f69b1c2f8ccd..42453bf291741c4c2e4f2dac6af54d5f42893831 100644 +index 522dd68e56544f583b7bdbb200fe08bc434d0ebb..11a5d9e48e85015c13d411d4bfa7d5279717a8a9 100644 --- a/src/models/deepseek32.cpp +++ b/src/models/deepseek32.cpp @@ -203,6 +203,8 @@ llama_model_deepseek32::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0012-family-deepseek4.patch b/llama_cpp/patches/generated/0012-family-deepseek4.patch index b6a5b4c5..62d2c208 100644 --- a/llama_cpp/patches/generated/0012-family-deepseek4.patch +++ b/llama_cpp/patches/generated/0012-family-deepseek4.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/deepseek4.cpp b/src/models/deepseek4.cpp -index 6f7b00f3b7aa79c6711aba30f76f12635254f5d6..b44cd6c474409cb830a6ce2d85b063e88dc00ed4 100644 +index 7fc139050734338fa4073f7af9d442fec681b268..7754937aadc8d6e83cc2e0bbb9b95c202aad4af9 100644 --- a/src/models/deepseek4.cpp +++ b/src/models/deepseek4.cpp @@ -1220,6 +1220,8 @@ llama_model_deepseek4::graph::graph(const llm_graph_params & params) : @@ -30,10 +30,10 @@ index 6f7b00f3b7aa79c6711aba30f76f12635254f5d6..b44cd6c474409cb830a6ce2d85b063e8 if ((size_t) n_layer < cparams.embeddings_layer_inp.size() && cparams.embeddings_layer_inp[n_layer]) { diff --git a/src/models/dflash.cpp b/src/models/dflash.cpp -index 67edb9893b9b7d89dad57c0f6665ee018b9603aa..4ba5e4c70cd5ac504e952b30a87701374deb061b 100644 +index 360a6269d8739b69e2f8c44734814be8154d8eb2..49d4e58dc9d82357e90269acea0379dee8f95853 100644 --- a/src/models/dflash.cpp +++ b/src/models/dflash.cpp -@@ -708,6 +708,8 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * tok_emb +@@ -710,6 +710,8 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * tok_emb cb(inpL, "inp_noise_embd", -1); for (int il = 0; il < n_layer; ++il) { @@ -42,7 +42,7 @@ index 67edb9893b9b7d89dad57c0f6665ee018b9603aa..4ba5e4c70cd5ac504e952b30a8770137 const auto & layer = model.layers[il]; ggml_tensor * noise_norm = build_norm(inpL, layer.attn_norm, NULL, LLM_NORM_RMS, il); -@@ -827,6 +829,7 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * tok_emb +@@ -829,6 +831,7 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * tok_emb cb(cur, "l_out", il); inpL = cur; diff --git a/llama_cpp/patches/generated/0013-family-dots1.patch b/llama_cpp/patches/generated/0013-family-dots1.patch index fbb636a9..6f084eab 100644 --- a/llama_cpp/patches/generated/0013-family-dots1.patch +++ b/llama_cpp/patches/generated/0013-family-dots1.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/dots1.cpp b/src/models/dots1.cpp -index c2fa965608cb46086ac67b17fa6513c0e08eb588..92b0ea11f7cae986a767183a60fd85aa89769d86 100644 +index 3f4b9e51364f6bbaf621a0f31ca6b47e63c64c54..5d1e733b0d1a3c042753f6aa43ac0b3c92dca110 100644 --- a/src/models/dots1.cpp +++ b/src/models/dots1.cpp @@ -91,6 +91,8 @@ llama_model_dots1::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0014-family-ernie4-5.patch b/llama_cpp/patches/generated/0014-family-ernie4-5.patch index 6f98b236..1f8bbe2e 100644 --- a/llama_cpp/patches/generated/0014-family-ernie4-5.patch +++ b/llama_cpp/patches/generated/0014-family-ernie4-5.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/ernie4-5.cpp b/src/models/ernie4-5.cpp -index 932cc74cefdeb0cf01c8f9d3b28fe266138f2301..a7fb269309f0b9504328904bc5db68beb10d9050 100644 +index 928f91272a99b4622cef626c5d2983ee77b6ae54..2d94051d6691d8faac3e2969ff4d22049db5047f 100644 --- a/src/models/ernie4-5.cpp +++ b/src/models/ernie4-5.cpp @@ -93,6 +93,8 @@ llama_model_ernie4_5::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0015-family-ernie4-5-moe.patch b/llama_cpp/patches/generated/0015-family-ernie4-5-moe.patch index 6e33d13d..021bbe99 100644 --- a/llama_cpp/patches/generated/0015-family-ernie4-5-moe.patch +++ b/llama_cpp/patches/generated/0015-family-ernie4-5-moe.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/ernie4-5-moe.cpp b/src/models/ernie4-5-moe.cpp -index 7edf9f508bcc6dd05fa5ffb1ba5d3a69ebbefb1e..2003980a83c5c5230b58f92ab2740b9874776b5b 100644 +index c1af284a0481ad377c5017f6ab397108a0db4994..f0a5a4fccddf8449b32652f80c90ab7b760f57b6 100644 --- a/src/models/ernie4-5-moe.cpp +++ b/src/models/ernie4-5-moe.cpp @@ -25,6 +25,8 @@ llama_model_ernie4_5_moe::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0016-family-exaone4.patch b/llama_cpp/patches/generated/0016-family-exaone4.patch index ab735d00..047b7692 100644 --- a/llama_cpp/patches/generated/0016-family-exaone4.patch +++ b/llama_cpp/patches/generated/0016-family-exaone4.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/exaone4.cpp b/src/models/exaone4.cpp -index bca08e0616cad8a65d44d0f5b1f9c81bbd47b6be..73a9a61aefa3812401843cd4ff49f3118c178a4e 100644 +index d405b076cbb4fe631d4c0961c646666897e816b3..1ae3a72d47bafeb69974d184fe02b2266e7fb755 100644 --- a/src/models/exaone4.cpp +++ b/src/models/exaone4.cpp @@ -116,6 +116,8 @@ llama_model_exaone4::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0017-family-falcon-dense.patch b/llama_cpp/patches/generated/0017-family-falcon-dense.patch index 2a212919..a0b7da25 100644 --- a/llama_cpp/patches/generated/0017-family-falcon-dense.patch +++ b/llama_cpp/patches/generated/0017-family-falcon-dense.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/falcon.cpp b/src/models/falcon.cpp -index 6269e633c150b70380b1f5daffa2f136d4492f85..2b4eef18ec9d637aef3a9651f6621a084be636f2 100644 +index 82ad1f420d7fb3a4e3c8a127f87cbd839fb5d460..2214519485eb2833fc280ab82eea381205b41954 100644 --- a/src/models/falcon.cpp +++ b/src/models/falcon.cpp @@ -66,6 +66,8 @@ llama_model_falcon::graph::graph(const llm_graph_params & params) : llm_graph_co diff --git a/llama_cpp/patches/generated/0018-family-falcon-h1.patch b/llama_cpp/patches/generated/0018-family-falcon-h1.patch index e0849f72..1ddaa243 100644 --- a/llama_cpp/patches/generated/0018-family-falcon-h1.patch +++ b/llama_cpp/patches/generated/0018-family-falcon-h1.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/falcon-h1.cpp b/src/models/falcon-h1.cpp -index 22c677b475f128fa8466087c35766c7d86dec6a4..fccb94ed18dd216a98786af280fbafc2b5609eff 100644 +index ffdf708bb5f7c04025279ec8408daf44787fbeb5..0a12e4a92dec164e4afff27f47a4822b4bcd3976 100644 --- a/src/models/falcon-h1.cpp +++ b/src/models/falcon-h1.cpp @@ -138,6 +138,8 @@ llama_model_falcon_h1::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0019-family-gemma.patch b/llama_cpp/patches/generated/0019-family-gemma.patch index 5642346e..fc42e07f 100644 --- a/llama_cpp/patches/generated/0019-family-gemma.patch +++ b/llama_cpp/patches/generated/0019-family-gemma.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/gemma.cpp b/src/models/gemma.cpp -index 1d42acd0127cbe5c4a62771301eb1aa521fee243..30a45b1f8d089ac72e84a25842152adc46380b06 100644 +index 7439f8ebefe72d922dbd6256deff4ec19a963fe8..56fa03afcc27d213630717731ea5cb2c3aecc41d 100644 --- a/src/models/gemma.cpp +++ b/src/models/gemma.cpp @@ -57,6 +57,8 @@ llama_model_gemma::graph::graph(const llm_graph_params & params) : llm_graph_con diff --git a/llama_cpp/patches/generated/0020-family-gemma2.patch b/llama_cpp/patches/generated/0020-family-gemma2.patch index 53323b09..3d33d069 100644 --- a/llama_cpp/patches/generated/0020-family-gemma2.patch +++ b/llama_cpp/patches/generated/0020-family-gemma2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/gemma2.cpp b/src/models/gemma2.cpp -index 826396ce1a59d1bdaf02477bfa3d04bddf6406fe..2bd67f5128d3f84d06082347c89dbb6824a50383 100644 +index 92ce6d9a649e18df936e70ffe3cd4e6659d90af8..ac6e9daed9e15c894bc7449e3059957e85582c9e 100644 --- a/src/models/gemma2.cpp +++ b/src/models/gemma2.cpp @@ -76,6 +76,8 @@ llama_model_gemma2::graph::graph(const llm_graph_params & params) : llm_graph_co diff --git a/llama_cpp/patches/generated/0021-family-gemma3.patch b/llama_cpp/patches/generated/0021-family-gemma3.patch index f6fb65f9..ad451b96 100644 --- a/llama_cpp/patches/generated/0021-family-gemma3.patch +++ b/llama_cpp/patches/generated/0021-family-gemma3.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/gemma3.cpp b/src/models/gemma3.cpp -index 9520c3fcfc72940f7e1b62f45268491951bf68e1..dd5fd99b1bbb729c1bf9e860841cee483738b5f0 100644 +index 8c4f235a6536f7bda40fc1b528aa03822489d278..16b99ed5905c5291fb470bd2dc9877e1797198af 100644 --- a/src/models/gemma3.cpp +++ b/src/models/gemma3.cpp @@ -105,6 +105,8 @@ llama_model_gemma3::graph::graph(const llm_graph_params & params) : llm_gr diff --git a/llama_cpp/patches/generated/0022-family-gemma3n.patch b/llama_cpp/patches/generated/0022-family-gemma3n.patch index 1539c10f..54d39e5d 100644 --- a/llama_cpp/patches/generated/0022-family-gemma3n.patch +++ b/llama_cpp/patches/generated/0022-family-gemma3n.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/gemma3n.cpp b/src/models/gemma3n.cpp -index 64809def800cadd8b8acbb440607296784027498..440538a8a3f8decf481d77343f6953a0f400cb42 100644 +index 91c1c9006aa980cbeb36d3a51af1a5f6046f0078..efc3a4ea25200d048faaec5f551b30ec717ae34f 100644 --- a/src/models/gemma3n.cpp +++ b/src/models/gemma3n.cpp @@ -131,6 +131,8 @@ llama_model_gemma3n::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0023-family-gemma4.patch b/llama_cpp/patches/generated/0023-family-gemma4.patch index 2cff00f6..c2dcf3a1 100644 --- a/llama_cpp/patches/generated/0023-family-gemma4.patch +++ b/llama_cpp/patches/generated/0023-family-gemma4.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/gemma4.cpp b/src/models/gemma4.cpp -index d8bf44a1205ef674bb15e9916447c556cfb255e6..80a5890a67b09212825f161f1171cdc6cdfd6916 100644 +index 26ac9201a4cb88998b66f6aad01859e931ae1c1d..7613662a1277f0a8f4462dcfe33e562c84b482d4 100644 --- a/src/models/gemma4.cpp +++ b/src/models/gemma4.cpp @@ -236,6 +236,8 @@ llama_model_gemma4::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0024-family-glm-dsa.patch b/llama_cpp/patches/generated/0024-family-glm-dsa.patch index 69b439f0..f76a0cac 100644 --- a/llama_cpp/patches/generated/0024-family-glm-dsa.patch +++ b/llama_cpp/patches/generated/0024-family-glm-dsa.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/glm-dsa.cpp b/src/models/glm-dsa.cpp -index 4528e2adc51c10c8dd3551295423a04a55417ea6..19fba0c174942e6f7783d5ec01d487ad6455ab6e 100644 +index 998a8f98f870c2e9806d52c8647b2f355d0e492d..1b2f2e3453ac0931ed65dbea5b2038c76df127f6 100644 --- a/src/models/glm-dsa.cpp +++ b/src/models/glm-dsa.cpp @@ -308,6 +308,8 @@ llama_model_glm_dsa::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0025-family-glm4--glm4-expansion.patch b/llama_cpp/patches/generated/0025-family-glm4--glm4-expansion.patch index 746b87bb..95c26204 100644 --- a/llama_cpp/patches/generated/0025-family-glm4--glm4-expansion.patch +++ b/llama_cpp/patches/generated/0025-family-glm4--glm4-expansion.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/glm4.cpp b/src/models/glm4.cpp -index 12da79b38352a14b45504be1b5336908340cb12a..c960d99b4b6cddc6163c459fc8f882f61c311f1f 100644 +index bf6f34af0044938a5c2eda0015cbb138173998be..324ceb127d074975c18504ae534cdae0a0b7f7ca 100644 --- a/src/models/glm4.cpp +++ b/src/models/glm4.cpp @@ -90,6 +90,8 @@ llama_model_glm4::graph::graph(const llm_graph_params & params) : llm_graph_cont diff --git a/llama_cpp/patches/generated/0026-family-glm4-expansion.patch b/llama_cpp/patches/generated/0026-family-glm4-expansion.patch index 1e450a2d..5478649b 100644 --- a/llama_cpp/patches/generated/0026-family-glm4-expansion.patch +++ b/llama_cpp/patches/generated/0026-family-glm4-expansion.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/chatglm.cpp b/src/models/chatglm.cpp -index e7442b75f981d5700f6ac704a1d3fcafe15e8ca4..eefb617808b8cb495742e9d8142e149724105547 100644 +index 917afd802f0a6a56641334ef17df4361c38678d9..fbb5e7290c5f1e06b5865d4b2407dd855377705f 100644 --- a/src/models/chatglm.cpp +++ b/src/models/chatglm.cpp @@ -73,6 +73,8 @@ llama_model_chatglm::graph::graph(const llm_graph_params & params) : llm_graph_c diff --git a/llama_cpp/patches/generated/0027-family-glm45-air.patch b/llama_cpp/patches/generated/0027-family-glm45-air.patch index 4694a50a..186137c3 100644 --- a/llama_cpp/patches/generated/0027-family-glm45-air.patch +++ b/llama_cpp/patches/generated/0027-family-glm45-air.patch @@ -9,10 +9,10 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/glm4-moe.cpp b/src/models/glm4-moe.cpp -index 6854485588e30a6351da29168234247f294f971d..4115455850ab6ad46167226d1b463e9b8417ec58 100644 +index e6b73f2ca4b6457466deeeabd7766384fcd87d96..8156e4e345589867d57730c84d4c64b96acc6fce 100644 --- a/src/models/glm4-moe.cpp +++ b/src/models/glm4-moe.cpp -@@ -300,6 +300,8 @@ llama_model_glm4_moe::graph::graph(const llm_graph_params & params) : llm_graph_ +@@ -297,6 +297,8 @@ llama_model_glm4_moe::graph::graph(const llm_graph_params & params) : llm_graph_ // NextN layers are processed by graph_mtp. for (int il = 0; il < n_layer; ++il) { @@ -21,7 +21,7 @@ index 6854485588e30a6351da29168234247f294f971d..4115455850ab6ad46167226d1b463e9b ggml_tensor * inpSA = inpL; // Pre-attention norm -@@ -389,6 +391,7 @@ llama_model_glm4_moe::graph::graph(const llm_graph_params & params) : llm_graph_ +@@ -386,6 +388,7 @@ llama_model_glm4_moe::graph::graph(const llm_graph_params & params) : llm_graph_ // input for next layer inpL = cur; diff --git a/llama_cpp/patches/generated/0028-family-gpt-oss.patch b/llama_cpp/patches/generated/0028-family-gpt-oss.patch index 571c71cf..06dfcdb8 100644 --- a/llama_cpp/patches/generated/0028-family-gpt-oss.patch +++ b/llama_cpp/patches/generated/0028-family-gpt-oss.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/openai-moe.cpp b/src/models/openai-moe.cpp -index 920acbb64c00ada60ba1e79f0566fc078e31a34e..04fb74859292157b803d40519e9df141b630b4b0 100644 +index 3a1b3c94ee060aba2279fd9604863cfcce3d28d7..769505a74d50f5a6a6c73fbb5d452074d0becc1e 100644 --- a/src/models/openai-moe.cpp +++ b/src/models/openai-moe.cpp @@ -73,6 +73,8 @@ llama_model_openai_moe::graph::graph(const llm_graph_params & params) : llm_grap diff --git a/llama_cpp/patches/generated/0029-family-gptneox.patch b/llama_cpp/patches/generated/0029-family-gptneox.patch index 785307e3..8d0d31eb 100644 --- a/llama_cpp/patches/generated/0029-family-gptneox.patch +++ b/llama_cpp/patches/generated/0029-family-gptneox.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/gptneox.cpp b/src/models/gptneox.cpp -index 8217e5a8a71db7decb5411779c442d827a33e7ff..366277122a9f88c452329199030875a13720643b 100644 +index bd56a77369046a1e2b91a67aae107f8504fc7506..e0e66d83b3d297a122cd7d8366abff2f309b1370 100644 --- a/src/models/gptneox.cpp +++ b/src/models/gptneox.cpp @@ -102,6 +102,8 @@ llama_model_gptneox::graph::graph(const llm_graph_params & params) : llm_graph_c diff --git a/llama_cpp/patches/generated/0030-family-granite-dense--granite-moe--minicpm.patch b/llama_cpp/patches/generated/0030-family-granite-dense--granite-moe--minicpm.patch index 9288fe0a..8becedfd 100644 --- a/llama_cpp/patches/generated/0030-family-granite-dense--granite-moe--minicpm.patch +++ b/llama_cpp/patches/generated/0030-family-granite-dense--granite-moe--minicpm.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/granite.cpp b/src/models/granite.cpp -index 0a5dd78eafb60785716365eda4a0d8f7ed6fa770..ab07182b86aa738aaa8aa7853e6602e8cd772e83 100644 +index b43fb1540eed74441aeaaa5ecadc471ec6c6e95b..3100f5361bb7e93e5b89e8bccdcd472b72540bb8 100644 --- a/src/models/granite.cpp +++ b/src/models/granite.cpp @@ -142,6 +142,8 @@ llama_model_granite::graph::graph(const llm_graph_params & params) : llm_graph_c diff --git a/llama_cpp/patches/generated/0031-family-granite-hybrid.patch b/llama_cpp/patches/generated/0031-family-granite-hybrid.patch index 41206733..518876c2 100644 --- a/llama_cpp/patches/generated/0031-family-granite-hybrid.patch +++ b/llama_cpp/patches/generated/0031-family-granite-hybrid.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/granite-hybrid.cpp b/src/models/granite-hybrid.cpp -index d638663afd44d774b19a2d3349eca71a652d0d21..f61e2cf83a77f2b64acab0870d9b9bbe89874298 100644 +index 8c2ce7da82854a4ed93c8c059eefcd0b744c5ea2..3f0371b75bfc700ee4d095325825fa7f60ff4ab1 100644 --- a/src/models/granite-hybrid.cpp +++ b/src/models/granite-hybrid.cpp @@ -153,6 +153,8 @@ llama_model_granite_hybrid::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0032-family-granite-swa.patch b/llama_cpp/patches/generated/0032-family-granite-swa.patch index 47d2703e..9ed3d4a5 100644 --- a/llama_cpp/patches/generated/0032-family-granite-swa.patch +++ b/llama_cpp/patches/generated/0032-family-granite-swa.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/granite-swa.cpp b/src/models/granite-swa.cpp -index 21a7ad4014ec888acca61e37dea2fca6f11036a8..f1275474c592d3a3f56b1f4a1de38d988175510d 100644 +index cafc5957f6f9adef71cdb4e70245a39e987be4d2..189d6c07296d45e4d10175e29ed4f7e3b66c0578 100644 --- a/src/models/granite-swa.cpp +++ b/src/models/granite-swa.cpp @@ -158,6 +158,8 @@ llama_model_granite_swa::graph::graph(const llm_graph_params & params) : llm_gra diff --git a/llama_cpp/patches/generated/0033-family-granite-switch.patch b/llama_cpp/patches/generated/0033-family-granite-switch.patch index b01cb7f3..f4b02c4e 100644 --- a/llama_cpp/patches/generated/0033-family-granite-switch.patch +++ b/llama_cpp/patches/generated/0033-family-granite-switch.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/granite-switch.cpp b/src/models/granite-switch.cpp -index 8cf7fef896007fd88719685c7e89a93cbc5b5be8..9786d0f420e5795ca65c9ab13fb389c44936a5b9 100644 +index ee47217101beaf14aa9a2e73b3c76d392887e7bb..03b06c4b65f163ba4c9f42e8f5509d1b0de17d3f 100644 --- a/src/models/granite-switch.cpp +++ b/src/models/granite-switch.cpp @@ -319,6 +319,8 @@ llama_model_granite_switch::graph::graph(const llm_graph_params & params) : llm_ diff --git a/llama_cpp/patches/generated/0034-family-grovemoe.patch b/llama_cpp/patches/generated/0034-family-grovemoe.patch index 64bb054d..e377ef79 100644 --- a/llama_cpp/patches/generated/0034-family-grovemoe.patch +++ b/llama_cpp/patches/generated/0034-family-grovemoe.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/grovemoe.cpp b/src/models/grovemoe.cpp -index c86ddbbf5b3f9c176e95f6fc3838de5205b1feb0..65f15736c15101164e2b286476c89d3cc796ae92 100644 +index e55a8ad993a026b24c619c9e4abcc9d5b0ff5d45..4444d42443bacf9298ec65f782c83e57757cc7b5 100644 --- a/src/models/grovemoe.cpp +++ b/src/models/grovemoe.cpp @@ -85,6 +85,8 @@ llama_model_grovemoe::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0035-family-hunyuan-dense.patch b/llama_cpp/patches/generated/0035-family-hunyuan-dense.patch index 775a81aa..60211062 100644 --- a/llama_cpp/patches/generated/0035-family-hunyuan-dense.patch +++ b/llama_cpp/patches/generated/0035-family-hunyuan-dense.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/hunyuan-vl.cpp b/src/models/hunyuan-vl.cpp -index 219ba39bda1ac71cadaba2cb5b7637ca6a04e8a2..1edf4bbfc19e745b7867c910c0edb64a17416988 100644 +index cf4020499af10e093f82f6ad0f62a73128f18d43..a084805a2d63ff7f82e4d1b62a7f40e74413241a 100644 --- a/src/models/hunyuan-vl.cpp +++ b/src/models/hunyuan-vl.cpp @@ -78,6 +78,8 @@ llama_model_hunyuan_vl::graph::graph(const llm_graph_params & params) : llm_grap diff --git a/llama_cpp/patches/generated/0036-family-hy-v3.patch b/llama_cpp/patches/generated/0036-family-hy-v3.patch index fcca095c..04fe0f0f 100644 --- a/llama_cpp/patches/generated/0036-family-hy-v3.patch +++ b/llama_cpp/patches/generated/0036-family-hy-v3.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/hy-v3.cpp b/src/models/hy-v3.cpp -index f53d94827ee753e8965304941440b50995fe0b41..c4aac4a910ffe5c38323d7824332002619bc46fa 100644 +index 4825677460ca0cb67fec4c54658d4cc5d813485f..2ffa2f792bdec98e7e3778e817854ec0a28c3848 100644 --- a/src/models/hy-v3.cpp +++ b/src/models/hy-v3.cpp @@ -112,6 +112,8 @@ llama_model_hy_v3::graph::graph(const llm_graph_params & params) : llm_graph_con diff --git a/llama_cpp/patches/generated/0037-family-inkling.patch b/llama_cpp/patches/generated/0037-family-inkling.patch index 43acd2a0..34d84c34 100644 --- a/llama_cpp/patches/generated/0037-family-inkling.patch +++ b/llama_cpp/patches/generated/0037-family-inkling.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/inkling.cpp b/src/models/inkling.cpp -index b8cc55734d615aef6cf94f8e7b2440221719783b..6be9814fabfada405a6cf55af9fd0c368aa05386 100644 +index 3fdbfa1c466c2cd0481376b8ef1e2cc072f0b2e4..7317dfc6f37f03aac6f85e9c3b3bb044a777f86d 100644 --- a/src/models/inkling.cpp +++ b/src/models/inkling.cpp @@ -649,8 +649,11 @@ llama_model_inkling::graph::graph(const llama_model & model, const llm_graph_par diff --git a/llama_cpp/patches/generated/0038-family-internlm2.patch b/llama_cpp/patches/generated/0038-family-internlm2.patch index 37d3a260..11d0f0e1 100644 --- a/llama_cpp/patches/generated/0038-family-internlm2.patch +++ b/llama_cpp/patches/generated/0038-family-internlm2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/internlm2.cpp b/src/models/internlm2.cpp -index 39ce67af6683bd400485975bce6e4df73eeb67f7..886c12971e985723680e1ef324288cd77a545890 100644 +index 09b084bf41996490f3b37a6d9079d479a4e89434..818f0975d402eb6c5f75614619946b444ef9a7d5 100644 --- a/src/models/internlm2.cpp +++ b/src/models/internlm2.cpp @@ -57,6 +57,8 @@ llama_model_internlm2::graph::graph(const llm_graph_params & params) : llm_graph diff --git a/llama_cpp/patches/generated/0039-family-jais.patch b/llama_cpp/patches/generated/0039-family-jais.patch index 11f35417..7d860808 100644 --- a/llama_cpp/patches/generated/0039-family-jais.patch +++ b/llama_cpp/patches/generated/0039-family-jais.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/jais.cpp b/src/models/jais.cpp -index daa3315bfc306f3f26d974dcb657c0100f4ac3d4..291509332da0cbf27a3a61d8c4ab9ac3d6450a88 100644 +index 6dbbee8a91dc8b0cdb784b6cab7ddaad7edbc708..987ebffb0f50cdf20f9220c290f9fd5e2b4edff2 100644 --- a/src/models/jais.cpp +++ b/src/models/jais.cpp @@ -67,6 +67,8 @@ llama_model_jais::graph::graph(const llm_graph_params & params) : llm_graph_cont diff --git a/llama_cpp/patches/generated/0040-family-jais2.patch b/llama_cpp/patches/generated/0040-family-jais2.patch index a859caa8..a129c31e 100644 --- a/llama_cpp/patches/generated/0040-family-jais2.patch +++ b/llama_cpp/patches/generated/0040-family-jais2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/jais2.cpp b/src/models/jais2.cpp -index 1f077fd8699b0a683a0cc0f561fec8e9b7c928d8..3141e19d37159d005c7e2cc1188b855dd531055e 100644 +index 207523fd5d5361ea12c869bfd4f7304626f92053..c00106a69da9d5193711d71e6200d472f93469e0 100644 --- a/src/models/jais2.cpp +++ b/src/models/jais2.cpp @@ -75,6 +75,8 @@ llama_model_jais2::graph::graph(const llm_graph_params & params) : llm_graph_con diff --git a/llama_cpp/patches/generated/0041-family-jamba2.patch b/llama_cpp/patches/generated/0041-family-jamba2.patch index 013263c2..6b9f43d1 100644 --- a/llama_cpp/patches/generated/0041-family-jamba2.patch +++ b/llama_cpp/patches/generated/0041-family-jamba2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/jamba.cpp b/src/models/jamba.cpp -index 842df63b6a80440794e3b823668e4cb1a532d555..5fac6dd53f0b5edc2be65ed2e0864299133ad1f1 100644 +index 60a9a1ea6bb080a7503208000f4d4a6c4b87fec2..ddfc17f92eb6c6c76f249b7b73fa5cc33eeeb2cc 100644 --- a/src/models/jamba.cpp +++ b/src/models/jamba.cpp @@ -119,6 +119,8 @@ llama_model_jamba::graph::graph(const llm_graph_params & params) : llm_build_mam diff --git a/llama_cpp/patches/generated/0042-family-kimi-k3.patch b/llama_cpp/patches/generated/0042-family-kimi-k3.patch index d33ed8e2..de89a388 100644 --- a/llama_cpp/patches/generated/0042-family-kimi-k3.patch +++ b/llama_cpp/patches/generated/0042-family-kimi-k3.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/kimi-k3.cpp b/src/models/kimi-k3.cpp -index 8ed249f71421c4d769cd0161f65d4899b2180088..0fab139c9688e30ab99dd2255bc6d71a7afd8dc4 100644 +index e4cb022c0f2ad35f879c14f137c70b517dddfd82..3a95f8a93b12373d8b83515bc9e2229cfed0a7fa 100644 --- a/src/models/kimi-k3.cpp +++ b/src/models/kimi-k3.cpp @@ -274,6 +274,8 @@ llama_model_kimi_k3::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0043-family-kimi-linear.patch b/llama_cpp/patches/generated/0043-family-kimi-linear.patch index 1608880a..328fb139 100644 --- a/llama_cpp/patches/generated/0043-family-kimi-linear.patch +++ b/llama_cpp/patches/generated/0043-family-kimi-linear.patch @@ -9,10 +9,10 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/kimi-linear.cpp b/src/models/kimi-linear.cpp -index ad454067ea71b2447df44840299eb6ec8edb15fc..83bd88b77a9aa3bdbf1bcb5382579aeec02efeb4 100644 +index 778b39143ee7a963d498f9f6893d86b06ea0e2ac..39f82a84fe2d63f36c3cc40816ccdeb9af5c77d2 100644 --- a/src/models/kimi-linear.cpp +++ b/src/models/kimi-linear.cpp -@@ -277,6 +277,8 @@ llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : +@@ -274,6 +274,8 @@ llama_model_kimi_linear::graph::graph(const llm_graph_params & params) : const float kq_scale_mla = 1.0f / sqrtf((float)n_embd_head_k_mla); for (int il = 0; il < n_layer; ++il) { diff --git a/llama_cpp/patches/generated/0044-family-laguna.patch b/llama_cpp/patches/generated/0044-family-laguna.patch index 1336f156..a8e7c90f 100644 --- a/llama_cpp/patches/generated/0044-family-laguna.patch +++ b/llama_cpp/patches/generated/0044-family-laguna.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/laguna.cpp b/src/models/laguna.cpp -index a92fe67dbbc4400ac9f542689d210ec1bc510c19..dfa89c0190a0038f4ecf497de4f162466a62fb13 100644 +index 7544d0d1b5b390ca1b60069562b0fc60b9c12b35..5c9c930f226e29348789795f380e7c3c1d567673 100644 --- a/src/models/laguna.cpp +++ b/src/models/laguna.cpp @@ -188,6 +188,8 @@ llama_model_laguna::graph::graph(const llm_graph_params & params) : llm_graph_co diff --git a/llama_cpp/patches/generated/0045-family-lfm2--lfm2-moe--lfm2-vl.patch b/llama_cpp/patches/generated/0045-family-lfm2--lfm2-moe--lfm2-vl.patch index 8cf154af..91646e34 100644 --- a/llama_cpp/patches/generated/0045-family-lfm2--lfm2-moe--lfm2-vl.patch +++ b/llama_cpp/patches/generated/0045-family-lfm2--lfm2-moe--lfm2-vl.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/lfm2.cpp b/src/models/lfm2.cpp -index 86b948cf3de9ac7a5b54f50c20377fa6011eedb4..b76f4e35026dc2ee9760298e7c260118ea40d447 100644 +index 3e6e8c1a07e88f165a66bb556bed6d5fcb21f2fb..6f45553cee7e84920b55a210c81b59ba46821df5 100644 --- a/src/models/lfm2.cpp +++ b/src/models/lfm2.cpp @@ -208,6 +208,8 @@ llama_model_lfm2::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0046-family-llama.patch b/llama_cpp/patches/generated/0046-family-llama.patch index 736785f5..abed949b 100644 --- a/llama_cpp/patches/generated/0046-family-llama.patch +++ b/llama_cpp/patches/generated/0046-family-llama.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/llama.cpp b/src/models/llama.cpp -index 3925699f418894d4eb8872ab7270feaacbc7ea75..1a1075023c6532717b249e763e6e842e32c403c0 100644 +index 8e1dbed9026cf97f838dd144459492ae865c7196..5f36a7c9f3ed8db840a9b0aa6252ff2a24b80083 100644 --- a/src/models/llama.cpp +++ b/src/models/llama.cpp @@ -124,6 +124,8 @@ llama_model_llama::graph::graph(const llm_graph_params & params) : llm_gr diff --git a/llama_cpp/patches/generated/0047-family-llama--olmo2.patch b/llama_cpp/patches/generated/0047-family-llama--olmo2.patch index b8a522e1..f70a2e25 100644 --- a/llama_cpp/patches/generated/0047-family-llama--olmo2.patch +++ b/llama_cpp/patches/generated/0047-family-llama--olmo2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/olmo2.cpp b/src/models/olmo2.cpp -index c0a3e8295da9ed2d35b909fad4ccccc86a8dda8e..e0939c7cb83612115b8dffcb77a03caeecd7d557 100644 +index 2b35b171e4bc54b0b43dbcbf84afc32649652571..c13f846aedb617f37acb9fb7b3854d066e53de4f 100644 --- a/src/models/olmo2.cpp +++ b/src/models/olmo2.cpp @@ -100,6 +100,8 @@ llama_model_olmo2::graph::graph(const llm_graph_params & params) : llm_gra diff --git a/llama_cpp/patches/generated/0048-family-llama4.patch b/llama_cpp/patches/generated/0048-family-llama4.patch index 5cd16285..345e845d 100644 --- a/llama_cpp/patches/generated/0048-family-llama4.patch +++ b/llama_cpp/patches/generated/0048-family-llama4.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/llama4.cpp b/src/models/llama4.cpp -index 5fa2a623f7438c548a3c63dd680c95a375f2ba33..22f069769476b7ce9bfb7ba2df26ab086f7f5ef9 100644 +index 1ba9a6d896d92e52ba93b131efb8ad5d839f49ed..14aa238cdbd4935c342efe7fa33b67430d5cdbc6 100644 --- a/src/models/llama4.cpp +++ b/src/models/llama4.cpp @@ -138,6 +138,8 @@ llama_model_llama4::graph::graph(const llm_graph_params & params) : llm_gr diff --git a/llama_cpp/patches/generated/0049-family-maincoder.patch b/llama_cpp/patches/generated/0049-family-maincoder.patch index d568d219..176b5d81 100644 --- a/llama_cpp/patches/generated/0049-family-maincoder.patch +++ b/llama_cpp/patches/generated/0049-family-maincoder.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/maincoder.cpp b/src/models/maincoder.cpp -index 1a2d2c695b6c1b72afe8dfc540f34d2e3467b16a..74ad18db79df606c082704c57bfbfd9ee6c2fb29 100644 +index b88ecaa4c144366007feb92ab4eae0018f798410..9c90fbc13a7ad53bad49c19b55abfc452fad0c7d 100644 --- a/src/models/maincoder.cpp +++ b/src/models/maincoder.cpp @@ -71,6 +71,8 @@ llama_model_maincoder::graph::graph(const llm_graph_params & params) : llm_graph diff --git a/llama_cpp/patches/generated/0050-family-mamba--mamba2.patch b/llama_cpp/patches/generated/0050-family-mamba--mamba2.patch index 3fd7e1f7..bcbd7a5c 100644 --- a/llama_cpp/patches/generated/0050-family-mamba--mamba2.patch +++ b/llama_cpp/patches/generated/0050-family-mamba--mamba2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/mamba.cpp b/src/models/mamba.cpp -index 13a9de6b0aeae62c601e10cfa368b085eb9f690a..b7364ecbfd144764a1bfdc0c5f8864c1d0d85c83 100644 +index c3d724438478a6a18f38792c417fca0a5ade87f9..82aeecfcd16c5888d7049bff458c6fc899bca50b 100644 --- a/src/models/mamba.cpp +++ b/src/models/mamba.cpp @@ -96,6 +96,8 @@ llama_model_mamba::graph::graph(const llm_graph_params & params) : llm_build_mam diff --git a/llama_cpp/patches/generated/0051-family-mellum.patch b/llama_cpp/patches/generated/0051-family-mellum.patch index 18f03d76..de84b961 100644 --- a/llama_cpp/patches/generated/0051-family-mellum.patch +++ b/llama_cpp/patches/generated/0051-family-mellum.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/mellum.cpp b/src/models/mellum.cpp -index d0b3609b1e08884151d0c067800942ebcaf32610..abd3c57363588ffe94fb4dfc433a6dc66287b081 100644 +index a31dbfb04f44cf362cf1f64df9721d89f01be8b6..9866fc8bdaf8da17bf993d8824723499fda270bd 100644 --- a/src/models/mellum.cpp +++ b/src/models/mellum.cpp @@ -144,6 +144,8 @@ llama_model_mellum::graph::graph(const llm_graph_params & params) : llm_gr diff --git a/llama_cpp/patches/generated/0052-family-mimo2.patch b/llama_cpp/patches/generated/0052-family-mimo2.patch index 6bba6bd4..397fbab1 100644 --- a/llama_cpp/patches/generated/0052-family-mimo2.patch +++ b/llama_cpp/patches/generated/0052-family-mimo2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/mimo2.cpp b/src/models/mimo2.cpp -index ac36e666496d16e552f55c98a7bfa11d1682f471..e91006eb1fd90685acfe3470ad649651df269cf1 100644 +index 5f1512eddfd7e520c90176cab5ef1a3c199c686c..3226034b12bafe0f7c49395bbb56cfca884168db 100644 --- a/src/models/mimo2.cpp +++ b/src/models/mimo2.cpp @@ -101,6 +101,8 @@ llama_model_mimo2::graph::graph(const llm_graph_params & params) : llm_graph_con diff --git a/llama_cpp/patches/generated/0053-family-minicpm3.patch b/llama_cpp/patches/generated/0053-family-minicpm3.patch index 26d33120..98ec3bbd 100644 --- a/llama_cpp/patches/generated/0053-family-minicpm3.patch +++ b/llama_cpp/patches/generated/0053-family-minicpm3.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/minicpm3.cpp b/src/models/minicpm3.cpp -index 0cfe0d5aba977dc030d133d80fe48993093610ba..51ef02c4ec2856699287d8e37b879f6ca0b94f09 100644 +index 6db9fcc00de5aeb7d46375cc5b3c3a85dc986ee1..ec1af1a6b0b739f281ceaa76c0d30577901c5a9f 100644 --- a/src/models/minicpm3.cpp +++ b/src/models/minicpm3.cpp @@ -89,6 +89,8 @@ llama_model_minicpm3::graph::graph(const llm_graph_params & params) : llm_graph_ diff --git a/llama_cpp/patches/generated/0054-family-minimax-m2.patch b/llama_cpp/patches/generated/0054-family-minimax-m2.patch index 0ea84083..733e813e 100644 --- a/llama_cpp/patches/generated/0054-family-minimax-m2.patch +++ b/llama_cpp/patches/generated/0054-family-minimax-m2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/minimax-m2.cpp b/src/models/minimax-m2.cpp -index 5b8258255f095dbb19bec0f378e329b395fb27e7..83f2ad2f562c0abfcbc60c70bb69677b683c78db 100644 +index cced2eb51f405932a4467ca3c8d6b47c2501059f..5e1da1756829c09bb68704e9d0ba158f341493f3 100644 --- a/src/models/minimax-m2.cpp +++ b/src/models/minimax-m2.cpp @@ -60,6 +60,8 @@ llama_model_minimax_m2::graph::graph(const llm_graph_params & params) : llm_grap diff --git a/llama_cpp/patches/generated/0055-family-minimax-m3.patch b/llama_cpp/patches/generated/0055-family-minimax-m3.patch index e39c10e6..e0c116d4 100644 --- a/llama_cpp/patches/generated/0055-family-minimax-m3.patch +++ b/llama_cpp/patches/generated/0055-family-minimax-m3.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/minimax-m3.cpp b/src/models/minimax-m3.cpp -index 6e48312093965b5fcf2c6c44735c0c045524ed91..dfa2d0900809efefb8de70fa2bb4cacff5e2f678 100644 +index 18bdd1cc5fc5db39687a49bad7b70689ba28e41e..03709e1ae2d3e2ada77861cbcc11f7331bb3b9aa 100644 --- a/src/models/minimax-m3.cpp +++ b/src/models/minimax-m3.cpp @@ -329,6 +329,8 @@ llama_model_minimax_m3::graph::graph(const llm_graph_params & params) : llm_grap diff --git a/llama_cpp/patches/generated/0056-family-mistral-small--mistral3.patch b/llama_cpp/patches/generated/0056-family-mistral-small--mistral3.patch index 449000cf..f6420842 100644 --- a/llama_cpp/patches/generated/0056-family-mistral-small--mistral3.patch +++ b/llama_cpp/patches/generated/0056-family-mistral-small--mistral3.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/mistral3.cpp b/src/models/mistral3.cpp -index b883dfa5898234e6ef2e83354812ab46387a1b7a..939284c84df77fb639e76e0cedaf8baf75c98636 100644 +index 83ac7581fdf59c1f0a6a40d78180240246383e6a..8198f28f8773f6d1677092e4f5b1f4f203d0afdf 100644 --- a/src/models/mistral3.cpp +++ b/src/models/mistral3.cpp @@ -163,6 +163,8 @@ llama_model_mistral3::graph::graph(const llm_graph_params & params) : llm_graph_ diff --git a/llama_cpp/patches/generated/0057-family-mpt.patch b/llama_cpp/patches/generated/0057-family-mpt.patch index 13fd1708..061556c6 100644 --- a/llama_cpp/patches/generated/0057-family-mpt.patch +++ b/llama_cpp/patches/generated/0057-family-mpt.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/mpt.cpp b/src/models/mpt.cpp -index 774907b4de64ff286250b1ff417d92093587d91c..0289715fbd00a53e1ce8351240a7f39c82a8bf96 100644 +index dd13e976a188598f96ea5afaad248ee222ae2f27..a0deab5e963f1bad562d2517eb1460861fd4e356 100644 --- a/src/models/mpt.cpp +++ b/src/models/mpt.cpp @@ -90,6 +90,8 @@ llama_model_mpt::graph::graph(const llm_graph_params & params) : llm_graph_conte diff --git a/llama_cpp/patches/generated/0058-family-muse-glimmer.patch b/llama_cpp/patches/generated/0058-family-muse-glimmer.patch index b17bbd53..52d3e8df 100644 --- a/llama_cpp/patches/generated/0058-family-muse-glimmer.patch +++ b/llama_cpp/patches/generated/0058-family-muse-glimmer.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/muse-glimmer.cpp b/src/models/muse-glimmer.cpp -index e3f478fe3480cda14096e55c8ee9c56d63e64ccc..a8bbfaa30d517ed0f492c2338663d6b3fa194a5f 100644 +index 128776b6b570499060cc63502728c62f6097c08e..8bde1099b4403646d6b8634069c408550cd77589 100644 --- a/src/models/muse-glimmer.cpp +++ b/src/models/muse-glimmer.cpp @@ -77,6 +77,8 @@ llama_model_muse_glimmer::graph::graph(const llm_graph_params & params) diff --git a/llama_cpp/patches/generated/0059-family-nemotron--nemotron-nano.patch b/llama_cpp/patches/generated/0059-family-nemotron--nemotron-nano.patch index ba81a936..c1989b7d 100644 --- a/llama_cpp/patches/generated/0059-family-nemotron--nemotron-nano.patch +++ b/llama_cpp/patches/generated/0059-family-nemotron--nemotron-nano.patch @@ -9,10 +9,10 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/nemotron-h.cpp b/src/models/nemotron-h.cpp -index ab312b370681c3c33e2fc5d985237a9943857bfa..8f22bbd0b0350224e97df4540b2f798008eece7a 100644 +index 813c10954061222ba0961a495ae724810242118b..89c7148434b2c70297cd4055d52ba3e78ecb71bb 100644 --- a/src/models/nemotron-h.cpp +++ b/src/models/nemotron-h.cpp -@@ -221,6 +221,8 @@ llama_model_nemotron_h::graph::graph(const llm_graph_params & params) : +@@ -212,6 +212,8 @@ llama_model_nemotron_h::graph::graph(const llm_graph_params & params) : const bool extract_final_inp = (size_t) n_layer < cparams.embeddings_layer_inp.size() && cparams.embeddings_layer_inp[n_layer]; for (int il = 0; il < n_layer; ++il) { @@ -21,7 +21,7 @@ index ab312b370681c3c33e2fc5d985237a9943857bfa..8f22bbd0b0350224e97df4540b2f7980 res->t_layer_inp[il] = inpL; struct ggml_tensor * inpSA = inpL; -@@ -250,6 +252,7 @@ llama_model_nemotron_h::graph::graph(const llm_graph_params & params) : +@@ -241,6 +243,7 @@ llama_model_nemotron_h::graph::graph(const llm_graph_params & params) : // input for next layer inpL = cur; diff --git a/llama_cpp/patches/generated/0060-family-nemotron-expansion.patch b/llama_cpp/patches/generated/0060-family-nemotron-expansion.patch index 16c1e09b..53770174 100644 --- a/llama_cpp/patches/generated/0060-family-nemotron-expansion.patch +++ b/llama_cpp/patches/generated/0060-family-nemotron-expansion.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/nemotron.cpp b/src/models/nemotron.cpp -index f769b25375a904aa01e44ef5ca912ff162d379d7..e27ba75b266cd5246281141d36af49cad888f000 100644 +index 139491a05ee386881d5a20b06f6a9b91dfda3d3c..aa5db917714afb451d4205b9f7873b58bcabe197 100644 --- a/src/models/nemotron.cpp +++ b/src/models/nemotron.cpp @@ -69,6 +69,8 @@ llama_model_nemotron::graph::graph(const llm_graph_params & params) : llm_graph_ diff --git a/llama_cpp/patches/generated/0061-family-phi2.patch b/llama_cpp/patches/generated/0061-family-phi2.patch index 7088a401..62690502 100644 --- a/llama_cpp/patches/generated/0061-family-phi2.patch +++ b/llama_cpp/patches/generated/0061-family-phi2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/phi2.cpp b/src/models/phi2.cpp -index 90c502cfdee47cd9658cce0a15818fab0392c2f3..4d56f0abb926d8c8de588f3b7719b6f1c7040fb5 100644 +index 3ebe6801ab0f670b3f0263820d7f53ee3676f673..34dc52bdf2f5e56b8725020ea4032ccccf33c7c4 100644 --- a/src/models/phi2.cpp +++ b/src/models/phi2.cpp @@ -64,6 +64,8 @@ llama_model_phi2::graph::graph(const llm_graph_params & params) : llm_graph_cont diff --git a/llama_cpp/patches/generated/0062-family-phi3--phi4.patch b/llama_cpp/patches/generated/0062-family-phi3--phi4.patch index 73e65078..92d9434d 100644 --- a/llama_cpp/patches/generated/0062-family-phi3--phi4.patch +++ b/llama_cpp/patches/generated/0062-family-phi3--phi4.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/phi3.cpp b/src/models/phi3.cpp -index 815ab0465b2a987daf01ad9383b568f4c0188b24..94e0061e505a3df3e4a68184aa126b22c7860807 100644 +index 4a856865de31c86f6decb284a17401526ed375b4..6c1d129bf6a9db29fffce21f765f39ea5d76e1fe 100644 --- a/src/models/phi3.cpp +++ b/src/models/phi3.cpp @@ -89,6 +89,8 @@ llama_model_phi3::graph::graph(const llm_graph_params & params) : llm_grap diff --git a/llama_cpp/patches/generated/0063-family-qwen2.patch b/llama_cpp/patches/generated/0063-family-qwen2.patch index 064b8f02..3b22bcef 100644 --- a/llama_cpp/patches/generated/0063-family-qwen2.patch +++ b/llama_cpp/patches/generated/0063-family-qwen2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen2.cpp b/src/models/qwen2.cpp -index bb93ca9b153c66eb5ab06bcd54a9148cf0a5ab32..f8cd21ca47f27a216ee8746ebde247e96555bd64 100644 +index 7846a5960e78179b45248b8339516bb3e5852bbf..7c0050199251e19f63936ae32700df9a28d4ff64 100644 --- a/src/models/qwen2.cpp +++ b/src/models/qwen2.cpp @@ -69,6 +69,8 @@ llama_model_qwen2::graph::graph(const llm_graph_params & params) : llm_graph_con diff --git a/llama_cpp/patches/generated/0064-family-qwen2-moe.patch b/llama_cpp/patches/generated/0064-family-qwen2-moe.patch index a6687491..ae19f321 100644 --- a/llama_cpp/patches/generated/0064-family-qwen2-moe.patch +++ b/llama_cpp/patches/generated/0064-family-qwen2-moe.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen2moe.cpp b/src/models/qwen2moe.cpp -index 256c91a8f209364616dc3ea9aafbf6ff9f62809a..f851bb076aae95a35af921fc2c0e0fe040d3c85d 100644 +index 56f137b97304abc9d1942cfaf25e6aa05a9b23c1..675b9f79163a5a4acf15c5b6f9acf7fa1535091e 100644 --- a/src/models/qwen2moe.cpp +++ b/src/models/qwen2moe.cpp @@ -84,6 +84,8 @@ llama_model_qwen2moe::graph::graph(const llm_graph_params & params) : llm_graph_ diff --git a/llama_cpp/patches/generated/0065-family-qwen2-vl.patch b/llama_cpp/patches/generated/0065-family-qwen2-vl.patch index e46b6249..28b9f644 100644 --- a/llama_cpp/patches/generated/0065-family-qwen2-vl.patch +++ b/llama_cpp/patches/generated/0065-family-qwen2-vl.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen2vl.cpp b/src/models/qwen2vl.cpp -index ba72876c2a8140e53881ba900c78c483f755938b..ac7e08649eb786552da6b5a149d624af3b88379c 100644 +index a70089fb17008e9b0752419d5aa70c61e9647ddd..72e5335ee8e1f9f455d829990aaaccf2741c5056 100644 --- a/src/models/qwen2vl.cpp +++ b/src/models/qwen2vl.cpp @@ -58,6 +58,8 @@ llama_model_qwen2vl::graph::graph(const llm_graph_params & params) : llm_graph_c diff --git a/llama_cpp/patches/generated/0066-family-qwen3-dense.patch b/llama_cpp/patches/generated/0066-family-qwen3-dense.patch index 047d4cd7..5a1958d6 100644 --- a/llama_cpp/patches/generated/0066-family-qwen3-dense.patch +++ b/llama_cpp/patches/generated/0066-family-qwen3-dense.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen3.cpp b/src/models/qwen3.cpp -index 7a6052970d8c35533dc33bf3a2e243fd9f29fa87..c5dc1c1c79a8ab74b4d5e5a858b3513b2bc8d46c 100644 +index 5059166e8220a7f9280fbbeaa51b0527aae83f1e..a468629a87e9ac869d40b6e8c66e1c3719571993 100644 --- a/src/models/qwen3.cpp +++ b/src/models/qwen3.cpp @@ -83,6 +83,8 @@ ggml_tensor * llama_model_qwen3::graph::build_backbone() { diff --git a/llama_cpp/patches/generated/0067-family-qwen3-moe.patch b/llama_cpp/patches/generated/0067-family-qwen3-moe.patch index 65398a8c..56a0797b 100644 --- a/llama_cpp/patches/generated/0067-family-qwen3-moe.patch +++ b/llama_cpp/patches/generated/0067-family-qwen3-moe.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen3moe.cpp b/src/models/qwen3moe.cpp -index 4cdf8d73c287ddb9fc7d9709614da29598a10dec..8ac119870a6e2e2f1cde47471756c8d11675d5ec 100644 +index d79e15163bf1aa8e9198dbe04fbd365f10206014..9e3cdd99984f7179f194f478554bd78b0f03cde8 100644 --- a/src/models/qwen3moe.cpp +++ b/src/models/qwen3moe.cpp @@ -122,6 +122,8 @@ llama_model_qwen3moe::graph::graph(const llm_graph_params & params) : llm_graph_ diff --git a/llama_cpp/patches/generated/0068-family-qwen3-next.patch b/llama_cpp/patches/generated/0068-family-qwen3-next.patch index 48421f52..6f2ea0e1 100644 --- a/llama_cpp/patches/generated/0068-family-qwen3-next.patch +++ b/llama_cpp/patches/generated/0068-family-qwen3-next.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen3next.cpp b/src/models/qwen3next.cpp -index b1327f9a77f5362670fbdd7292f095f671b0076a..91912b051565b43df87f885c8513f1718c744911 100644 +index 8ddd339b383d2271a48d15b779a636bc2dfaebd8..5d23fbda8825955fa93165a59d8b0e1390cf6c95 100644 --- a/src/models/qwen3next.cpp +++ b/src/models/qwen3next.cpp @@ -150,6 +150,8 @@ llama_model_qwen3next::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0069-family-qwen3-vl.patch b/llama_cpp/patches/generated/0069-family-qwen3-vl.patch index 80e5aa6c..ce11d601 100644 --- a/llama_cpp/patches/generated/0069-family-qwen3-vl.patch +++ b/llama_cpp/patches/generated/0069-family-qwen3-vl.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen3vl.cpp b/src/models/qwen3vl.cpp -index a0bc450f79258a5784aeae23a87d455f7898edea..413e24cab8c8cc893bbfbe6c308d080d801348bf 100644 +index 2c31f2090668b45129279c2db8a7a64e577088f6..41c1196757c09e7de6653ea85d6d214dbc80bf1b 100644 --- a/src/models/qwen3vl.cpp +++ b/src/models/qwen3vl.cpp @@ -85,6 +85,8 @@ llama_model_qwen3vl::graph::graph(const llm_graph_params & params) : llm_graph_c diff --git a/llama_cpp/patches/generated/0070-family-qwen35.patch b/llama_cpp/patches/generated/0070-family-qwen35.patch index af72b066..b0ecd725 100644 --- a/llama_cpp/patches/generated/0070-family-qwen35.patch +++ b/llama_cpp/patches/generated/0070-family-qwen35.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen35.cpp b/src/models/qwen35.cpp -index 6c71af445ef49693978a6dccf131685e57464b78..dd6f9a426c7fb79f085bb71b6551cb8947ece965 100644 +index 883e3c03460375dde17a86809591decc84f50557..0731fc85642cd1cc61d9bee7d5aa44526f7cd40a 100644 --- a/src/models/qwen35.cpp +++ b/src/models/qwen35.cpp @@ -161,6 +161,8 @@ llama_model_qwen35::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0071-family-qwen35moe.patch b/llama_cpp/patches/generated/0071-family-qwen35moe.patch index 2c12180c..b8056eb1 100644 --- a/llama_cpp/patches/generated/0071-family-qwen35moe.patch +++ b/llama_cpp/patches/generated/0071-family-qwen35moe.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen35moe.cpp b/src/models/qwen35moe.cpp -index 5874868b9e8aa21659b032e3513479d68e369aaf..0f310185d035fe02ce34e1c423a9b24d9f4ffc1c 100644 +index 1b926691a406fd1cf7fa80967bfe482be550a3f3..eff645cd6650c0433242fdf184163d41dec62945 100644 --- a/src/models/qwen35moe.cpp +++ b/src/models/qwen35moe.cpp @@ -173,6 +173,8 @@ llama_model_qwen35moe::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0072-family-qwen3vlmoe.patch b/llama_cpp/patches/generated/0072-family-qwen3vlmoe.patch index 0b333b0b..10fbbd62 100644 --- a/llama_cpp/patches/generated/0072-family-qwen3vlmoe.patch +++ b/llama_cpp/patches/generated/0072-family-qwen3vlmoe.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen3vlmoe.cpp b/src/models/qwen3vlmoe.cpp -index c13f619906ffb412eb909f1db525631950da6359..e20d396a88f39785c5763b98d4ae8882c10fe425 100644 +index 0d13a1dc542509771c9b69f437fcd26c71ebc23e..e47d64c6f8d74bdbeda3a767cbcb6d3a4c6e18f5 100644 --- a/src/models/qwen3vlmoe.cpp +++ b/src/models/qwen3vlmoe.cpp @@ -83,6 +83,8 @@ llama_model_qwen3vlmoe::graph::graph(const llm_graph_params & params) : llm_grap diff --git a/llama_cpp/patches/generated/0073-family-qwen4exp.patch b/llama_cpp/patches/generated/0073-family-qwen4exp.patch index ce0a53b0..020d9813 100644 --- a/llama_cpp/patches/generated/0073-family-qwen4exp.patch +++ b/llama_cpp/patches/generated/0073-family-qwen4exp.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/qwen4exp.cpp b/src/models/qwen4exp.cpp -index 9bc67bddf2b5dbf7ef870c51420c61d0ae50ff64..85177555a9a4297db15785df28e88b54d2dc9025 100644 +index a3cd1cb97f4ad80806144c4a19924e752c72e22b..fa0278407a59c6db63a6ccf6532007bf30adbaee 100644 --- a/src/models/qwen4exp.cpp +++ b/src/models/qwen4exp.cpp @@ -497,6 +497,8 @@ llama_model_qwen4exp::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/0074-family-rwkv6.patch b/llama_cpp/patches/generated/0074-family-rwkv6.patch index d8403724..283f51e6 100644 --- a/llama_cpp/patches/generated/0074-family-rwkv6.patch +++ b/llama_cpp/patches/generated/0074-family-rwkv6.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/rwkv6.cpp b/src/models/rwkv6.cpp -index c6df75ae59808b010a460904fdef0a98d5176e86..4993798dbdda9f7718b22665c2e59579b4443ad8 100644 +index ea92a377df830755c3c50c414fa792089bbcae1e..d21f363673b5e8b60d2e2a1f65eb854aa63f08bc 100644 --- a/src/models/rwkv6.cpp +++ b/src/models/rwkv6.cpp @@ -110,6 +110,8 @@ llama_model_rwkv6::graph::graph(const llm_graph_params & params) : @@ -21,7 +21,7 @@ index c6df75ae59808b010a460904fdef0a98d5176e86..4993798dbdda9f7718b22665c2e59579 const llama_layer * layer = &model.layers[il]; inpL = ggml_reshape_3d(ctx0, inpL, n_embd, n_seq_tokens, n_seqs); -@@ -169,6 +171,7 @@ llama_model_rwkv6::graph::graph(const llm_graph_params & params) : +@@ -171,6 +173,7 @@ llama_model_rwkv6::graph::graph(const llm_graph_params & params) : // input for next layer inpL = cur; @@ -30,7 +30,7 @@ index c6df75ae59808b010a460904fdef0a98d5176e86..4993798dbdda9f7718b22665c2e59579 cur = inpL; cur = build_norm(cur, model.output_norm, model.output_norm_b, LLM_NORM, -1); diff --git a/src/models/rwkv6qwen2.cpp b/src/models/rwkv6qwen2.cpp -index e81c0132f8cfb56ed50917cf1c9aa6c8e9c17e3e..2403ab3cae1eabdcc8311eee7e28181a799e8371 100644 +index 9139eda56ab1bc7a77ce1e6f8b99e5656c02b332..e230398505b34d6ed506e503b951d3b09c9e8329 100644 --- a/src/models/rwkv6qwen2.cpp +++ b/src/models/rwkv6qwen2.cpp @@ -98,6 +98,8 @@ llama_model_rwkv6qwen2::graph::graph(const llm_graph_params & params) : llm_buil diff --git a/llama_cpp/patches/generated/0075-family-rwkv7.patch b/llama_cpp/patches/generated/0075-family-rwkv7.patch index 8baa7856..ddc5dd77 100644 --- a/llama_cpp/patches/generated/0075-family-rwkv7.patch +++ b/llama_cpp/patches/generated/0075-family-rwkv7.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/rwkv7.cpp b/src/models/rwkv7.cpp -index 77c97f953a866c498c795aeea9962b7f4493bc92..c60943f9a5450a93ae9eff9467b5c93a63c4e69e 100644 +index e630a694dfdb580e528da34c8bbcddd552100d90..85415dd8d1cd723c3bb0c0ae4860a48248b4b180 100644 --- a/src/models/rwkv7.cpp +++ b/src/models/rwkv7.cpp @@ -141,6 +141,8 @@ llama_model_rwkv7::graph::graph(const llm_graph_params & params) : @@ -21,7 +21,7 @@ index 77c97f953a866c498c795aeea9962b7f4493bc92..c60943f9a5450a93ae9eff9467b5c93a const llama_layer * layer = &model.layers[il]; inpL = ggml_reshape_3d(ctx0, inpL, n_embd, n_seq_tokens, n_seqs); -@@ -195,6 +197,7 @@ llama_model_rwkv7::graph::graph(const llm_graph_params & params) : +@@ -197,6 +199,7 @@ llama_model_rwkv7::graph::graph(const llm_graph_params & params) : // input for next layer inpL = cur; diff --git a/llama_cpp/patches/generated/0076-family-smollm3.patch b/llama_cpp/patches/generated/0076-family-smollm3.patch index f670db8b..007f79ce 100644 --- a/llama_cpp/patches/generated/0076-family-smollm3.patch +++ b/llama_cpp/patches/generated/0076-family-smollm3.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/smollm3.cpp b/src/models/smollm3.cpp -index fa9e9c5395a7ad68e925267f7089f5892701e40f..4fe7a41c87083788767b759a2eed8fcfee268644 100644 +index dcb52b0a37605e7f86e1deb8145ba6e037a6240c..bf443124fc9720a6842927b7300b0e9423a2fac3 100644 --- a/src/models/smollm3.cpp +++ b/src/models/smollm3.cpp @@ -67,6 +67,8 @@ llama_model_smollm3::graph::graph(const llm_graph_params & params) : llm_graph_c diff --git a/llama_cpp/patches/generated/0077-family-spark2-5.patch b/llama_cpp/patches/generated/0077-family-spark2-5.patch index c8bba3d1..08dbc478 100644 --- a/llama_cpp/patches/generated/0077-family-spark2-5.patch +++ b/llama_cpp/patches/generated/0077-family-spark2-5.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/spark2-5.cpp b/src/models/spark2-5.cpp -index e90184d8e8665038cff07de511db69dc81fe904c..32b45d898e77dd59a625f7b8faffadb34c2e6cae 100644 +index c9076402a38cfa7511df5d02587f9dd8667ee7c6..a4c655bb35459508fb07c03043048547c1cdce5d 100644 --- a/src/models/spark2-5.cpp +++ b/src/models/spark2-5.cpp @@ -67,6 +67,8 @@ llama_model_spark2_5::graph::graph(const llm_graph_params & params) : llm_graph_ diff --git a/llama_cpp/patches/generated/0078-family-stablelm.patch b/llama_cpp/patches/generated/0078-family-stablelm.patch index 47488ef1..37fbb538 100644 --- a/llama_cpp/patches/generated/0078-family-stablelm.patch +++ b/llama_cpp/patches/generated/0078-family-stablelm.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/stablelm.cpp b/src/models/stablelm.cpp -index 5aec7beee520986ad6ba4c4563ad2bb7c8647517..a68cc0d623e3d48c65862e6cb739dbd93eba34a2 100644 +index fe2b874933289579b6ee33f24310fdb35d9e40bc..cb87fe4e1df84ca74a16e15597eff95ad6d0f95b 100644 --- a/src/models/stablelm.cpp +++ b/src/models/stablelm.cpp @@ -66,6 +66,8 @@ llama_model_stablelm::graph::graph(const llm_graph_params & params) : llm_graph_ diff --git a/llama_cpp/patches/generated/0079-family-starcoder2.patch b/llama_cpp/patches/generated/0079-family-starcoder2.patch index 14bcef71..f55ff118 100644 --- a/llama_cpp/patches/generated/0079-family-starcoder2.patch +++ b/llama_cpp/patches/generated/0079-family-starcoder2.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/starcoder2.cpp b/src/models/starcoder2.cpp -index 2b670d5629dbf61088c068de14143e72f0cc1cae..752f2aaa6451508a58fc4e220358b0f59de4e93d 100644 +index 9b3a14868dc8791a5d93aba671545320ed20fb84..85b49a788832087d7f6ebfa91e1ec47b65fbff07 100644 --- a/src/models/starcoder2.cpp +++ b/src/models/starcoder2.cpp @@ -75,6 +75,8 @@ llama_model_starcoder2::graph::graph(const llm_graph_params & params) : llm_grap diff --git a/llama_cpp/patches/generated/0080-family-step35.patch b/llama_cpp/patches/generated/0080-family-step35.patch index 055bac3d..4e95f0f5 100644 --- a/llama_cpp/patches/generated/0080-family-step35.patch +++ b/llama_cpp/patches/generated/0080-family-step35.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/step35.cpp b/src/models/step35.cpp -index 5bed70163a95d20e1e3f1521109a8972fe02e7b6..0f9e87c9731cf3dc26b83020e8424d577a52c419 100644 +index b2692d6a7906e40d16796e394be709401fc013e9..f2bd0e195d769b72ddeeef933c9cc9f2caa1e396 100644 --- a/src/models/step35.cpp +++ b/src/models/step35.cpp @@ -200,6 +200,8 @@ llama_model_step35::graph::graph(const llm_graph_params & params) : llm_graph_co diff --git a/llama_cpp/patches/generated/0081-family-unmapped.patch b/llama_cpp/patches/generated/0081-family-unmapped.patch index e5cfdbd7..10bc1eda 100644 --- a/llama_cpp/patches/generated/0081-family-unmapped.patch +++ b/llama_cpp/patches/generated/0081-family-unmapped.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/arctic.cpp b/src/models/arctic.cpp -index a72f2043b61bc174f585545f089a2e37d300bcf1..9961d4cd89dc154ae3479d71c404a6ee63411cf0 100644 +index f69ac4f18b3034724b01cc24601d9dab37e733d0..28bb0158a26471f03f70a245a24629705e3a6caf 100644 --- a/src/models/arctic.cpp +++ b/src/models/arctic.cpp @@ -72,6 +72,8 @@ llama_model_arctic::graph::graph(const llm_graph_params & params) : llm_graph_co @@ -30,7 +30,7 @@ index a72f2043b61bc174f585545f089a2e37d300bcf1..9961d4cd89dc154ae3479d71c404a6ee cur = inpL; diff --git a/src/models/baichuan.cpp b/src/models/baichuan.cpp -index 3bccc0bffdc9059783a4702aad4288585d3647de..b098fd326e9ccd67e8dc781a899c856243e23438 100644 +index 8cb5e46c76a00bf09d2b076ffb9bdb90c9fb7493..a726be73c4aedab951a665ceaa3b6d9f0d1332e4 100644 --- a/src/models/baichuan.cpp +++ b/src/models/baichuan.cpp @@ -67,6 +67,8 @@ llama_model_baichuan::graph::graph(const llm_graph_params & params) : llm_graph_ @@ -51,7 +51,7 @@ index 3bccc0bffdc9059783a4702aad4288585d3647de..b098fd326e9ccd67e8dc781a899c8562 cur = inpL; diff --git a/src/models/bailingmoe.cpp b/src/models/bailingmoe.cpp -index 890dcaa7b30c963d1ed6c5d1f62104b8d6072fa6..3205d2c6cac03dcf00c1a5b07be996f1bc4a7185 100644 +index dfa3add92da130540fe70dd707479f69c0ed5666..b5351b0f6caee6292d9e7219bed43d749159fcca 100644 --- a/src/models/bailingmoe.cpp +++ b/src/models/bailingmoe.cpp @@ -73,6 +73,8 @@ llama_model_bailingmoe::graph::graph(const llm_graph_params & params) : llm_grap @@ -72,7 +72,7 @@ index 890dcaa7b30c963d1ed6c5d1f62104b8d6072fa6..3205d2c6cac03dcf00c1a5b07be996f1 cur = inpL; diff --git a/src/models/beam.cpp b/src/models/beam.cpp -index 8654e0c95a4feef28fd02fcd137944011803da9f..0dc0177a70357e1b112bdab1902ba66cf8ecaafc 100644 +index f54166ae2765e0a5fd78601d892e1205e0f82860..30569a4ea3c23e84150640dc43a5e2146a49a28f 100644 --- a/src/models/beam.cpp +++ b/src/models/beam.cpp @@ -136,6 +136,8 @@ llama_model_beam::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -93,7 +93,7 @@ index 8654e0c95a4feef28fd02fcd137944011803da9f..0dc0177a70357e1b112bdab1902ba66c cur = inpL; diff --git a/src/models/bert.cpp b/src/models/bert.cpp -index b98faffc90fd38b2fb4df3b7f226a4dda3205cdb..741aeb0577b82ded54505fcb52a317386b8cb680 100644 +index b4978636eef76de47331d03e84853c2e3c0d08bc..88d670d416533e2df75b9316bff0509535fc6d12 100644 --- a/src/models/bert.cpp +++ b/src/models/bert.cpp @@ -106,6 +106,8 @@ llama_model_bert::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -114,10 +114,10 @@ index b98faffc90fd38b2fb4df3b7f226a4dda3205cdb..741aeb0577b82ded54505fcb52a31738 cur = inpL; diff --git a/src/models/bitnet.cpp b/src/models/bitnet.cpp -index 269028f5ffb74000917014fb41a886653fc11ee3..d3879f2cbd401cb437a7e764effe9a411fb39db8 100644 +index 981c2ee474ea4db65d4bc3ac721bc2d9c4a21615..a313ff511973ac027ba91ee2407a5a8f5faf0f88 100644 --- a/src/models/bitnet.cpp +++ b/src/models/bitnet.cpp -@@ -67,6 +67,8 @@ llama_model_bitnet::graph::graph(const llm_graph_params & params) : llm_graph_co +@@ -60,6 +60,8 @@ llama_model_bitnet::graph::graph(const llm_graph_params & params) : llm_graph_co ggml_tensor * inp_out_ids = build_inp_out_ids(); for (int il = 0; il < n_layer; ++il) { @@ -126,7 +126,7 @@ index 269028f5ffb74000917014fb41a886653fc11ee3..d3879f2cbd401cb437a7e764effe9a41 ggml_tensor * inpSA = inpL; cur = build_norm(inpL, -@@ -140,6 +142,7 @@ llama_model_bitnet::graph::graph(const llm_graph_params & params) : llm_graph_co +@@ -133,6 +135,7 @@ llama_model_bitnet::graph::graph(const llm_graph_params & params) : llm_graph_co // input for next layer inpL = cur; @@ -135,7 +135,7 @@ index 269028f5ffb74000917014fb41a886653fc11ee3..d3879f2cbd401cb437a7e764effe9a41 cur = inpL; diff --git a/src/models/clef.cpp b/src/models/clef.cpp -index c41c93cb138c83cb5b3e941885fa0bf9cc812ac0..9c4aa05b373ec1d1d5037d1f513eacd7b70d5869 100644 +index 0add0655b8d1aeb12e4273c33185c7d43860a6e1..9d2ac0f1733deddb7a9e6e4ea0d1c20e40dd2c8f 100644 --- a/src/models/clef.cpp +++ b/src/models/clef.cpp @@ -278,6 +278,8 @@ llama_model_clef::graph::graph(const llm_graph_params & params) : @@ -156,7 +156,7 @@ index c41c93cb138c83cb5b3e941885fa0bf9cc812ac0..9c4aa05b373ec1d1d5037d1f513eacd7 cur = build_norm(inpL, model.output_norm, nullptr, LLM_NORM_RMS, -1); diff --git a/src/models/clover-moe.cpp b/src/models/clover-moe.cpp -index 83799726145c89d38f1de233fb5938cfb840a3b6..c1da628709dc0834995c0add614694f4fd324d34 100644 +index bc1519d652970c17ab83dfc876ad14325e485ab3..1bd8304db660c254a95a0ca87dab429112e6c51f 100644 --- a/src/models/clover-moe.cpp +++ b/src/models/clover-moe.cpp @@ -135,6 +135,8 @@ llama_model_clover_moe::graph::graph(const llm_graph_params & params) : @@ -177,7 +177,7 @@ index 83799726145c89d38f1de233fb5938cfb840a3b6..c1da628709dc0834995c0add614694f4 cur = inpL; diff --git a/src/models/codeshell.cpp b/src/models/codeshell.cpp -index e316602f5a21e71bace02682f3e93925a26d525f..9d13a8561d76a2e86795cd571a2164ec59fde79e 100644 +index b37af8c1271c4d31de091e6ec7a42d700bf64690..c069b02889f8cbc20416c44ed714fa4c7a691e2b 100644 --- a/src/models/codeshell.cpp +++ b/src/models/codeshell.cpp @@ -69,6 +69,8 @@ llama_model_codeshell::graph::graph(const llm_graph_params & params) : llm_graph @@ -198,7 +198,7 @@ index e316602f5a21e71bace02682f3e93925a26d525f..9d13a8561d76a2e86795cd571a2164ec cur = build_norm(inpL, diff --git a/src/models/cogvlm.cpp b/src/models/cogvlm.cpp -index 657b7d89d1c8b95d1bfff98367ff38e20d79ce04..c19c88579c2746d77c75a8db97219289dbc794d7 100644 +index 36c8d1093c4ffe5ce7f8bc4a6d3510b55df7c709..0474d35405daa7b2e31ce9516999083b56478800 100644 --- a/src/models/cogvlm.cpp +++ b/src/models/cogvlm.cpp @@ -94,6 +94,8 @@ llama_model_cogvlm::graph::graph(const llm_graph_params & params) : @@ -208,9 +208,9 @@ index 657b7d89d1c8b95d1bfff98367ff38e20d79ce04..c19c88579c2746d77c75a8db97219289 + begin_block(inpL, il); + // get either the text or image weight tensors - ggml_tensor *wqkv, *wo, *wo_s; + ggml_tensor *wqkv, *wo; ggml_tensor *ffn_gate, *ffn_down, *ffn_up; -@@ -160,6 +162,7 @@ llama_model_cogvlm::graph::graph(const llm_graph_params & params) : +@@ -158,6 +160,7 @@ llama_model_cogvlm::graph::graph(const llm_graph_params & params) : // input for next layer inpL = cur; @@ -219,7 +219,7 @@ index 657b7d89d1c8b95d1bfff98367ff38e20d79ce04..c19c88579c2746d77c75a8db97219289 cur = inpL; diff --git a/src/models/cohere2moe.cpp b/src/models/cohere2moe.cpp -index c4d778e5050d7309cdbc0d02a5eb1b02b62df11a..43f96b34975fa2362441a5dc0bd5fde6d1e8f7cc 100644 +index 70a1418cbc9692256e4faaa21d5def7fae100b36..6c1c9fcef51ef9a818fa106c8fd145029ce8b330 100644 --- a/src/models/cohere2moe.cpp +++ b/src/models/cohere2moe.cpp @@ -172,6 +172,8 @@ llama_model_cohere2moe::graph::graph(const llm_graph_params & params) : llm_grap @@ -240,7 +240,7 @@ index c4d778e5050d7309cdbc0d02a5eb1b02b62df11a..43f96b34975fa2362441a5dc0bd5fde6 cur = inpL; diff --git a/src/models/command-r.cpp b/src/models/command-r.cpp -index bea97e6d81d8f35ece0dbda838a99726c559f869..8271b17a50e3be30fe8edd3ed8fd2ee20b3e738f 100644 +index 056cb04f87829eaab4c39f7cbbb7c0a7d57e53e8..d35a507b6bd50fc5ffdc1f5a01b50c56d6bcac2b 100644 --- a/src/models/command-r.cpp +++ b/src/models/command-r.cpp @@ -64,6 +64,8 @@ llama_model_command_r::graph::graph(const llm_graph_params & params) : @@ -261,7 +261,7 @@ index bea97e6d81d8f35ece0dbda838a99726c559f869..8271b17a50e3be30fe8edd3ed8fd2ee2 cur = inpL; diff --git a/src/models/dbrx.cpp b/src/models/dbrx.cpp -index 343040e0bd339db09dfad1477daf6314868f7eb8..ea1c54431851e527966bd7ee66f0649fbc33a177 100644 +index 10910c22951548548600cd89641a8aa67dc72448..97ca597f06b9acfab1c978dd0b8a25c5e31608a8 100644 --- a/src/models/dbrx.cpp +++ b/src/models/dbrx.cpp @@ -63,6 +63,8 @@ llama_model_dbrx::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -282,7 +282,7 @@ index 343040e0bd339db09dfad1477daf6314868f7eb8..ea1c54431851e527966bd7ee66f0649f cur = inpL; diff --git a/src/models/deci.cpp b/src/models/deci.cpp -index 114b12640796560fbb0d0d7e5bc9dfea693c7b9d..673ad70f6c6cdd7858b3a4e5bbf330746108f458 100644 +index f1e593c6984ff70d361b06a8dea616005539f8ef..00fc287d039afab9c46d1cdaeaf85285ef536827 100644 --- a/src/models/deci.cpp +++ b/src/models/deci.cpp @@ -99,6 +99,8 @@ llama_model_deci::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -311,7 +311,7 @@ index 114b12640796560fbb0d0d7e5bc9dfea693c7b9d..673ad70f6c6cdd7858b3a4e5bbf33074 cur = inpL; diff --git a/src/models/deepseek.cpp b/src/models/deepseek.cpp -index c6a6d6a97521fa8cfee3c8073e7ccfd9ff594108..a88cb1dd2e3636258be19c27b6102b505888521e 100644 +index 8b7865f244b3409edc64a27d78200fa985deedae..305f684f661e074f06f92f329a56bc026bb45cd1 100644 --- a/src/models/deepseek.cpp +++ b/src/models/deepseek.cpp @@ -94,6 +94,8 @@ llama_model_deepseek::graph::graph(const llm_graph_params & params) : @@ -332,7 +332,7 @@ index c6a6d6a97521fa8cfee3c8073e7ccfd9ff594108..a88cb1dd2e3636258be19c27b6102b50 cur = inpL; diff --git a/src/models/deepseek41.cpp b/src/models/deepseek41.cpp -index c9c00b88558b44cad40439f7d30fa3658d3fdb7d..2a2aa48a374a651b9df0c870cd5f478a09b65f35 100644 +index 9cc21d429a9fdb80ccf6da11c53d91010264e0af..c6585e7d3a4a840564fc17b91d8053c582157771 100644 --- a/src/models/deepseek41.cpp +++ b/src/models/deepseek41.cpp @@ -832,6 +832,8 @@ llama_model_deepseek41::graph::graph(const llm_graph_params & params) : @@ -353,7 +353,7 @@ index c9c00b88558b44cad40439f7d30fa3658d3fdb7d..2a2aa48a374a651b9df0c870cd5f478a // no hc_head: collapse with the last FFN's pre-mix diff --git a/src/models/diffusion-gemma.cpp b/src/models/diffusion-gemma.cpp -index d34473c69df83f0b75647ebc1f645c7d01ff5c55..548107464c622e27dac4227cf64c43fb03c51c4e 100644 +index 02ba1e47c87f17296dccbe61a16770827e30376b..40dca0d59b37c3b81accaaa0606792ea0f2faf21 100644 --- a/src/models/diffusion-gemma.cpp +++ b/src/models/diffusion-gemma.cpp @@ -493,6 +493,8 @@ llama_model_diffusion_gemma::graph::graph(const llama_model & model, const llm_g @@ -374,7 +374,7 @@ index d34473c69df83f0b75647ebc1f645c7d01ff5c55..548107464c622e27dac4227cf64c43fb cur = inpL; diff --git a/src/models/domyn-edge.cpp b/src/models/domyn-edge.cpp -index 6452894d34bee29fb55141fbbacb30d4df5dec72..9def4649b32cbc41fa82425510e9a7b3e7b46554 100644 +index 27282045d198a69a0fdf85c45e2bc2ae323c6b34..bbe43c49e0b7d799bea00469867cc4e147e1c7d2 100644 --- a/src/models/domyn-edge.cpp +++ b/src/models/domyn-edge.cpp @@ -83,6 +83,8 @@ llama_model_domyn_edge::graph::graph(const llm_graph_params & params) @@ -395,7 +395,7 @@ index 6452894d34bee29fb55141fbbacb30d4df5dec72..9def4649b32cbc41fa82425510e9a7b3 cur = build_norm(inpL, model.output_norm, NULL, LLM_NORM_RMS, -1); diff --git a/src/models/dots3note.cpp b/src/models/dots3note.cpp -index 2a2d5500b992c751a567a386aff0bc4d1bf05d4b..90a48634daf14cce19491457afe1d1ea48d2babc 100644 +index 206557b12205b3c9034204e12b1894ee3a048adc..28bd48af112582da674646238ed9ab16dc5015ba 100644 --- a/src/models/dots3note.cpp +++ b/src/models/dots3note.cpp @@ -182,6 +182,8 @@ llama_model_dots3note::graph::graph(const llm_graph_params & params) : @@ -416,7 +416,7 @@ index 2a2d5500b992c751a567a386aff0bc4d1bf05d4b..90a48634daf14cce19491457afe1d1ea cur = inpL; diff --git a/src/models/dream.cpp b/src/models/dream.cpp -index 76c0b03c86a5f64bfbeadba4515822f6a62cc138..3223350ef48c4a7310a9363399ee9d32e297ad88 100644 +index 9b0a0fbe431cce712c6b5e4c21d5623908688003..a6e3946b71e969df096005deddba144d825403af 100644 --- a/src/models/dream.cpp +++ b/src/models/dream.cpp @@ -70,6 +70,8 @@ llama_model_dream::graph::graph(const llm_graph_params & params) : @@ -437,7 +437,7 @@ index 76c0b03c86a5f64bfbeadba4515822f6a62cc138..3223350ef48c4a7310a9363399ee9d32 cur = inpL; diff --git a/src/models/eurobert.cpp b/src/models/eurobert.cpp -index 7a42f0dbf2e1442ed69611f365ece39ab472a75c..dc8ac42bdb5e78d24ba8121a18a0b4d58a8164c2 100644 +index 891d262f024b69f9ce257403eec9279baa26422f..fab5e5789e39b5ad6392cfe0ba5c3386de76b629 100644 --- a/src/models/eurobert.cpp +++ b/src/models/eurobert.cpp @@ -52,6 +52,8 @@ llama_model_eurobert::graph::graph(const llm_graph_params & params) : llm_graph_ @@ -458,7 +458,7 @@ index 7a42f0dbf2e1442ed69611f365ece39ab472a75c..dc8ac42bdb5e78d24ba8121a18a0b4d5 cur = inpL; diff --git a/src/models/exaone-moe.cpp b/src/models/exaone-moe.cpp -index 15bbd5a3f6e8eaca2ae4281ffb3a184ce2904dcc..10028c01a0b2283b34fd7a8d3b0e96cdc68fde8f 100644 +index c85ca8ce673e8e9dce8862327ed3efe165dad176..08350e822dcd0cf6ac6a4b4a990a091b3b2f0c1a 100644 --- a/src/models/exaone-moe.cpp +++ b/src/models/exaone-moe.cpp @@ -136,6 +136,8 @@ llama_model_exaone_moe::graph::graph(const llm_graph_params & params) : @@ -479,7 +479,7 @@ index 15bbd5a3f6e8eaca2ae4281ffb3a184ce2904dcc..10028c01a0b2283b34fd7a8d3b0e96cd cur = inpL; diff --git a/src/models/exaone.cpp b/src/models/exaone.cpp -index 780f34f04571fea8bebf676fbe0eac6cfd730f1e..e2dc66638aeca115b2f369a36396fd07e300608a 100644 +index 9f30e342188af492250b446b20f967a9179801df..ee5c2f2e4e41fee6642fb8d4f1d462ab6e41469a 100644 --- a/src/models/exaone.cpp +++ b/src/models/exaone.cpp @@ -63,6 +63,8 @@ llama_model_exaone::graph::graph(const llm_graph_params & params) : @@ -500,7 +500,7 @@ index 780f34f04571fea8bebf676fbe0eac6cfd730f1e..e2dc66638aeca115b2f369a36396fd07 cur = inpL; diff --git a/src/models/flint.cpp b/src/models/flint.cpp -index 173278b6f34c4cba355ab47d0b8b8c3cec07eddd..9c5e59af5e1e733f4b606bc833dc4a0c3f584b94 100644 +index 8f78ea2b816a57aaa4910c39011ba0e409ca391c..0d2278ae33a401417348c851b375953eae39835a 100644 --- a/src/models/flint.cpp +++ b/src/models/flint.cpp @@ -104,6 +104,8 @@ llama_model_flint::graph::graph(const llm_graph_params & params) : @@ -521,7 +521,7 @@ index 173278b6f34c4cba355ab47d0b8b8c3cec07eddd..9c5e59af5e1e733f4b606bc833dc4a0c cur = inpL; diff --git a/src/models/gemma-embedding.cpp b/src/models/gemma-embedding.cpp -index aa43910be0c0de9e2f5da078ac3f5c39cc4f7fb5..2de935723b7ae75d1e424bdb68cf8cf07c061703 100644 +index a07a73c9e98a52f7e16e4cbfcd6a717a8cf3a560..bf2af2d56cd0bc99b1ec2492102440535357fe9b 100644 --- a/src/models/gemma-embedding.cpp +++ b/src/models/gemma-embedding.cpp @@ -89,6 +89,8 @@ llama_model_gemma_embedding::graph::graph(const llm_graph_params & params) : @@ -542,7 +542,7 @@ index aa43910be0c0de9e2f5da078ac3f5c39cc4f7fb5..2de935723b7ae75d1e424bdb68cf8cf0 cur = inpL; diff --git a/src/models/gemma-embedding2.cpp b/src/models/gemma-embedding2.cpp -index 920827dc58d857cfd77b213820358850dab364aa..84110ebdb1b54232b11ea1ccdfded2e257709691 100644 +index 3dcc4d9c992fab4bfa47568e362036d474114993..b2fc17c805719d61f89450080e284432944ec908 100644 --- a/src/models/gemma-embedding2.cpp +++ b/src/models/gemma-embedding2.cpp @@ -96,6 +96,8 @@ llama_model_gemma_embedding2::graph::graph(const llm_graph_params & params) : @@ -563,10 +563,10 @@ index 920827dc58d857cfd77b213820358850dab364aa..84110ebdb1b54232b11ea1ccdfded2e2 cur = build_norm(inpL, model.output_norm, nullptr, LLM_NORM_RMS, -1); diff --git a/src/models/glm5-next.cpp b/src/models/glm5-next.cpp -index 452aea5abfb4f5cbc8b89418108691ecbb79af54..15e92ab6cc458e77ee45e6f2804fdc0d4e3f096c 100644 +index c2b4081518fe8102223e04afff80ae82d6c5adeb..a5984e6376af15340fb0e4c929e67c693d204f21 100644 --- a/src/models/glm5-next.cpp +++ b/src/models/glm5-next.cpp -@@ -713,6 +713,8 @@ llama_model_glm5_next::graph::graph(const llm_graph_params & params) : +@@ -712,6 +712,8 @@ llama_model_glm5_next::graph::graph(const llm_graph_params & params) : ggml_tensor * prev_sel = nullptr; for (int il = 0; il < n_layer; ++il) { @@ -575,7 +575,7 @@ index 452aea5abfb4f5cbc8b89418108691ecbb79af54..15e92ab6cc458e77ee45e6f2804fdc0d // Speculative drafters (DFlash, EAGLE3) read the stream-mean residual entering each layer. if ((size_t) il < cparams.embeddings_layer_inp.size() && cparams.embeddings_layer_inp[il]) { res->t_layer_inp[il] = build_hc_mean(inpL); -@@ -786,6 +788,7 @@ llama_model_glm5_next::graph::graph(const llm_graph_params & params) : +@@ -785,6 +787,7 @@ llama_model_glm5_next::graph::graph(const llm_graph_params & params) : inpL = build_hc_post(cur, residual, ffn_hc.post, ffn_hc.comb, il); inpL = build_cvec(inpL, il); cb(inpL, "l_out", il); @@ -584,7 +584,7 @@ index 452aea5abfb4f5cbc8b89418108691ecbb79af54..15e92ab6cc458e77ee45e6f2804fdc0d if ((size_t) n_layer < cparams.embeddings_layer_inp.size() && cparams.embeddings_layer_inp[n_layer]) { diff --git a/src/models/gpt2.cpp b/src/models/gpt2.cpp -index 711a148a28bd1aa2c1dccf2e3b21803aac4a4185..1b8d70b304628707d8d71efbd83fda0e6e787792 100644 +index b34d3688e1c4e43a202d80157c1e7019b12cfed1..349c9bc2346e6dfb3253cb9e0e5631261941e78b 100644 --- a/src/models/gpt2.cpp +++ b/src/models/gpt2.cpp @@ -81,6 +81,8 @@ llama_model_gpt2::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -605,7 +605,7 @@ index 711a148a28bd1aa2c1dccf2e3b21803aac4a4185..1b8d70b304628707d8d71efbd83fda0e cur = build_norm(inpL, diff --git a/src/models/grok.cpp b/src/models/grok.cpp -index 36debf2ad2085874ddea5755038fb9f147dae701..dd1832acbdbf50d76cbf2625e83351878bdb19d0 100644 +index e2598e65cf8815f86155d6fbd99af9d2c5dff9dd..b7847ff67b100dacfbcdba94d18387dffd7f28c9 100644 --- a/src/models/grok.cpp +++ b/src/models/grok.cpp @@ -99,6 +99,8 @@ llama_model_grok::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -626,7 +626,7 @@ index 36debf2ad2085874ddea5755038fb9f147dae701..dd1832acbdbf50d76cbf2625e8335187 cur = inpL; diff --git a/src/models/hunyuan-moe.cpp b/src/models/hunyuan-moe.cpp -index 00659c88eb53c377a1d30e9bdba4e2670ce0cb65..dd2f5ab2f7bb996a77aee08b3659e6abcc650bc2 100644 +index 0bcf008104a34c47b98ff61b6e85aba93d2aa90b..7048fc7137aa548a6e67a28a4f62e997be226578 100644 --- a/src/models/hunyuan-moe.cpp +++ b/src/models/hunyuan-moe.cpp @@ -82,6 +82,8 @@ llama_model_hunyuan_moe::graph::graph(const llm_graph_params & params) : llm_gra @@ -647,7 +647,7 @@ index 00659c88eb53c377a1d30e9bdba4e2670ce0cb65..dd2f5ab2f7bb996a77aee08b3659e6ab cur = inpL; diff --git a/src/models/hy-v4-flash.cpp b/src/models/hy-v4-flash.cpp -index 7f5c39232ec6786195522f1faa0ef529c971f8fb..3ef05560fbba7425ac1cc3eec85498b7184e8cde 100644 +index 063b7aea41dc477fc5e3120bfc683d80f19441a8..825166a7339fd80645bdcb770065cec9a34f570f 100644 --- a/src/models/hy-v4-flash.cpp +++ b/src/models/hy-v4-flash.cpp @@ -1011,6 +1011,8 @@ llama_model_hy_v4_flash::graph::graph(const llama_model & model, const llm_graph @@ -668,7 +668,7 @@ index 7f5c39232ec6786195522f1faa0ef529c971f8fb..3ef05560fbba7425ac1cc3eec85498b7 // prune the output rows after all streams, or after the nextn state when it needs every row diff --git a/src/models/hy-v4.cpp b/src/models/hy-v4.cpp -index de7d87cd03ee978fd70c20f5eb1b2d086158282b..a9e294d655e8f0d0659f7ea78b65f57b40063324 100644 +index 88465f70fef6b6aed710427c275ccc662bfab839..6e3aebbe7da44e74a478d2874704199f746ab6d9 100644 --- a/src/models/hy-v4.cpp +++ b/src/models/hy-v4.cpp @@ -501,6 +501,8 @@ llama_model_hy_v4::graph::graph(const llm_graph_params & params) : @@ -689,10 +689,10 @@ index de7d87cd03ee978fd70c20f5eb1b2d086158282b..a9e294d655e8f0d0659f7ea78b65f57b // prune to the requested output rows once, after all HC streams are done diff --git a/src/models/inkling2.cpp b/src/models/inkling2.cpp -index 9960a4fc1d0d9ab667830a425eaddee3cd7d1fbe..419f1b0a3a5462d58c1a12e1bb77311d7593d952 100644 +index 5560c182021a9ba1e7beb22112ef9acb7e5b5671..927efc15ef42ee274ae283a4e268f14ba7752e09 100644 --- a/src/models/inkling2.cpp +++ b/src/models/inkling2.cpp -@@ -459,9 +459,12 @@ llama_model_inkling2::graph::graph(const llm_graph_params & params) : llm_graph_ +@@ -469,9 +469,12 @@ llama_model_inkling2::graph::graph(const llm_graph_params & params) : llm_graph_ std::vector blocks; for (int il = 0; il < n_layer; ++il) { @@ -706,7 +706,7 @@ index 9960a4fc1d0d9ab667830a425eaddee3cd7d1fbe..419f1b0a3a5462d58c1a12e1bb77311d build_output(cur, blocks); diff --git a/src/models/k2-horizon.cpp b/src/models/k2-horizon.cpp -index cf82347b7e66fd4764e76555c5b57d21a0da5414..e5b1c085dc3695430f00e86564ed16f1088b2402 100644 +index 5654d5759b39a13b6133469901f8c30939b8e7a3..dfa1583574ef2108bd2837c0c39c13f7f2d624f4 100644 --- a/src/models/k2-horizon.cpp +++ b/src/models/k2-horizon.cpp @@ -227,6 +227,8 @@ llama_model_k2_horizon::graph::graph(const llm_graph_params & params) : llm_grap @@ -727,7 +727,7 @@ index cf82347b7e66fd4764e76555c5b57d21a0da5414..e5b1c085dc3695430f00e86564ed16f1 cur = k2_horizon_group_rms_norm(ctx0, inpL, model.output_norm, hparams.n_norm_groups, hparams.f_norm_rms_eps); diff --git a/src/models/kimi-k31.cpp b/src/models/kimi-k31.cpp -index 49e0c747e8ccb03b896c065076e14c016c440fa7..c3ac763ffc971290a18fed26bd0d71c0b60f342a 100644 +index 5cda968252d133b3e1c12e7afaa836c1d717b748..7d5693c2743593cdc8d410ebaa8db00d1afecaa6 100644 --- a/src/models/kimi-k31.cpp +++ b/src/models/kimi-k31.cpp @@ -308,6 +308,8 @@ llama_model_kimi_k31::graph::graph(const llm_graph_params & params) : @@ -748,7 +748,7 @@ index 49e0c747e8ccb03b896c065076e14c016c440fa7..c3ac763ffc971290a18fed26bd0d71c0 cur = inpL; diff --git a/src/models/kokoro.cpp b/src/models/kokoro.cpp -index c236134af87c1912a233bdf1d39070356abc43b2..d6f2c3a1064ea44651e56f4310f4a3c1fa79dd88 100644 +index 77f230a83b62fad2a43a81131fc46308364512ca..2a4bbfd84bfbd8225f3d0938d8f22c7ffabbe26b 100644 --- a/src/models/kokoro.cpp +++ b/src/models/kokoro.cpp @@ -93,6 +93,8 @@ llama_model_kokoro::graph::graph(const llm_graph_params & params) : llm_graph_co @@ -769,7 +769,7 @@ index c236134af87c1912a233bdf1d39070356abc43b2..d6f2c3a1064ea44651e56f4310f4a3c1 cur = inpL; diff --git a/src/models/kolibri1.cpp b/src/models/kolibri1.cpp -index 64182d186061bea2f2b791d3ebdddcc54f184f04..9873481a1750f47c28dc6cc38dc80d074b1aa07f 100644 +index ebaf039bc0400429206908558cb7863c1f772e03..c08090385155af87caa1afcbe0ace50d8144e284 100644 --- a/src/models/kolibri1.cpp +++ b/src/models/kolibri1.cpp @@ -81,6 +81,8 @@ llama_model_kolibri1::graph::graph(const llm_graph_params & params) @@ -790,7 +790,7 @@ index 64182d186061bea2f2b791d3ebdddcc54f184f04..9873481a1750f47c28dc6cc38dc80d07 cur = build_norm(inpL, model.output_norm, NULL, LLM_NORM_RMS, -1); diff --git a/src/models/lfm3.cpp b/src/models/lfm3.cpp -index a820d9b97e1e9ce68cc56cb5a2c9ebd09c64927a..f12a8dc7877bd72372740b32e9029522318d1388 100644 +index 273e1609494f8136cb222f6def66e668cd1b5207..7d765740962ebd2edae3a63e0cd429f8d3f4faea 100644 --- a/src/models/lfm3.cpp +++ b/src/models/lfm3.cpp @@ -149,6 +149,8 @@ llama_model_lfm3::graph::graph(const llm_graph_params & params) : @@ -811,7 +811,7 @@ index a820d9b97e1e9ce68cc56cb5a2c9ebd09c64927a..f12a8dc7877bd72372740b32e9029522 cur = build_norm(cur, model.output_norm, NULL, LLM_NORM_RMS, -1); diff --git a/src/models/limite.cpp b/src/models/limite.cpp -index 887bfef63091eb0679303152998c8ced2751f32e..693380b177d176300cfadd5171c48026f10bb700 100644 +index 38107cf525a7faa33a9cb7ebe0ed3c9336f8aede..be1703238f652496672ef3e66152a02ec5f70bf4 100644 --- a/src/models/limite.cpp +++ b/src/models/limite.cpp @@ -118,6 +118,8 @@ llama_model_limite::graph::graph(const llm_graph_params & params) : llm_graph_co @@ -832,7 +832,7 @@ index 887bfef63091eb0679303152998c8ced2751f32e..693380b177d176300cfadd5171c48026 cur = build_norm(inpL, nullptr, nullptr, LLM_NORM_RMS, -1); diff --git a/src/models/llada-moe.cpp b/src/models/llada-moe.cpp -index 0086d52afd8a92a4b8dc3c5307fb4b96ca91d8cc..1b78b4ea330dc787781781744942df4ccc5f1f03 100644 +index cc4e9b972c7634ad2893a6039e0639a5a78177b1..25d3508b16a108a113bfc4f75f71e8faa56aaf2b 100644 --- a/src/models/llada-moe.cpp +++ b/src/models/llada-moe.cpp @@ -70,6 +70,8 @@ llama_model_llada_moe::graph::graph(const llm_graph_params & params) : llm_graph @@ -853,7 +853,7 @@ index 0086d52afd8a92a4b8dc3c5307fb4b96ca91d8cc..1b78b4ea330dc787781781744942df4c cur = inpL; diff --git a/src/models/llada.cpp b/src/models/llada.cpp -index 8777cff642ccf837177912ff1c0e8a48ab3eab12..c323a5feab230a29341cd3cf747d2cd8ec124e7a 100644 +index ef540aaef3fbb75527b15ff24cb4417857df4844..8fdb4311f6374975cd02a091b08e8f80b4ac8ca3 100644 --- a/src/models/llada.cpp +++ b/src/models/llada.cpp @@ -92,6 +92,8 @@ llama_model_llada::graph::graph(const llm_graph_params & params) : llm_graph_con @@ -874,7 +874,7 @@ index 8777cff642ccf837177912ff1c0e8a48ab3eab12..c323a5feab230a29341cd3cf747d2cd8 cur = inpL; diff --git a/src/models/maion-coder.cpp b/src/models/maion-coder.cpp -index 5c1e376c5d8c8fc593a0cf6675800d13a5c344aa..c42646cfe2fe680277206fa4a78cf08e664ead4a 100644 +index 19860070182c459aec6176130a72e97748af1a9a..69dc68d6f36e57ad638f843d6efaa9768ab5ead9 100644 --- a/src/models/maion-coder.cpp +++ b/src/models/maion-coder.cpp @@ -82,6 +82,8 @@ llama_model_maion_coder::graph::graph(const llm_graph_params & params) : llm_gra @@ -895,7 +895,7 @@ index 5c1e376c5d8c8fc593a0cf6675800d13a5c344aa..c42646cfe2fe680277206fa4a78cf08e ggml_tensor * cur = build_norm(inpL, model.output_norm, NULL, LLM_NORM_RMS, -1); diff --git a/src/models/maple.cpp b/src/models/maple.cpp -index eb0b3b4ac823d1296a72f0005c882a0e4da45528..51fe55a82be64152556c69ce4084bd2d8f92dd46 100644 +index 202bb9d5443cce7b9cd7218b17256bcb36255531..0e9d775d00df69c0a9d2c6c4132d947913737c31 100644 --- a/src/models/maple.cpp +++ b/src/models/maple.cpp @@ -75,6 +75,8 @@ llama_model_maple::graph::graph(const llm_graph_params & params) : @@ -916,7 +916,7 @@ index eb0b3b4ac823d1296a72f0005c882a0e4da45528..51fe55a82be64152556c69ce4084bd2d ggml_tensor * cur = build_norm(inpL, model.output_norm, nullptr, LLM_NORM_RMS, -1); diff --git a/src/models/minimax-01.cpp b/src/models/minimax-01.cpp -index 2ca70e8efe2862deb5e76b2b6cdf037dae4f5272..6efe6299b14998e00f6cd326ef2cf4d769d076d2 100644 +index eed269ac59a73ae28a54b374069a17da3d4aaccb..1e94e892c17b1e0d176662280d136d46e358c134 100644 --- a/src/models/minimax-01.cpp +++ b/src/models/minimax-01.cpp @@ -239,6 +239,8 @@ llama_model_minimax_01::graph::graph(const llm_graph_params & params) : llm_grap @@ -937,7 +937,7 @@ index 2ca70e8efe2862deb5e76b2b6cdf037dae4f5272..6efe6299b14998e00f6cd326ef2cf4d7 cur = inpL; diff --git a/src/models/mistral-large4.cpp b/src/models/mistral-large4.cpp -index aab49df9d8a4e7d50c1448389121e28cf3fa17ad..2c9e367c6790661db692bc83013970e44624d407 100644 +index 952313804d55ef0422b72986ea57298d4ed053a7..4a2a79343766213945d0ed8831fafe03b1c5121e 100644 --- a/src/models/mistral-large4.cpp +++ b/src/models/mistral-large4.cpp @@ -216,6 +216,8 @@ llama_model_mistral_large4::graph::graph(const llm_graph_params & params) : @@ -958,7 +958,7 @@ index aab49df9d8a4e7d50c1448389121e28cf3fa17ad..2c9e367c6790661db692bc83013970e4 if (extract_last) { diff --git a/src/models/modern-bert.cpp b/src/models/modern-bert.cpp -index 17c9c5ab6b91fd898eea89e32dd25cecb8eafb15..4ed2caea19424d9acc8ff82f939b81fc1e280620 100644 +index 9b3aa03748341b1dce5904a13f8ba3691d652c1d..b89b26a914f21660871261990c0cbd206bf301c9 100644 --- a/src/models/modern-bert.cpp +++ b/src/models/modern-bert.cpp @@ -160,6 +160,8 @@ llama_model_modern_bert::graph::graph(const llm_graph_params & params) : llm_gra @@ -979,7 +979,7 @@ index 17c9c5ab6b91fd898eea89e32dd25cecb8eafb15..4ed2caea19424d9acc8ff82f939b81fc cur = inpL; diff --git a/src/models/moshi.cpp b/src/models/moshi.cpp -index 5cb63cd7e855b8dc5c758435f9ff360f2d58a908..883931f0382c5af33cb3240b9b597c2a97b079c5 100644 +index 724dafa719fd5abff5c66c1e915d44937c9c2bfd..25ee264f557850793f643f41d7f745a9d33c1f76 100644 --- a/src/models/moshi.cpp +++ b/src/models/moshi.cpp @@ -67,6 +67,8 @@ llama_model_moshi::graph::graph(const llm_graph_params & params) : llm_graph_con @@ -1000,7 +1000,7 @@ index 5cb63cd7e855b8dc5c758435f9ff360f2d58a908..883931f0382c5af33cb3240b9b597c2a cur = build_norm(inpL, model.output_norm, NULL, LLM_NORM_RMS, -1); diff --git a/src/models/muse-spark.cpp b/src/models/muse-spark.cpp -index 10de4676e12fa439603206c023a41324840bfa3c..1e516abccf84dc808473372c482b639cc6e19a60 100644 +index 6f84424815d06c15a7424f42c17ec79c65d95bdd..51b2272ab5d7e87a488281996a3767fa8819041d 100644 --- a/src/models/muse-spark.cpp +++ b/src/models/muse-spark.cpp @@ -95,6 +95,8 @@ llama_model_muse_spark::graph::graph(const llm_graph_params & params) @@ -1021,7 +1021,7 @@ index 10de4676e12fa439603206c023a41324840bfa3c..1e516abccf84dc808473372c482b639c cur = inpL; diff --git a/src/models/nanbeige.cpp b/src/models/nanbeige.cpp -index 2f3e0ff1c3e70e6157a0a780af3c982580264378..1e184e8bfc203610bef38c5b5e865dff02d7594c 100644 +index 0c70e32ad76ea25ecd08d781d0b821028f941e8a..603e3e9352351ce70daed8e1872bf0d823b68d68 100644 --- a/src/models/nanbeige.cpp +++ b/src/models/nanbeige.cpp @@ -103,6 +103,8 @@ llama_model_nanbeige::graph::graph(const llm_graph_params & params) : @@ -1042,7 +1042,7 @@ index 2f3e0ff1c3e70e6157a0a780af3c982580264378..1e184e8bfc203610bef38c5b5e865dff cur = inpL; diff --git a/src/models/neo-bert.cpp b/src/models/neo-bert.cpp -index 58a012a689508f504ff5facee14cf1a73f10cfbd..47e57c2793d877260b8203eb8fbf69f7e1c05727 100644 +index 3b9a0f85d9709bb0b47ab7c8acdb67ee4098a34e..7321d4e5145d399ac455e4f105972821887dc00d 100644 --- a/src/models/neo-bert.cpp +++ b/src/models/neo-bert.cpp @@ -58,6 +58,8 @@ llama_model_neo_bert::graph::graph(const llm_graph_params & params) : llm_graph_ @@ -1063,7 +1063,7 @@ index 58a012a689508f504ff5facee14cf1a73f10cfbd..47e57c2793d877260b8203eb8fbf69f7 cur = inpL; diff --git a/src/models/olmo.cpp b/src/models/olmo.cpp -index 2afead631bace4538c105d77be09dd4d97a0663d..62c677f7f6a3e7a6f715ae9efdce5ad6d52416fb 100644 +index 844b6dfe48924ef377be95e68c52cfeac8f62a67..ae1113116c1aa83a68ef93d3945625bb584153c3 100644 --- a/src/models/olmo.cpp +++ b/src/models/olmo.cpp @@ -59,6 +59,8 @@ llama_model_olmo::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -1084,7 +1084,7 @@ index 2afead631bace4538c105d77be09dd4d97a0663d..62c677f7f6a3e7a6f715ae9efdce5ad6 cur = inpL; diff --git a/src/models/olmoe.cpp b/src/models/olmoe.cpp -index 9ebdd9c94aebd30c24a9bcb1efbbca1231529bc3..93e4e2721911d642f006fba16aeaa915b591e0f3 100644 +index 3f3952ac1db10a95c36df5093c64e5513bd0c357..0e04f78b2964a3c6b79fe430a1cdbada7c0bf29e 100644 --- a/src/models/olmoe.cpp +++ b/src/models/olmoe.cpp @@ -69,6 +69,8 @@ llama_model_olmoe::graph::graph(const llm_graph_params & params) : llm_graph_con @@ -1105,7 +1105,7 @@ index 9ebdd9c94aebd30c24a9bcb1efbbca1231529bc3..93e4e2721911d642f006fba16aeaa915 cur = inpL; diff --git a/src/models/openelm.cpp b/src/models/openelm.cpp -index 3328bd54c6831d4af1caa2584d3fe51d19291aa5..a0612781d314322aefa1ea361353bef1b80e3e86 100644 +index 6db688a0ef1aa2eb18ac3bc474b23f07ab8dd848..2b3b357f906611a1dae7ad8105485931834514d9 100644 --- a/src/models/openelm.cpp +++ b/src/models/openelm.cpp @@ -64,6 +64,8 @@ llama_model_openelm::graph::graph(const llm_graph_params & params) : llm_graph_c @@ -1126,7 +1126,7 @@ index 3328bd54c6831d4af1caa2584d3fe51d19291aa5..a0612781d314322aefa1ea361353bef1 cur = inpL; diff --git a/src/models/orion.cpp b/src/models/orion.cpp -index 4fe921189571d9522a6ad4d2e2ad03e84247f63f..f71cf96c0f6306594a6fbe308a44e9db1b9d28c9 100644 +index e1dbe6bdae847e2528d0a449fa8d95527a22e092..3773604325302d00683ea425389b11c641d7d7fa 100644 --- a/src/models/orion.cpp +++ b/src/models/orion.cpp @@ -59,6 +59,8 @@ llama_model_orion::graph::graph(const llm_graph_params & params) : llm_graph_con @@ -1147,7 +1147,7 @@ index 4fe921189571d9522a6ad4d2e2ad03e84247f63f..f71cf96c0f6306594a6fbe308a44e9db cur = inpL; diff --git a/src/models/paddleocr.cpp b/src/models/paddleocr.cpp -index 4dbd9e21554208e649a28c7cd316c95857353104..cafb617cbf4c09d99b6a7829806d1f8ec08c24e9 100644 +index 684c2d480871d3663180ec6cb236e52a63e00686..0bdbe6b8ae52816a856766f5ce33153b6e11841f 100644 --- a/src/models/paddleocr.cpp +++ b/src/models/paddleocr.cpp @@ -27,6 +27,8 @@ llama_model_paddleocr::graph::graph(const llm_graph_params & params) : @@ -1168,7 +1168,7 @@ index 4dbd9e21554208e649a28c7cd316c95857353104..cafb617cbf4c09d99b6a7829806d1f8e cur = inpL; diff --git a/src/models/pangu-embed.cpp b/src/models/pangu-embed.cpp -index 336c71a41a8b6bf523d82b5a88d59e003e177867..d722065783977c2b13e6755a065dbe161afa31ec 100644 +index 92cc43fbffe2489fc963fb7ebd8c9155ad444273..f3e698d04f9b7097c36531379de6fbb9e0ea6c59 100644 --- a/src/models/pangu-embed.cpp +++ b/src/models/pangu-embed.cpp @@ -82,6 +82,8 @@ llama_model_pangu_embed::graph::graph(const llm_graph_params & params) : llm_gra @@ -1189,7 +1189,7 @@ index 336c71a41a8b6bf523d82b5a88d59e003e177867..d722065783977c2b13e6755a065dbe16 cur = inpL; diff --git a/src/models/plamo.cpp b/src/models/plamo.cpp -index 10348f291e005490f40bf717ce32e9049d6ea7e4..374542bf9483a05491cd81a34898db8acbda2973 100644 +index cc695ea1078e238a31de5e0efc2451828e771ff6..dca51bd356bba0eaf0a079021a219a7a5639e87c 100644 --- a/src/models/plamo.cpp +++ b/src/models/plamo.cpp @@ -55,6 +55,8 @@ llama_model_plamo::graph::graph(const llm_graph_params & params) : llm_graph_con @@ -1210,7 +1210,7 @@ index 10348f291e005490f40bf717ce32e9049d6ea7e4..374542bf9483a05491cd81a34898db8a cur = inpL; diff --git a/src/models/plamo2.cpp b/src/models/plamo2.cpp -index f019bd0b6955e18d350c09b9a667e41859bf7241..1385dc7ced57ea627f5d7e621e405cb15cfe2a9d 100644 +index c04d0fab3add18144706868780a52c9cd8a8e2e4..bd0f2ef89d94b63bf7fb0f2cebb7dce141983cf7 100644 --- a/src/models/plamo2.cpp +++ b/src/models/plamo2.cpp @@ -123,6 +123,8 @@ llama_model_plamo2::graph::graph(const llm_graph_params & params) : @@ -1231,7 +1231,7 @@ index f019bd0b6955e18d350c09b9a667e41859bf7241..1385dc7ced57ea627f5d7e621e405cb1 cur = inpL; diff --git a/src/models/plamo3.cpp b/src/models/plamo3.cpp -index d6de1a3564467966d3eab3d812786498dc90a507..af53882958c5da2f5cc0b860873adbeb863c5d0a 100644 +index 5efb13dea71b106d38ace6a99d99a61c083857b6..00146c192b44deb712a89dc4666866d5b4434bf0 100644 --- a/src/models/plamo3.cpp +++ b/src/models/plamo3.cpp @@ -87,6 +87,8 @@ llama_model_plamo3::graph::graph(const llm_graph_params & params) : @@ -1252,7 +1252,7 @@ index d6de1a3564467966d3eab3d812786498dc90a507..af53882958c5da2f5cc0b860873adbeb cur = inpL; diff --git a/src/models/plm.cpp b/src/models/plm.cpp -index b0069e49b954adeab32fc0b26f16dd8167be4938..f037bfe1cdb0a76b7b02f295e7f4bfd0b6fb1fdf 100644 +index 40a487d85e9161cf8fb2ca356ac8e4763200af0d..a50eb147e035997be2b7c317bb670833149fc0d0 100644 --- a/src/models/plm.cpp +++ b/src/models/plm.cpp @@ -67,6 +67,8 @@ llama_model_plm::graph::graph(const llm_graph_params & params) : llm_graph_conte @@ -1273,7 +1273,7 @@ index b0069e49b954adeab32fc0b26f16dd8167be4938..f037bfe1cdb0a76b7b02f295e7f4bfd0 cur = inpL; diff --git a/src/models/pockettts.cpp b/src/models/pockettts.cpp -index a7dcb5366a129e6e914a600ceb44abd0d17a9fa3..987c7baf128699dadff30d5000fa3d89a6f7055f 100644 +index 9b7a1669fef29b2198651546f53d7936353e462f..6e020075eed544aefff8b64cc4b1044355f3da7e 100644 --- a/src/models/pockettts.cpp +++ b/src/models/pockettts.cpp @@ -63,6 +63,8 @@ llama_model_pockettts::graph::graph(const llm_graph_params & params) : llm_graph @@ -1294,7 +1294,7 @@ index a7dcb5366a129e6e914a600ceb44abd0d17a9fa3..987c7baf128699dadff30d5000fa3d89 cur = build_norm(inpL, diff --git a/src/models/qwen.cpp b/src/models/qwen.cpp -index 4e0b1986da88a67b1820ce968e42dccbe8c8c6bd..292adb2aa1c0e1a7be5a3eb847873fbd01a98533 100644 +index 0e6325bb9aea380567731b1040f55263998330c3..6a92d1e28b0dceaeceda606d61fe62128b5f71e4 100644 --- a/src/models/qwen.cpp +++ b/src/models/qwen.cpp @@ -58,6 +58,8 @@ llama_model_qwen::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -1315,7 +1315,7 @@ index 4e0b1986da88a67b1820ce968e42dccbe8c8c6bd..292adb2aa1c0e1a7be5a3eb847873fbd cur = inpL; diff --git a/src/models/raon1-mini.cpp b/src/models/raon1-mini.cpp -index e5b1671ecdd4880eb1af015757427427e7025444..e526d566aa3f2792c08053c85a605d93c3529391 100644 +index 70fbfa35126b0efeaf83cc8cdf62f713d2571915..8bd92cf482bdba3ffb2d41bec76017e287e99cc9 100644 --- a/src/models/raon1-mini.cpp +++ b/src/models/raon1-mini.cpp @@ -425,6 +425,8 @@ llama_model_raon1_mini::graph::graph(const llm_graph_params & params) : llm_buil @@ -1336,7 +1336,7 @@ index e5b1671ecdd4880eb1af015757427427e7025444..e526d566aa3f2792c08053c85a605d93 ggml_tensor * cur = nullptr; for (int64_t i = 0; i < hc; ++i) { diff --git a/src/models/refact.cpp b/src/models/refact.cpp -index 51bb0bad6227bbfc37619bb06e2b43cee915e25b..ec4b6063ea2a131411b0628cf1c04a28f3fa2104 100644 +index de379f7d70f97f6ad40b7b4a3ed91f4d456c81d2..ed4c48650a03f68f71c1dd45c1d0b06c685a5b5d 100644 --- a/src/models/refact.cpp +++ b/src/models/refact.cpp @@ -91,6 +91,8 @@ llama_model_refact::graph::graph(const llm_graph_params & params) : llm_graph_co @@ -1357,7 +1357,7 @@ index 51bb0bad6227bbfc37619bb06e2b43cee915e25b..ec4b6063ea2a131411b0628cf1c04a28 cur = inpL; diff --git a/src/models/ricursive.cpp b/src/models/ricursive.cpp -index 306cdd4dc6c42065868c7a19b3bb0a0ab39450e0..68740b0b7a08f44624497382006f0d575a67f9c6 100644 +index 07ef4420e37c6256942137681129f9891e57dad6..276898857e46524858b9df67f3e07d85835ec959 100644 --- a/src/models/ricursive.cpp +++ b/src/models/ricursive.cpp @@ -130,6 +130,8 @@ llama_model_ricursive::graph::graph(const llm_graph_params & params) : llm_graph @@ -1378,7 +1378,7 @@ index 306cdd4dc6c42065868c7a19b3bb0a0ab39450e0..68740b0b7a08f44624497382006f0d57 cur = build_norm(inpL, model.output_norm, NULL, LLM_NORM_RMS, -1); diff --git a/src/models/rnd1.cpp b/src/models/rnd1.cpp -index 8ea8d23649a0824348551d235de59a1c0a5e4947..dd52092f860585e9fcc6cab90bed3593c1fba04e 100644 +index cf16a5071e3f988ac8b7d16624ab3538d14440cd..f4a79fa9383c7a5edba402ce1554d98faa641fd9 100644 --- a/src/models/rnd1.cpp +++ b/src/models/rnd1.cpp @@ -82,6 +82,8 @@ llama_model_rnd1::graph::graph(const llm_graph_params & params) : llm_graph_cont @@ -1399,7 +1399,7 @@ index 8ea8d23649a0824348551d235de59a1c0a5e4947..dd52092f860585e9fcc6cab90bed3593 cur = inpL; diff --git a/src/models/seed-oss.cpp b/src/models/seed-oss.cpp -index c7940dc806b4ce0fa74303dac62553cba88bc622..03744e09f8e0d853b29ff177485980a78a024525 100644 +index 85cdbbf069356902147980ba5de8b6ef4e4569a2..10a8a90fab149da67810b7cd5362e510c1e03497 100644 --- a/src/models/seed-oss.cpp +++ b/src/models/seed-oss.cpp @@ -67,6 +67,8 @@ llama_model_seed_oss::graph::graph(const llm_graph_params & params) : llm_graph_ @@ -1420,7 +1420,7 @@ index c7940dc806b4ce0fa74303dac62553cba88bc622..03744e09f8e0d853b29ff177485980a7 cur = inpL; diff --git a/src/models/sensenova-u1.cpp b/src/models/sensenova-u1.cpp -index 7c8025703f18f8fdfa971244803e06f9fac9d7de..8904aed0ba35b2d71b9f9c9e017e7fff3aa74956 100644 +index cdd974d72b00a13f0ab79414d16d57fe8472a469..169c82584bb8c419081ff079361a242ebfc7d58f 100644 --- a/src/models/sensenova-u1.cpp +++ b/src/models/sensenova-u1.cpp @@ -125,6 +125,8 @@ llama_model_sensenova_u1::graph::graph(const llm_graph_params & params) : llm_gr @@ -1441,7 +1441,7 @@ index 7c8025703f18f8fdfa971244803e06f9fac9d7de..8904aed0ba35b2d71b9f9c9e017e7fff cur = inpL; diff --git a/src/models/smallthinker.cpp b/src/models/smallthinker.cpp -index 2c183e33c629220ed867c208e07bc6173134b959..d638affcb65c34a1e95a72b26946352b052828ad 100644 +index 76f61f02147ec580ad8b8bc34c70036e57ab4617..4a2084d53b3098ce6423258b5a457e1a6fcfca9e 100644 --- a/src/models/smallthinker.cpp +++ b/src/models/smallthinker.cpp @@ -101,6 +101,8 @@ llama_model_smallthinker::graph::graph(const llm_graph_params & params) : @@ -1462,7 +1462,7 @@ index 2c183e33c629220ed867c208e07bc6173134b959..d638affcb65c34a1e95a72b26946352b cur = inpL; diff --git a/src/models/starcoder.cpp b/src/models/starcoder.cpp -index 7d73aa01bcbe225744eb0debaed2ea31f335a303..503f785d02fd6e8249ac15298e93dc19bd0587b3 100644 +index 700ab0ce13d8f165373ca96054468f00a54985bc..43d14b30151446e78561a028be04dc42c4c9f679 100644 --- a/src/models/starcoder.cpp +++ b/src/models/starcoder.cpp @@ -81,6 +81,8 @@ llama_model_starcoder::graph::graph(const llm_graph_params & params) : llm_graph @@ -1483,7 +1483,7 @@ index 7d73aa01bcbe225744eb0debaed2ea31f335a303..503f785d02fd6e8249ac15298e93dc19 cur = build_norm(inpL, model.output_norm, diff --git a/src/models/t5.cpp b/src/models/t5.cpp -index 8a0aac1c8004eb81e4504ec4b965aa6e12b742f9..9b789a57a8071ba217405978525f7b2342c2c7ca 100644 +index 86b14a1d9b60b93bd1a288ab1498c8eb1017fc1f..c07d8b4b92ff536a2312385226b40cb4ccf4dc2f 100644 --- a/src/models/t5.cpp +++ b/src/models/t5.cpp @@ -131,6 +131,8 @@ llama_model_t5::graph::graph(const llm_graph_params & params) : llm_graph @@ -1521,7 +1521,7 @@ index 8a0aac1c8004eb81e4504ec4b965aa6e12b742f9..9b789a57a8071ba217405978525f7b23 cur = inpL; cb(cur, "result_embd", -1); diff --git a/src/models/talkie.cpp b/src/models/talkie.cpp -index 5bf18f0665e3987514746467b1158c1a9d1f2498..a643066c7f97ce9cf4b40d5506b820e1c80edce2 100644 +index afb6e67725a805cc2a0bd9f14a7ede1fcb03bd0b..ce11a44b501cffa85b6d7a5131b82a2984111dae 100644 --- a/src/models/talkie.cpp +++ b/src/models/talkie.cpp @@ -62,6 +62,8 @@ llama_model_talkie::graph::graph(const llm_graph_params & params) : llm_graph_co @@ -1542,7 +1542,7 @@ index 5bf18f0665e3987514746467b1158c1a9d1f2498..a643066c7f97ce9cf4b40d5506b820e1 cur = inpL; diff --git a/src/models/tiny-voca.cpp b/src/models/tiny-voca.cpp -index c7541f5e92785466926ef33ca065cec40bd8460b..f61d9cc29765bf2ff53ba0e5fab6652137c80cf4 100644 +index b4969f3c641f6a264228020c078d2f3107dbdc5e..8d2214c1ab11b7fb8ceaa21f1d5332c3b5187b44 100644 --- a/src/models/tiny-voca.cpp +++ b/src/models/tiny-voca.cpp @@ -104,6 +104,8 @@ llama_model_tiny_voca::graph::graph(const llm_graph_params & params) : llm_graph @@ -1563,10 +1563,10 @@ index c7541f5e92785466926ef33ca065cec40bd8460b..f61d9cc29765bf2ff53ba0e5fab66521 cur = build_norm(inpL, model.output_norm, model.output_norm_b, LLM_NORM, -1); diff --git a/src/models/xing4-0.cpp b/src/models/xing4-0.cpp -index f405fcc9c9c5dd3d6803121d8730742c05d88194..2ead2e64771cb675462e406663c74fdb6d6eabed 100644 +index e19c3527249e6f17cbf15b990265b782d34685e6..0f5c159d0ee0eb9e2b03a20136ccf4315080d14a 100644 --- a/src/models/xing4-0.cpp +++ b/src/models/xing4-0.cpp -@@ -626,6 +626,8 @@ llama_model_xing4_0::graph::graph(const llama_model & model, const llm_graph_par +@@ -622,6 +622,8 @@ llama_model_xing4_0::graph::graph(const llama_model & model, const llm_graph_par cb(inpL, "hc_init", -1); for (int il = 0; il < n_layer; ++il) { @@ -1575,7 +1575,7 @@ index f405fcc9c9c5dd3d6803121d8730742c05d88194..2ead2e64771cb675462e406663c74fdb const auto & layer = model.layers[il]; ggml_tensor * residual = inpL; -@@ -794,6 +796,7 @@ llama_model_xing4_0::graph::graph(const llama_model & model, const llm_graph_par +@@ -790,6 +792,7 @@ llama_model_xing4_0::graph::graph(const llama_model & model, const llm_graph_par inpL = build_hc_post(cur, residual, post, comb, il); inpL = build_cvec(inpL, il); cb(inpL, "l_out", il); @@ -1584,7 +1584,7 @@ index f405fcc9c9c5dd3d6803121d8730742c05d88194..2ead2e64771cb675462e406663c74fdb cur = inpL; diff --git a/src/models/xverse.cpp b/src/models/xverse.cpp -index e0710bd9cecd32525d667d528579e9426efe0028..08d0bc8c7aa9904285f821227253b7f6466c1403 100644 +index 7d83a55da27ab1eb7985f674d46c085c111058e1..b4e7971ef98f0bec80d2858893126b67ce119a35 100644 --- a/src/models/xverse.cpp +++ b/src/models/xverse.cpp @@ -57,6 +57,8 @@ llama_model_xverse::graph::graph(const llm_graph_params & params) : llm_graph_co @@ -1605,7 +1605,7 @@ index e0710bd9cecd32525d667d528579e9426efe0028..08d0bc8c7aa9904285f821227253b7f6 cur = inpL; diff --git a/src/models/zaya1.cpp b/src/models/zaya1.cpp -index 013658c7344868ff8b6a1057d9757a4a88dd0617..d0f6533a0864e144be452b92859cf7f9595c3329 100644 +index dd9082d0edf81b1b82e768a4fac1fd6d6d2309f9..ab4bef9c8b4fffc194369b01e2d3f287d204ffc6 100644 --- a/src/models/zaya1.cpp +++ b/src/models/zaya1.cpp @@ -296,6 +296,8 @@ llama_model_zaya1::graph::graph(const llama_model & model, const llm_graph_param @@ -1626,7 +1626,7 @@ index 013658c7344868ff8b6a1057d9757a4a88dd0617..d0f6533a0864e144be452b92859cf7f9 cur = build_norm(cur, model.output_norm, NULL, LLM_NORM_RMS, -1); diff --git a/src/models/zonos3.cpp b/src/models/zonos3.cpp -index 6877e172583068ee6c7a8ff7788300514ef3cd25..23437d1e534c450e5e6ac9754f62fe627c5027c4 100644 +index 4cc0f19ccb704156e199c34d33c2e34d047cf2ed..a5b72704d298a8fd9aff42d0ad86d5d4ccd11c5f 100644 --- a/src/models/zonos3.cpp +++ b/src/models/zonos3.cpp @@ -118,6 +118,8 @@ llama_model_zonos3::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/series.json b/llama_cpp/patches/generated/series.json index ae0c9f32..b8826a37 100644 --- a/llama_cpp/patches/generated/series.json +++ b/llama_cpp/patches/generated/series.json @@ -1,5 +1,5 @@ { - "full_patch_sha256": "d6a3e1a3b32a0aabe570cc287616e264b2ae21798b91f7638247939a708b425b", + "full_patch_sha256": "c09a7108de0f9c3f68be61d9c5450ba70c77a86d02cc110c838fcd0f63d4733f", "generator_version": "0.5.0", "schema_version": 1, "shards": [ @@ -8,7 +8,7 @@ "afmoe" ], "file": "0001-family-afmoe.patch", - "sha256": "938f2b02f0f7f3f0542e06bc82a6b1329dc09c078af2f6bb6c748000fc359bcb", + "sha256": "2bacbe9a2e7b8b5880036daf16b388f262be7c17d29bd314f56f8f963efab921", "sources": [ "src/models/afmoe.cpp" ] @@ -18,7 +18,7 @@ "apertus" ], "file": "0002-family-apertus.patch", - "sha256": "ee8d335e2c22ef3da92a502a3be2978b39bc4a235675af1c32a7d8e2fd882b2d", + "sha256": "b637ebadbb30710cffd42204f2eaf79198d3e971b1a050751f98f316f24901ee", "sources": [ "src/models/apertus.cpp" ] @@ -28,7 +28,7 @@ "arcee" ], "file": "0003-family-arcee.patch", - "sha256": "b5aa70fbcf05930add3f184883ee6a90f7f5d5a76531cf37fec239784ffe6a73", + "sha256": "b7a1c6d4404b54fb4b2acc5cf95a2c4f293d4e3c7e99ce2b898bf95c7cd0a672", "sources": [ "src/models/arcee.cpp" ] @@ -39,7 +39,7 @@ "rwkv7" ], "file": "0004-family-arwkv7--rwkv7.patch", - "sha256": "610d1236cac421095d33c028033526d93c5a55adaaa77cc5563b3dc345bc4b93", + "sha256": "a6b3a52708e234eac6e87d771f235bf45baaee54ad3335922d6d77b432f5bdae", "sources": [ "src/models/arwkv7.cpp" ] @@ -49,7 +49,7 @@ "bailingmoe2" ], "file": "0005-family-bailingmoe2.patch", - "sha256": "2ae8e7691da594ec78d8f9e58623732f9c9e5a3e110e3f5e0a23ddab227e2ef4", + "sha256": "bf326c0407c81722e6d6bac61033199afe4c4fd465b3e919ce4e5dfdd5e07549", "sources": [ "src/models/bailingmoe2.cpp" ] @@ -59,7 +59,7 @@ "bailingmoe3" ], "file": "0006-family-bailingmoe3.patch", - "sha256": "c709680caf0d51dc268efe63a45dcd8dd2b9acb87f3dd73f66cb9004b5fc4a37", + "sha256": "c851908b90ba8d44080f178e289af8a7bf065d6e47c5b42b632a4d801511be97", "sources": [ "src/models/bailingmoe3.cpp" ] @@ -69,7 +69,7 @@ "bloom" ], "file": "0007-family-bloom.patch", - "sha256": "790196afbc2e5db5fc13248a4eacafbb2ecefefb8753d45c96eb25455fdbe5d3", + "sha256": "a3c568108ba058b7e792856432b48e3a9e937f48afad8a5bfb85cf9237620ece", "sources": [ "src/models/bloom.cpp" ] @@ -79,7 +79,7 @@ "chameleon" ], "file": "0008-family-chameleon.patch", - "sha256": "da36515600ec09d2aae3a217e8128d97d1f77940e1ac011f01c3dde9827a4d2e", + "sha256": "38397a1716c1e03b34108d92bbbb14ddcaa2fd2b21c9133803c0034588622177", "sources": [ "src/models/chameleon.cpp" ] @@ -89,7 +89,7 @@ "cohere2" ], "file": "0009-family-cohere2.patch", - "sha256": "08a6e721c26f58bd49e1c3d14f715fa1a8316a2ef84bc3817a4948c9c69e922e", + "sha256": "07b5747c177b09b4422463232a61d3e3d5946fc7a653deed1ba42538c24d6697", "sources": [ "src/models/cohere2.cpp" ] @@ -101,7 +101,7 @@ "mistral4" ], "file": "0010-family-deepseek2--glm47-flash--mistral4.patch", - "sha256": "d95aa84e7bc7386869efb40cf864a0f17dafbb1c7118f587f29c22fe0bef89c8", + "sha256": "983fff9076385f737d9caa2117edd37440fdd9844770023befdaf954da9da7fd", "sources": [ "src/models/deepseek2.cpp" ] @@ -111,7 +111,7 @@ "deepseek32" ], "file": "0011-family-deepseek32.patch", - "sha256": "1b3503117e828ce7205512b6c1cb67e3714a533ac71e106fefd9ca00277ae5ac", + "sha256": "15d1aad3041c602098fda5ae26bc62b19872d9c26df2686283a4bf9fe2cbc893", "sources": [ "src/models/deepseek32.cpp" ] @@ -121,7 +121,7 @@ "deepseek4" ], "file": "0012-family-deepseek4.patch", - "sha256": "2a8f5f48031811fa18b484f89aa7bd5c99f271f4d31893a1b567689f2e8d802f", + "sha256": "365cdae66813fe979ae04fffcdd5a82a70f2b7adaae53b0accc750085be8aa96", "sources": [ "src/models/deepseek4.cpp", "src/models/dflash.cpp" @@ -132,7 +132,7 @@ "dots1" ], "file": "0013-family-dots1.patch", - "sha256": "379d8ad78429b74364949341b16de2ea24ac498c7c95335b17abd0c2f1b15503", + "sha256": "91d34251250ec5f9eb106c92cceeb18a2a3a4f33927872af1d86121246d1ca62", "sources": [ "src/models/dots1.cpp" ] @@ -142,7 +142,7 @@ "ernie4-5" ], "file": "0014-family-ernie4-5.patch", - "sha256": "b451f17268b5f41a7720cc08fc01fd682477a6817952b7658823cc691d2c7bfa", + "sha256": "c1cd80e5a55d0709827b850cd8ed930495798d80865a1add48657603a3765eb8", "sources": [ "src/models/ernie4-5.cpp" ] @@ -152,7 +152,7 @@ "ernie4-5-moe" ], "file": "0015-family-ernie4-5-moe.patch", - "sha256": "e1d8741e2d7f9ff83ca88900601fb96bd8c2907ed237aaf7e8b0354b382300b2", + "sha256": "93d3b00597247db487de3e39dcba68af84404b80e57877f44f15e6991f2ec4b0", "sources": [ "src/models/ernie4-5-moe.cpp" ] @@ -162,7 +162,7 @@ "exaone4" ], "file": "0016-family-exaone4.patch", - "sha256": "8907d8552f3f7933953f8ad1e3dfc987c90afba4b8dd9dfd34fcdcaf9dba8191", + "sha256": "526e5f1a1f760de3d98ee3b780e15e2c03115856c0f4a4b3e13ffa4b5f3a7ec6", "sources": [ "src/models/exaone4.cpp" ] @@ -172,7 +172,7 @@ "falcon-dense" ], "file": "0017-family-falcon-dense.patch", - "sha256": "f7806763f94c44368374cc3ebc939181d97c4465adb70ac84c2b6a48ff061870", + "sha256": "a8def9655557a56d383687d89aaabf7c97c57e961c9d02d8c56d1b52ef350f19", "sources": [ "src/models/falcon.cpp" ] @@ -182,7 +182,7 @@ "falcon-h1" ], "file": "0018-family-falcon-h1.patch", - "sha256": "016e56398285118ef7c957f6a74d8e64f5af8aa27334a2658bb20daf625c53e6", + "sha256": "bcf00a2b77da284d867870271254eb932892007d626548369321eed99aced2e0", "sources": [ "src/models/falcon-h1.cpp" ] @@ -192,7 +192,7 @@ "gemma" ], "file": "0019-family-gemma.patch", - "sha256": "d53592cd99ab036d786d8fb9ad0cb3525d34c8a6ecc1b50cb0d92a11d6da2867", + "sha256": "01c132e5ff88641c8a0dc02194494dbb6108eecbac7e941db0aaf38e4d18da57", "sources": [ "src/models/gemma.cpp" ] @@ -202,7 +202,7 @@ "gemma2" ], "file": "0020-family-gemma2.patch", - "sha256": "cdbeaa4565ca77559d346eeeb5be3335ff1b464d830f65f2fd35c07173ab1470", + "sha256": "8cd4df925b2d1e5a2a210e108451e32217cc9a0023e9ccee7b7ab0027f28fa31", "sources": [ "src/models/gemma2.cpp" ] @@ -212,7 +212,7 @@ "gemma3" ], "file": "0021-family-gemma3.patch", - "sha256": "572ed97e4b941bf3691e802a58c76b26d637f0984d9ea11302ae5b23e2bb81a2", + "sha256": "19a7df9434610f605319748523361919bc1c3b2939434782c721754aa38911c0", "sources": [ "src/models/gemma3.cpp" ] @@ -222,7 +222,7 @@ "gemma3n" ], "file": "0022-family-gemma3n.patch", - "sha256": "c7cb95d328f023110b3107c09ec621074c00be72f66e10c090210a40e841e64a", + "sha256": "77ea6d5fe2cdc67690ec3dd562f73f4e1b4fb09ce9600b4f23b02cd08b469a6c", "sources": [ "src/models/gemma3n.cpp" ] @@ -232,7 +232,7 @@ "gemma4" ], "file": "0023-family-gemma4.patch", - "sha256": "aa415a89669b6915fd41a900811115e7e1102ddf89d2f0f526913115a12610af", + "sha256": "58707788c1fbbb9d27cf40038a915581e5bc85ce9007b1dbee8e21def987b5c7", "sources": [ "src/models/gemma4.cpp" ] @@ -242,7 +242,7 @@ "glm-dsa" ], "file": "0024-family-glm-dsa.patch", - "sha256": "b3ba3281bb0b9a08d2f7b88455e8105ae74b86a9c9a0cf44d5836ffbd72e15bc", + "sha256": "2dd40489d56862a8168f097c81b2fe2a2e0debb715dfd62cddd3ec2fda80d9d0", "sources": [ "src/models/glm-dsa.cpp" ] @@ -253,7 +253,7 @@ "glm4-expansion" ], "file": "0025-family-glm4--glm4-expansion.patch", - "sha256": "4638c3db29c1574c253a91a9072a68d345859cfa4b65216e095f46d037ad1684", + "sha256": "5b762c4d3af2c68c3dd5c8823c8f7d6302d8d98b6d3c202a74df0a460502b52d", "sources": [ "src/models/glm4.cpp" ] @@ -263,7 +263,7 @@ "glm4-expansion" ], "file": "0026-family-glm4-expansion.patch", - "sha256": "2e0eaf58c5deb2d31f7b7b9bdcd2542fa89097eea421d02c3d50c44b53aac07b", + "sha256": "f100d440d35927177e47475b87943ac801c890a4d3a09f3f077a32d76ff17e3d", "sources": [ "src/models/chatglm.cpp" ] @@ -273,7 +273,7 @@ "glm45-air" ], "file": "0027-family-glm45-air.patch", - "sha256": "02282eea2a611b47fda7026d5befcf799f831b633394b8d3c135eea05989bd24", + "sha256": "440682f9ad72bc7dad0f9e130e5d9d0fdc8632a13fa08f1a32ed17779214ef96", "sources": [ "src/models/glm4-moe.cpp" ] @@ -283,7 +283,7 @@ "gpt-oss" ], "file": "0028-family-gpt-oss.patch", - "sha256": "5c2770c6a283f6026b1e18aac6dbcfa2cd9d02adde8600b27f5b8bca895ecaef", + "sha256": "a4eee16bc8d0f46449f953389ca73c240a1f3527b4c8a706e7790cbec4e9221e", "sources": [ "src/models/openai-moe.cpp" ] @@ -293,7 +293,7 @@ "gptneox" ], "file": "0029-family-gptneox.patch", - "sha256": "26e8440cc64c23ff5ab7f6621b6804d17cec2bb1ba089b6bc3fb11d010f65759", + "sha256": "383747ecb395bc8824cb288d4861775377f0abb4b78c7c095c7285e6c042c847", "sources": [ "src/models/gptneox.cpp" ] @@ -305,7 +305,7 @@ "minicpm" ], "file": "0030-family-granite-dense--granite-moe--minicpm.patch", - "sha256": "3f1b4d4077216a61218f31905ef96542b2d5f91b530960d84c51fe6ef1ee1afc", + "sha256": "56b8bc1c990b379c03dcc3ca948db897e3dac6108dc9cb8c2000e62c0d4b5c38", "sources": [ "src/models/granite.cpp" ] @@ -315,7 +315,7 @@ "granite-hybrid" ], "file": "0031-family-granite-hybrid.patch", - "sha256": "2f33aa8b70ec9aaa8128ef27fe39310fd68641ad6a330f35018ee804048977a4", + "sha256": "45b6a165f26ca8aa0f5a646f7aa20ee910317bf14293584adba8a85ca5e336ca", "sources": [ "src/models/granite-hybrid.cpp" ] @@ -325,7 +325,7 @@ "granite-swa" ], "file": "0032-family-granite-swa.patch", - "sha256": "d5a4757c7240907c04dead201c4809926b58dd163b9481478f547c5f26304c56", + "sha256": "5223ff27efca0cb77cb079d7b4f4b9566ee38c0a849fe2a9f450ab9133ee12bc", "sources": [ "src/models/granite-swa.cpp" ] @@ -335,7 +335,7 @@ "granite-switch" ], "file": "0033-family-granite-switch.patch", - "sha256": "85e3193e9b0c2a9456c2b34811582af51a701c9ddcb2509df1b02f2af90c491d", + "sha256": "e7fb15b7a09430e08f0ac43622cf41ad6695ddf5c22b2c8b6f6ded137d68b734", "sources": [ "src/models/granite-switch.cpp" ] @@ -345,7 +345,7 @@ "grovemoe" ], "file": "0034-family-grovemoe.patch", - "sha256": "568fcaec74ff989baa792df65fd7bb8d4e1556a9563c25e8abc852fb1abc9a2e", + "sha256": "ebe73db11a2081d826148410c38afb295aa57e6fb4f11b858d49efb7e89a6275", "sources": [ "src/models/grovemoe.cpp" ] @@ -355,7 +355,7 @@ "hunyuan-dense" ], "file": "0035-family-hunyuan-dense.patch", - "sha256": "9b3d25311aafcf934ff1be1e50eb2dd7c13e87836d4c63c735acdd5c82dcbb0b", + "sha256": "322255821bd797d3210e46d27f16b94fcb3cf642673684308fc1886e36efeced", "sources": [ "src/models/hunyuan-vl.cpp" ] @@ -365,7 +365,7 @@ "hy-v3" ], "file": "0036-family-hy-v3.patch", - "sha256": "c75ee7bd8238e5f1f57c6979faf166019958592a24665ff1849c7c3ba199d32c", + "sha256": "8355ba23657a8d6502d965cc21c45fa46ac79fa9d8155a46ae2b001c4e8c6374", "sources": [ "src/models/hy-v3.cpp" ] @@ -375,7 +375,7 @@ "inkling" ], "file": "0037-family-inkling.patch", - "sha256": "836630a4c3279a560f0db40bdabd4cfc9d5d1411d41761aff334c716805bf473", + "sha256": "d7d0bf3dc90249f36655b55282e7feb48ceefdd439a3630ebab2f9e3d7124e22", "sources": [ "src/models/inkling.cpp" ] @@ -385,7 +385,7 @@ "internlm2" ], "file": "0038-family-internlm2.patch", - "sha256": "ebfee2813faa89982e5e56f36fe768fd896a04645e2cd316eb0a780b2d71fef7", + "sha256": "749e31720a48df23229689bcde52016104c0d08041cdb7db34e1f394f65e1267", "sources": [ "src/models/internlm2.cpp" ] @@ -395,7 +395,7 @@ "jais" ], "file": "0039-family-jais.patch", - "sha256": "c0f1e395aeabd7036ee91a5aa945365c47be43e3df6342944c19b0aa4918a80c", + "sha256": "9759c8eda8334846a437fb0e046ba590ed08fce69244e3ef040aee48a5a41786", "sources": [ "src/models/jais.cpp" ] @@ -405,7 +405,7 @@ "jais2" ], "file": "0040-family-jais2.patch", - "sha256": "31d23be525c97b0d185c99ad5d2ec1af0240e46e5bb319bd2a01e7aab349cd0b", + "sha256": "5675bb8e13b35b55d2f89bb49e75fb5deb9be509312c5bf87632f0308aa516b1", "sources": [ "src/models/jais2.cpp" ] @@ -415,7 +415,7 @@ "jamba2" ], "file": "0041-family-jamba2.patch", - "sha256": "4064a32380c995793b0d5debd7a3929f7e4aee24795848f422df435da6dba3c2", + "sha256": "c3ea2767fc880e0ed185a738367c61088823a4256896e91399af03676a940b30", "sources": [ "src/models/jamba.cpp" ] @@ -425,7 +425,7 @@ "kimi-k3" ], "file": "0042-family-kimi-k3.patch", - "sha256": "55654a62a13880939141d11f4d8ad7d182cd9c1f0caf66ba4a7f4d3c8b62c68f", + "sha256": "9396cae5e6526fb5b7d1a9385aa4cdde662293dc22e347f02bb1288c2514b7b1", "sources": [ "src/models/kimi-k3.cpp" ] @@ -435,7 +435,7 @@ "kimi-linear" ], "file": "0043-family-kimi-linear.patch", - "sha256": "bded431df5ff138ac8409adb2cf60e057144067f138e31599055e03ae9616f00", + "sha256": "78c7cc614d36610d1b4a15ef3d6b531b8893b5c52eab5ab0dde54ffb462fcb93", "sources": [ "src/models/kimi-linear.cpp" ] @@ -445,7 +445,7 @@ "laguna" ], "file": "0044-family-laguna.patch", - "sha256": "f4e1050dbd03f3e429bf44298875b253e733c4b1022d220eb87ca42a7dd94561", + "sha256": "1fb6db0a0d2a3f2cbaa563f313b65cea788bc58362175dc70b857f734383bb26", "sources": [ "src/models/laguna.cpp" ] @@ -457,7 +457,7 @@ "lfm2-vl" ], "file": "0045-family-lfm2--lfm2-moe--lfm2-vl.patch", - "sha256": "df34e4470be04a4dc5a1803ef9d3c8f7fdd6942dd37a663742355aa6bfcb7398", + "sha256": "3e5ab556f54b2e8e08a04a2d7e0d145b5bc8024496ddd4a72ccd2b129aaae0c6", "sources": [ "src/models/lfm2.cpp" ] @@ -467,7 +467,7 @@ "llama" ], "file": "0046-family-llama.patch", - "sha256": "e4869daa5184a7f821f74bc00a55d1091ab51c5538adf23d58b6e5d19182d920", + "sha256": "893f65cddbe48038291ef1456903b9738b56757a9c28cc538d29c691fe5316bf", "sources": [ "src/models/llama.cpp" ] @@ -478,7 +478,7 @@ "olmo2" ], "file": "0047-family-llama--olmo2.patch", - "sha256": "321c791d4f3583cd65eb70bba4d981ab3b49771fcf174091b1a28f76599d8bcc", + "sha256": "6f7e9bbb650b6f055a95c994ddba80828dd42b1149d8231ac0aafc5032774b6d", "sources": [ "src/models/olmo2.cpp" ] @@ -488,7 +488,7 @@ "llama4" ], "file": "0048-family-llama4.patch", - "sha256": "feb748bcd5d49b35146e0d7fdb64c8ca654434fbba0128a91833baa8edc0f0b5", + "sha256": "cc03e04b1ffcd3ac739055dafa7c7113421d51a63a07f06cffd791f35789bc99", "sources": [ "src/models/llama4.cpp" ] @@ -498,7 +498,7 @@ "maincoder" ], "file": "0049-family-maincoder.patch", - "sha256": "85570c511f7649d196aed2aa5d74d3807e6b74e4dbe4a6d25808827fad4038b7", + "sha256": "c116eb7c83156e044361c32e2cba8df818171a262f014a34c94f2bab3bf08562", "sources": [ "src/models/maincoder.cpp" ] @@ -509,7 +509,7 @@ "mamba2" ], "file": "0050-family-mamba--mamba2.patch", - "sha256": "e44972ca305cd42971f8579b3d3caa06ca73cac2503582334d2d632dddc608a8", + "sha256": "f755a09d1d4454b952b071936ec8ffb421128d0ba2d111eb275215999abdc604", "sources": [ "src/models/mamba.cpp" ] @@ -519,7 +519,7 @@ "mellum" ], "file": "0051-family-mellum.patch", - "sha256": "3acf68c74a77d8f822e8166d1c9763b727da4b74631d245b814d1bc42a13c3a9", + "sha256": "1267b9caca7a998e78576eedaa180e7fbf0c7f32b35c139fe0273edc2e60f5fe", "sources": [ "src/models/mellum.cpp" ] @@ -529,7 +529,7 @@ "mimo2" ], "file": "0052-family-mimo2.patch", - "sha256": "056e3cc3e7b4297df4c8f057e079a113f4e65b73f61bdf0d12a921c60416036c", + "sha256": "4eda7cb53da815be1d846b06e921738fe649a57c2c881d738da5499b991dcd8b", "sources": [ "src/models/mimo2.cpp" ] @@ -539,7 +539,7 @@ "minicpm3" ], "file": "0053-family-minicpm3.patch", - "sha256": "e32eea8607497d89beedb5e6d1caba94bcc6504861a2892e366b05f7108973c2", + "sha256": "849293b29a2f305d20301e4a5dabb9402967ad0c798e74f3178f2df338dd19c2", "sources": [ "src/models/minicpm3.cpp" ] @@ -549,7 +549,7 @@ "minimax-m2" ], "file": "0054-family-minimax-m2.patch", - "sha256": "522cfb132985f67090b5d608d8395f78896d39eb8a39b804516266bac14bd168", + "sha256": "2fa688a425887d0068b877e014f6e2af64db28940830b5d409aaeeb82b6b3fcf", "sources": [ "src/models/minimax-m2.cpp" ] @@ -559,7 +559,7 @@ "minimax-m3" ], "file": "0055-family-minimax-m3.patch", - "sha256": "4865e0aff8b385b6cc1d65e0d3be78ecbce4aa7a405684653cde105419be997d", + "sha256": "a9d86ff7316e7768c0415209734b592f845eea589b934e4f9d78d2e4cac54c55", "sources": [ "src/models/minimax-m3.cpp" ] @@ -570,7 +570,7 @@ "mistral3" ], "file": "0056-family-mistral-small--mistral3.patch", - "sha256": "100af39dd134b652f6896f31d0d708881092a8bdd51384bdc46d75e6c595ad38", + "sha256": "caf5f0ea333e2a2e03a9dd52fdb6538ce0482a4f78f5c84336987963fa7d288e", "sources": [ "src/models/mistral3.cpp" ] @@ -580,7 +580,7 @@ "mpt" ], "file": "0057-family-mpt.patch", - "sha256": "ec50f60eb8a712f9f8c78d8a90ed99604882b08a12302cab8bb5ffaf70ec269d", + "sha256": "a3cf9d9f61f5f790049e1f75a8327e4d55f326322d31b3679d84af92be2e5e7e", "sources": [ "src/models/mpt.cpp" ] @@ -590,7 +590,7 @@ "muse-glimmer" ], "file": "0058-family-muse-glimmer.patch", - "sha256": "dbcb81b8f5faf48d760e270a80d4c2110102318b47ec8b0324a7e7beddd8d364", + "sha256": "dce2a194156c2d9f12ea00629b40fc7621dd85734ceb40edcca0c3037a8a358e", "sources": [ "src/models/muse-glimmer.cpp" ] @@ -601,7 +601,7 @@ "nemotron-nano" ], "file": "0059-family-nemotron--nemotron-nano.patch", - "sha256": "590bd9686b8d6156b1f432cfc4ab99d38ee2395b80ffd72a2909841b53b36d82", + "sha256": "37f2a3883899e92e8ebcb3ab69df1ffa3196971423dcf3dd803f57df2ab144f8", "sources": [ "src/models/nemotron-h.cpp" ] @@ -611,7 +611,7 @@ "nemotron-expansion" ], "file": "0060-family-nemotron-expansion.patch", - "sha256": "8d47eda66876506080e7f68a31bbead40aa87fe83199a57ee8bf8f7efcf327b6", + "sha256": "aa0187cea7d82c13d6ab6c8433c73fec64a4b231d728a1c59b9577eee10d6eac", "sources": [ "src/models/nemotron.cpp" ] @@ -621,7 +621,7 @@ "phi2" ], "file": "0061-family-phi2.patch", - "sha256": "4869029e0b1c3363a4ba3473713a7b5f90068442c97110853e5132b6052635d4", + "sha256": "372fbf4980acd45f240a4435b15d0903421b2c11cff66cbe2c703370452d664e", "sources": [ "src/models/phi2.cpp" ] @@ -632,7 +632,7 @@ "phi4" ], "file": "0062-family-phi3--phi4.patch", - "sha256": "6c047a7df4796c73d780ce2f262764463747eec5e3a2b5b7eeaf7d019a6594cc", + "sha256": "954eb5bc44470b304c2b756cbeb4f8c2f21f0774ede5c912f9034999c93fe7d2", "sources": [ "src/models/phi3.cpp" ] @@ -642,7 +642,7 @@ "qwen2" ], "file": "0063-family-qwen2.patch", - "sha256": "b2d61f84a99eec3df30e3e5aff99033cfeb64034c0487bc39b8c7ed9eeb8ab98", + "sha256": "8ec0bec01171dd135ea128b881dcf9a6d68240e3107ccf5898eeb05d32b3cd89", "sources": [ "src/models/qwen2.cpp" ] @@ -652,7 +652,7 @@ "qwen2-moe" ], "file": "0064-family-qwen2-moe.patch", - "sha256": "eef6258f5bb87046144e146bf9ee8d2f6ccda05070c810dbc6693c65aed7b36f", + "sha256": "b510ed36e4216afaba16e330c2f60931054ad8d4658370b07c551e6d38ee27eb", "sources": [ "src/models/qwen2moe.cpp" ] @@ -662,7 +662,7 @@ "qwen2-vl" ], "file": "0065-family-qwen2-vl.patch", - "sha256": "4745ebddcad397cf6ca4d3c523d0f4e980b629fca20be2d9e9dd4c5b1bbf0afd", + "sha256": "d418583451b4ab1885d8ee2d1917e196e3dd0cc63aa5236432fc130c97ec0d2e", "sources": [ "src/models/qwen2vl.cpp" ] @@ -672,7 +672,7 @@ "qwen3-dense" ], "file": "0066-family-qwen3-dense.patch", - "sha256": "e3285c58884c48b9252a0821ee3241b646ac92ce7923fda1027b8e9819d0dd08", + "sha256": "9ec1fef0a4ffe4df1483436bb759437a9e2ea0f8949301183ee3568709a5d06d", "sources": [ "src/models/qwen3.cpp" ] @@ -682,7 +682,7 @@ "qwen3-moe" ], "file": "0067-family-qwen3-moe.patch", - "sha256": "50c5ab5dff404f4dd64a85453d1cfd11e0e59ceb1a593a95ee6ceff2bee0a8f0", + "sha256": "817551e761175a85ac124e5290dd0324f32d0c3b9e685bc10925c6be60ef39ec", "sources": [ "src/models/qwen3moe.cpp" ] @@ -692,7 +692,7 @@ "qwen3-next" ], "file": "0068-family-qwen3-next.patch", - "sha256": "eeb8f8f4de3ebe72cee9b49e1b44bfe018e7329fa546fa27194c52537ad2d93e", + "sha256": "8bb9c704ecaf32ba11c20a2d083458b71299712dc305ebef25a4c2ef304c895c", "sources": [ "src/models/qwen3next.cpp" ] @@ -702,7 +702,7 @@ "qwen3-vl" ], "file": "0069-family-qwen3-vl.patch", - "sha256": "780670f4f552fd53deca5de88a23333b00767b2097df4db7087331e3bb1c5ec9", + "sha256": "d38f3c2cd3213f276525d2c8e640a3caf30a90c430668278e2d2b7c140c704fd", "sources": [ "src/models/qwen3vl.cpp" ] @@ -712,7 +712,7 @@ "qwen35" ], "file": "0070-family-qwen35.patch", - "sha256": "378366e6236c4da47143ecf2a3383411a27261bb7c25a0528928b7b24434d5b6", + "sha256": "108441c610661f3c9c383179c6cbe7c68e708e673af2c2a6a2e84d16303da5f5", "sources": [ "src/models/qwen35.cpp" ] @@ -722,7 +722,7 @@ "qwen35moe" ], "file": "0071-family-qwen35moe.patch", - "sha256": "34ee142c08aebcd74246575472b4e02a8bfd8bf66c44763e1d22d90551871c93", + "sha256": "e99c5b6877778838ec7bbfac7f7f988021be6104eb4e87c94ffba62794d9a70a", "sources": [ "src/models/qwen35moe.cpp" ] @@ -732,7 +732,7 @@ "qwen3vlmoe" ], "file": "0072-family-qwen3vlmoe.patch", - "sha256": "4c393f169d4861dce76415e00c6d65f1318c00c4bf930f2eeb1f4a0dbcdb0c76", + "sha256": "5af929715c64a1f628d0bb384dd3c0fe63204b55311cb4d131c62e39575e57b0", "sources": [ "src/models/qwen3vlmoe.cpp" ] @@ -742,7 +742,7 @@ "qwen4exp" ], "file": "0073-family-qwen4exp.patch", - "sha256": "e0fe4ae76b7db7de8480e0778f27abdfc8a40c6c9241c1da0c302ef80af622e5", + "sha256": "596c27f0b4bc7753cf333609b7d7f3880045824d7a22596c7996c583452f3fd9", "sources": [ "src/models/qwen4exp.cpp" ] @@ -752,7 +752,7 @@ "rwkv6" ], "file": "0074-family-rwkv6.patch", - "sha256": "7e635625559debbec6eb06fa26e47d5fd46f7234bb7fce684d11293ef5a19f87", + "sha256": "59c26dba82861232d18a4151441c131c8f8a29ff7b2848f66547bea739b2984b", "sources": [ "src/models/rwkv6.cpp", "src/models/rwkv6qwen2.cpp" @@ -763,7 +763,7 @@ "rwkv7" ], "file": "0075-family-rwkv7.patch", - "sha256": "141d3a6176d59ba25ca749656518a127e52944ab80a3aa7587cea473fd471c79", + "sha256": "7289033cae4c08d0e38982e2f4969df039678c6c306e38005cd43366656bbdc8", "sources": [ "src/models/rwkv7.cpp" ] @@ -773,7 +773,7 @@ "smollm3" ], "file": "0076-family-smollm3.patch", - "sha256": "5b7096dc148796232efe34b101a84716b4287ce707bcd43689c5ce8cc14c2614", + "sha256": "1a3a6f2e6cdfc1db49ceb0093dd013b15873621eab6f66e91785a05120c783f0", "sources": [ "src/models/smollm3.cpp" ] @@ -783,7 +783,7 @@ "spark2-5" ], "file": "0077-family-spark2-5.patch", - "sha256": "d707bada11aaee29e56fd5ef03f393498b59779350155d8743e249a63d85899f", + "sha256": "67de86a105d6a3778539bfc80303f7c0edf7c116361848ee8f5325aaaabc7d53", "sources": [ "src/models/spark2-5.cpp" ] @@ -793,7 +793,7 @@ "stablelm" ], "file": "0078-family-stablelm.patch", - "sha256": "f04eec145dfd0131bccba463317d89f19b88b004de4fce494c9f369235374408", + "sha256": "869cef6db1e1590f76e2877a0508ce0cdea63d1eb050ac8246bb4eae18a63dca", "sources": [ "src/models/stablelm.cpp" ] @@ -803,7 +803,7 @@ "starcoder2" ], "file": "0079-family-starcoder2.patch", - "sha256": "867ba57da47db5d35887c2b397176e431de595607c3e10ebb1bc98cc4f092f5c", + "sha256": "e899be635ee30b70b33e824056e3ac029ff1bc1ee88a2e21c7030f0b3a28d25b", "sources": [ "src/models/starcoder2.cpp" ] @@ -813,7 +813,7 @@ "step35" ], "file": "0080-family-step35.patch", - "sha256": "d4b2774705bc637355d082e6d5b5b0a91d52f9656a6622c7cb30b32472c92922", + "sha256": "a575217edbc39bc090f930c0496438068c1cc721a222185eb5cb76cbb46cb61d", "sources": [ "src/models/step35.cpp" ] @@ -821,7 +821,7 @@ { "families": [], "file": "0081-family-unmapped.patch", - "sha256": "d5e6f5886b50dbf99a5befc951654179fae2b503891ae608ce69fed9dfda04ab", + "sha256": "6b8d3bd66b1fd5ede7d8863c90667192c5d35f15e32d793db3e0dfe69db93fb2", "sources": [ "src/models/arctic.cpp", "src/models/baichuan.cpp", diff --git a/llama_cpp/patches/model_support/0001-models-add-inkling-family-support.patch b/llama_cpp/patches/model_support/0001-models-add-inkling-family-support.patch index 545f84bf..3f1d2efd 100644 --- a/llama_cpp/patches/model_support/0001-models-add-inkling-family-support.patch +++ b/llama_cpp/patches/model_support/0001-models-add-inkling-family-support.patch @@ -1,4 +1,4 @@ -From 2c2a00f686d03297fc821d8b4b491c9bc9e23fdd Mon Sep 17 00:00:00 2001 +From dda949784471439daee190e9cc6263ba25229097 Mon Sep 17 00:00:00 2001 From: James Dumay Date: Fri, 6 Nov 2026 10:32:22 -0800 Subject: [PATCH] models: add inkling family support @@ -49,7 +49,7 @@ Subject: [PATCH] models: add inkling family support create mode 100644 tools/mtmd/models/inkling.cpp diff --git a/common/chat.cpp b/common/chat.cpp -index 5a44cec44..e888a807f 100644 +index 5a44cec445069f962c31b371ff6b7664512b32b9..e888a807f2d188390f1dec61440ee03b623d979e 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -1488,6 +1488,14 @@ static common_chat_params_init_fn common_chat_template_detect_params_init(const @@ -79,7 +79,7 @@ index 5a44cec44..e888a807f 100644 return nullptr; diff --git a/common/parsers/inkling.cpp b/common/parsers/inkling.cpp -index 082bd86fd..8009b793c 100644 +index 082bd86fdfd205cf4d51c191d937ce0003ffdf45..8009b793c70d1ec3716d1a62ef8e1800397f79db 100644 --- a/common/parsers/inkling.cpp +++ b/common/parsers/inkling.cpp @@ -49,7 +49,7 @@ static void inkling_split_media(common_chat_prompt & prompt) { @@ -213,7 +213,7 @@ index 082bd86fd..8009b793c 100644 + return data; +} diff --git a/common/parsers/parsers.h b/common/parsers/parsers.h -index 867403370..924eec391 100644 +index 867403370968f45a52813a2ae8ab1406b9ab813e..924eec3914fb3f35857738d97cc0f93ce663fe1a 100644 --- a/common/parsers/parsers.h +++ b/common/parsers/parsers.h @@ -57,7 +57,7 @@ common_chat_params common_chat_params_init_gpt_oss(const common_chat_template & @@ -235,7 +235,7 @@ index 867403370..924eec391 100644 common_chat_params common_chat_params_init_lfm2(const common_chat_template & tmpl, const autoparser::generation_params & inputs, bool tool_list_tokens); diff --git a/common/parsers/sources.cmake b/common/parsers/sources.cmake -index 934e22673..5d18e50e0 100644 +index 934e22673e899ac24ba8d8dc4e010e5dbcb2f250..5d18e50e0e50b8064f38a2d79adda055c85f8887 100644 --- a/common/parsers/sources.cmake +++ b/common/parsers/sources.cmake @@ -15,6 +15,7 @@ set(LLAMA_CHAT_PARSERS_SOURCES @@ -248,7 +248,7 @@ index 934e22673..5d18e50e0 100644 ${CMAKE_CURRENT_LIST_DIR}/minicpm5.cpp diff --git a/models/templates/Inkling.jinja b/models/templates/Inkling.jinja new file mode 100644 -index 000000000..95874d23d +index 0000000000000000000000000000000000000000..95874d23d765ab04484e5e1162f78181b861ddd1 --- /dev/null +++ b/models/templates/Inkling.jinja @@ -0,0 +1,514 @@ @@ -767,7 +767,7 @@ index 000000000..95874d23d +{%- endif -%} +{#- Unsloth translation to jinja from TML's parser #} diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp -index 4e213021a..41f92e0c4 100644 +index d3b46066600fe1df2f4d003ec2ba1d5814692616..9cb8279de2c04e4588d587eb058d9c4b4fd8a861 100644 --- a/src/llama-arch.cpp +++ b/src/llama-arch.cpp @@ -189,6 +189,7 @@ static const std::map LLM_ARCH_NAMES = { @@ -778,7 +778,7 @@ index 4e213021a..41f92e0c4 100644 { LLM_ARCH_UNKNOWN, "(unknown)" }, }; -@@ -469,6 +470,18 @@ static const std::map LLM_KV_NAMES = { +@@ -470,6 +471,18 @@ static const std::map LLM_KV_NAMES = { { LLM_KV_LILICORR_MLP_HIDDEN_SIZE, "lilicorr.mlp_hidden_size" }, { LLM_KV_SHORTCONV_L_CACHE, "%s.shortconv.l_cache" }, @@ -797,7 +797,7 @@ index 4e213021a..41f92e0c4 100644 // sentence-transformers dense modules feature dims { LLM_KV_DENSE_2_FEAT_IN, "%s.dense_2_feat_in" }, { LLM_KV_DENSE_2_FEAT_OUT, "%s.dense_2_feat_out" }, -@@ -1535,6 +1548,7 @@ bool llm_arch_is_hybrid(const llm_arch & arch) { +@@ -1536,6 +1549,7 @@ bool llm_arch_is_hybrid(const llm_arch & arch) { case LLM_ARCH_ZONOS3: case LLM_ARCH_INKLING2: case LLM_ARCH_INKLING2_LOOP: @@ -805,7 +805,7 @@ index 4e213021a..41f92e0c4 100644 return true; default: return false; -@@ -1641,6 +1655,7 @@ bool llm_arch_supports_sm_tensor(const llm_arch & arch) { +@@ -1645,6 +1659,7 @@ bool llm_arch_supports_sm_tensor(const llm_arch & arch) { case LLM_ARCH_KIMI_K31: case LLM_ARCH_RAON1_MINI: case LLM_ARCH_QWEN3TTS: @@ -814,7 +814,7 @@ index 4e213021a..41f92e0c4 100644 return false; default: diff --git a/src/llama-arch.h b/src/llama-arch.h -index 93cd543d9..66594e68b 100644 +index b36f0fb7f402c117213a18912bc50e1ce18aa45f..f89d2c95a568732185a08dc2de9fd5a243db9c5e 100644 --- a/src/llama-arch.h +++ b/src/llama-arch.h @@ -193,6 +193,7 @@ enum llm_arch { @@ -825,7 +825,7 @@ index 93cd543d9..66594e68b 100644 LLM_ARCH_UNKNOWN, }; -@@ -517,6 +518,17 @@ enum llm_kv { +@@ -518,6 +519,17 @@ enum llm_kv { LLM_KV_SHORTCONV_L_CACHE, @@ -843,7 +843,7 @@ index 93cd543d9..66594e68b 100644 LLM_KV_XIELU_ALPHA_N, LLM_KV_XIELU_ALPHA_P, LLM_KV_XIELU_BETA, -@@ -617,6 +629,10 @@ enum llm_tensor { +@@ -618,6 +630,10 @@ enum llm_tensor { LLM_TENSOR_FFN_DOWN_CHEXPS, LLM_TENSOR_FFN_GATE_CHEXPS, LLM_TENSOR_FFN_UP_CHEXPS, @@ -854,7 +854,7 @@ index 93cd543d9..66594e68b 100644 LLM_TENSOR_FFN_EXP_PROBS_B, LLM_TENSOR_FFN_EXP_PROBS_B_VL, LLM_TENSOR_FFN_LATENT_DOWN, -@@ -884,6 +900,14 @@ enum llm_tensor { +@@ -883,6 +899,14 @@ enum llm_tensor { LLM_TENSOR_SHORTCONV_CONV, LLM_TENSOR_SHORTCONV_INPROJ, LLM_TENSOR_SHORTCONV_OUTPROJ, @@ -870,7 +870,7 @@ index 93cd543d9..66594e68b 100644 LLM_TENSOR_VISEXP_ATTN_OUT, LLM_TENSOR_VISEXP_FFN_GATE, diff --git a/src/llama-context.cpp b/src/llama-context.cpp -index 942780c7c..15a07961c 100644 +index 5d106837bf2cd451fa5f2339ebb7dcf128577a8d..8f6cb7345600940b5b6f70fba88acc55e17e73bc 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -283,6 +283,12 @@ llama_context::llama_context( @@ -887,10 +887,10 @@ index 942780c7c..15a07961c 100644 // the trunk tensors through ctx_other (see graph_mtp in nemotron-h-moe.cpp). // Without this clause the constructor silently drops params.ctx_other and diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp -index faa236a96..c46ae73b6 100644 +index 4bb2489eb84cfddc7f78bba201fee272f31a3b74..0c98759ee508544c86317dd9b6cef7862d0e3359 100644 --- a/src/llama-graph.cpp +++ b/src/llama-graph.cpp -@@ -3874,10 +3874,27 @@ ggml_tensor * llm_graph_context::build_attn_mha( +@@ -3889,10 +3889,27 @@ ggml_tensor * llm_graph_context::build_attn_mha( ggml_tensor * cur; @@ -918,9 +918,9 @@ index faa236a96..c46ae73b6 100644 + cb(fa_mask, "kq_mask_biased", il); + } - if (v_trans) { - v = ggml_transpose(ctx0, v); -@@ -3893,10 +3910,10 @@ ggml_tensor * llm_graph_context::build_attn_mha( + if (k_scale) { + q = ggml_mul(ctx0, q, k_scale); +@@ -3912,10 +3929,10 @@ ggml_tensor * llm_graph_context::build_attn_mha( } if (kv_rows) { @@ -934,7 +934,7 @@ index faa236a96..c46ae73b6 100644 } res->add_fused_node({kv_rows ? LLM_FUSED_OP_FLASH_ATTN_KV_ROWS : LLM_FUSED_OP_FLASH_ATTN, cur, il}); diff --git a/src/llama-hparams.cpp b/src/llama-hparams.cpp -index ec7a529c9..d7b920106 100644 +index ec7a529c91861d6196f018f4002db2dbc9af6cf5..d7b9201061bd891bb6298580edecde8ffcfdc04b 100644 --- a/src/llama-hparams.cpp +++ b/src/llama-hparams.cpp @@ -217,7 +217,7 @@ uint32_t llama_hparams::n_embd_k_idx(uint32_t il) const { @@ -947,7 +947,7 @@ index ec7a529c9..d7b920106 100644 } diff --git a/src/llama-hparams.h b/src/llama-hparams.h -index 5c5980e85..c721eb9bc 100644 +index 0e74e3e33cc058e9cfc9f616ebc7e97736abd348..12486b9e65304a192a2463f2970924c1de8bca5f 100644 --- a/src/llama-hparams.h +++ b/src/llama-hparams.h @@ -107,9 +107,17 @@ struct llama_hparams { @@ -970,10 +970,10 @@ index 5c5980e85..c721eb9bc 100644 std::array n_head_kv_arr; std::array n_ff_arr; diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp -index 6497494f2..94e542d5e 100644 +index c030afcfe3822f9baf928f957f71cb88f20e7df2..a994c48e7d50aedd06cab8aa29d8860357267a6a 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp -@@ -3766,7 +3766,7 @@ void llama_kv_cache::set_input_kpool(ggml_tensor * pool_idxs, ggml_tensor * pool +@@ -3762,7 +3762,7 @@ void llama_kv_cache::set_input_kpool(ggml_tensor * pool_idxs, ggml_tensor * pool ggml_backend_tensor_set(tail_idxs, tail_idxs_data.data(), 0, ggml_nbytes(tail_idxs)); } @@ -982,7 +982,7 @@ index 6497494f2..94e542d5e 100644 const int64_t n_tokens = ubatch->n_tokens; GGML_ASSERT(ggml_backend_buffer_is_host(dst->buffer)); -@@ -3776,7 +3776,16 @@ void llama_kv_cache::set_input_pos_rel_flat(ggml_tensor * dst, const llama_ubatc +@@ -3772,7 +3772,16 @@ void llama_kv_cache::set_input_pos_rel_flat(ggml_tensor * dst, const llama_ubatc const int64_t n_kv = dst->ne[0]; GGML_ASSERT(dst->ne[1] == n_tokens); @@ -1000,7 +1000,7 @@ index 6497494f2..94e542d5e 100644 for (int64_t i = 0; i < n_tokens; ++i) { const llama_seq_id seq_id = ubatch->seq_id[i][0]; -@@ -3787,8 +3796,10 @@ void llama_kv_cache::set_input_pos_rel_flat(ggml_tensor * dst, const llama_ubatc +@@ -3783,8 +3792,10 @@ void llama_kv_cache::set_input_pos_rel_flat(ggml_tensor * dst, const llama_ubatc for (int64_t j = 0; j < n_kv; ++j) { // use the ACTUAL absolute position in the KV cell; physical slot order is not monotonic int32_t rel = (int32_t) extent; // zero-bias column @@ -1013,7 +1013,7 @@ index 6497494f2..94e542d5e 100644 if (d >= 0 && d < (llama_pos) extent) { rel = (int32_t) d; } -@@ -5068,8 +5079,9 @@ void llama_kv_cache_context::set_input_relative_pos(ggml_tensor * dst, const lla +@@ -5064,8 +5075,9 @@ void llama_kv_cache_context::set_input_relative_pos(ggml_tensor * dst, const lla kv->set_input_relative_pos(dst, ubatch, extent); } @@ -1026,7 +1026,7 @@ index 6497494f2..94e542d5e 100644 void llama_kv_cache_context::get_prev_tokens(const llama_ubatch & ubatch, uint32_t n, std::vector & res) const { diff --git a/src/llama-kv-cache.h b/src/llama-kv-cache.h -index 52c06ffa4..0519c8afd 100644 +index 52c06ffa44be8c62c2eab7b3671006d33a0702b6..0519c8afd170b0a610d0eedc95af933de9da7ae0 100644 --- a/src/llama-kv-cache.h +++ b/src/llama-kv-cache.h @@ -355,7 +355,7 @@ public: @@ -1048,7 +1048,7 @@ index 52c06ffa4..0519c8afd 100644 // see llama_kv_cache::get_prev_tokens() void get_prev_tokens(const llama_ubatch & ubatch, uint32_t n, std::vector & res) const; diff --git a/src/llama-model.cpp b/src/llama-model.cpp -index 0042d5def..63a35ad78 100644 +index f522436951c2f5d15b97d2d0d268e461c85418a4..e3a295b99e4ecb01b90824e1728ff2024cf74588 100644 --- a/src/llama-model.cpp +++ b/src/llama-model.cpp @@ -407,6 +407,8 @@ static llama_model * llama_model_mapping(llm_arch arch, const llama_model_params @@ -1060,7 +1060,7 @@ index 0042d5def..63a35ad78 100644 default: throw std::runtime_error(std::string("unsupported model architecture: '") + llm_arch_name(arch) + "'"); } -@@ -3652,8 +3654,19 @@ llama_memory_i * llama_model::create_memory( +@@ -3517,8 +3519,19 @@ llama_memory_i * llama_model::create_memory( return il < hparams.n_layer() && !hparams.is_recr(il) && hparams.is_indexer_full(il); }; } else if (arch == LLM_ARCH_FALCON_H1 || arch == LLM_ARCH_INKLING2 || arch == LLM_ARCH_INKLING2_LOOP || arch == LLM_ARCH_ZAYA1) { @@ -1080,7 +1080,7 @@ index 0042d5def..63a35ad78 100644 } else if (arch == LLM_ARCH_NEMOTRON_H || arch == LLM_ARCH_NEMOTRON_H_MOE) { filter_attn = [&](uint32_t il) { return !hparams.is_recr(il) && hparams.n_ff(il) == 0; -@@ -4045,6 +4058,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) { +@@ -3910,6 +3923,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) { case LLM_ARCH_INKLING2: case LLM_ARCH_INKLING2_LOOP: case LLM_ARCH_KOKORO: @@ -1089,10 +1089,10 @@ index 0042d5def..63a35ad78 100644 // use what we call a normal RoPE, operating on pairs of consecutive head values diff --git a/src/llama-model.h b/src/llama-model.h -index 7c0de5851..5ebbf3382 100644 +index b7480fd9d012afe77b764ef1e1c1e75e833d4352..c841eae96638845f2db50326545b31abbda1d515 100644 --- a/src/llama-model.h +++ b/src/llama-model.h -@@ -736,6 +736,15 @@ struct llama_layer { +@@ -685,6 +685,15 @@ struct llama_layer { struct llama_layer_nextn nextn; @@ -1109,7 +1109,7 @@ index 7c0de5851..5ebbf3382 100644 }; diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp -index 73b5247eb..f1f185cf9 100644 +index 7dc9cf36a28af65765cf6af1d95804132c2181e6..69a453e15d250a7dd92551d7fcff0e1a8bd61090 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -362,6 +362,16 @@ static bool tensor_allows_quantization(const llama_model_quantize_params * param @@ -1130,7 +1130,7 @@ index 73b5247eb..f1f185cf9 100644 quantize &= name.find("indexer.k_proj.weight") == std::string::npos; quantize &= name.find("indexer.q_proj.weight") == std::string::npos; diff --git a/src/llama-vocab.cpp b/src/llama-vocab.cpp -index 6f168fa55..1ad23e1ef 100644 +index 6f168fa5535c55014f8d5103ae37ec6a572f877a..1ad23e1ef94b69c517e81249005e06b1a71f93a0 100644 --- a/src/llama-vocab.cpp +++ b/src/llama-vocab.cpp @@ -470,6 +470,12 @@ struct llm_tokenizer_bpe : llm_tokenizer { @@ -1158,7 +1158,7 @@ index 6f168fa55..1ad23e1ef 100644 tokenizer_pre == "granite-embed-multi-97m") { pre_type = LLAMA_VOCAB_PRE_TYPE_GRANITE_EMB_MULTI; diff --git a/src/llama-vocab.h b/src/llama-vocab.h -index b3e8cd7e1..dbaa5af91 100644 +index b3e8cd7e18b6304c595c43c4457a08df4a2c22ae..dbaa5af91531c1b94e221567ef3dc6c61c5b1673 100644 --- a/src/llama-vocab.h +++ b/src/llama-vocab.h @@ -78,6 +78,7 @@ enum llama_vocab_pre_type { @@ -1171,7 +1171,7 @@ index b3e8cd7e1..dbaa5af91 100644 // HF Metaspace pre-tokenizer prepend_scheme diff --git a/src/models/inkling.cpp b/src/models/inkling.cpp new file mode 100644 -index 000000000..b8cc55734 +index 0000000000000000000000000000000000000000..3fdbfa1c466c2cd0481376b8ef1e2cc072f0b2e4 --- /dev/null +++ b/src/models/inkling.cpp @@ -0,0 +1,691 @@ @@ -1627,7 +1627,7 @@ index 000000000..b8cc55734 + } + + cur = build_attn(inp_attn, -+ layer.wo, NULL, NULL, ++ layer.wo, NULL, + q, k, v, kq_b, nullptr, nullptr, 1.0f, il); + cb(cur, "inkling_attn_o", il); + @@ -1636,9 +1636,9 @@ index 000000000..b8cc55734 + + auto build_dense_ffn = [&](ggml_tensor * cur, int il) -> ggml_tensor * { + cur = build_ffn(cur, -+ model.layers[il].ffn_up, NULL, NULL, -+ model.layers[il].ffn_gate, NULL, NULL, -+ model.layers[il].ffn_down, NULL, NULL, ++ model.layers[il].ffn_up, NULL, ++ model.layers[il].ffn_gate, NULL, ++ model.layers[il].ffn_down, NULL, + NULL, LLM_FFN_SILU, LLM_FFN_PAR, il); + cur = ggml_mul(ctx0, cur, model.layers[il].ffn_gscale); + cb(cur, "inkling_dense_ffn_out", il); @@ -1867,7 +1867,7 @@ index 000000000..b8cc55734 + ggml_build_forward_expand(gf, cur); +} diff --git a/src/models/models.h b/src/models/models.h -index f1ac8e402..65960f3c3 100644 +index 322f2286ef5a047d9d6848b13d080ceb1c16ff16..91efea8762ed2aabcd820c0db1c7c066ce73d9ef 100644 --- a/src/models/models.h +++ b/src/models/models.h @@ -2789,6 +2789,22 @@ struct llama_model_zaya1 : public llama_model_base { @@ -1894,7 +1894,7 @@ index f1ac8e402..65960f3c3 100644 llama_model_smallthinker(const struct llama_model_params & params) : llama_model_base(params) {} void load_arch_hparams(llama_model_loader & ml) override; diff --git a/src/models/nemotron-h-moe.cpp b/src/models/nemotron-h-moe.cpp -index 055b95dee..684aeed66 100644 +index 90d07963c1d5ee19aeff6f22f60d3cf7f978d639..196aa38a2e41335fe697c6f1c4d7a13a125e8df6 100644 --- a/src/models/nemotron-h-moe.cpp +++ b/src/models/nemotron-h-moe.cpp @@ -23,7 +23,7 @@ llama_model_nemotron_h_moe::graph_mtp::graph_mtp(const llm_graph_params & params @@ -1907,7 +1907,7 @@ index 055b95dee..684aeed66 100644 ggml_tensor * tok_embd_w = layer.nextn.embed_tokens ? layer.nextn.embed_tokens : (model.tok_embd ? model.tok_embd diff --git a/src/skippy/speculative_decoding.cpp b/src/skippy/speculative_decoding.cpp -index 3fb86667d..8a53ceb51 100644 +index 3fb86667d61e1c68748faa9133a7952ebd4af596..8a53ceb51250d70a1f6d47d3d08314069355fc3f 100644 --- a/src/skippy/speculative_decoding.cpp +++ b/src/skippy/speculative_decoding.cpp @@ -8,6 +8,7 @@ @@ -2054,7 +2054,7 @@ index 3fb86667d..8a53ceb51 100644 draft_limit = std::min(draft_limit, mtp_depth_scope.depth_count); } diff --git a/tests/test-chat.cpp b/tests/test-chat.cpp -index 291b7a753..5c48dba96 100644 +index 49d9417d4c88bed9351ce53beeea46bae6088f58..39af725c3168439c233f4b355ef825cc6af2d443 100644 --- a/tests/test-chat.cpp +++ b/tests/test-chat.cpp @@ -3273,6 +3273,97 @@ static void test_template_output_peg_parsers(bool detailed_debug) { @@ -2155,7 +2155,7 @@ index 291b7a753..5c48dba96 100644 { // Google Gemma 2 2B - does not support tool calling auto tst = peg_tester("models/templates/google-gemma-2-2b-it.jinja"); -@@ -8766,6 +8857,28 @@ static void test_template_generation_prompt() { +@@ -8782,6 +8873,28 @@ static void test_template_generation_prompt() { check(tmpls, continuation_reasoning(), "<|im_start|>assistant\n\nI'm"); } @@ -2184,7 +2184,7 @@ index 291b7a753..5c48dba96 100644 { // Preserve canonical "none" while keeping the boolean aliases disabled. auto render_disabled = [](const char * template_path) { -@@ -8799,6 +8912,8 @@ static void test_template_generation_prompt() { +@@ -8815,6 +8928,8 @@ static void test_template_generation_prompt() { assert_contains(qwen, "\n\n\n\n"); const auto gpt_oss = render_disabled("models/templates/openai-gpt-oss-120b.jinja").str(); assert_contains(gpt_oss, "Reasoning: none"); @@ -2194,10 +2194,10 @@ index 291b7a753..5c48dba96 100644 } diff --git a/tests/test-llama-archs.cpp b/tests/test-llama-archs.cpp -index 24f3e36f8..5c1508d10 100644 +index 37115641bb4cd65b42d531f6939621c5061a2bef..cf1e093488bfa856bdcad8358a1edb93756493db 100644 --- a/tests/test-llama-archs.cpp +++ b/tests/test-llama-archs.cpp -@@ -1471,6 +1471,10 @@ static bool arch_supported(const llm_arch arch) { +@@ -1474,6 +1474,10 @@ static bool arch_supported(const llm_arch arch) { if (arch == LLM_ARCH_DEEPSEEK2OCR) { return false; } @@ -2209,7 +2209,7 @@ index 24f3e36f8..5c1508d10 100644 #ifdef GGML_USE_WEBGPU if (arch == LLM_ARCH_DEEPSEEK32 || arch == LLM_ARCH_GLM_DSA || arch == LLM_ARCH_DOTS3NOTE || arch == LLM_ARCH_QWEN4EXP || diff --git a/tests/test-mtmd-impl.cpp b/tests/test-mtmd-impl.cpp -index 319811b77..ef7a87c07 100644 +index 319811b77315755f760e2c028fe24ae038a1682b..ef7a87c078bcc7b34960dde2aec8e09c9281776e 100644 --- a/tests/test-mtmd-impl.cpp +++ b/tests/test-mtmd-impl.cpp @@ -2,6 +2,7 @@ @@ -2290,7 +2290,7 @@ index 319811b77..ef7a87c07 100644 mtmd_hparams hparams; hparams.image_longest_edge = 1540; diff --git a/tests/test-skippy-kv-page-export.cpp b/tests/test-skippy-kv-page-export.cpp -index d5e26d984..8c109c1e9 100644 +index d5e26d9849a985ae6ae29a1c7011bf7ab61ec0a2..8c109c1e9ab8fa8d88a5f3d0f11a14ea364c278d 100644 --- a/tests/test-skippy-kv-page-export.cpp +++ b/tests/test-skippy-kv-page-export.cpp @@ -1,4 +1,8 @@ @@ -2365,7 +2365,7 @@ index d5e26d984..8c109c1e9 100644 fprintf(stderr, "graph cache capabilities do not cover complete state\n"); return 1; diff --git a/tools/mtmd/CMakeLists.txt b/tools/mtmd/CMakeLists.txt -index 273c5148f..4a2fdf69c 100644 +index 273c5148f4180f05f978b75dea8537a68e5e8542..4a2fdf69cc175dcdb2415fc9d2e4ea310531670f 100644 --- a/tools/mtmd/CMakeLists.txt +++ b/tools/mtmd/CMakeLists.txt @@ -57,6 +57,7 @@ add_library(mtmd @@ -2378,7 +2378,7 @@ index 273c5148f..4a2fdf69c 100644 models/nemotron-v2-vl.cpp diff --git a/tools/mtmd/models/inkling.cpp b/tools/mtmd/models/inkling.cpp new file mode 100644 -index 000000000..71041023a +index 0000000000000000000000000000000000000000..71041023a3b7918852dcb7fc884ae7a98e30cfdd --- /dev/null +++ b/tools/mtmd/models/inkling.cpp @@ -0,0 +1,105 @@ @@ -2488,7 +2488,7 @@ index 000000000..71041023a + return gf; +} diff --git a/tools/mtmd/models/models.h b/tools/mtmd/models/models.h -index b47574157..b895d3589 100644 +index b47574157090bbe71493c13bbc6902ec31b1de28..b895d3589beea9c1976cc53d3f6f766531598adc 100644 --- a/tools/mtmd/models/models.h +++ b/tools/mtmd/models/models.h @@ -18,6 +18,17 @@ struct mtmd_graph_siglip : mtmd_graph { @@ -2510,7 +2510,7 @@ index b47574157..b895d3589 100644 mtmd_graph_gemma4v(mtmd_subcontext * ctx, const mtmd_image_f32 & img) : mtmd_graph(ctx, img) {} ggml_cgraph * build() override; diff --git a/tools/mtmd/mtmd-audio.cpp b/tools/mtmd/mtmd-audio.cpp -index bfea3a364..612555dee 100644 +index bfea3a364a48c426a19f6ab627835f85cd3b9882..612555deef8f9ac67d496d136fb836b536313112 100644 --- a/tools/mtmd/mtmd-audio.cpp +++ b/tools/mtmd/mtmd-audio.cpp @@ -494,6 +494,78 @@ static bool log_mel_spectrogram( @@ -2593,7 +2593,7 @@ index bfea3a364..612555dee 100644 // mtmd_audio_preprocessor_whisper // diff --git a/tools/mtmd/mtmd-audio.h b/tools/mtmd/mtmd-audio.h -index 7ca00190c..e3adfe7cb 100644 +index 7ca00190cf7a7e39b8f0660ad48a997035d8a2a8..e3adfe7cb8ad957e7be240ccf8be40fd70505220 100644 --- a/tools/mtmd/mtmd-audio.h +++ b/tools/mtmd/mtmd-audio.h @@ -155,6 +155,18 @@ struct mtmd_audio_preprocessor_vibevoice_asr : mtmd_audio_preprocessor { @@ -2616,7 +2616,7 @@ index 7ca00190c..e3adfe7cb 100644 mtmd_audio_preprocessor_conformer(const mtmd_model * model) : mtmd_audio_preprocessor(model) {} mtmd_audio_preprocessor_conformer(const mtmd_hparams & hparams, ggml_backend_sched_t sched) : mtmd_audio_preprocessor(hparams, sched) {} diff --git a/tools/mtmd/mtmd-graph.cpp b/tools/mtmd/mtmd-graph.cpp -index 576f27b83..345f10f6c 100644 +index 576f27b836a06a465fd364d23ba49157ff082d4d..345f10f6c4fbea8acac916865587261de23c23a1 100644 --- a/tools/mtmd/mtmd-graph.cpp +++ b/tools/mtmd/mtmd-graph.cpp @@ -752,6 +752,10 @@ std::unique_ptr mtmd_get_graph_builder(mtmd_subcontext * ctx, const @@ -2631,7 +2631,7 @@ index 576f27b83..345f10f6c 100644 case PROJECTOR_TYPE_IDEFICS3: case PROJECTOR_TYPE_COHERE2V: diff --git a/tools/mtmd/mtmd-image.cpp b/tools/mtmd/mtmd-image.cpp -index c69930f85..479975350 100644 +index c69930f8597f36de1e21f26c6a47a870f738cb91..47997535068bb9f5c7812cfef89ccb46dc381f99 100644 --- a/tools/mtmd/mtmd-image.cpp +++ b/tools/mtmd/mtmd-image.cpp @@ -512,6 +512,78 @@ private: @@ -2714,7 +2714,7 @@ index c69930f85..479975350 100644 // mtmd_image_preprocessor_llava_uhd // diff --git a/tools/mtmd/mtmd-image.h b/tools/mtmd/mtmd-image.h -index b11f001ab..4a03e6873 100644 +index b11f001ab6793a61df917dd9817e2ec1c1ae5f1a..4a03e6873c25b3e595108b736e1ee77d855962e0 100644 --- a/tools/mtmd/mtmd-image.h +++ b/tools/mtmd/mtmd-image.h @@ -26,6 +26,20 @@ struct mtmd_image_preproc_out { @@ -2752,7 +2752,7 @@ index b11f001ab..4a03e6873 100644 // if image_resize_pad is true, the resized image will be padded, otherwise it will be either stretched or center-cropped depending on image_resize_pad // this is used by models with native support for dynamic image size, for example: Qwen-VL, Pixtral, Kimi-VL, etc diff --git a/tools/mtmd/mtmd-impl.h b/tools/mtmd/mtmd-impl.h -index d6b32fae4..77c38d8d3 100644 +index d6b32fae4f8b71d4f3eee80ffe1d05026f79c016..77c38d8d3cf2c1c625269fffafddf32aeeb513c3 100644 --- a/tools/mtmd/mtmd-impl.h +++ b/tools/mtmd/mtmd-impl.h @@ -466,6 +466,13 @@ @@ -2786,7 +2786,7 @@ index d6b32fae4..77c38d8d3 100644 { PROJECTOR_TYPE_LDP, "ldp" }, { PROJECTOR_TYPE_LDPV2, "ldpv2"}, diff --git a/tools/mtmd/mtmd-model.cpp b/tools/mtmd/mtmd-model.cpp -index 508dfbe94..54e45bd14 100644 +index 508dfbe94d81289b14925de592d1b5519e8e5c65..54e45bd1442767adf61438c9d9c91f77d7001092 100644 --- a/tools/mtmd/mtmd-model.cpp +++ b/tools/mtmd/mtmd-model.cpp @@ -294,6 +294,21 @@ struct mtmd_model_loader { @@ -2884,7 +2884,7 @@ index 508dfbe94..54e45bd14 100644 return mm_model_block_1_block_2_1_b->ne[0]; case PROJECTOR_TYPE_LDPV2: diff --git a/tools/mtmd/mtmd-model.h b/tools/mtmd/mtmd-model.h -index 10c3154e8..4e49edd8d 100644 +index 10c3154e8b034088146953da0565c297ea5f58a5..4e49edd8df9cee8fb5c06a94c1d495a96324c541 100644 --- a/tools/mtmd/mtmd-model.h +++ b/tools/mtmd/mtmd-model.h @@ -656,6 +656,12 @@ struct mtmd_code2wav { @@ -2914,7 +2914,7 @@ index 10c3154e8..4e49edd8d 100644 ggml_tensor * patch_norm_1_w = nullptr; ggml_tensor * patch_norm_1_b = nullptr; diff --git a/tools/mtmd/mtmd-subcontext.cpp b/tools/mtmd/mtmd-subcontext.cpp -index 4ea2217d0..3c8e858a1 100644 +index 4ea2217d04bb1d4d5de91cc05b81ac70c94e5b0a..3c8e858a10b69650c099da5b63639ebeb7b776a9 100644 --- a/tools/mtmd/mtmd-subcontext.cpp +++ b/tools/mtmd/mtmd-subcontext.cpp @@ -170,6 +170,11 @@ mtmd_image_f32_batch mtmd_subcontext::get_dummy_batch() const { @@ -2941,7 +2941,7 @@ index 4ea2217d0..3c8e858a1 100644 { const int grid_w = pos_w; // image_size_width / patch_size diff --git a/tools/mtmd/mtmd.cpp b/tools/mtmd/mtmd.cpp -index e99d25792..58a8229b3 100644 +index e99d25792acc1a318f8d5c2d2b88698488436169..58a8229b33c07b166a886d678b0c3ddd15fa0b8d 100644 --- a/tools/mtmd/mtmd.cpp +++ b/tools/mtmd/mtmd.cpp @@ -1045,6 +1045,12 @@ struct mtmd_context { @@ -3013,6 +3013,3 @@ index e99d25792..58a8229b3 100644 } else { // other models, we only need the total number of tokens image_tokens->nx = n_tokens; --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0002-fix-kimi-k3-name-residual-checkpoint-activation-port.patch b/llama_cpp/patches/model_support/0002-fix-kimi-k3-name-residual-checkpoint-activation-port.patch index 0a738adb..6e814432 100644 --- a/llama_cpp/patches/model_support/0002-fix-kimi-k3-name-residual-checkpoint-activation-port.patch +++ b/llama_cpp/patches/model_support/0002-fix-kimi-k3-name-residual-checkpoint-activation-port.patch @@ -1,4 +1,4 @@ -From 3e386fee6001119aa878a4c63ecc7e0b0541a641 Mon Sep 17 00:00:00 2001 +From b8286ee042e500706ff5775e4027363b43e285a0 Mon Sep 17 00:00:00 2001 From: James Dumay Date: Mon, 21 Sep 2026 05:48:09 +1000 Subject: [PATCH] fix(kimi-k3): name residual checkpoint activation ports @@ -8,7 +8,7 @@ Subject: [PATCH] fix(kimi-k3): name residual checkpoint activation ports 1 file changed, 1 insertion(+) diff --git a/src/models/kimi-k3.cpp b/src/models/kimi-k3.cpp -index 57b950e39..3a6ddaf0e 100644 +index be64d662a776293d9e55e4690e21fc983a28ac65..e4cb022c0f2ad35f879c14f137c70b517dddfd82 100644 --- a/src/models/kimi-k3.cpp +++ b/src/models/kimi-k3.cpp @@ -286,6 +286,7 @@ llama_model_kimi_k3::graph::graph(const llm_graph_params & params) : @@ -19,6 +19,3 @@ index 57b950e39..3a6ddaf0e 100644 banked = true; } --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0003-llama-port-diffusiongemma-support.patch b/llama_cpp/patches/model_support/0003-llama-port-diffusiongemma-support.patch index c1e730a8..aefdc152 100644 --- a/llama_cpp/patches/model_support/0003-llama-port-diffusiongemma-support.patch +++ b/llama_cpp/patches/model_support/0003-llama-port-diffusiongemma-support.patch @@ -1,4 +1,4 @@ -From d3946314eecebfc99681e7cb09c317ce413daa70 Mon Sep 17 00:00:00 2001 +From c8738568e1c4bff0d19cf8db3a68b3f632e33a15 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 6 Nov 2026 10:33:32 -0800 Subject: [PATCH] llama: port DiffusionGemma support @@ -39,7 +39,7 @@ Subject: [PATCH] llama: port DiffusionGemma support create mode 100644 src/models/gemma4-common.h diff --git a/common/arg.cpp b/common/arg.cpp -index c322b5c0f..af6cd6ae6 100644 +index c322b5c0fcfc5ce62b9f591685f1b8e17b2a4caa..af6cd6ae6a89c9a30f7451ed70aa61f64cf6d359 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -1892,7 +1892,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex @@ -159,7 +159,7 @@ index c322b5c0f..af6cd6ae6 100644 { "-lr", "--learning-rate" }, "ALPHA", string_format("adamw or sgd optimizer alpha (default: %.2g); note: sgd alpha recommended ~10x (no momentum)", (double) params.lr.lr0), diff --git a/common/common.h b/common/common.h -index 4981afa92..e850c61bb 100644 +index 4981afa922f87d9f344e44b17c2ece103472cbc4..e850c61bb1fe8e68ef93de127a76d77b668c634d 100644 --- a/common/common.h +++ b/common/common.h @@ -430,7 +430,10 @@ struct common_params_speculative { @@ -193,7 +193,7 @@ index 4981afa92..e850c61bb 100644 // reasoning API response format (not to be confused as chat template's reasoning format) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt -index 39f802d25..2888c13d1 100644 +index 39f802d250e141135aafe05f532192e435ce135f..2888c13d1795e0ff3dfdb2f2cf1e5c42ee7a7fe3 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -16,6 +16,8 @@ if (EMSCRIPTEN) @@ -207,7 +207,7 @@ index 39f802d25..2888c13d1 100644 diff --git a/examples/diffusion-gemma-eval/CMakeLists.txt b/examples/diffusion-gemma-eval/CMakeLists.txt new file mode 100644 -index 000000000..7a99b8423 +index 0000000000000000000000000000000000000000..7a99b8423a1dfe80ddecea8f2cc5d97046965eed --- /dev/null +++ b/examples/diffusion-gemma-eval/CMakeLists.txt @@ -0,0 +1,5 @@ @@ -218,7 +218,7 @@ index 000000000..7a99b8423 +target_compile_features(${TARGET} PRIVATE cxx_std_17) diff --git a/examples/diffusion-gemma-eval/diffusion-gemma-eval.cpp b/examples/diffusion-gemma-eval/diffusion-gemma-eval.cpp new file mode 100644 -index 000000000..7e3fb4698 +index 0000000000000000000000000000000000000000..7e3fb4698a4c9a671f97d5244e8f31e1e64c2d7b --- /dev/null +++ b/examples/diffusion-gemma-eval/diffusion-gemma-eval.cpp @@ -0,0 +1,196 @@ @@ -420,7 +420,7 @@ index 000000000..7e3fb4698 +} diff --git a/examples/diffusion-gemma-server/CMakeLists.txt b/examples/diffusion-gemma-server/CMakeLists.txt new file mode 100644 -index 000000000..768ce5895 +index 0000000000000000000000000000000000000000..768ce5895e655dfaf5b72da2d5160abb64f5f891 --- /dev/null +++ b/examples/diffusion-gemma-server/CMakeLists.txt @@ -0,0 +1,13 @@ @@ -439,7 +439,7 @@ index 000000000..768ce5895 +target_compile_features(${TARGET} PRIVATE cxx_std_17) diff --git a/examples/diffusion-gemma-server/diffusion-gemma-server.cpp b/examples/diffusion-gemma-server/diffusion-gemma-server.cpp new file mode 100644 -index 000000000..8a430b504 +index 0000000000000000000000000000000000000000..8a430b5042cab3886338622a338bc9bd7c259b3d --- /dev/null +++ b/examples/diffusion-gemma-server/diffusion-gemma-server.cpp @@ -0,0 +1,189 @@ @@ -634,7 +634,7 @@ index 000000000..8a430b504 +} diff --git a/examples/diffusion-gemma-server/diffusion-gemma-visual-server.cpp b/examples/diffusion-gemma-server/diffusion-gemma-visual-server.cpp new file mode 100644 -index 000000000..a4dea3783 +index 0000000000000000000000000000000000000000..a4dea3783b7e9bc171badd61d2e6149bcdf49df2 --- /dev/null +++ b/examples/diffusion-gemma-server/diffusion-gemma-visual-server.cpp @@ -0,0 +1,388 @@ @@ -1027,7 +1027,7 @@ index 000000000..a4dea3783 + return 0; +} diff --git a/examples/diffusion/diffusion-cli.cpp b/examples/diffusion/diffusion-cli.cpp -index c64611356..7f036913a 100644 +index c64611356204d8c4c6c020f902ac55019c9384fa..7f036913a4de43000d320ac6c85ba66f815de02f 100644 --- a/examples/diffusion/diffusion-cli.cpp +++ b/examples/diffusion/diffusion-cli.cpp @@ -2,13 +2,27 @@ @@ -1685,7 +1685,7 @@ index c64611356..7f036913a 100644 llama_free(ctx); diff --git a/examples/diffusion/diffusion.cpp b/examples/diffusion/diffusion.cpp -index 0ff57d953..cf5c0e149 100644 +index 0ff57d953c4a42d6035230a26ad98b0d2e576667..cf5c0e14954002fc61993eb9bd07709c762ad4d9 100644 --- a/examples/diffusion/diffusion.cpp +++ b/examples/diffusion/diffusion.cpp @@ -8,7 +8,9 @@ @@ -2025,7 +2025,7 @@ index 0ff57d953..cf5c0e149 100644 + } +} diff --git a/examples/diffusion/diffusion.h b/examples/diffusion/diffusion.h -index 783144522..a7f305e29 100644 +index 7831445224c9917d7c207fcf571ea447710ecaf0..a7f305e2921353b2d694e46a68fbf765c2f24836 100644 --- a/examples/diffusion/diffusion.h +++ b/examples/diffusion/diffusion.h @@ -33,6 +33,10 @@ struct diffusion_params { @@ -2079,7 +2079,7 @@ index 783144522..a7f305e29 100644 + int32_t & n_generated); diff --git a/ggml/src/ggml-cuda/diffusion-sampling.cu b/ggml/src/ggml-cuda/diffusion-sampling.cu new file mode 100644 -index 000000000..2347002d8 +index 0000000000000000000000000000000000000000..2347002d8a770129f8e0b16a8025c6fba5d3bfab --- /dev/null +++ b/ggml/src/ggml-cuda/diffusion-sampling.cu @@ -0,0 +1,178 @@ @@ -2263,7 +2263,7 @@ index 000000000..2347002d8 +} diff --git a/ggml/src/ggml-cuda/diffusion-sampling.cuh b/ggml/src/ggml-cuda/diffusion-sampling.cuh new file mode 100644 -index 000000000..678611e0d +index 0000000000000000000000000000000000000000..678611e0d856ad3840f5737aeea1c07bb71ea899 --- /dev/null +++ b/ggml/src/ggml-cuda/diffusion-sampling.cuh @@ -0,0 +1,19 @@ @@ -2287,7 +2287,7 @@ index 000000000..678611e0d + int n_tokens, + float inv_temp); diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu -index 655cfd31a..bc601f76b 100644 +index c7f2e5dd79037ff9b809ed6e868ae20c839b619f..9a58c5af8978904215084cd9a7f5e8fb660a331f 100644 --- a/ggml/src/ggml-cuda/ggml-cuda.cu +++ b/ggml/src/ggml-cuda/ggml-cuda.cu @@ -27,6 +27,7 @@ @@ -2297,8 +2297,8 @@ index 655cfd31a..bc601f76b 100644 +#include "ggml-cuda/diffusion-sampling.cuh" #include "ggml-cuda/fattn.cuh" #include "ggml-cuda/fp8.cuh" - #include "ggml-cuda/fwht.cuh" -@@ -7458,6 +7459,9 @@ static void * ggml_backend_cuda_reg_get_proc_address(ggml_backend_reg_t reg, con + #include "ggml-cuda/fusion.cuh" +@@ -5205,6 +5206,9 @@ static void * ggml_backend_cuda_reg_get_proc_address(ggml_backend_reg_t reg, con return (void *)ggml_cuda_cachegen_decode; } #endif // !defined(GGML_USE_MUSA) @@ -2309,7 +2309,7 @@ index 655cfd31a..bc601f76b 100644 } diff --git a/include/llama.h b/include/llama.h -index 7a2b918b4..4e88136c4 100644 +index 7a2b918b40eae4a476da4714617eee37a9c2b337..4e88136c4cbc1ccc57f06f66435a2eb4bd14ad1c 100644 --- a/include/llama.h +++ b/include/llama.h @@ -603,6 +603,55 @@ extern "C" { @@ -2369,7 +2369,7 @@ index 7a2b918b4..4e88136c4 100644 LLAMA_API int32_t llama_model_n_embd (const struct llama_model * model); LLAMA_API int32_t llama_model_n_embd_inp (const struct llama_model * model); diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp -index 41f92e0c4..36e872224 100644 +index 9cb8279de2c04e4588d587eb058d9c4b4fd8a861..232dd9e4a40c078e927cdc5f3220c7c98d938df7 100644 --- a/src/llama-arch.cpp +++ b/src/llama-arch.cpp @@ -64,6 +64,7 @@ static const std::map LLM_ARCH_NAMES = { @@ -2380,7 +2380,7 @@ index 41f92e0c4..36e872224 100644 { LLM_ARCH_GEMMA_EMBEDDING, "gemma-embedding" }, { LLM_ARCH_GEMMA_EMBEDDING2, "gemma-embedding2" }, { LLM_ARCH_STARCODER2, "starcoder2" }, -@@ -482,6 +483,9 @@ static const std::map LLM_KV_NAMES = { +@@ -483,6 +484,9 @@ static const std::map LLM_KV_NAMES = { { LLM_KV_INKLING_LOG_SCALING_ALPHA, "%s.log_scaling_alpha" }, { LLM_KV_INKLING_UNPADDED_VOCAB_SIZE, "%s.unpadded_vocab_size" }, @@ -2390,7 +2390,7 @@ index 41f92e0c4..36e872224 100644 // sentence-transformers dense modules feature dims { LLM_KV_DENSE_2_FEAT_IN, "%s.dense_2_feat_in" }, { LLM_KV_DENSE_2_FEAT_OUT, "%s.dense_2_feat_out" }, -@@ -668,6 +672,11 @@ static const std::map LLM_TENSOR_NAMES = { +@@ -669,6 +673,11 @@ static const std::map LLM_TENSOR_NAMES = { { LLM_TENSOR_ATTN_QKV, "blk.%d.attn_qkv" }, { LLM_TENSOR_LAYER_OUT_NORM, "blk.%d.layer_output_norm" }, { LLM_TENSOR_LAYER_OUT_SCALE, "blk.%d.layer_output_scale" }, @@ -2402,7 +2402,7 @@ index 41f92e0c4..36e872224 100644 { LLM_TENSOR_ATTN_VRES_LAMBDA, "blk.%d.attn_vres_lambda" }, { LLM_TENSOR_ATTN_OUT_NORM, "blk.%d.attn_output_norm" }, { LLM_TENSOR_POS_EMBD, "position_embd" }, -@@ -1225,6 +1234,11 @@ static const std::map LLM_TENSOR_INFOS = { +@@ -1226,6 +1235,11 @@ static const std::map LLM_TENSOR_INFOS = { {LLM_TENSOR_ATTN_K_NORM, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL}}, {LLM_TENSOR_LAYER_OUT_NORM, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL}}, {LLM_TENSOR_LAYER_OUT_SCALE, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL}}, @@ -2414,7 +2414,7 @@ index 41f92e0c4..36e872224 100644 {LLM_TENSOR_ATTN_VRES_LAMBDA, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL}}, {LLM_TENSOR_ATTN_Q_A_NORM, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL}}, {LLM_TENSOR_ATTN_KV_A_NORM, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL}}, -@@ -1561,6 +1575,7 @@ bool llm_arch_is_diffusion(const llm_arch & arch) { +@@ -1562,6 +1576,7 @@ bool llm_arch_is_diffusion(const llm_arch & arch) { case LLM_ARCH_LLADA: case LLM_ARCH_LLADA_MOE: case LLM_ARCH_RND1: @@ -2422,7 +2422,7 @@ index 41f92e0c4..36e872224 100644 return true; default: return false; -@@ -1686,6 +1701,7 @@ bool llama_arch_supports_save(llm_arch arch) { +@@ -1690,6 +1705,7 @@ bool llama_arch_supports_save(llm_arch arch) { case LLM_ARCH_CLEF: // the head tensors are not saved case LLM_ARCH_INKLING2_LOOP: // the loop tensors are not saved and the cache slots are expanded at load case LLM_ARCH_VLLM_DECISION2: @@ -2431,7 +2431,7 @@ index 41f92e0c4..36e872224 100644 default: return true; diff --git a/src/llama-arch.h b/src/llama-arch.h -index 66594e68b..005219cd9 100644 +index f89d2c95a568732185a08dc2de9fd5a243db9c5e..dcf8d90d860fc69a27b68ef1da0e7bd0b084d158 100644 --- a/src/llama-arch.h +++ b/src/llama-arch.h @@ -68,6 +68,7 @@ enum llm_arch { @@ -2442,7 +2442,7 @@ index 66594e68b..005219cd9 100644 LLM_ARCH_GEMMA_EMBEDDING, LLM_ARCH_GEMMA_EMBEDDING2, LLM_ARCH_STARCODER2, -@@ -528,6 +529,7 @@ enum llm_kv { +@@ -529,6 +530,7 @@ enum llm_kv { LLM_KV_INKLING_LOG_SCALING_N_FLOOR, LLM_KV_INKLING_LOG_SCALING_ALPHA, LLM_KV_INKLING_UNPADDED_VOCAB_SIZE, @@ -2450,7 +2450,7 @@ index 66594e68b..005219cd9 100644 LLM_KV_XIELU_ALPHA_N, LLM_KV_XIELU_ALPHA_P, -@@ -690,6 +692,11 @@ enum llm_tensor { +@@ -691,6 +693,11 @@ enum llm_tensor { LLM_TENSOR_ATTN_K_NORM, LLM_TENSOR_LAYER_OUT_NORM, LLM_TENSOR_LAYER_OUT_SCALE, @@ -2460,10 +2460,10 @@ index 66594e68b..005219cd9 100644 + LLM_TENSOR_SC_UP, // diffusion-gemma self-conditioning + LLM_TENSOR_SC_DOWN, // diffusion-gemma self-conditioning LLM_TENSOR_ATTN_VRES_LAMBDA, - LLM_TENSOR_POST_ATTN_NORM, - LLM_TENSOR_POST_MLP_NORM, + LLM_TENSOR_PER_LAYER_TOKEN_EMBD, // gemma3n + LLM_TENSOR_PER_LAYER_MODEL_PROJ, // gemma3n diff --git a/src/llama-model.cpp b/src/llama-model.cpp -index 63a35ad78..0a2b8bcd7 100644 +index e3a295b99e4ecb01b90824e1728ff2024cf74588..c257f9bbbf9f81a79fdf2dd36a2c2adb378e9ace 100644 --- a/src/llama-model.cpp +++ b/src/llama-model.cpp @@ -171,6 +171,8 @@ static llama_model * llama_model_mapping(llm_arch arch, const llama_model_params @@ -2475,7 +2475,7 @@ index 63a35ad78..0a2b8bcd7 100644 case LLM_ARCH_GEMMA_EMBEDDING: return new llama_model_gemma_embedding(params); case LLM_ARCH_GEMMA_EMBEDDING2: -@@ -3271,6 +3273,7 @@ llama_memory_i * llama_model::create_memory( +@@ -3136,6 +3138,7 @@ llama_memory_i * llama_model::create_memory( case LLM_ARCH_CLEF: case LLM_ARCH_KOKORO: case LLM_ARCH_TINY_VOCA: @@ -2483,7 +2483,7 @@ index 63a35ad78..0a2b8bcd7 100644 { res = nullptr; } break; -@@ -4162,6 +4165,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) { +@@ -4027,6 +4030,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) { case LLM_ARCH_GEMMA4: case LLM_ARCH_MAION_CODER: case LLM_ARCH_GEMMA4_ASSISTANT: @@ -2492,10 +2492,10 @@ index 63a35ad78..0a2b8bcd7 100644 case LLM_ARCH_GEMMA_EMBEDDING2: case LLM_ARCH_STARCODER2: diff --git a/src/llama-model.h b/src/llama-model.h -index 5ebbf3382..14838b67b 100644 +index c841eae96638845f2db50326545b31abbda1d515..0c082ad2e1d4bca443825ef0134d90a2db12fa40 100644 --- a/src/llama-model.h +++ b/src/llama-model.h -@@ -725,6 +725,8 @@ struct llama_layer { +@@ -674,6 +674,8 @@ struct llama_layer { struct ggml_tensor * attn_res_query = nullptr; struct ggml_tensor * ffn_post_conv = nullptr; struct ggml_tensor * ffn_res_query = nullptr; @@ -2504,7 +2504,7 @@ index 5ebbf3382..14838b67b 100644 struct llama_layer_posnet posnet; -@@ -929,6 +931,11 @@ struct llama_model { +@@ -896,6 +898,11 @@ struct llama_model { struct ggml_tensor * cont_hidden_b = nullptr; struct ggml_tensor * cont_output = nullptr; struct ggml_tensor * cont_output_b = nullptr; @@ -2518,7 +2518,7 @@ index 5ebbf3382..14838b67b 100644 struct ggml_tensor * hc_head_fn = nullptr; diff --git a/src/models/diffusion-gemma.cpp b/src/models/diffusion-gemma.cpp new file mode 100644 -index 000000000..d34473c69 +index 0000000000000000000000000000000000000000..02ba1e47c87f17296dccbe61a16770827e30376b --- /dev/null +++ b/src/models/diffusion-gemma.cpp @@ -0,0 +1,850 @@ @@ -2844,7 +2844,7 @@ index 000000000..d34473c69 + layer.ffn_up_exps = create_tensor(tn(LLM_TENSOR_FFN_UP_EXPS, "weight", i), {n_embd, n_ff_exp, n_expert}, 0); + } + layer.ffn_down_exps = create_tensor(tn(LLM_TENSOR_FFN_DOWN_EXPS, "weight", i), {n_ff_exp, n_embd, n_expert}, 0); -+ // per-expert scale (router.per_expert_scale) is loaded as ffn_down_exps_s ++ // per-expert scale (router.per_expert_scale) registers on the expert weights + } +} + @@ -3061,7 +3061,7 @@ index 000000000..d34473c69 + Kfull = ggml_concat(ctx0, cast_kv(pk), Kcur, 2); + Vfull = ggml_concat(ctx0, cast_kv(pv), Vcur, 2); + } -+ cur = build_attn(inp_attn, model.layers[il].wo, nullptr, nullptr, ++ cur = build_attn(inp_attn, model.layers[il].wo, nullptr, + Qcur, Kfull, Vfull, nullptr, nullptr, nullptr, + hparams.f_attention_scale, il); + } else if (is_decode) { @@ -3072,11 +3072,11 @@ index 000000000..d34473c69 + dmodel.pkv_v[il]->nb[1], dmodel.pkv_v[il]->nb[2], 0); + ggml_tensor * Kfull = ggml_concat(ctx0, cast_kv(pk), Kcur, 2); + ggml_tensor * Vfull = ggml_concat(ctx0, cast_kv(pv), Vcur, 2); -+ cur = build_attn(inp_attn, model.layers[il].wo, nullptr, nullptr, ++ cur = build_attn(inp_attn, model.layers[il].wo, nullptr, + Qcur, Kfull, Vfull, nullptr, nullptr, nullptr, + hparams.f_attention_scale, il); + } else { -+ cur = build_attn(inp_attn, model.layers[il].wo, nullptr, nullptr, ++ cur = build_attn(inp_attn, model.layers[il].wo, nullptr, + Qcur, Kcur, Vcur, nullptr, nullptr, nullptr, + hparams.f_attention_scale, il); + } @@ -3374,7 +3374,7 @@ index 000000000..d34473c69 +} diff --git a/src/models/gemma4-common.h b/src/models/gemma4-common.h new file mode 100644 -index 000000000..9a6f4ddd5 +index 0000000000000000000000000000000000000000..4a1b1c87123a1df5a64a201246d1c7b12727fc35 --- /dev/null +++ b/src/models/gemma4-common.h @@ -0,0 +1,126 @@ @@ -3399,7 +3399,7 @@ index 000000000..9a6f4ddd5 + // full_attention (non-SWA) layers use rope_freqs for proportional rope + ggml_tensor * freq_factors = hp.is_swa(il) ? nullptr : model.layers[il].rope_freqs; + -+ ggml_tensor * Qcur = g.build_lora_mm(model.layers[il].wq, cur, model.layers[il].wq_s); ++ ggml_tensor * Qcur = g.build_lora_mm(model.layers[il].wq, cur); + g.cb(Qcur, "Qcur", il); + Qcur = ggml_reshape_3d(g.ctx0, Qcur, n_embd_head, n_head, g.n_tokens); + Qcur = g.build_norm(Qcur, model.layers[il].attn_q_norm, nullptr, LLM_NORM_RMS, il); @@ -3423,10 +3423,10 @@ index 000000000..9a6f4ddd5 + const int n_rot_l = hp.n_rot(il); + ggml_tensor * freq_factors = hp.is_swa(il) ? nullptr : model.layers[il].rope_freqs; + -+ ggml_tensor * Kcur = g.build_lora_mm(model.layers[il].wk, cur, model.layers[il].wk_s); ++ ggml_tensor * Kcur = g.build_lora_mm(model.layers[il].wk, cur); + g.cb(Kcur, "Kcur", il); + ggml_tensor * Vcur = model.layers[il].wv -+ ? g.build_lora_mm(model.layers[il].wv, cur, model.layers[il].wv_s) ++ ? g.build_lora_mm(model.layers[il].wv, cur) + : Kcur; + g.cb(Vcur, "Vcur", il); + @@ -3462,9 +3462,9 @@ index 000000000..9a6f4ddd5 + ggml_tensor * cur_mlp = g.build_norm(attn_out, layer.ffn_norm, nullptr, LLM_NORM_RMS, il); + g.cb(cur_mlp, "ffn_norm_1", il); + cur_mlp = g.build_ffn(cur_mlp, -+ layer.ffn_up, nullptr, layer.ffn_up_s, -+ layer.ffn_gate, nullptr, layer.ffn_gate_s, -+ layer.ffn_down, nullptr, layer.ffn_down_s, ++ layer.ffn_up, nullptr, ++ layer.ffn_gate, nullptr, ++ layer.ffn_down, nullptr, + nullptr, LLM_FFN_GELU, LLM_FFN_PAR, il); + cur_mlp = g.build_norm(cur_mlp, layer.ffn_post_norm_1, nullptr, LLM_NORM_RMS, il); + g.cb(cur_mlp, "ffn_mlp", il); @@ -3483,7 +3483,7 @@ index 000000000..9a6f4ddd5 + nullptr, g.n_expert, g.n_expert_used, + LLM_FFN_GELU, true, 1.0f, LLAMA_EXPERT_GATING_FUNC_TYPE_SOFTMAX, + il, logits, -+ layer.ffn_gate_up_exps, layer.ffn_up_exps_s, layer.ffn_gate_exps_s, layer.ffn_down_exps_s); ++ layer.ffn_gate_up_exps); + cur_moe = g.build_norm(cur_moe, layer.ffn_post_norm_2, nullptr, LLM_NORM_RMS, il); + g.cb(cur_moe, "ffn_moe", il); + @@ -3493,9 +3493,9 @@ index 000000000..9a6f4ddd5 + cur = g.build_norm(attn_out, layer.ffn_norm, nullptr, LLM_NORM_RMS, il); + g.cb(cur, "ffn_norm", il); + cur = g.build_ffn(cur, -+ layer.ffn_up, nullptr, layer.ffn_up_s, -+ layer.ffn_gate, nullptr, layer.ffn_gate_s, -+ layer.ffn_down, nullptr, layer.ffn_down_s, ++ layer.ffn_up, nullptr, ++ layer.ffn_gate, nullptr, ++ layer.ffn_down, nullptr, + nullptr, LLM_FFN_GELU, LLM_FFN_PAR, il); + g.cb(cur, "ffn_out", il); + } @@ -3505,7 +3505,7 @@ index 000000000..9a6f4ddd5 + return cur; +} diff --git a/src/models/models.h b/src/models/models.h -index 65960f3c3..298957f7a 100644 +index 91efea8762ed2aabcd820c0db1c7c066ce73d9ef..0355d3c462b319310ca79b01d20ac85abfca1cf6 100644 --- a/src/models/models.h +++ b/src/models/models.h @@ -1005,6 +1005,66 @@ struct llama_model_gemma4 : public llama_model_base { @@ -3576,10 +3576,10 @@ index 65960f3c3..298957f7a 100644 llama_model_gemma4_assistant(const struct llama_model_params & params) : llama_model_base(params) {} void load_arch_hparams(llama_model_loader & ml) override; diff --git a/tests/test-llama-archs.cpp b/tests/test-llama-archs.cpp -index 5c1508d10..c08cb4341 100644 +index cf1e093488bfa856bdcad8358a1edb93756493db..2ad7538be245bbfc43c58f1d689eeb77cb3de992 100644 --- a/tests/test-llama-archs.cpp +++ b/tests/test-llama-archs.cpp -@@ -575,7 +575,11 @@ static gguf_context_ptr get_gguf_ctx( +@@ -577,7 +577,11 @@ static gguf_context_ptr get_gguf_ctx( } else if (arch == LLM_ARCH_COHERE2MOE || arch == LLM_ARCH_MIMO2 || arch == LLM_ARCH_STEP35 || arch == LLM_ARCH_SPARK2_5 || arch == LLM_ARCH_MUSE_GLIMMER || arch == LLM_ARCH_MUSE_SPARK || arch == LLM_ARCH_GRANITE_SWA || arch == LLM_ARCH_DOTS3NOTE || arch == LLM_ARCH_KOLIBRI1 || arch == LLM_ARCH_MAPLE || arch == LLM_ARCH_FLINT || arch == LLM_ARCH_BEAM || arch == LLM_ARCH_RICURSIVE || arch == LLM_ARCH_DOMYN_EDGE || @@ -3592,7 +3592,7 @@ index 5c1508d10..c08cb4341 100644 std::vector pattern; pattern.reserve(n_layer); for (uint32_t il = 0; il < n_layer; il++) { -@@ -1005,6 +1009,16 @@ static gguf_context_ptr get_gguf_ctx( +@@ -1007,6 +1011,16 @@ static gguf_context_ptr get_gguf_ctx( ms.add_kv(LLM_KV_SWIGLU_CLAMP_EXP, clamp_exp); ms.add_kv(LLM_KV_SWIGLU_CLAMP_SHEXP, clamp_shexp); } @@ -3609,7 +3609,7 @@ index 5c1508d10..c08cb4341 100644 ms.add_kv(LLM_KV_WKV_HEAD_SIZE, n_embd/n_head); ms.add_kv(LLM_KV_SHORTCONV_L_CACHE, uint32_t(3)); ms.add_kv(LLM_KV_RESIDUAL_SCALE, 3.5565588200778455f); -@@ -1365,6 +1379,7 @@ static bool moe_mandatory(const llm_arch arch) { +@@ -1367,6 +1381,7 @@ static bool moe_mandatory(const llm_arch arch) { case LLM_ARCH_DEEPSEEK2: case LLM_ARCH_DEEPSEEK32: case LLM_ARCH_DOTS3NOTE: @@ -3617,7 +3617,7 @@ index 5c1508d10..c08cb4341 100644 case LLM_ARCH_DEEPSEEK4: case LLM_ARCH_DEEPSEEK41: case LLM_ARCH_XING4_0: -@@ -1708,7 +1723,10 @@ static int test_backends(const std::string & arch_filter, const size_t seed, con +@@ -1711,7 +1726,10 @@ static int test_backends(const std::string & arch_filter, const size_t seed, con continue; } @@ -3629,6 +3629,3 @@ index 5c1508d10..c08cb4341 100644 for (bool moe : {false, true}) { if (moe && !moe_implemented(arch)) { continue; --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0004-skippy-add-diffusiongemma-system-one-reads.patch b/llama_cpp/patches/model_support/0004-skippy-add-diffusiongemma-system-one-reads.patch index b65ea86b..06aedae5 100644 --- a/llama_cpp/patches/model_support/0004-skippy-add-diffusiongemma-system-one-reads.patch +++ b/llama_cpp/patches/model_support/0004-skippy-add-diffusiongemma-system-one-reads.patch @@ -1,4 +1,4 @@ -From 88d0d4f10b7b1ecb81aef47ddb2b44558fe48ca2 Mon Sep 17 00:00:00 2001 +From e6dc3f58489d1dc6c3bdb90fdbbbe27c78107814 Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 20 Sep 2026 11:19:07 +1000 Subject: [PATCH] skippy: add DiffusionGemma system-one reads @@ -20,7 +20,7 @@ Signed-off-by: Michael Neale <14976+michaelneale@users.noreply.github.com> create mode 100644 src/skippy/system_one.cpp diff --git a/include/skippy.h b/include/skippy.h -index 8d710ed64..cd65095a5 100644 +index 8d710ed646eb00880f69437e5a2130d6ab423047..cd65095a5cca1baa93c540c1a1e4c465651f9ebb 100644 --- a/include/skippy.h +++ b/include/skippy.h @@ -26,5 +26,6 @@ @@ -31,7 +31,7 @@ index 8d710ed64..cd65095a5 100644 #endif // SKIPPY_H diff --git a/include/skippy/common.h b/include/skippy/common.h -index 557ba5169..108d50c48 100644 +index 557ba51694839de1611ef2b33a7cce90437e8b84..108d50c48519c0f09fe9e85b641bf9b7a2f24db5 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -53,7 +53,7 @@ index 557ba5169..108d50c48 100644 diff --git a/include/skippy/system_one.h b/include/skippy/system_one.h new file mode 100644 -index 000000000..4faf057ba +index 0000000000000000000000000000000000000000..4faf057ba9d302358e7924642ffbe5e715625141 --- /dev/null +++ b/include/skippy/system_one.h @@ -0,0 +1,60 @@ @@ -118,7 +118,7 @@ index 000000000..4faf057ba + +#endif // SKIPPY_SYSTEM_ONE_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 1985b193a..f8c872fe7 100644 +index 1985b193a40d2ab166dd58cf983c70a7ded75fe8..f8c872fe76f70ed6166afc47357711d8a44b7bc9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,6 +100,7 @@ add_library(llama @@ -130,7 +130,7 @@ index 1985b193a..f8c872fe7 100644 ${LLAMA_MODELS_SOURCES} ) diff --git a/src/skippy/abi.cpp b/src/skippy/abi.cpp -index 15c5c343b..95a845de0 100644 +index 15c5c343bc42e295cb01a435d71b6d3b59096c3f..95a845de0d09b3e36643c8612c0746c9e4ac1063 100644 --- a/src/skippy/abi.cpp +++ b/src/skippy/abi.cpp @@ -47,6 +47,7 @@ uint64_t skippy_abi_features(void) { @@ -143,7 +143,7 @@ index 15c5c343b..95a845de0 100644 diff --git a/src/skippy/system_one.cpp b/src/skippy/system_one.cpp new file mode 100644 -index 000000000..d0c51d87a +index 0000000000000000000000000000000000000000..d0c51d87ad62835a675e62f72d430161c0242000 --- /dev/null +++ b/src/skippy/system_one.cpp @@ -0,0 +1,243 @@ @@ -390,6 +390,3 @@ index 000000000..d0c51d87a + "unexpected native exception during system-one read"); + } +} --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0005-skippy-query-diffusion-canvas-length.patch b/llama_cpp/patches/model_support/0005-skippy-query-diffusion-canvas-length.patch index 606b9a1e..cb72490f 100644 --- a/llama_cpp/patches/model_support/0005-skippy-query-diffusion-canvas-length.patch +++ b/llama_cpp/patches/model_support/0005-skippy-query-diffusion-canvas-length.patch @@ -1,4 +1,4 @@ -From 7eecfd1652fb0a32254e4bd62f1e09bcc7908d7c Mon Sep 17 00:00:00 2001 +From 424de48160a20b4d4cd8520aaa9733041ba99a10 Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 20 Sep 2026 11:38:59 +1000 Subject: [PATCH] skippy: query diffusion canvas length @@ -14,7 +14,7 @@ Signed-off-by: Michael Neale <14976+michaelneale@users.noreply.github.com> 2 files changed, 32 insertions(+) diff --git a/include/skippy/system_one.h b/include/skippy/system_one.h -index 4faf057ba..6046c77ec 100644 +index 4faf057ba9d302358e7924642ffbe5e715625141..6046c77ec841af67796159e9fe674fabfb5cf4a7 100644 --- a/include/skippy/system_one.h +++ b/include/skippy/system_one.h @@ -27,6 +27,17 @@ struct skippy_system_one_slot { @@ -36,7 +36,7 @@ index 4faf057ba..6046c77ec 100644 * @brief Scores structured labels with one DiffusionGemma read. * diff --git a/src/skippy/system_one.cpp b/src/skippy/system_one.cpp -index d0c51d87a..9cbe792ae 100644 +index d0c51d87ad62835a675e62f72d430161c0242000..9cbe792ae3cc73e6bb09b3f016199887d13d1f3b 100644 --- a/src/skippy/system_one.cpp +++ b/src/skippy/system_one.cpp @@ -55,6 +55,27 @@ public: @@ -67,6 +67,3 @@ index d0c51d87a..9cbe792ae 100644 extern "C" enum skippy_status skippy_system_one_read( struct skippy_model * model, const llama_token * prompt_tokens, --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0006-models-add-laya-decision-model-support.patch b/llama_cpp/patches/model_support/0006-models-add-laya-decision-model-support.patch index 2fcba7cb..cd0f60ba 100644 --- a/llama_cpp/patches/model_support/0006-models-add-laya-decision-model-support.patch +++ b/llama_cpp/patches/model_support/0006-models-add-laya-decision-model-support.patch @@ -1,4 +1,4 @@ -From edda4d5a9bb442db86c6d9f24b53fad815cf32de Mon Sep 17 00:00:00 2001 +From 99eefce3e9f5eb45b6ea3818f8f80d60b3cfeef9 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Sun, 27 Sep 2026 21:12:21 +1000 Subject: [PATCH] models: add Laya decision model support @@ -58,7 +58,7 @@ Co-authored-by: ZhangYu create mode 100644 tools/laya/laya.h diff --git a/include/skippy.h b/include/skippy.h -index cd65095a5..a1d73ac5a 100644 +index cd65095a5cca1baa93c540c1a1e4c465651f9ebb..a1d73ac5aeb58a1096bd2e9a747cd1246ffcf4c3 100644 --- a/include/skippy.h +++ b/include/skippy.h @@ -27,5 +27,6 @@ @@ -69,7 +69,7 @@ index cd65095a5..a1d73ac5a 100644 #endif // SKIPPY_H diff --git a/include/skippy/common.h b/include/skippy/common.h -index 108d50c48..2c9342d91 100644 +index 108d50c48519c0f09fe9e85b641bf9b7a2f24db5..2c9342d9168d2663babb5922f68d6ddfa9e706dc 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -92,7 +92,7 @@ index 108d50c48..2c9342d91 100644 SKIPPY_STATUS_OK = 0, diff --git a/include/skippy/laya.h b/include/skippy/laya.h new file mode 100644 -index 000000000..002fac598 +index 0000000000000000000000000000000000000000..002fac5980f2d02c84d0408640e21d5ad44a87a7 --- /dev/null +++ b/include/skippy/laya.h @@ -0,0 +1,167 @@ @@ -264,7 +264,7 @@ index 000000000..002fac598 + +#endif // SKIPPY_LAYA_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index f8c872fe7..ee12298b4 100644 +index f8c872fe76f70ed6166afc47357711d8a44b7bc9..ee12298b47a7f389095d2ab7d3207ef4b477d666 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -101,6 +101,8 @@ add_library(llama @@ -286,7 +286,7 @@ index f8c872fe7..ee12298b4 100644 target_compile_features (llama PRIVATE cxx_std_17) # don't bump # Upstream added a models.h PCH for the llama target. The Skippy stage diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp -index 36e872224..9ef5756b6 100644 +index 232dd9e4a40c078e927cdc5f3220c7c98d938df7..44576b6d6e0ed99b5e0058c8f38b655d0fd0ee57 100644 --- a/src/llama-arch.cpp +++ b/src/llama-arch.cpp @@ -22,6 +22,7 @@ static const std::map LLM_ARCH_NAMES = { @@ -311,7 +311,7 @@ index 36e872224..9ef5756b6 100644 { LLM_KV_POOLING_TYPE, "%s.pooling_type" }, { LLM_KV_LOGIT_SCALE, "%s.logit_scale" }, { LLM_KV_DECODER_START_TOKEN_ID, "%s.decoder_start_token_id" }, -@@ -705,6 +713,18 @@ static const std::map LLM_TENSOR_NAMES = { +@@ -706,6 +714,18 @@ static const std::map LLM_TENSOR_NAMES = { { LLM_TENSOR_DECISION_QUERY, "decision.query" }, { LLM_TENSOR_DECISION_OPTION_MLP, "decision.option_mlp" }, { LLM_TENSOR_DECISION_QUERY_MLP, "decision.query_mlp" }, @@ -330,7 +330,7 @@ index 36e872224..9ef5756b6 100644 { LLM_TENSOR_ENC_OUTPUT_NORM, "enc.output_norm" }, { LLM_TENSOR_FFN_GATE_INP_SHEXP, "blk.%d.ffn_gate_inp_shexp" }, { LLM_TENSOR_SSM_A_NOSCAN, "blk.%d.ssm_a" }, -@@ -1039,6 +1059,18 @@ static const std::map LLM_TENSOR_INFOS = { +@@ -1040,6 +1060,18 @@ static const std::map LLM_TENSOR_INFOS = { {LLM_TENSOR_DECISION_QUERY, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL_MAT}}, {LLM_TENSOR_DECISION_OPTION_MLP, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL_MAT}}, {LLM_TENSOR_DECISION_QUERY_MLP, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL_MAT}}, @@ -349,7 +349,7 @@ index 36e872224..9ef5756b6 100644 {LLM_TENSOR_DENSE_2_OUT, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL_MAT}}, // Dense layer output {LLM_TENSOR_DENSE_3_OUT, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL_MAT}}, // Dense layer output {LLM_TENSOR_OUTPUT_NORM, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL}}, -@@ -1701,6 +1733,7 @@ bool llama_arch_supports_save(llm_arch arch) { +@@ -1705,6 +1737,7 @@ bool llama_arch_supports_save(llm_arch arch) { case LLM_ARCH_CLEF: // the head tensors are not saved case LLM_ARCH_INKLING2_LOOP: // the loop tensors are not saved and the cache slots are expanded at load case LLM_ARCH_VLLM_DECISION2: @@ -358,7 +358,7 @@ index 36e872224..9ef5756b6 100644 return false; default: diff --git a/src/llama-arch.h b/src/llama-arch.h -index 005219cd9..8ebfeae7e 100644 +index dcf8d90d860fc69a27b68ef1da0e7bd0b084d158..3c515e98b0b99bc7b2764c84d5d9a09f5deb6d0e 100644 --- a/src/llama-arch.h +++ b/src/llama-arch.h @@ -26,6 +26,7 @@ enum llm_arch { @@ -383,7 +383,7 @@ index 005219cd9..8ebfeae7e 100644 LLM_KV_POOLING_TYPE, LLM_KV_LOGIT_SCALE, LLM_KV_DECODER_START_TOKEN_ID, -@@ -888,6 +896,18 @@ enum llm_tensor { +@@ -887,6 +895,18 @@ enum llm_tensor { LLM_TENSOR_DECISION_QUERY, LLM_TENSOR_DECISION_OPTION_MLP, LLM_TENSOR_DECISION_QUERY_MLP, @@ -403,7 +403,7 @@ index 005219cd9..8ebfeae7e 100644 LLM_TENSOR_CONVNEXT_DW, LLM_TENSOR_CONVNEXT_NORM, diff --git a/src/llama-model.cpp b/src/llama-model.cpp -index 0a2b8bcd7..aa4e7ce35 100644 +index c257f9bbbf9f81a79fdf2dd36a2c2adb378e9ace..ba5fbb9f2bb9cf66a47834a3ee1703e01019c869 100644 --- a/src/llama-model.cpp +++ b/src/llama-model.cpp @@ -411,6 +411,11 @@ static llama_model * llama_model_mapping(llm_arch arch, const llama_model_params @@ -418,7 +418,7 @@ index 0a2b8bcd7..aa4e7ce35 100644 default: throw std::runtime_error(std::string("unsupported model architecture: '") + llm_arch_name(arch) + "'"); } -@@ -3264,6 +3269,7 @@ llama_memory_i * llama_model::create_memory( +@@ -3129,6 +3134,7 @@ llama_memory_i * llama_model::create_memory( case LLM_ARCH_EUROBERT: case LLM_ARCH_WAVTOKENIZER_DEC: case LLM_ARCH_MODERN_BERT: @@ -426,7 +426,7 @@ index 0a2b8bcd7..aa4e7ce35 100644 case LLM_ARCH_GEMMA_EMBEDDING: case LLM_ARCH_GEMMA_EMBEDDING2: case LLM_ARCH_DREAM: -@@ -4134,6 +4140,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) { +@@ -3999,6 +4005,7 @@ llama_rope_type llama_model_rope_type(const llama_model * model) { case LLM_ARCH_BERT: case LLM_ARCH_JINA_BERT_V3: case LLM_ARCH_MODERN_BERT: @@ -435,7 +435,7 @@ index 0a2b8bcd7..aa4e7ce35 100644 case LLM_ARCH_NOMIC_BERT_MOE: case LLM_ARCH_EUROBERT: diff --git a/src/skippy/abi.cpp b/src/skippy/abi.cpp -index 95a845de0..bce625118 100644 +index 95a845de0d09b3e36643c8612c0746c9e4ac1063..bce6251184f529def3f8215b3f711e2c096cf6a7 100644 --- a/src/skippy/abi.cpp +++ b/src/skippy/abi.cpp @@ -48,7 +48,8 @@ uint64_t skippy_abi_features(void) { @@ -450,7 +450,7 @@ index 95a845de0..bce625118 100644 void skippy_error_free(struct skippy_error * error) { diff --git a/src/skippy/laya.cpp b/src/skippy/laya.cpp new file mode 100644 -index 000000000..9d9f26ecd +index 0000000000000000000000000000000000000000..9d9f26ecd732cc2d36b4936dba055ac26eaefaae --- /dev/null +++ b/src/skippy/laya.cpp @@ -0,0 +1,372 @@ @@ -827,7 +827,7 @@ index 000000000..9d9f26ecd + }); +} diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 57d53df25..673b8cc97 100644 +index 57d53df256591f9fffd0a8f43fdc3579fafa0689..673b8cc97bdbc45eaefebd1ecc2540e5dec1af7a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -30,6 +30,7 @@ else() @@ -840,7 +840,7 @@ index 57d53df25..673b8cc97 100644 endif() diff --git a/tools/laya/CMakeLists.txt b/tools/laya/CMakeLists.txt new file mode 100644 -index 000000000..608e677b8 +index 0000000000000000000000000000000000000000..608e677b8e48de9a4b79e821c2e7f5a5c1294ec7 --- /dev/null +++ b/tools/laya/CMakeLists.txt @@ -0,0 +1,23 @@ @@ -869,7 +869,7 @@ index 000000000..608e677b8 +endif() diff --git a/tools/laya/laya-cli.cpp b/tools/laya/laya-cli.cpp new file mode 100644 -index 000000000..b225ceff0 +index 0000000000000000000000000000000000000000..b225ceff05e0a19293c71ff1677c34a703392bfa --- /dev/null +++ b/tools/laya/laya-cli.cpp @@ -0,0 +1,670 @@ @@ -1545,7 +1545,7 @@ index 000000000..b225ceff0 +} diff --git a/tools/laya/laya.cpp b/tools/laya/laya.cpp new file mode 100644 -index 000000000..00b893a3c +index 0000000000000000000000000000000000000000..00b893a3c81d7caf1c5e81efd4d2c629292306c1 --- /dev/null +++ b/tools/laya/laya.cpp @@ -0,0 +1,1132 @@ @@ -2683,7 +2683,7 @@ index 000000000..00b893a3c +} diff --git a/tools/laya/laya.h b/tools/laya/laya.h new file mode 100644 -index 000000000..8a713d563 +index 0000000000000000000000000000000000000000..8a713d563f67da97a6317e35dc2b36cd02730d4a --- /dev/null +++ b/tools/laya/laya.h @@ -0,0 +1,119 @@ @@ -2806,6 +2806,3 @@ index 000000000..8a713d563 + +// run one forward pass; returns 0 on success, non-zero on failure +LLAMA_API int laya_encode(laya_context * ctx, const laya_batch & batch, laya_result & result); --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0007-fix-muse-glimmer-parse-implicit-reasoning-continuati.patch b/llama_cpp/patches/model_support/0007-fix-muse-glimmer-parse-implicit-reasoning-continuati.patch index 0524e7e9..a105c999 100644 --- a/llama_cpp/patches/model_support/0007-fix-muse-glimmer-parse-implicit-reasoning-continuati.patch +++ b/llama_cpp/patches/model_support/0007-fix-muse-glimmer-parse-implicit-reasoning-continuati.patch @@ -1,4 +1,4 @@ -From 7276b07c4444878681870845560cc682a6f496f2 Mon Sep 17 00:00:00 2001 +From 8da2b300ceb57e4467cb55a8e09e50ca33b9301a Mon Sep 17 00:00:00 2001 From: James Dumay Date: Sat, 17 Oct 2026 03:37:10 +1100 Subject: [PATCH] fix(muse-glimmer): parse implicit reasoning continuations @@ -9,7 +9,7 @@ Subject: [PATCH] fix(muse-glimmer): parse implicit reasoning continuations 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/common/parsers/muse-glimmer.cpp b/common/parsers/muse-glimmer.cpp -index a1ee40f49..f31845702 100644 +index a1ee40f498cb56097807e395d2ad06bf551720d5..f31845702cbdf91c5d30568ec6c994c967c0b255 100644 --- a/common/parsers/muse-glimmer.cpp +++ b/common/parsers/muse-glimmer.cpp @@ -59,7 +59,10 @@ common_chat_params common_chat_params_init_muse_glimmer(const common_chat_templa @@ -25,10 +25,10 @@ index a1ee40f49..f31845702 100644 p.rule("analysis", p.literal(" to=self") + message + p.content(p.until(eom)) + eom); } diff --git a/tests/test-chat.cpp b/tests/test-chat.cpp -index 5c48dba96..d079742f5 100644 +index 39af725c3168439c233f4b355ef825cc6af2d443..19530a987690d9d1eb45962c5deaeb5b6b3e896c 100644 --- a/tests/test-chat.cpp +++ b/tests/test-chat.cpp -@@ -7742,6 +7742,12 @@ static void test_template_output_peg_parsers(bool detailed_debug) { +@@ -7758,6 +7758,12 @@ static void test_template_output_peg_parsers(bool detailed_debug) { .expect(message_assist) .run(); @@ -41,6 +41,3 @@ index 5c48dba96..d079742f5 100644 // A tool call as the first message of the turn: "<|start|>assistant" is the // generation prompt, so the output starts at " to=". tst.test(" to=special_function<|message|>" + call_markup) --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0008-models-add-qwen3-moe-native-mtp.patch b/llama_cpp/patches/model_support/0008-models-add-qwen3-moe-native-mtp.patch index 826f4db3..d38d23ca 100644 --- a/llama_cpp/patches/model_support/0008-models-add-qwen3-moe-native-mtp.patch +++ b/llama_cpp/patches/model_support/0008-models-add-qwen3-moe-native-mtp.patch @@ -1,4 +1,4 @@ -From 23eb86881559c651cbb9f6d349cc57b64f9e8b60 Mon Sep 17 00:00:00 2001 +From 939a774fc16d3644d3bd3ba89507799979d44539 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Fri, 6 Nov 2026 10:37:00 -0800 Subject: [PATCH] models: add Qwen3-MoE native MTP @@ -13,10 +13,10 @@ Subject: [PATCH] models: add Qwen3-MoE native MTP 6 files changed, 336 insertions(+), 19 deletions(-) diff --git a/conversion/qwen.py b/conversion/qwen.py -index 376535460..0bdbdf143 100644 +index 02e4cb3edc4a040031ad4c339bcb83d8f003700d..6b6416f995cfdaf064ddd9386aaed4f302c76afc 100644 --- a/conversion/qwen.py +++ b/conversion/qwen.py -@@ -278,12 +278,110 @@ class Qwen3Model(Qwen2Model): +@@ -288,12 +288,110 @@ class Qwen3Model(Qwen2Model): @ModelBase.register("Qwen3MoeForCausalLM") @ModelBase.example("Qwen/Qwen3-30B-A3B") class Qwen3MoeModel(Qwen2MoeModel): @@ -128,10 +128,10 @@ index 376535460..0bdbdf143 100644 def set_vocab(self): # deal with intern-s1 diff --git a/gguf-py/gguf/constants.py b/gguf-py/gguf/constants.py -index 15163565d..d8dcd2b97 100644 +index 347378e612fa754e1235ab1f5b25143de1d440f3..8f101e52f5f9676d917023d78eaefad89796437e 100644 --- a/gguf-py/gguf/constants.py +++ b/gguf-py/gguf/constants.py -@@ -3543,6 +3543,16 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = { +@@ -3544,6 +3544,16 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = { MODEL_TENSOR.FFN_GATE_EXP, MODEL_TENSOR.FFN_DOWN_EXP, MODEL_TENSOR.FFN_UP_EXP, @@ -149,7 +149,7 @@ index 15163565d..d8dcd2b97 100644 MODEL_ARCH.FLINT: [ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index ee12298b4..a961445c6 100644 +index ee12298b47a7f389095d2ab7d3207ef4b477d666..a961445c68c5ac1bef7ba2a0a9d1c629ba5c5db0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -262,6 +262,14 @@ if (LLAMA_STAGE_BUILD_TESTS) @@ -168,7 +168,7 @@ index ee12298b4..a961445c6 100644 file(MAKE_DIRECTORY "${MULTIDEPTH_MTP_FIXTURE_DIR}") add_test(NAME skippy_generate_multidepth_mtp COMMAND skippy-model-fixture-generator diff --git a/src/models/models.h b/src/models/models.h -index 298957f7a..384fcadf4 100644 +index 0355d3c462b319310ca79b01d20ac85abfca1cf6..8a81ae121532dcdea41574503b4ca2188405d59c 100644 --- a/src/models/models.h +++ b/src/models/models.h @@ -602,6 +602,11 @@ struct llama_model_sensenova_u1 : public llama_model_base { @@ -196,7 +196,7 @@ index 298957f7a..384fcadf4 100644 }; diff --git a/src/models/qwen3moe.cpp b/src/models/qwen3moe.cpp -index fc57928f5..4cdf8d73c 100644 +index 53e230477a379a0eef3313c30dd1852c35b52075..d79e15163bf1aa8e9198dbe04fbd365f10206014 100644 --- a/src/models/qwen3moe.cpp +++ b/src/models/qwen3moe.cpp @@ -11,9 +11,15 @@ void llama_model_qwen3moe::load_arch_hparams(llama_model_loader & ml) { @@ -310,7 +310,7 @@ index fc57928f5..4cdf8d73c 100644 } @@ -112,7 +156,9 @@ llama_model_qwen3moe::graph::graph(const llm_graph_params & params) : llm_graph_ - model.layers[il].wo, model.layers[il].wo_b, model.layers[il].wo_s, + model.layers[il].wo, model.layers[il].wo_b, Qcur, Kcur, Vcur, nullptr, nullptr, nullptr, 1.0f/sqrtf(float(n_embd_head)), il); } - if (il == n_layer - 1 && inp_out_ids) { @@ -403,7 +403,7 @@ index fc57928f5..4cdf8d73c 100644 + ggml_tensor * concat = ggml_concat(ctx0, e_norm, h_norm, /*dim=*/ 0); + cb(concat, "mtp_concat", il); + -+ ggml_tensor * cur = build_lora_mm(layer.nextn.eh_proj, concat, layer.nextn.eh_proj_s); ++ ggml_tensor * cur = build_lora_mm(layer.nextn.eh_proj, concat); + cb(cur, "mtp_eh_proj", il); + + ggml_tensor * inpSA = cur; @@ -435,7 +435,7 @@ index fc57928f5..4cdf8d73c 100644 + cb(Vcur, "mtp_Vcur", il); + + cur = build_attn(inp_attn, -+ layer.wo, layer.wo_b, layer.wo_s, ++ layer.wo, layer.wo_b, + Qcur, Kcur, Vcur, nullptr, nullptr, nullptr, 1.0f/sqrtf(float(n_embd_head)), il); + } + cb(cur, "mtp_attn_out", il); @@ -447,9 +447,9 @@ index fc57928f5..4cdf8d73c 100644 + cb(cur, "mtp_ffn_norm", il); + + cur = build_ffn(cur, -+ layer.ffn_up, nullptr, layer.ffn_up_s, -+ layer.ffn_gate, nullptr, layer.ffn_gate_s, -+ layer.ffn_down, nullptr, layer.ffn_down_s, ++ layer.ffn_up, nullptr, ++ layer.ffn_gate, nullptr, ++ layer.ffn_down, nullptr, + nullptr, + LLM_FFN_SILU, LLM_FFN_PAR, il); + cb(cur, "mtp_ffn_out", il); @@ -468,7 +468,7 @@ index fc57928f5..4cdf8d73c 100644 + cb(cur, "mtp_shared_head_norm", -1); + + ggml_tensor * head_w = layer.nextn.shared_head_head ? layer.nextn.shared_head_head : model.output; -+ ggml_tensor * head_s = layer.nextn.shared_head_head ? layer.nextn.shared_head_head_s : model.output_s; ++ ggml_tensor * head_s = get_weight_scale(head_w); + GGML_ASSERT(head_w && "QWEN3MOE MTP: missing LM head (nextn.shared_head_head or model.output)"); + cur = build_lora_mm(head_w, cur, head_s); + cb(cur, "result_output", -1); @@ -477,10 +477,10 @@ index fc57928f5..4cdf8d73c 100644 + ggml_build_forward_expand(gf, cur); +} diff --git a/tests/test-llama-archs.cpp b/tests/test-llama-archs.cpp -index c08cb4341..9733d1121 100644 +index 2ad7538be245bbfc43c58f1d689eeb77cb3de992..0e8c34acfc4439f3a0df0793922b7e19297d2188 100644 --- a/tests/test-llama-archs.cpp +++ b/tests/test-llama-archs.cpp -@@ -2363,7 +2363,7 @@ int main(int argc, char ** argv) { +@@ -2405,7 +2405,7 @@ int main(int argc, char ** argv) { if (dense_mtp_depth == 0) throw std::runtime_error("--dense-mtp-depth must be positive"); auto gguf = get_gguf_ctx(arch, arch == LLM_ARCH_STEP35 || arch == LLM_ARCH_MIMO2 || arch == LLM_ARCH_HY_V3 || @@ -489,6 +489,3 @@ index c08cb4341..9733d1121 100644 0, glm_dsa_indexshare_fixture::DEFAULT, 256, 8, false, 2 + dense_mtp_depth, 256); --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0009-skippy-add-whisper-speech-recognition.patch b/llama_cpp/patches/model_support/0009-skippy-add-whisper-speech-recognition.patch index a6b1f159..2c33a52f 100644 --- a/llama_cpp/patches/model_support/0009-skippy-add-whisper-speech-recognition.patch +++ b/llama_cpp/patches/model_support/0009-skippy-add-whisper-speech-recognition.patch @@ -1,4 +1,4 @@ -From 175231e54b8493fb0a917ddd621214286e210326 Mon Sep 17 00:00:00 2001 +From 9108b7de60d43a2c7975b4ef8c185fe8d1911064 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Thu, 22 Oct 2026 17:15:05 +1100 Subject: [PATCH] skippy: add Whisper speech recognition @@ -27,7 +27,7 @@ Bumps the Skippy ABI to 0.1.72. create mode 100644 src/skippy/asr.cpp diff --git a/include/skippy.h b/include/skippy.h -index a1d73ac5a..fb2e80806 100644 +index a1d73ac5aeb58a1096bd2e9a747cd1246ffcf4c3..fb2e80806d804b01e504ad99f0f6c3fd3bb20f4c 100644 --- a/include/skippy.h +++ b/include/skippy.h @@ -28,5 +28,6 @@ @@ -39,7 +39,7 @@ index a1d73ac5a..fb2e80806 100644 #endif // SKIPPY_H diff --git a/include/skippy/asr.h b/include/skippy/asr.h new file mode 100644 -index 000000000..99d4a1094 +index 0000000000000000000000000000000000000000..99d4a1094ad584e3a7b6a608fe83c87c40e88542 --- /dev/null +++ b/include/skippy/asr.h @@ -0,0 +1,172 @@ @@ -216,7 +216,7 @@ index 000000000..99d4a1094 + +#endif // SKIPPY_ASR_H diff --git a/include/skippy/common.h b/include/skippy/common.h -index 2c9342d91..cc08d3899 100644 +index 2c9342d9168d2663babb5922f68d6ddfa9e706dc..cc08d38990445089e9fc86d30fbb2bb980ce8ef0 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -238,7 +238,7 @@ index 2c9342d91..cc08d3899 100644 enum skippy_status { SKIPPY_STATUS_OK = 0, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index a961445c6..00b9dac51 100644 +index a961445c68c5ac1bef7ba2a0a9d1c629ba5c5db0..00b9dac516d37dd84973e538bee9650f648ee86d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,6 +103,7 @@ add_library(llama @@ -300,7 +300,7 @@ index a961445c6..00b9dac51 100644 target_compile_definitions(llama PRIVATE LLAMA_STAGE_BUILD_TESTS) diff --git a/src/skippy/abi.cpp b/src/skippy/abi.cpp -index bce625118..ec369088b 100644 +index bce6251184f529def3f8215b3f711e2c096cf6a7..ec369088b9395c5105d5356fd7b39a420c221bea 100644 --- a/src/skippy/abi.cpp +++ b/src/skippy/abi.cpp @@ -49,7 +49,11 @@ uint64_t skippy_abi_features(void) { @@ -318,7 +318,7 @@ index bce625118..ec369088b 100644 void skippy_error_free(struct skippy_error * error) { diff --git a/src/skippy/asr.cpp b/src/skippy/asr.cpp new file mode 100644 -index 000000000..680549066 +index 0000000000000000000000000000000000000000..680549066e82df6de485c141f212e0e6fc279fab --- /dev/null +++ b/src/skippy/asr.cpp @@ -0,0 +1,465 @@ @@ -787,6 +787,3 @@ index 000000000..680549066 +extern "C" void skippy_asr_result_free(struct skippy_asr_result * result) { + delete result; +} --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0010-skippy-record-per-token-logprobs-while-sampling.patch b/llama_cpp/patches/model_support/0010-skippy-record-per-token-logprobs-while-sampling.patch index ed7fc3b7..f0208512 100644 --- a/llama_cpp/patches/model_support/0010-skippy-record-per-token-logprobs-while-sampling.patch +++ b/llama_cpp/patches/model_support/0010-skippy-record-per-token-logprobs-while-sampling.patch @@ -1,4 +1,4 @@ -From 8167e6133bd09264c88e982698fc29b2c4e2d1a0 Mon Sep 17 00:00:00 2001 +From 521de5142d36430bb764e4c6eff0dcd9ebb63dd2 Mon Sep 17 00:00:00 2001 From: Virgile-pct Date: Wed, 21 Oct 2026 23:42:33 +0200 Subject: [PATCH] skippy: record per-token logprobs while sampling @@ -31,7 +31,7 @@ to touch common.h it carries the queue's ABI version, 0.1.77. create mode 100644 src/skippy/logprobs.cpp diff --git a/include/skippy.h b/include/skippy.h -index fb2e80806..37a15eea3 100644 +index fb2e80806d804b01e504ad99f0f6c3fd3bb20f4c..37a15eea339f3dc3297ea99be6eef0d8c3ff4141 100644 --- a/include/skippy.h +++ b/include/skippy.h @@ -25,6 +25,7 @@ @@ -43,7 +43,7 @@ index fb2e80806..37a15eea3 100644 #include "skippy/system_one.h" #include "skippy/laya.h" diff --git a/include/skippy/common.h b/include/skippy/common.h -index cc08d3899..d014c10da 100644 +index cc08d38990445089e9fc86d30fbb2bb980ce8ef0..d014c10da1e5fe6fd0cbd957a4ee61bbe3c2b884 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -57,7 +57,7 @@ index cc08d3899..d014c10da 100644 #define SKIPPY_DEPRECATED(message) __declspec(deprecated(message)) diff --git a/include/skippy/logprobs.h b/include/skippy/logprobs.h new file mode 100644 -index 000000000..c7f4ab5cd +index 0000000000000000000000000000000000000000..c7f4ab5cd19b2b92c6158a2910de4340c27a5819 --- /dev/null +++ b/include/skippy/logprobs.h @@ -0,0 +1,60 @@ @@ -122,7 +122,7 @@ index 000000000..c7f4ab5cd + +#endif // SKIPPY_LOGPROBS_H diff --git a/include/skippy/sampling.h b/include/skippy/sampling.h -index 1b42f32c0..c1a755c4c 100644 +index 1b42f32c0c68b206273cdb4d992bad2419b6e6be..c1a755c4cc795170d3a71ae89f91a05ecb9b3a40 100644 --- a/include/skippy/sampling.h +++ b/include/skippy/sampling.h @@ -18,6 +18,8 @@ extern "C" { @@ -144,7 +144,7 @@ index 1b42f32c0..c1a755c4c 100644 #ifdef __cplusplus diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 00b9dac51..37d87b23c 100644 +index 00b9dac516d37dd84973e538bee9650f648ee86d..37d87b23c3a8b69f4687f425f1d7398f2269aa2c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -89,6 +89,7 @@ add_library(llama @@ -157,7 +157,7 @@ index 00b9dac51..37d87b23c 100644 skippy/stage_realization.cpp diff --git a/src/skippy/logprobs.cpp b/src/skippy/logprobs.cpp new file mode 100644 -index 000000000..43260dfc2 +index 0000000000000000000000000000000000000000..43260dfc2644db3e053333704f2a65835241d450 --- /dev/null +++ b/src/skippy/logprobs.cpp @@ -0,0 +1,94 @@ @@ -256,7 +256,7 @@ index 000000000..43260dfc2 + return skippy_success(out_error); +} diff --git a/src/skippy/resident_prefix.cpp b/src/skippy/resident_prefix.cpp -index 57b1d78ac..ebe660b64 100644 +index 57b1d78acff050502af87b8a49bb9c15482f15ab..ebe660b64c9f5411a72bc271468d244dd29ba411 100644 --- a/src/skippy/resident_prefix.cpp +++ b/src/skippy/resident_prefix.cpp @@ -172,6 +172,7 @@ skippy_status restore_checkpoint(skippy_session * session, int32_t cache_seq_id, @@ -268,7 +268,7 @@ index 57b1d78ac..ebe660b64 100644 skippy_clear_verify_windows(session); return skippy_success(error); diff --git a/src/skippy/runtime_types.h b/src/skippy/runtime_types.h -index 3a2e3147e..e610e8205 100644 +index 3a2e3147e92af58ae1d11c844e5c3410e12b6dc0..e610e8205f26d00c36c5642eefbb81ed4bf0a085 100644 --- a/src/skippy/runtime_types.h +++ b/src/skippy/runtime_types.h @@ -153,6 +153,8 @@ struct skippy_session { @@ -281,7 +281,7 @@ index 3a2e3147e..e610e8205 100644 std::vector prefill_n_seq_ids; std::vector prefill_seq_ids; diff --git a/src/skippy/sampling.cpp b/src/skippy/sampling.cpp -index d9f980c39..256eb2182 100644 +index d9f980c394c805284bc274f28ad940f723f6a255..256eb21822e36c4b9adcc71578b853b057d25e2c 100644 --- a/src/skippy/sampling.cpp +++ b/src/skippy/sampling.cpp @@ -430,6 +430,9 @@ static bool skippy_sampling_chain_is_reusable_for( @@ -333,7 +333,7 @@ index d9f980c39..256eb2182 100644 skippy_session * session, const skippy_sampling_config * sampling) { diff --git a/src/skippy/sampling_internal.h b/src/skippy/sampling_internal.h -index 38621b6e9..9847f95f0 100644 +index 38621b6e923e0b588baa08ee486d9b86f0114d0d..9847f95f0aa6ee724ae0f1c0843d94580b36b811 100644 --- a/src/skippy/sampling_internal.h +++ b/src/skippy/sampling_internal.h @@ -18,6 +18,13 @@ struct skippy_session; @@ -351,7 +351,7 @@ index 38621b6e9..9847f95f0 100644 skippy_session * session, const llama_token * token_ids, diff --git a/src/skippy/session.cpp b/src/skippy/session.cpp -index d5ac795e9..a08cd599f 100644 +index d5ac795e95f2bd41947b282f02aa53583ac39d9a..a08cd599f3f1bf507c2abf3336ddbeea8d987d8a 100644 --- a/src/skippy/session.cpp +++ b/src/skippy/session.cpp @@ -381,6 +381,7 @@ enum skippy_status skippy_session_reset( @@ -363,7 +363,7 @@ index d5ac795e9..a08cd599f 100644 // makes the next sampled decode reattach the chain and mark the scheduler // for reserve, which rebuilds compute buffers at every request boundary. diff --git a/src/skippy/workloads.cpp b/src/skippy/workloads.cpp -index d3de66cbe..3ca967bf3 100644 +index d3de66cbe98390974482208af891fa3567967f51..3ca967bf3c519b089f765619ad0e33a816c1ea5f 100644 --- a/src/skippy/workloads.cpp +++ b/src/skippy/workloads.cpp @@ -91,6 +91,7 @@ void skippy_prepare_non_chat_workload(skippy_session * session) { @@ -374,6 +374,3 @@ index d3de66cbe..3ca967bf3 100644 } namespace { --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0011-models-expose-glm5-next-stage-graph-semantics.patch b/llama_cpp/patches/model_support/0011-models-expose-glm5-next-stage-graph-semantics.patch index 78413a70..15aa538a 100644 --- a/llama_cpp/patches/model_support/0011-models-expose-glm5-next-stage-graph-semantics.patch +++ b/llama_cpp/patches/model_support/0011-models-expose-glm5-next-stage-graph-semantics.patch @@ -1,4 +1,4 @@ -From 87f1af05c5953e33c5eb2c58fba6a3dcfa37fedc Mon Sep 17 00:00:00 2001 +From 97a47650770401855cf3979d055aaa5ff26e09ff Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Fri, 6 Nov 2026 10:37:22 -0800 Subject: [PATCH] models: expose glm5-next stage graph semantics @@ -12,7 +12,7 @@ Subject: [PATCH] models: expose glm5-next stage graph semantics 5 files changed, 217 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 37d87b23c..fda659913 100644 +index 37d87b23c3a8b69f4687f425f1d7398f2269aa2c..fda659913208dd73888ae1ea85705926123048e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -308,6 +308,17 @@ if (LLAMA_STAGE_BUILD_TESTS) @@ -42,7 +42,7 @@ index 37d87b23c..fda659913 100644 target_include_directories(skippy-backend-sample-capacity PRIVATE .) target_compile_features(skippy-backend-sample-capacity PRIVATE cxx_std_17) diff --git a/src/models/glm5-next.cpp b/src/models/glm5-next.cpp -index 5d3944af2..452aea5ab 100644 +index a2d67b164f9a7a95873563e8f7c70803eb83fc82..c2b4081518fe8102223e04afff80ae82d6c5adeb 100644 --- a/src/models/glm5-next.cpp +++ b/src/models/glm5-next.cpp @@ -215,7 +215,7 @@ ggml_tensor * llama_model_glm5_next::graph::build_kda_conv1d( @@ -86,7 +86,7 @@ index 5d3944af2..452aea5ab 100644 ggml_tensor * inp_out_ids = build_inp_out_ids(); -@@ -697,6 +713,13 @@ llama_model_glm5_next::graph::graph(const llm_graph_params & params) : +@@ -696,6 +712,13 @@ llama_model_glm5_next::graph::graph(const llm_graph_params & params) : ggml_tensor * prev_sel = nullptr; for (int il = 0; il < n_layer; ++il) { @@ -100,7 +100,7 @@ index 5d3944af2..452aea5ab 100644 const auto & layer = model.layers[il]; ggml_tensor * residual = inpL; -@@ -765,6 +788,12 @@ llama_model_glm5_next::graph::graph(const llm_graph_params & params) : +@@ -764,6 +787,12 @@ llama_model_glm5_next::graph::graph(const llm_graph_params & params) : cb(inpL, "l_out", il); } @@ -113,7 +113,7 @@ index 5d3944af2..452aea5ab 100644 // narrow to the output tokens, then collapse the streams // Unmasked nextn embeddings need all rows. if (crop_before_nextn(inp_out_ids)) { -@@ -803,7 +832,7 @@ ggml_tensor * llama_model_glm5_next::graph::build_kda_layer( +@@ -802,7 +831,7 @@ ggml_tensor * llama_model_glm5_next::graph::build_kda_layer( const auto * mctx_cur = inp_rs->mctx; ggml_tensor * conv_states_all = mctx_cur->get_r_l(il); @@ -122,7 +122,7 @@ index 5d3944af2..452aea5ab 100644 ggml_tensor * Qcur = build_kda_conv1d(inp_rs, conv_states_all, conv_state_all, 0, cur, layer.wq, layer.ssm_q_conv, d_conv, head_dim, n_head_kda, n_seq_tokens, n_seqs, il); ggml_tensor * Kcur = build_kda_conv1d(inp_rs, conv_states_all, conv_state_all, 1, cur, layer.wk, layer.ssm_k_conv, d_conv, head_dim, n_head_kda, n_seq_tokens, n_seqs, il); -@@ -839,7 +868,7 @@ ggml_tensor * llama_model_glm5_next::graph::build_kda_layer( +@@ -838,7 +867,7 @@ ggml_tensor * llama_model_glm5_next::graph::build_kda_layer( cb(beta, "kda_beta", il); ggml_tensor * ssm_states_all = mctx_cur->get_s_l(il); @@ -131,7 +131,7 @@ index 5d3944af2..452aea5ab 100644 state = ggml_reshape_4d(ctx0, state, head_dim, head_dim, n_head_kda, n_seqs); // Match FLA l2 norm -@@ -899,7 +928,10 @@ ggml_tensor * llama_model_glm5_next::graph::build_kpool_select( +@@ -898,7 +927,10 @@ ggml_tensor * llama_model_glm5_next::graph::build_kpool_select( ggml_tensor * pzero = ggml_fill(ctx0, ggml_new_tensor_2d(ctx0, GGML_TYPE_F32, n_embd_indexer, n_tokens), 0.0f); ggml_tensor * packed = ggml_concat(ctx0, ggml_concat(ctx0, ik, ig, 0), pzero, 0); packed = ggml_reshape_3d(ctx0, packed, 3*n_embd_indexer, 1, n_tokens); @@ -143,7 +143,7 @@ index 5d3944af2..452aea5ab 100644 auto kpool_cache = mctx_hyb->get_kpool_access(ctx0, il, n_embd_indexer); const int64_t n_kv = mctx_lid->get_n_kv(); -@@ -927,7 +959,9 @@ ggml_tensor * llama_model_glm5_next::graph::build_kpool_select( +@@ -926,7 +958,9 @@ ggml_tensor * llama_model_glm5_next::graph::build_kpool_select( // scatter the fresh pooled keys into their rep rows, then gather all n_pool of them by cell: // the older pools come from the rows earlier ubatches wrote @@ -154,7 +154,7 @@ index 5d3944af2..452aea5ab 100644 ggml_tensor * pooled = kpool_cache.gather_pooled(inp_kpool->pool_cells); pooled = ggml_reshape_3d(ctx0, pooled, n_embd_indexer, 1, n_pool); cb(pooled, "indexer_pool_k", il); -@@ -1046,6 +1080,7 @@ llama_model_glm5_next::graph::build_dsa_layer( +@@ -1045,6 +1079,7 @@ llama_model_glm5_next::graph::build_dsa_layer( cb(q_absorbed, "q_absorbed", il); ggml_tensor * k = mctx_mla->get_k(ctx0, il); @@ -162,7 +162,7 @@ index 5d3944af2..452aea5ab 100644 ggml_tensor * v = ggml_view_4d(ctx0, k, kv_lora_rank, k->ne[1], k->ne[2], k->ne[3], k->nb[1], k->nb[2], k->nb[3], 0); ggml_tensor * sel = prev_sel; -@@ -1062,7 +1097,9 @@ llama_model_glm5_next::graph::build_dsa_layer( +@@ -1061,7 +1096,9 @@ llama_model_glm5_next::graph::build_dsa_layer( ggml_build_forward_expand(gf, q_absorbed); ggml_build_forward_expand(gf, kv_cmpr); @@ -174,7 +174,7 @@ index 5d3944af2..452aea5ab 100644 cb(sel, "kq_mask_dsa", il); diff --git a/src/skippy/tests/graph_build_inputs.cpp b/src/skippy/tests/graph_build_inputs.cpp -index 5aab920cd..5fbf171f8 100644 +index 5aab920cd04436d65dbfa384c325f04ed8ea0806..5fbf171f8352adf1e41e18087c7fa1a1da4f35bd 100644 --- a/src/skippy/tests/graph_build_inputs.cpp +++ b/src/skippy/tests/graph_build_inputs.cpp @@ -1,4 +1,5 @@ @@ -340,7 +340,7 @@ index 5aab920cd..5fbf171f8 100644 llama_backend_init(); const int rc = check_stage_fused_ops_auto(argv[2]); diff --git a/src/skippy/tests/graph_contract_cases.cmake b/src/skippy/tests/graph_contract_cases.cmake -index 4ee862411..0d1bbf6e7 100644 +index 4ee862411340737eaf63fe9bbd3e3268b444d413..0d1bbf6e729562f1ea075700522c740cb50f8a69 100644 --- a/src/skippy/tests/graph_contract_cases.cmake +++ b/src/skippy/tests/graph_contract_cases.cmake @@ -118,3 +118,20 @@ add_test(NAME skippy_graph_contract_glm53_synthetic COMMAND skippy-graph-contrac @@ -365,10 +365,10 @@ index 4ee862411..0d1bbf6e7 100644 +set_tests_properties(skippy_glm5_next_stage_layer_inputs PROPERTIES + FIXTURES_REQUIRED contract-glm5-next-synthetic TIMEOUT 900) diff --git a/tests/test-llama-archs.cpp b/tests/test-llama-archs.cpp -index 9733d1121..cbce40585 100644 +index 0e8c34acfc4439f3a0df0793922b7e19297d2188..a66d76a91a2061b35c6747e1b3c383d15efba168 100644 --- a/tests/test-llama-archs.cpp +++ b/tests/test-llama-archs.cpp -@@ -2363,7 +2363,7 @@ int main(int argc, char ** argv) { +@@ -2405,7 +2405,7 @@ int main(int argc, char ** argv) { if (dense_mtp_depth == 0) throw std::runtime_error("--dense-mtp-depth must be positive"); auto gguf = get_gguf_ctx(arch, arch == LLM_ARCH_STEP35 || arch == LLM_ARCH_MIMO2 || arch == LLM_ARCH_HY_V3 || @@ -377,7 +377,7 @@ index 9733d1121..cbce40585 100644 0, glm_dsa_indexshare_fixture::DEFAULT, 256, 8, false, 2 + dense_mtp_depth, 256); -@@ -2394,6 +2394,13 @@ int main(int argc, char ** argv) { +@@ -2436,6 +2436,13 @@ int main(int argc, char ** argv) { const std::array recurrent = {model->hparams.is_recr(0), model->hparams.is_recr(1), false}; gguf_set_arr_data(saver.gguf_ctx, saver.llm_kv(LLM_KV_ATTENTION_RECURRENT_LAYERS).c_str(), GGUF_TYPE_BOOL, recurrent.data(), recurrent.size()); @@ -391,6 +391,3 @@ index 9733d1121..cbce40585 100644 saver.add_tensors_from_model(); saver.save(path); require_fixture_written(path); --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0012-skippy-add-clef-joint-decision-reads.patch b/llama_cpp/patches/model_support/0012-skippy-add-clef-joint-decision-reads.patch index dd579df9..5b27bd72 100644 --- a/llama_cpp/patches/model_support/0012-skippy-add-clef-joint-decision-reads.patch +++ b/llama_cpp/patches/model_support/0012-skippy-add-clef-joint-decision-reads.patch @@ -1,4 +1,4 @@ -From ccc9a8e8c4586ac1253cd413112bf6dfb25f1e1c Mon Sep 17 00:00:00 2001 +From 447b53c655d73c7b6fd0513b5629f93c951ab1df Mon Sep 17 00:00:00 2001 From: Michael Neale <14976+michaelneale@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:27:44 +1100 Subject: [PATCH] skippy: add clef joint decision reads @@ -18,7 +18,7 @@ in one micro-batch, as the upstream server does for clef. create mode 100644 src/skippy/clef.cpp diff --git a/include/skippy.h b/include/skippy.h -index 37a15eea3..15d9af032 100644 +index 37a15eea339f3dc3297ea99be6eef0d8c3ff4141..15d9af0320da4f7a647332ba7963c3dae991cccf 100644 --- a/include/skippy.h +++ b/include/skippy.h @@ -29,6 +29,7 @@ @@ -31,7 +31,7 @@ index 37a15eea3..15d9af032 100644 #endif // SKIPPY_H diff --git a/include/skippy/clef.h b/include/skippy/clef.h new file mode 100644 -index 000000000..cf13822ed +index 0000000000000000000000000000000000000000..cf13822edddfcc88ab93a7fc7bae17b83874d857 --- /dev/null +++ b/include/skippy/clef.h @@ -0,0 +1,144 @@ @@ -180,7 +180,7 @@ index 000000000..cf13822ed + +#endif // SKIPPY_CLEF_H diff --git a/include/skippy/common.h b/include/skippy/common.h -index d014c10da..63a16bd85 100644 +index d014c10da1e5fe6fd0cbd957a4ee61bbe3c2b884..63a16bd85b67620114d5a76537140610b1f73ebf 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -202,7 +202,7 @@ index d014c10da..63a16bd85 100644 enum skippy_status { SKIPPY_STATUS_OK = 0, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index fda659913..761a427f5 100644 +index fda659913208dd73888ae1ea85705926123048e9..761a427f56f331db2608a23ac449b5bcd46e1d3b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,6 +103,8 @@ add_library(llama @@ -240,7 +240,7 @@ index fda659913..761a427f5 100644 target_include_directories(llama PUBLIC ../include) target_compile_features (llama PRIVATE cxx_std_17) # don't bump diff --git a/src/skippy/abi.cpp b/src/skippy/abi.cpp -index ec369088b..c772a3766 100644 +index ec369088b9395c5105d5356fd7b39a420c221bea..c772a376619df8ac204f51dd61eb59cc2169fa6d 100644 --- a/src/skippy/abi.cpp +++ b/src/skippy/abi.cpp @@ -50,6 +50,7 @@ uint64_t skippy_abi_features(void) { @@ -253,7 +253,7 @@ index ec369088b..c772a3766 100644 #endif diff --git a/src/skippy/clef.cpp b/src/skippy/clef.cpp new file mode 100644 -index 000000000..6ccd39221 +index 0000000000000000000000000000000000000000..6ccd39221b8fc6c211c26a4090bf5b0a63a0d603 --- /dev/null +++ b/src/skippy/clef.cpp @@ -0,0 +1,517 @@ @@ -774,6 +774,3 @@ index 000000000..6ccd39221 + return skippy_success(out_error); + }); +} --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0013-models-expose-metis16-delegated-pass-layers.patch b/llama_cpp/patches/model_support/0013-models-expose-metis16-delegated-pass-layers.patch index 4adb8259..536302ea 100644 --- a/llama_cpp/patches/model_support/0013-models-expose-metis16-delegated-pass-layers.patch +++ b/llama_cpp/patches/model_support/0013-models-expose-metis16-delegated-pass-layers.patch @@ -1,4 +1,4 @@ -From b5b8bbe0f3dd1c5489a2f7a319138ffc1b29760a Mon Sep 17 00:00:00 2001 +From 504ec6a7a4b6e2b79a29282fe43e7ce3c6d05554 Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Fri, 6 Nov 2026 10:38:07 -0800 Subject: [PATCH] models: expose Metis16 delegated pass layers @@ -9,7 +9,7 @@ Subject: [PATCH] models: expose Metis16 delegated pass layers 2 files changed, 90 insertions(+), 80 deletions(-) diff --git a/src/models/metis16.cpp b/src/models/metis16.cpp -index 0a57a6ab0..137cee74d 100644 +index 443daf11684bce438f921048b1071b9d1e617f38..2010594bce83d259d26b60fdc034dd6a25d038c1 100644 --- a/src/models/metis16.cpp +++ b/src/models/metis16.cpp @@ -258,17 +258,98 @@ ggml_tensor * llama_model_metis16::graph::route_features(const llama_model_metis @@ -48,7 +48,7 @@ index 0a57a6ab0..137cee74d 100644 + ggml_tensor * K = ggml_cont(ctx0, ggml_view_3d(ctx0, qkv, n_hd, n_head_kv, n_tokens, n_hd*es, qkv->nb[1], n_hd*n_head*es)); + ggml_tensor * V = ggml_cont(ctx0, ggml_view_3d(ctx0, qkv, n_hd, n_head_kv, n_tokens, n_hd*es, qkv->nb[1], n_hd*(n_head + n_head_kv)*es)); + -+ cur = build_attn(inp->get_attn(), layer.wo, nullptr, nullptr, Q, K, V, nullptr, nullptr, nullptr, 1.0f/sqrtf(float(n_hd)), il); ++ cur = build_attn(inp->get_attn(), layer.wo, nullptr, Q, K, V, nullptr, nullptr, nullptr, 1.0f/sqrtf(float(n_hd)), il); + } else { + cur = build_mamba2_layer(inp->get_recr(), cur, ubatch, il); + } @@ -68,9 +68,9 @@ index 0a57a6ab0..137cee74d 100644 + n_exp, n_used, LLM_FFN_SILU, false, 0.0f, LLAMA_EXPERT_GATING_FUNC_TYPE_SOFTMAX_WEIGHT, il_p, + logits, layer.ffn_gate_up_exps, selected); + ggml_tensor * shexp = build_ffn(latent, -+ layer.ffn_up_shexp, NULL, NULL, -+ layer.ffn_gate_shexp, NULL, NULL, -+ layer.ffn_down_shexp, NULL, NULL, ++ layer.ffn_up_shexp, NULL, ++ layer.ffn_gate_shexp, NULL, ++ layer.ffn_down_shexp, NULL, + NULL, LLM_FFN_SILU, LLM_FFN_PAR, il_p); + cur = ggml_mul_mat(ctx0, layer.ffn_latent_up, ggml_add(ctx0, moe_out, shexp)); + cb(cur, "ffn_out", il); @@ -133,7 +133,7 @@ index 0a57a6ab0..137cee74d 100644 - ggml_tensor * cur = hc_read(x, layer.hc_attn_mix, layer.hc_attn_read, layer.attn_norm, p, &mixed, il); - if (is_attn) { - ggml_tensor * qkv = build_lora_mm(layer.wqkv, cur); -- ggml_tensor * lora = ggml_mul_mat(ctx0, layer.attn_pass_lora_up, ggml_mul_mat(ctx0, layer.attn_pass_lora_down, cur)); +- ggml_tensor * lora = build_lora_mm(layer.attn_pass_lora_up, build_lora_mm(layer.attn_pass_lora_down, cur)); - qkv = ggml_add(ctx0, qkv, ggml_mul(ctx0, lora, ggml_view_1d(ctx0, layer.attn_pass_gate, 1, p*layer.attn_pass_gate->nb[0]))); - - const int64_t n_head = hparams.n_head(il); @@ -143,7 +143,7 @@ index 0a57a6ab0..137cee74d 100644 - ggml_tensor * K = ggml_cont(ctx0, ggml_view_3d(ctx0, qkv, n_hd, n_head_kv, n_tokens, n_hd*es, qkv->nb[1], n_hd*n_head*es)); - ggml_tensor * V = ggml_cont(ctx0, ggml_view_3d(ctx0, qkv, n_hd, n_head_kv, n_tokens, n_hd*es, qkv->nb[1], n_hd*(n_head + n_head_kv)*es)); - -- cur = build_attn(inp->get_attn(), layer.wo, nullptr, nullptr, Q, K, V, nullptr, nullptr, nullptr, 1.0f/sqrtf(float(n_hd)), il); +- cur = build_attn(inp->get_attn(), layer.wo, nullptr, Q, K, V, nullptr, nullptr, nullptr, 1.0f/sqrtf(float(n_hd)), il); - } else { - cur = build_mamba2_layer(inp->get_recr(), cur, ubatch, il); - } @@ -152,8 +152,8 @@ index 0a57a6ab0..137cee74d 100644 - - cur = hc_read(x, layer.hc_ffn_mix, layer.hc_ffn_read, layer.ffn_norm, p, &mixed, il); - { -- ggml_tensor * latent = ggml_mul_mat(ctx0, layer.ffn_latent_down, cur); -- ggml_tensor * logits = ggml_mul_mat(ctx0, layer.ffn_gate_inp, ggml_concat(ctx0, latent, feats, 0)); +- ggml_tensor * latent = build_lora_mm(layer.ffn_latent_down, cur); +- ggml_tensor * logits = build_lora_mm(layer.ffn_gate_inp, ggml_concat(ctx0, latent, feats, 0)); - logits = ggml_add(ctx0, logits, layer.ffn_gate_inp_b); - - // the balance bias picks the experts; the weights come from the unbiased logits @@ -163,11 +163,11 @@ index 0a57a6ab0..137cee74d 100644 - n_exp, n_used, LLM_FFN_SILU, false, 0.0f, LLAMA_EXPERT_GATING_FUNC_TYPE_SOFTMAX_WEIGHT, il_p, - logits, layer.ffn_gate_up_exps, selected); - ggml_tensor * shexp = build_ffn(latent, -- layer.ffn_up_shexp, NULL, NULL, -- layer.ffn_gate_shexp, NULL, NULL, -- layer.ffn_down_shexp, NULL, NULL, +- layer.ffn_up_shexp, NULL, +- layer.ffn_gate_shexp, NULL, +- layer.ffn_down_shexp, NULL, - NULL, LLM_FFN_SILU, LLM_FFN_PAR, il_p); -- cur = ggml_mul_mat(ctx0, layer.ffn_latent_up, ggml_add(ctx0, moe_out, shexp)); +- cur = build_lora_mm(layer.ffn_latent_up, ggml_add(ctx0, moe_out, shexp)); - cb(cur, "ffn_out", il); - - // routing summary: the chosen experts' identity vectors blended by their weights @@ -200,10 +200,10 @@ index 0a57a6ab0..137cee74d 100644 // end of the pass: one more memory read, the depth head, and an entry recording where the pass left the token ggml_tensor * retrieved = mem_read(model, &x); diff --git a/src/models/models.h b/src/models/models.h -index 90415fc94..aed5b89cd 100644 +index 8a81ae121532dcdea41574503b4ca2188405d59c..3a250b2b708945aeedd49842f2163b711dde382b 100644 --- a/src/models/models.h +++ b/src/models/models.h -@@ -1976,6 +1976,9 @@ struct llama_model_metis16 : public llama_model_base { +@@ -1981,6 +1981,9 @@ struct llama_model_metis16 : public llama_model_base { struct graph : public llm_build_mamba_base { graph(const llm_graph_params & params); @@ -213,6 +213,3 @@ index 90415fc94..aed5b89cd 100644 // memory bank of the current forward: keys [n_mem, n_entry, n_tokens], values [n_entry, n_mem, n_tokens] ggml_tensor * bank_k = nullptr; --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0014-test-skippy-cover-head-input-publication.patch b/llama_cpp/patches/model_support/0014-test-skippy-cover-head-input-publication.patch index 74b367be..964d715d 100644 --- a/llama_cpp/patches/model_support/0014-test-skippy-cover-head-input-publication.patch +++ b/llama_cpp/patches/model_support/0014-test-skippy-cover-head-input-publication.patch @@ -1,4 +1,4 @@ -From 756649f29efb149e39756bb9e41169f20186cc80 Mon Sep 17 00:00:00 2001 +From fc5cf2c232255c7508c024306cc7e955c6c4ca92 Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Mon, 9 Nov 2026 09:20:42 +1100 Subject: [PATCH] test(skippy): cover head-input publication and stage capture @@ -15,7 +15,7 @@ case runs in native-rollback mode. 3 files changed, 134 insertions(+), 17 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 761a427f5..ac5698b88 100644 +index 761a427f56f331db2608a23ac449b5bcd46e1d3b..ac5698b88969c4859c2bd5de11c330e209e7f8ed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -529,6 +529,9 @@ if (LLAMA_STAGE_BUILD_TESTS) @@ -49,7 +49,7 @@ index 761a427f5..ac5698b88 100644 NAME skippy_generate_mamba2_fixture COMMAND skippy-model-fixture-generator diff --git a/src/skippy/tests/graph_build_inputs.cpp b/src/skippy/tests/graph_build_inputs.cpp -index 5fbf171f8..628ef1174 100644 +index 5fbf171f8352adf1e41e18087c7fa1a1da4f35bd..628ef1174150248e01de311bbae58bc18dce1233 100644 --- a/src/skippy/tests/graph_build_inputs.cpp +++ b/src/skippy/tests/graph_build_inputs.cpp @@ -13,7 +13,9 @@ static const skippy::log_gate::installer skippy_log_gate_installer{}; @@ -236,7 +236,7 @@ index 5fbf171f8..628ef1174 100644 return rc; } diff --git a/src/skippy/tests/graph_contract_cases.cmake b/src/skippy/tests/graph_contract_cases.cmake -index 0d1bbf6e7..fdcdc631f 100644 +index 0d1bbf6e729562f1ea075700522c740cb50f8a69..fdcdc631fa672bdd052fa77e3e3b9bbd74a749e9 100644 --- a/src/skippy/tests/graph_contract_cases.cmake +++ b/src/skippy/tests/graph_contract_cases.cmake @@ -135,3 +135,26 @@ add_test(NAME skippy_glm5_next_stage_layer_inputs COMMAND skippy-graph-build-inp @@ -266,6 +266,3 @@ index 0d1bbf6e7..fdcdc631f 100644 + "${SKIPPY_MODEL_FIXTURE_DIR}/contract-qwen3-dense/graph-contract.gguf" 0) +set_tests_properties(skippy_qwen3_head_input_not_published PROPERTIES + FIXTURES_REQUIRED contract-qwen3-dense TIMEOUT 900) --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0015-models-add-laguna-dflash-drafts.patch b/llama_cpp/patches/model_support/0015-models-add-laguna-dflash-drafts.patch index f9518aaf..83e7441a 100644 --- a/llama_cpp/patches/model_support/0015-models-add-laguna-dflash-drafts.patch +++ b/llama_cpp/patches/model_support/0015-models-add-laguna-dflash-drafts.patch @@ -1,4 +1,4 @@ -From 3ce149560262b9365d15119c92cfcfdad3795a19 Mon Sep 17 00:00:00 2001 +From 8edeaee5da0f9073d3a56f8ba59f4443abdfe78b Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Mon, 9 Nov 2026 15:52:17 +1100 Subject: [PATCH] models: add Laguna DFlash drafts @@ -46,7 +46,7 @@ of the Laguna contract fixture keep the draft's target layers 2, 14, 10 files changed, 225 insertions(+), 7 deletions(-) diff --git a/conversion/__init__.py b/conversion/__init__.py -index 679682010..159b163c6 100644 +index 6796820109a938b017e39bd0eff560028093801b..159b163c67eaa2a2cd74c91e801ce87ba0fb31e0 100644 --- a/conversion/__init__.py +++ b/conversion/__init__.py @@ -66,6 +66,7 @@ TEXT_MODEL_MAP: dict[str, str] = { @@ -58,7 +58,7 @@ index 679682010..159b163c6 100644 "Qwen3DSparkModel": "qwen", "DSparkDraftModel": "qwen", diff --git a/conversion/laguna.py b/conversion/laguna.py -index 29e0b3d6b..3510a0489 100644 +index 29e0b3d6b318b73aa7f5c608103b9e3a90ddd271..3510a048967eee972777c4707dfc74f3e56609a4 100644 --- a/conversion/laguna.py +++ b/conversion/laguna.py @@ -10,6 +10,7 @@ if TYPE_CHECKING: @@ -147,18 +147,18 @@ index 29e0b3d6b..3510a0489 100644 + + yield from super().modify_tensors(data_torch, name, bid) diff --git a/gguf-py/gguf/constants.py b/gguf-py/gguf/constants.py -index d8dcd2b97..685c6cf79 100644 +index 8f101e52f5f9676d917023d78eaefad89796437e..1a77055820cf82dddce78a88ec53b67dc51046d2 100644 --- a/gguf-py/gguf/constants.py +++ b/gguf-py/gguf/constants.py -@@ -175,6 +175,7 @@ class Keys: - CONV_GROUP_SIZE = "{arch}.conv_group_size" +@@ -176,6 +176,7 @@ class Keys: SELECTOR_RANK = "{arch}.selector_rank" SELECTOR_TOP_K = "{arch}.selector_top_k" + SELECTOR_SOFTCAP_AFTER_CORRECTION = "{arch}.selector_softcap_after_correction" + DECODER_ARCH = "{arch}.decoder_arch" SAMPLE_FROM_ANCHOR = "{arch}.sample_from_anchor" HAS_CONFIDENCE_HEAD = "{arch}.has_confidence_head" HAS_MARKOV_CONTEXT = "{arch}.has_markov_context" -@@ -1104,6 +1105,7 @@ class MODEL_TENSOR(IntEnum): +@@ -1105,6 +1106,7 @@ class MODEL_TENSOR(IntEnum): ENC_FFN_DOWN = auto() ENC_FFN_UP = auto() ENC_OUTPUT_NORM = auto() @@ -166,7 +166,7 @@ index d8dcd2b97..685c6cf79 100644 CLS = auto() # classifier CLS_OUT = auto() # classifier output projection CLS_NORM = auto() -@@ -2133,6 +2135,7 @@ TENSOR_NAMES: dict[MODEL_TENSOR, str] = { +@@ -2134,6 +2136,7 @@ TENSOR_NAMES: dict[MODEL_TENSOR, str] = { MODEL_TENSOR.ENC_FFN_DOWN: "enc.blk.{bid}.ffn_down", MODEL_TENSOR.ENC_FFN_UP: "enc.blk.{bid}.ffn_up", MODEL_TENSOR.ENC_OUTPUT_NORM: "enc.output_norm", @@ -174,7 +174,7 @@ index d8dcd2b97..685c6cf79 100644 MODEL_TENSOR.CLS: "cls", MODEL_TENSOR.CLS_OUT: "cls.output", MODEL_TENSOR.CLS_NORM: "cls.norm", -@@ -6574,6 +6577,7 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = { +@@ -6575,6 +6578,7 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = { MODEL_TENSOR.ATTN_OUT, MODEL_TENSOR.ATTN_Q_NORM, MODEL_TENSOR.ATTN_K_NORM, @@ -182,7 +182,7 @@ index d8dcd2b97..685c6cf79 100644 MODEL_TENSOR.ATTN_SINKS, MODEL_TENSOR.ATTN_Q_A, MODEL_TENSOR.ATTN_Q_B, -@@ -6609,6 +6613,7 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = { +@@ -6610,6 +6614,7 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = { MODEL_TENSOR.FFN_UP_SHEXP, MODEL_TENSOR.FC, MODEL_TENSOR.ENC_OUTPUT_NORM, @@ -191,12 +191,12 @@ index d8dcd2b97..685c6cf79 100644 # optional DSpark heads MODEL_TENSOR.DSPARK_MARKOV_W1, diff --git a/gguf-py/gguf/gguf_writer.py b/gguf-py/gguf/gguf_writer.py -index 28b481e65..64e2eeed6 100644 +index 887352b2619d4765e885b8bf95255d7cafe5db46..6a9e84fdf040b0d073e425845d662a3363e8b88b 100644 --- a/gguf-py/gguf/gguf_writer.py +++ b/gguf-py/gguf/gguf_writer.py -@@ -1107,6 +1107,9 @@ class GGUFWriter: - def add_selector_top_k(self, value: int) -> None: - self.add_uint32(Keys.LLM.SELECTOR_TOP_K.format(arch=self.arch), value) +@@ -1110,6 +1110,9 @@ class GGUFWriter: + def add_selector_softcap_after_correction(self, value: bool) -> None: + self.add_bool(Keys.LLM.SELECTOR_SOFTCAP_AFTER_CORRECTION.format(arch=self.arch), value) + def add_decoder_arch(self, value: str) -> None: + self.add_string(Keys.LLM.DECODER_ARCH.format(arch=self.arch), value) @@ -205,18 +205,18 @@ index 28b481e65..64e2eeed6 100644 self.add_bool(Keys.LLM.SAMPLE_FROM_ANCHOR.format(arch=self.arch), value) diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp -index 9ef5756b6..ee1f597d0 100644 +index 44576b6d6e0ed99b5e0058c8f38b655d0fd0ee57..da3b432f7c3579e4d34fe6c25ab4dd8f538dfad2 100644 --- a/src/llama-arch.cpp +++ b/src/llama-arch.cpp -@@ -468,6 +468,7 @@ static const std::map LLM_KV_NAMES = { - { LLM_KV_DFLASH_SELECTOR_RANK, "%s.selector_rank" }, - { LLM_KV_DFLASH_SELECTOR_TOP_K, "%s.selector_top_k" }, - { LLM_KV_DFLASH_HAS_MARKOV_CONTEXT, "%s.has_markov_context" }, -+ { LLM_KV_DFLASH_DECODER_ARCH, "%s.decoder_arch" }, +@@ -469,6 +469,7 @@ static const std::map LLM_KV_NAMES = { + { LLM_KV_DFLASH_SELECTOR_TOP_K, "%s.selector_top_k" }, + { LLM_KV_DFLASH_SELECTOR_SOFTCAP_AFTER_CORRECTION, "%s.selector_softcap_after_correction" }, + { LLM_KV_DFLASH_HAS_MARKOV_CONTEXT, "%s.has_markov_context" }, ++ { LLM_KV_DFLASH_DECODER_ARCH, "%s.decoder_arch" }, { LLM_KV_LILICORR_HIDDEN_SIZE, "lilicorr.hidden_size" }, { LLM_KV_LILICORR_CANDIDATE_TOPK, "lilicorr.candidate_topk" }, -@@ -726,6 +727,7 @@ static const std::map LLM_TENSOR_NAMES = { +@@ -727,6 +728,7 @@ static const std::map LLM_TENSOR_NAMES = { { LLM_TENSOR_ACT_HEAD_0, "act_head.0" }, { LLM_TENSOR_ACT_HEAD_2, "act_head.2" }, { LLM_TENSOR_ENC_OUTPUT_NORM, "enc.output_norm" }, @@ -224,7 +224,7 @@ index 9ef5756b6..ee1f597d0 100644 { LLM_TENSOR_FFN_GATE_INP_SHEXP, "blk.%d.ffn_gate_inp_shexp" }, { LLM_TENSOR_SSM_A_NOSCAN, "blk.%d.ssm_a" }, { LLM_TENSOR_SSM_CONV1D, "blk.%d.ssm_conv1d" }, -@@ -1078,6 +1080,7 @@ static const std::map LLM_TENSOR_INFOS = { +@@ -1079,6 +1081,7 @@ static const std::map LLM_TENSOR_INFOS = { {LLM_TENSOR_OUTPUT_RES_QUERY, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL_MAT}}, {LLM_TENSOR_DEC_OUTPUT_NORM, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL}}, {LLM_TENSOR_ENC_OUTPUT_NORM, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL}}, @@ -233,18 +233,18 @@ index 9ef5756b6..ee1f597d0 100644 {LLM_TENSOR_ROPE_FACTORS_LONG, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_ROPE}}, {LLM_TENSOR_ROPE_FACTORS_SHORT, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_ROPE}}, diff --git a/src/llama-arch.h b/src/llama-arch.h -index 8ebfeae7e..c56aa6f37 100644 +index 3c515e98b0b99bc7b2764c84d5d9a09f5deb6d0e..a4de98e8f20e70473ace7e21605d993d2b66ba75 100644 --- a/src/llama-arch.h +++ b/src/llama-arch.h -@@ -514,6 +514,7 @@ enum llm_kv { - LLM_KV_DFLASH_SELECTOR_RANK, +@@ -515,6 +515,7 @@ enum llm_kv { LLM_KV_DFLASH_SELECTOR_TOP_K, + LLM_KV_DFLASH_SELECTOR_SOFTCAP_AFTER_CORRECTION, LLM_KV_DFLASH_HAS_MARKOV_CONTEXT, + LLM_KV_DFLASH_DECODER_ARCH, LLM_KV_LILICORR_HIDDEN_SIZE, LLM_KV_LILICORR_CANDIDATE_TOPK, LLM_KV_LILICORR_NUM_HEADS, -@@ -875,6 +876,7 @@ enum llm_tensor { +@@ -874,6 +875,7 @@ enum llm_tensor { LLM_TENSOR_ENC_FFN_DOWN, LLM_TENSOR_ENC_FFN_UP, LLM_TENSOR_ENC_OUTPUT_NORM, @@ -253,10 +253,10 @@ index 8ebfeae7e..c56aa6f37 100644 LLM_TENSOR_CLS_OUT, LLM_TENSOR_CLS_NORM, diff --git a/src/models/dflash.cpp b/src/models/dflash.cpp -index 6200b6c44..461d1e13b 100644 +index 04749dfadd33c3a6b83a2fbc867a340bd95a7fca..5cb6987190eecb29452791281771fb7586f573a9 100644 --- a/src/models/dflash.cpp +++ b/src/models/dflash.cpp -@@ -83,6 +83,23 @@ void llama_model_dflash::load_arch_hparams(llama_model_loader & ml) { +@@ -84,6 +84,23 @@ void llama_model_dflash::load_arch_hparams(llama_model_loader & ml) { hparams.rope_freq_scale_train_swa = hparams.rope_freq_scale_train; } @@ -280,7 +280,7 @@ index 6200b6c44..461d1e13b 100644 ml.get_key_or_arr(LLM_KV_ATTENTION_ROPE_PATTERN, hparams.rope_pattern, hparams.n_layer(), false); type = LLM_TYPE_UNKNOWN; -@@ -122,7 +139,7 @@ void llama_model_dflash::load_arch_tensors(llama_model_loader &) { +@@ -121,7 +138,7 @@ void llama_model_dflash::load_arch_tensors(llama_model_loader &) { // optional: norm of the anchor embedding tok_norm = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD_NORM, "weight", 0), { n_embd }, TENSOR_NOT_REQUIRED); @@ -289,7 +289,7 @@ index 6200b6c44..461d1e13b 100644 // optional: reduced-vocab drafts ship their own lm head, full-vocab drafts can share the target's via ctx_other // a draft with its own embeddings + head references no target tensors and can run on devices the target does not use (e.g. -devd with a tensor-split target) output = create_tensor(tn(LLM_TENSOR_OUTPUT, "weight"), { n_embd, n_vocab_draft }, TENSOR_NOT_REQUIRED); -@@ -173,6 +190,20 @@ void llama_model_dflash::load_tensors_layers_base() { +@@ -172,6 +189,20 @@ void llama_model_dflash::load_tensors_layers_base() { // optional per-head attention sinks (e.g. Nemotron DSpark) layer.attn_sinks = create_tensor(tn(LLM_TENSOR_ATTN_SINKS, "weight", i), { n_head }, TENSOR_NOT_REQUIRED); @@ -310,7 +310,7 @@ index 6200b6c44..461d1e13b 100644 layer.ffn_norm = create_tensor(tn(LLM_TENSOR_FFN_NORM, "weight", i), { n_embd }, 0); layer.ffn_gate = create_tensor(tn(LLM_TENSOR_FFN_GATE, "weight", i), { n_embd, n_ff }, 0); layer.ffn_down = create_tensor(tn(LLM_TENSOR_FFN_DOWN, "weight", i), { n_ff, n_embd }, 0); -@@ -189,6 +220,26 @@ void llama_model_dflash::load_tensors_layers_base() { +@@ -188,6 +219,26 @@ void llama_model_dflash::load_tensors_layers_base() { } } @@ -337,23 +337,23 @@ index 6200b6c44..461d1e13b 100644 template <> ggml_tensor * llama_model_dflash::graph::build_inp_embd_enc() const { const int64_t n_embd_inp = hparams.n_embd_inp_enc(); -@@ -210,6 +261,7 @@ template <> +@@ -209,6 +260,7 @@ template <> llama_model_dflash::graph::graph(const llm_graph_params & params) : llm_graph_context(params) { ggml_tensor * cur = build_inp_embd_enc(); + cur = build_dflash_aux_norm(*this, model, cur); - cur = build_lora_mm(model.fc, cur, model.fc_s); + cur = build_lora_mm(model.fc, cur); cb(cur, "fc_out", -1); -@@ -250,6 +302,7 @@ ggml_tensor * llama_model_dflash::build_inject_inp(llm_graph_context & g, const +@@ -249,6 +301,7 @@ ggml_tensor * llama_model_dflash::build_inject_inp(llm_graph_context & g, const g.res->add_input(std::move(inp)); + inp_target = build_dflash_aux_norm(g, model, inp_target); - ggml_tensor * inp_g = g.build_lora_mm(model.fc, inp_target, model.fc_s); + ggml_tensor * inp_g = g.build_lora_mm(model.fc, inp_target); return g.build_norm(inp_g, model.output_norm_enc, nullptr, LLM_NORM_RMS, -1); } -@@ -357,12 +410,22 @@ ggml_tensor * llama_model_dflash::graph_base::build_inject() { +@@ -356,12 +409,22 @@ ggml_tensor * llama_model_dflash::graph_base::build_inject() { ggml_tensor * inp_g = build_inject_inp(*this, model); cb(inp_g, "inp_g_embeddings", -1); @@ -362,7 +362,7 @@ index 6200b6c44..461d1e13b 100644 for (int il = 0; il < n_layer; ++il) { const auto & layer = model.layers[il]; -- ggml_tensor * Kcur = build_lora_mm(layer.wk, inp_g, layer.wk_s); +- ggml_tensor * Kcur = build_lora_mm(layer.wk, inp_g); + // Laguna drafters project context K/V from the layer's input norm, + // as they do the noise block; generic DFlash projects them raw. + ggml_tensor * kv_inp = inp_g; @@ -371,14 +371,14 @@ index 6200b6c44..461d1e13b 100644 + cb(kv_inp, "kv_inp_normed", il); + } + -+ ggml_tensor * Kcur = build_lora_mm(layer.wk, kv_inp, layer.wk_s); ++ ggml_tensor * Kcur = build_lora_mm(layer.wk, kv_inp); const bool shared_kv = layer.wv == nullptr; -- ggml_tensor * Vcur = shared_kv ? Kcur : build_lora_mm(layer.wv, inp_g, layer.wv_s); -+ ggml_tensor * Vcur = shared_kv ? Kcur : build_lora_mm(layer.wv, kv_inp, layer.wv_s); +- ggml_tensor * Vcur = shared_kv ? Kcur : build_lora_mm(layer.wv, inp_g); ++ ggml_tensor * Vcur = shared_kv ? Kcur : build_lora_mm(layer.wv, kv_inp); Kcur = ggml_reshape_3d(ctx0, Kcur, n_embd_head, n_head_kv, n_tokens); Vcur = ggml_reshape_3d(ctx0, Vcur, n_embd_head, n_head_kv, n_tokens); -@@ -486,10 +549,34 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * inp_tok +@@ -488,10 +551,34 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * inp_tok cb(Kcur, "Kcur", il); cb(Vcur, "Vcur", il); @@ -388,10 +388,10 @@ index 6200b6c44..461d1e13b 100644 + // A gated layer applies its output projection after the gate. + const bool gated = layer.wqkv_gate != nullptr; ggml_tensor * cur = use_iswa -- ? build_attn(inp_attn_iswa, layer.wo, NULL, layer.wo_s, Qcur, Kcur, Vcur, nullptr, layer.attn_sinks, nullptr, kq_scale, il) -- : build_attn(inp_attn, layer.wo, NULL, layer.wo_s, Qcur, Kcur, Vcur, nullptr, layer.attn_sinks, nullptr, kq_scale, il); -+ ? build_attn(inp_attn_iswa, gated ? nullptr : layer.wo, NULL, gated ? nullptr : layer.wo_s, Qcur, Kcur, Vcur, nullptr, layer.attn_sinks, nullptr, kq_scale, il) -+ : build_attn(inp_attn, gated ? nullptr : layer.wo, NULL, gated ? nullptr : layer.wo_s, Qcur, Kcur, Vcur, nullptr, layer.attn_sinks, nullptr, kq_scale, il); +- ? build_attn(inp_attn_iswa, layer.wo, NULL, Qcur, Kcur, Vcur, nullptr, layer.attn_sinks, nullptr, kq_scale, il) +- : build_attn(inp_attn, layer.wo, NULL, Qcur, Kcur, Vcur, nullptr, layer.attn_sinks, nullptr, kq_scale, il); ++ ? build_attn(inp_attn_iswa, gated ? nullptr : layer.wo, NULL, Qcur, Kcur, Vcur, nullptr, layer.attn_sinks, nullptr, kq_scale, il) ++ : build_attn(inp_attn, gated ? nullptr : layer.wo, NULL, Qcur, Kcur, Vcur, nullptr, layer.attn_sinks, nullptr, kq_scale, il); + + if (gated) { + // softplus gate on the normed block input, per head (broadcast @@ -411,13 +411,13 @@ index 6200b6c44..461d1e13b 100644 + } + cb(cur, "attn_gated", il); + -+ cur = build_lora_mm(layer.wo, cur, layer.wo_s); ++ cur = build_lora_mm(layer.wo, cur); + } if (hparams.f_attn_value_scale != 0.0f) { cur = ggml_scale(ctx0, cur, hparams.f_attn_value_scale); diff --git a/src/models/laguna.cpp b/src/models/laguna.cpp -index 2b179e8c3..a92fe67db 100644 +index 177b31451e1085360218fb63d6911500320b920e..7544d0d1b5b390ca1b60069562b0fc60b9c12b35 100644 --- a/src/models/laguna.cpp +++ b/src/models/laguna.cpp @@ -181,6 +181,9 @@ llama_model_laguna::graph::graph(const llm_graph_params & params) : llm_graph_co @@ -463,10 +463,10 @@ index 2b179e8c3..a92fe67db 100644 cb(cur, "result_norm", -1); res->t_embd = cur; diff --git a/src/models/models.h b/src/models/models.h -index aed5b89cd..c0a68949c 100644 +index 3a250b2b708945aeedd49842f2163b711dde382b..3ade1536ebe1d2a93177c3cbdc86f2504fae50fc 100644 --- a/src/models/models.h +++ b/src/models/models.h -@@ -1726,6 +1726,14 @@ struct llama_model_dflash : public llama_model_base { +@@ -1731,6 +1731,14 @@ struct llama_model_dflash : public llama_model_base { void load_tensors_layers_dsv4(); void load_tensors_layers_mistral_large4(); @@ -482,7 +482,7 @@ index aed5b89cd..c0a68949c 100644 struct graph : public llm_graph_context { graph(const llm_graph_params & params); diff --git a/src/skippy/tests/graph_contract_cases.cmake b/src/skippy/tests/graph_contract_cases.cmake -index fdcdc631f..725b75ad2 100644 +index fdcdc631fa672bdd052fa77e3e3b9bbd74a749e9..725b75ad21c475ec3b7fe499ec254fe576a0f693 100644 --- a/src/skippy/tests/graph_contract_cases.cmake +++ b/src/skippy/tests/graph_contract_cases.cmake @@ -158,3 +158,26 @@ add_test(NAME skippy_qwen3_head_input_not_published COMMAND skippy-graph-build-i @@ -512,6 +512,3 @@ index fdcdc631f..725b75ad2 100644 + "${SKIPPY_MODEL_FIXTURE_DIR}/contract-laguna/graph-contract.gguf" 2,14,26,34,40) +set_tests_properties(skippy_laguna_stage_layer_inputs PROPERTIES + FIXTURES_REQUIRED contract-laguna TIMEOUT 900) --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0016-models-add-dspine-block-parallel-drafter-support.patch b/llama_cpp/patches/model_support/0016-models-add-dspine-block-parallel-drafter-support.patch index 7ab36906..4b9a60a5 100644 --- a/llama_cpp/patches/model_support/0016-models-add-dspine-block-parallel-drafter-support.patch +++ b/llama_cpp/patches/model_support/0016-models-add-dspine-block-parallel-drafter-support.patch @@ -1,4 +1,4 @@ -From bbb84a28103ad40b35b28ea7bcbe2d39dfbf1033 Mon Sep 17 00:00:00 2001 +From 6370bffcbe9f903089f48b4c1940087418c90751 Mon Sep 17 00:00:00 2001 From: AjHomelab <31621065+Ajay9o9@users.noreply.github.com> Date: Mon, 9 Nov 2026 07:03:22 +1100 Subject: [PATCH] dflash : add DSpine draft model support @@ -33,10 +33,10 @@ Review hardening on top of the import: 10 files changed, 416 insertions(+), 1 deletion(-) diff --git a/conversion/qwen.py b/conversion/qwen.py -index 0bdbdf143..6480fb4e0 100644 +index 6b6416f995cfdaf064ddd9386aaed4f302c76afc..6e3e0f9c980ae3feb62e83b042a59b40535398ad 100644 --- a/conversion/qwen.py +++ b/conversion/qwen.py -@@ -1055,6 +1055,9 @@ class DFlashModel(Qwen3Model): +@@ -1101,6 +1101,9 @@ class DFlashModel(Qwen3Model): causal = self.hparams.get("is_causal") if causal is None: causal = dflash_config.get("causal") @@ -46,7 +46,7 @@ index 0bdbdf143..6480fb4e0 100644 if causal is not None: self.gguf_writer.add_causal_attention(bool(causal)) -@@ -1064,6 +1067,45 @@ class DFlashModel(Qwen3Model): +@@ -1110,6 +1113,45 @@ class DFlashModel(Qwen3Model): head_dim = self.hparams.get("head_dim") or self.hparams["hidden_size"] // self.hparams["num_attention_heads"] self.gguf_writer.add_rope_dimension_sections([head_dim // 2, 0, 0, 0]) @@ -92,8 +92,8 @@ index 0bdbdf143..6480fb4e0 100644 def generate_extra_tensors(self) -> Iterable[tuple[str, Tensor]]: yield from super().generate_extra_tensors() -@@ -1161,6 +1203,44 @@ class DFlashModel(Qwen3Model): - ): +@@ -1213,6 +1255,44 @@ class DFlashModel(Qwen3Model): + data_torch = data_torch[:self.hparams["vocab_size"]] name += ".weight" + if self._is_dspine(): @@ -138,7 +138,7 @@ index 0bdbdf143..6480fb4e0 100644 diff --git a/docs/speculative.md b/docs/speculative.md -index 3cd77046d..1664e0a48 100644 +index 3cd77046dca299283628cd8b53b8451a5aff69d9..1664e0a481824ab980a80e354a097cbbd10bb2f8 100644 --- a/docs/speculative.md +++ b/docs/speculative.md @@ -176,6 +176,45 @@ llama-server -m target.gguf -md LiliCorr.gguf --spec-type draft-lilicorr -fa on @@ -188,10 +188,10 @@ index 3cd77046d..1664e0a48 100644 ### n-gram Cache (`ngram-cache`) diff --git a/gguf-py/gguf/constants.py b/gguf-py/gguf/constants.py -index 685c6cf79..f30b251ae 100644 +index 1a77055820cf82dddce78a88ec53b67dc51046d2..dd381cfe52ca25c860d13a4962e716abbee1efc9 100644 --- a/gguf-py/gguf/constants.py +++ b/gguf-py/gguf/constants.py -@@ -1564,6 +1564,12 @@ class MODEL_TENSOR(IntEnum): +@@ -1565,6 +1565,12 @@ class MODEL_TENSOR(IntEnum): DFLASH_ATTN_K_CTX = auto() # per-layer context K projection DFLASH_ATTN_V_CTX = auto() # per-layer context V projection DFLASH_ATTN_K_CTX_NORM = auto() @@ -204,7 +204,7 @@ index 685c6cf79..f30b251ae 100644 LILICORR_TOKEN_PROJ = auto() LILICORR_PASS_HIDDEN_PROJ = auto() LILICORR_SLOT_EMBD = auto() -@@ -2634,6 +2640,12 @@ TENSOR_NAMES: dict[MODEL_TENSOR, str] = { +@@ -2635,6 +2641,12 @@ TENSOR_NAMES: dict[MODEL_TENSOR, str] = { MODEL_TENSOR.DFLASH_ATTN_K_CTX: "blk.{bid}.attn_k_ctx", MODEL_TENSOR.DFLASH_ATTN_V_CTX: "blk.{bid}.attn_v_ctx", MODEL_TENSOR.DFLASH_ATTN_K_CTX_NORM: "blk.{bid}.attn_k_ctx_norm", @@ -217,7 +217,7 @@ index 685c6cf79..f30b251ae 100644 MODEL_TENSOR.LILICORR_TOKEN_PROJ: "lilicorr.token_proj", MODEL_TENSOR.LILICORR_PASS_HIDDEN_PROJ: "lilicorr.pass_hidden_proj", MODEL_TENSOR.LILICORR_SLOT_EMBD: "lilicorr.slot_embedding", -@@ -6635,6 +6647,12 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = { +@@ -6636,6 +6648,12 @@ MODEL_TENSORS: dict[MODEL_ARCH, list[MODEL_TENSOR]] = { MODEL_TENSOR.DFLASH_ATTN_K_CTX, MODEL_TENSOR.DFLASH_ATTN_V_CTX, MODEL_TENSOR.DFLASH_ATTN_K_CTX_NORM, @@ -231,7 +231,7 @@ index 685c6cf79..f30b251ae 100644 MODEL_TENSOR.LILICORR_PASS_HIDDEN_PROJ, MODEL_TENSOR.LILICORR_SLOT_EMBD, diff --git a/gguf-py/gguf/tensor_mapping.py b/gguf-py/gguf/tensor_mapping.py -index a8e7367c3..bcfa6875c 100644 +index a8e7367c396be01dc6b439c50d9d40cf3263a1bd..bcfa6875ca98ebb567bd6eaacd52ceaeb8a77f23 100644 --- a/gguf-py/gguf/tensor_mapping.py +++ b/gguf-py/gguf/tensor_mapping.py @@ -1900,6 +1900,30 @@ class TensorNameMap: @@ -266,10 +266,10 @@ index a8e7367c3..bcfa6875c 100644 "model.lilicorr.layers.{bid}.attn.in_proj", ), diff --git a/src/llama-arch.cpp b/src/llama-arch.cpp -index ee1f597d0..9e130d0bc 100644 +index da3b432f7c3579e4d34fe6c25ab4dd8f538dfad2..40bdcbcb18ea42a32fee4cdd4abd531e9641ccfe 100644 --- a/src/llama-arch.cpp +++ b/src/llama-arch.cpp -@@ -995,6 +995,12 @@ static const std::map LLM_TENSOR_NAMES = { +@@ -996,6 +996,12 @@ static const std::map LLM_TENSOR_NAMES = { { LLM_TENSOR_DFLASH_ATTN_K_CTX, "blk.%d.attn_k_ctx" }, { LLM_TENSOR_DFLASH_ATTN_V_CTX, "blk.%d.attn_v_ctx" }, { LLM_TENSOR_DFLASH_ATTN_K_CTX_NORM, "blk.%d.attn_k_ctx_norm" }, @@ -282,7 +282,7 @@ index ee1f597d0..9e130d0bc 100644 { LLM_TENSOR_LILICORR_TOKEN_PROJ, "lilicorr.token_proj" }, { LLM_TENSOR_LILICORR_PASS_HIDDEN_PROJ, "lilicorr.pass_hidden_proj" }, { LLM_TENSOR_LILICORR_SLOT_EMBD, "lilicorr.slot_embedding" }, -@@ -1463,6 +1469,12 @@ static const std::map LLM_TENSOR_INFOS = { +@@ -1464,6 +1470,12 @@ static const std::map LLM_TENSOR_INFOS = { {LLM_TENSOR_DFLASH_ATTN_K_CTX, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT}}, {LLM_TENSOR_DFLASH_ATTN_V_CTX, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL_MAT}}, {LLM_TENSOR_DFLASH_ATTN_K_CTX_NORM, {LLM_TENSOR_LAYER_REPEATING, GGML_OP_MUL}}, @@ -296,10 +296,10 @@ index ee1f597d0..9e130d0bc 100644 {LLM_TENSOR_LILICORR_PASS_HIDDEN_PROJ, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_MUL_MAT}}, {LLM_TENSOR_LILICORR_SLOT_EMBD, {LLM_TENSOR_LAYER_OUTPUT, GGML_OP_ADD}}, diff --git a/src/llama-arch.h b/src/llama-arch.h -index c56aa6f37..a25a2ae79 100644 +index a4de98e8f20e70473ace7e21605d993d2b66ba75..f51d7c0b5b7ffcba6314e9b6653eea27b430fc0d 100644 --- a/src/llama-arch.h +++ b/src/llama-arch.h -@@ -999,6 +999,12 @@ enum llm_tensor { +@@ -998,6 +998,12 @@ enum llm_tensor { LLM_TENSOR_DFLASH_ATTN_K_CTX, LLM_TENSOR_DFLASH_ATTN_V_CTX, LLM_TENSOR_DFLASH_ATTN_K_CTX_NORM, @@ -313,10 +313,10 @@ index c56aa6f37..a25a2ae79 100644 LLM_TENSOR_LILICORR_PASS_HIDDEN_PROJ, LLM_TENSOR_LILICORR_SLOT_EMBD, diff --git a/src/llama-model.h b/src/llama-model.h -index 14838b67b..b3910a15c 100644 +index 0c082ad2e1d4bca443825ef0134d90a2db12fa40..a92c7dad3200fddcfb6fcfdc2ce1663c9af2e8c3 100644 --- a/src/llama-model.h +++ b/src/llama-model.h -@@ -431,6 +431,8 @@ struct llama_layer { +@@ -422,6 +422,8 @@ struct llama_layer { struct ggml_tensor * dflash_wk_ctx = nullptr; struct ggml_tensor * dflash_wv_ctx = nullptr; struct ggml_tensor * dflash_attn_k_ctx_norm = nullptr; @@ -325,7 +325,7 @@ index 14838b67b..b3910a15c 100644 struct ggml_tensor * lilicorr_attn_norm = nullptr; struct ggml_tensor * lilicorr_mlp_norm = nullptr; -@@ -996,6 +998,13 @@ struct llama_model { +@@ -960,6 +962,13 @@ struct llama_model { struct ggml_tensor * dflash_selector_next = nullptr; struct ggml_tensor * dflash_selector_hidden = nullptr; @@ -338,9 +338,9 @@ index 14838b67b..b3910a15c 100644 + struct ggml_tensor * lilicorr_token_proj = nullptr; struct ggml_tensor * lilicorr_token_proj_b = nullptr; - struct ggml_tensor * lilicorr_token_proj_s = nullptr; + struct ggml_tensor * lilicorr_pass_hidden_proj = nullptr; diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp -index f1f185cf9..2b2672f9c 100644 +index 69a453e15d250a7dd92551d7fcff0e1a8bd61090..7d24bcf24adff17cf453b291d469f6d6770c7838 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -386,6 +386,11 @@ static bool tensor_allows_quantization(const llama_model_quantize_params * param @@ -356,10 +356,10 @@ index f1f185cf9..2b2672f9c 100644 if (arch == LLM_ARCH_KIMI_K31) { quantize &= name.find("indexer.attn_q_b") == std::string::npos; diff --git a/src/models/dflash.cpp b/src/models/dflash.cpp -index 461d1e13b..285ed6920 100644 +index 5cb6987190eecb29452791281771fb7586f573a9..4bbe706da6c24271e49b03fcd7d034b551c21dd7 100644 --- a/src/models/dflash.cpp +++ b/src/models/dflash.cpp -@@ -139,7 +139,13 @@ void llama_model_dflash::load_arch_tensors(llama_model_loader &) { +@@ -138,7 +138,13 @@ void llama_model_dflash::load_arch_tensors(llama_model_loader &) { // optional: norm of the anchor embedding tok_norm = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD_NORM, "weight", 0), { n_embd }, TENSOR_NOT_REQUIRED); @@ -374,7 +374,7 @@ index 461d1e13b..285ed6920 100644 // optional: reduced-vocab drafts ship their own lm head, full-vocab drafts can share the target's via ctx_other // a draft with its own embeddings + head references no target tensors and can run on devices the target does not use (e.g. -devd with a tensor-split target) output = create_tensor(tn(LLM_TENSOR_OUTPUT, "weight"), { n_embd, n_vocab_draft }, TENSOR_NOT_REQUIRED); -@@ -218,6 +224,31 @@ void llama_model_dflash::load_tensors_layers_base() { +@@ -217,6 +223,31 @@ void llama_model_dflash::load_tensors_layers_base() { layer.dflash_attn_k_ctx_norm = create_tensor(tn(LLM_TENSOR_DFLASH_ATTN_K_CTX_NORM, "weight", i), { n_embd_head_k }, 0); } } @@ -406,8 +406,8 @@ index 461d1e13b..285ed6920 100644 } // Laguna drafters RMS-norm each captured target feature before fc: view the -@@ -331,6 +362,175 @@ std::pair llama_model_dflash::get_lm_head(const ll - return { model_other->output, model_other->output_s }; +@@ -330,6 +361,175 @@ ggml_tensor * llama_model_dflash::get_lm_head(const llm_graph_context & g, const + return model_other->output; } +// anchor (token 0) of every block @@ -582,7 +582,7 @@ index 461d1e13b..285ed6920 100644 // DFlash decoder, dual-mode by batch type: // * embd batch -> fused target features: project + inject K/V into the cache. // * token batch -> noise-block diffusion: attend over [committed, MASK...] to generate draft tokens -@@ -515,6 +715,8 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * inp_tok +@@ -517,6 +717,8 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * inp_tok } cb(inpL, "inp_noise_embd", -1); @@ -591,7 +591,7 @@ index 461d1e13b..285ed6920 100644 for (int il = 0; il < n_layer; ++il) { const auto & layer = model.layers[il]; -@@ -628,6 +830,10 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * inp_tok +@@ -630,6 +832,10 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * inp_tok if (layer.out_scale) { cur = ggml_mul(ctx0, cur, layer.out_scale); } @@ -602,7 +602,7 @@ index 461d1e13b..285ed6920 100644 cb(cur, "l_out", il); inpL = cur; -@@ -695,6 +901,12 @@ llama_model_dflash::graph_dflash::graph_dflash(const llm_graph_params & params) +@@ -697,6 +903,12 @@ llama_model_dflash::graph_dflash::graph_dflash(const llm_graph_params & params) ggml_tensor * cur = build_layers(inp_tokens); build_logits(cur); @@ -616,10 +616,10 @@ index 461d1e13b..285ed6920 100644 std::unique_ptr llama_model_dflash::build_arch_graph(const llm_graph_params & params) const { diff --git a/src/models/models.h b/src/models/models.h -index c0a68949c..107c1a612 100644 +index 3ade1536ebe1d2a93177c3cbdc86f2504fae50fc..0dfab747277346622d59de18f99dbfc6dab110bc 100644 --- a/src/models/models.h +++ b/src/models/models.h -@@ -1692,6 +1692,13 @@ struct llama_model_eagle3 : public llama_model_base { +@@ -1697,6 +1697,13 @@ struct llama_model_eagle3 : public llama_model_base { std::unique_ptr build_arch_graph(const llm_graph_params & params) const override; }; @@ -633,7 +633,7 @@ index c0a68949c..107c1a612 100644 struct llama_model_dflash : public llama_model_base { llama_model_dflash(const struct llama_model_params & params) : llama_model_base(params) {} void load_arch_hparams(llama_model_loader & ml) override; -@@ -1752,6 +1759,9 @@ struct llama_model_dflash : public llama_model_base { +@@ -1757,6 +1764,9 @@ struct llama_model_dflash : public llama_model_base { llm_graph_input_attn_kv * inp_attn = nullptr; llm_graph_input_attn_kv_iswa * inp_attn_iswa = nullptr; @@ -643,6 +643,3 @@ index c0a68949c..107c1a612 100644 graph_base(const llm_graph_params & params); ggml_tensor * build_inject(); --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0017-skippy-remove-callback-backed-checkpoint-serving.patch b/llama_cpp/patches/model_support/0017-skippy-remove-callback-backed-checkpoint-serving.patch index 5c6bcd7e..d4764683 100644 --- a/llama_cpp/patches/model_support/0017-skippy-remove-callback-backed-checkpoint-serving.patch +++ b/llama_cpp/patches/model_support/0017-skippy-remove-callback-backed-checkpoint-serving.patch @@ -1,4 +1,4 @@ -From 23f1cc2948e39c9f56cfbd608e2bce427325113a Mon Sep 17 00:00:00 2001 +From f2ccd14fd945ab6f6ca989105114a2eaffdcfb38 Mon Sep 17 00:00:00 2001 From: Skippy Date: Fri, 20 Nov 2026 16:34:51 +1100 Subject: [PATCH] skippy: remove callback-backed checkpoint serving @@ -18,7 +18,7 @@ Subject: [PATCH] skippy: remove callback-backed checkpoint serving delete mode 100644 src/skippy/model_source.cpp diff --git a/include/skippy.h b/include/skippy.h -index 15d9af032..27f96181e 100644 +index 15d9af0320da4f7a647332ba7963c3dae991cccf..27f96181ea737b795d78d12cebd4a0dbaa48f62a 100644 --- a/include/skippy.h +++ b/include/skippy.h @@ -15,7 +15,6 @@ @@ -30,7 +30,7 @@ index 15d9af032..27f96181e 100644 #include "skippy/activation.h" #include "skippy/sampling.h" diff --git a/include/skippy/common.h b/include/skippy/common.h -index 63a16bd85..e06e491d5 100644 +index 63a16bd85b67620114d5a76537140610b1f73ebf..e06e491d546c2d8497d49092cdee347f1d9cbd39 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -53,7 +53,7 @@ index 63a16bd85..e06e491d5 100644 // Feature bit 31 is declared as a `uint64_t` constant, not an `enum diff --git a/include/skippy/model_source.h b/include/skippy/model_source.h deleted file mode 100644 -index 5d77f4804..000000000 +index 5d77f4804b3a34f9ccb7057d82846060c587ef37..0000000000000000000000000000000000000000 --- a/include/skippy/model_source.h +++ /dev/null @@ -1,84 +0,0 @@ @@ -142,7 +142,7 @@ index 5d77f4804..000000000 - -#endif // SKIPPY_MODEL_SOURCE_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index ac5698b88..a4952c269 100644 +index ac5698b88969c4859c2bd5de11c330e209e7f8ed..a4952c269472d2bb0aa430b75f08288039fdd003 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,7 +56,6 @@ add_library(llama @@ -154,7 +154,7 @@ index ac5698b88..a4952c269 100644 skippy/verification.cpp skippy/verify_window.cpp diff --git a/src/llama-model-loader.h b/src/llama-model-loader.h -index b8dc0cfa7..7cd451d85 100644 +index 72d9fc0b2922d20d1b0777c5fb69d3b8d4e3b54d..fc1b0e7a597564d4280a8dc3d7bb268e1fba93b6 100644 --- a/src/llama-model-loader.h +++ b/src/llama-model-loader.h @@ -27,13 +27,6 @@ struct llama_model_loader_stage_selection { @@ -172,7 +172,7 @@ index b8dc0cfa7..7cd451d85 100644 const char * path_model, struct llama_model_params params, diff --git a/src/llama.cpp b/src/llama.cpp -index bad9730ba..8fee4d61b 100644 +index bad9730ba0830c202cce3eb77225131aa8db4812..8fee4d61bdaf2157eec97eb0397cf77de849656d 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -470,21 +470,6 @@ struct llama_model * llama_model_init_from_user( @@ -198,7 +198,7 @@ index bad9730ba..8fee4d61b 100644 const char * path_model, struct llama_model_params params) { diff --git a/src/skippy/abi.cpp b/src/skippy/abi.cpp -index c772a3766..8ac906c9e 100644 +index c772a376619df8ac204f51dd61eb59cc2169fa6d..8ac906c9ed4739bd32d8e6bf0ecce4ad771739cc 100644 --- a/src/skippy/abi.cpp +++ b/src/skippy/abi.cpp @@ -38,7 +38,6 @@ uint64_t skippy_abi_features(void) { @@ -210,7 +210,7 @@ index c772a3766..8ac906c9e 100644 SKIPPY_FEATURE_MODEL_LOAD_EVENTS_V2 | SKIPPY_FEATURE_KV_EVENTS | diff --git a/src/skippy/model_loading.cpp b/src/skippy/model_loading.cpp -index 364ae850e..2cf87e158 100644 +index 364ae850e8455830c3d9b12b5be119239d86b5ea..2cf87e1580ed7957fb517fd3e04dd6a1e82b4093 100644 --- a/src/skippy/model_loading.cpp +++ b/src/skippy/model_loading.cpp @@ -35,12 +35,14 @@ @@ -289,7 +289,7 @@ index 364ae850e..2cf87e158 100644 skippy_set_error(out_error, SKIPPY_STATUS_INVALID_ARGUMENT, message); diff --git a/src/skippy/model_source.cpp b/src/skippy/model_source.cpp deleted file mode 100644 -index 2b91f2b71..000000000 +index 2b91f2b71bb228cec598aab02dc0585c128b8bad..0000000000000000000000000000000000000000 --- a/src/skippy/model_source.cpp +++ /dev/null @@ -1,465 +0,0 @@ @@ -758,6 +758,3 @@ index 2b91f2b71..000000000 - return SKIPPY_STATUS_RUNTIME_ERROR; - } -} --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0018-models-shape-dflash-inkling2-zonos3-builders-for-stage-proof.patch b/llama_cpp/patches/model_support/0018-models-shape-dflash-inkling2-zonos3-builders-for-stage-proof.patch index 38fbeff8..6818d166 100644 --- a/llama_cpp/patches/model_support/0018-models-shape-dflash-inkling2-zonos3-builders-for-stage-proof.patch +++ b/llama_cpp/patches/model_support/0018-models-shape-dflash-inkling2-zonos3-builders-for-stage-proof.patch @@ -1,4 +1,4 @@ -From e1cd0c2cec04f546e72ff221335e249e9b63b197 Mon Sep 17 00:00:00 2001 +From 8a0723fe2e966bd2dc6cc0b0c83ff0a7b85270cc Mon Sep 17 00:00:00 2001 From: Skippy Date: Tue, 24 Nov 2026 12:35:20 +0000 Subject: [PATCH] models: shape dflash inkling2 zonos3 builders for stage @@ -22,21 +22,21 @@ carried a differently named local through its layer loop. No graph changes: the same nodes are built in the same order. --- - src/models/dflash.cpp | 38 +++++++++++++++------------ - src/models/dflash2.cpp | 14 +++++++++- - src/models/dspark.cpp | 50 +++++++++++++++++++++++++++++++----- - src/models/inkling2-loop.cpp | 40 +++++++++++++++++++++-------- - src/models/inkling2.cpp | 20 +++++++-------- - src/models/lilicorr.cpp | 14 ++++++++-- - src/models/models.h | 17 ++++++++---- - src/models/zonos3.cpp | 46 ++++++++++++++++----------------- - 8 files changed, 161 insertions(+), 78 deletions(-) + src/models/dflash.cpp | 50 ++++++++++++++++------------- + src/models/dflash2.cpp | 14 +++++++- + src/models/dspark.cpp | 62 ++++++++++++++++++++++++++++-------- + src/models/inkling2-loop.cpp | 40 ++++++++++++++++------- + src/models/inkling2.cpp | 21 ++++++------ + src/models/lilicorr.cpp | 14 ++++++-- + src/models/models.h | 19 +++++++---- + src/models/zonos3.cpp | 46 +++++++++++++------------- + 8 files changed, 174 insertions(+), 92 deletions(-) diff --git a/src/models/dflash.cpp b/src/models/dflash.cpp -index 285ed6920..583f94eee 100644 +index 4bbe706da6c24271e49b03fcd7d034b551c21dd7..15f1d5f129a61417e01562864d75bc2ceb72890b 100644 --- a/src/models/dflash.cpp +++ b/src/models/dflash.cpp -@@ -338,18 +338,6 @@ ggml_tensor * llama_model_dflash::build_inject_inp(llm_graph_context & g, const +@@ -337,28 +337,16 @@ ggml_tensor * llama_model_dflash::build_inject_inp(llm_graph_context & g, const return g.build_norm(inp_g, model.output_norm_enc, nullptr, LLM_NORM_RMS, -1); } @@ -52,10 +52,24 @@ index 285ed6920..583f94eee 100644 - return model_other->tok_embd; -} - - // lm_head and its scale from the target model (shared via ctx_other) when the draft has none - std::pair llama_model_dflash::get_lm_head(const llm_graph_context & g, const llama_model & model) { +-// lm_head from the target model (shared via ctx_other) when the draft has none +-ggml_tensor * llama_model_dflash::get_lm_head(const llm_graph_context & g, const llama_model & model) { ++// lm_head and its scale from the target model (shared via ctx_other) when the draft has none ++std::pair llama_model_dflash::get_lm_head(const llm_graph_context & g, const llama_model & model) { if (model.output) { -@@ -534,7 +522,11 @@ static void build_dspine_lattice(llm_graph_context & g, const llama_model & mode +- return model.output; ++ return { model.output, model.w_scales.get(model.output) }; + } + GGML_ASSERT(g.cparams.ctx_other != nullptr); + const auto * model_other = llama_get_model(g.cparams.ctx_other); + + GGML_ASSERT(model_other->output != nullptr && "DFlash draft requires the target model's output projection"); +- return model_other->output; ++ return { model_other->output, model_other->w_scales.get(model_other->output) }; + } + + // anchor (token 0) of every block +@@ -533,7 +521,11 @@ static void build_dspine_lattice(llm_graph_context & g, const llama_model & mode // DFlash decoder, dual-mode by batch type: // * embd batch -> fused target features: project + inject K/V into the cache. // * token batch -> noise-block diffusion: attend over [committed, MASK...] to generate draft tokens @@ -68,7 +82,7 @@ index 285ed6920..583f94eee 100644 n_embd_head = hparams.n_embd_head_v(); GGML_ASSERT(n_embd_head == hparams.n_embd_head_k()); -@@ -704,12 +696,12 @@ ggml_tensor * llama_model_dflash::graph_base::build_inp_tokens() { +@@ -703,12 +695,12 @@ ggml_tensor * llama_model_dflash::graph_base::build_inp_tokens() { return inp_tokens; } @@ -81,10 +95,21 @@ index 285ed6920..583f94eee 100644 - : ggml_get_rows(ctx0, get_tok_embd(*this, model), inp_tokens); + ? build_dspark_inp_block(*this, model, tok_embd, inp_tokens) + : ggml_get_rows(ctx0, tok_embd, inp_tokens); - if (hparams.f_embedding_scale != 0.0f) { - inpL = ggml_scale(ctx0, inpL, hparams.f_embedding_scale); + if (model.tok_norm && !model.dspark_mask_embd) { + inpL = build_norm(inpL, model.tok_norm, nullptr, LLM_NORM_RMS, -1); } -@@ -891,14 +883,26 @@ ggml_tensor * llama_model_dflash::graph_base::build_logits(ggml_tensor * cur) { +@@ -850,8 +842,8 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * inp_tok + } + + ggml_tensor * llama_model_dflash::graph_base::build_logits(ggml_tensor * cur) { +- auto * output = get_lm_head(*this, model); +- cur = build_lora_mm(output, cur); ++ const auto [output, output_s] = get_lm_head(*this, model); ++ cur = build_lora_mm(output, cur, output_s); + + // a padded lm head (e.g. shared from the target): drop the rows past the vocabulary + if (!model.d2t && cur->ne[0] > (int64_t) model.vocab.n_tokens()) { +@@ -893,14 +885,26 @@ ggml_tensor * llama_model_dflash::graph_base::build_logits(ggml_tensor * cur) { } llama_model_dflash::graph_dflash::graph_dflash(const llm_graph_params & params) : graph_base(params) { @@ -113,10 +138,10 @@ index 285ed6920..583f94eee 100644 build_logits(cur); diff --git a/src/models/dflash2.cpp b/src/models/dflash2.cpp -index b384d9527..c750acf19 100644 +index c37e962b98ee1b19a5ee159f08edea75e471ec49..9c1d78523350de1acc35ab5abbddce47356df16a 100644 --- a/src/models/dflash2.cpp +++ b/src/models/dflash2.cpp -@@ -209,14 +209,26 @@ static void build_dflash2_selector(llm_graph_context & g, const llama_model & mo +@@ -213,14 +213,26 @@ static void build_dflash2_selector(llm_graph_context & g, const llama_model & mo } llama_model_dflash::graph_dflash2::graph_dflash2(const llm_graph_params & params) : graph_base(params) { @@ -145,10 +170,10 @@ index b384d9527..c750acf19 100644 build_logits(cur); diff --git a/src/models/dspark.cpp b/src/models/dspark.cpp -index 81ededc79..adb3d073e 100644 +index 012d42bf3cee793ad24c0df144d9d57f9d130f3d..f0aab152c6385a5194f8620fb31ba2ad1c36d1b6 100644 --- a/src/models/dspark.cpp +++ b/src/models/dspark.cpp -@@ -191,14 +191,12 @@ void llama_model_dflash::load_tensors_layers_mistral_large4() { +@@ -190,14 +190,12 @@ void llama_model_dflash::load_tensors_layers_mistral_large4() { } // DSpark block [anchor, mask_1, ..., mask_k] per sequence: slot k > 0 uses mask row k - 1, the anchor uses its (normed) token embedding @@ -164,7 +189,7 @@ index 81ededc79..adb3d073e 100644 const int64_t n_blocks = g.ubatch.n_seqs_unq; const int64_t block_drafts = n_blocks > 0 ? n_tokens / n_blocks : 0; -@@ -455,12 +453,24 @@ static void build_dspark_markov_head(llm_graph_context & g, const llama_model & +@@ -454,12 +452,24 @@ static void build_dspark_markov_head(llm_graph_context & g, const llama_model & } llama_model_dflash::graph_dspark::graph_dspark(const llm_graph_params & params) : graph_base(params) { @@ -189,7 +214,7 @@ index 81ededc79..adb3d073e 100644 // the Inkling2 rnn head state arrives as the state embedding of the block tokens ggml_tensor * inp_tokens = nullptr; ggml_tensor * rnn_state = nullptr; -@@ -484,7 +494,7 @@ llama_model_dflash::graph_dspark::graph_dspark(const llm_graph_params & params) +@@ -483,7 +493,7 @@ llama_model_dflash::graph_dspark::graph_dspark(const llm_graph_params & params) inp_attn_iswa->self_attn_mask_swa.block_uniform = true; } @@ -198,7 +223,7 @@ index 81ededc79..adb3d073e 100644 build_logits(cur); -@@ -541,7 +551,15 @@ llama_model_dflash::graph_dsv4::graph_dsv4(const llm_graph_params & params) : +@@ -540,7 +550,15 @@ llama_model_dflash::graph_dsv4::graph_dsv4(const llm_graph_params & params) : return; } @@ -215,7 +240,18 @@ index 81ededc79..adb3d073e 100644 auto inp = std::make_unique(n_embd); -@@ -688,7 +706,15 @@ llama_model_dflash::graph_dsv41::graph_dsv41(const llm_graph_params & params) : +@@ -627,8 +645,8 @@ llama_model_dflash::graph_dsv4::graph_dsv4(const llm_graph_params & params) : + cur = build_norm(cur, model.output_norm, nullptr, LLM_NORM_RMS, -1); + cb(cur, "result_norm", -1); + +- auto * output = get_lm_head(*this, model); +- cur = build_lora_mm(output, cur); ++ const auto [output, output_s] = get_lm_head(*this, model); ++ cur = build_lora_mm(output, cur, output_s); + cb(cur, "result_output", -1); + res->t_logits = cur; + +@@ -687,7 +705,15 @@ llama_model_dflash::graph_dsv41::graph_dsv41(const llm_graph_params & params) : return; } @@ -232,7 +268,18 @@ index 81ededc79..adb3d073e 100644 auto inp = std::make_unique(n_embd); -@@ -907,6 +933,16 @@ llama_model_dflash::graph_mistral_large4::graph_mistral_large4(const llm_graph_p +@@ -832,8 +858,8 @@ llama_model_dflash::graph_dsv41::graph_dsv41(const llm_graph_params & params) : + cur = build_norm(cur, model.output_norm, nullptr, LLM_NORM_RMS, -1); + cb(cur, "result_norm", -1); + +- auto * output = get_lm_head(*this, model); +- cur = build_lora_mm(output, cur); ++ const auto [output, output_s] = get_lm_head(*this, model); ++ cur = build_lora_mm(output, cur, output_s); + cb(cur, "result_output", -1); + res->t_logits = cur; + +@@ -906,6 +932,16 @@ llama_model_dflash::graph_mistral_large4::graph_mistral_large4(const llm_graph_p return; } @@ -249,7 +296,7 @@ index 81ededc79..adb3d073e 100644 auto inp = std::make_unique(n_embd); inp->tokens = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, n_tokens); -@@ -916,7 +952,7 @@ llama_model_dflash::graph_mistral_large4::graph_mistral_large4(const llm_graph_p +@@ -915,7 +951,7 @@ llama_model_dflash::graph_mistral_large4::graph_mistral_large4(const llm_graph_p res->add_input(std::move(inp)); @@ -258,8 +305,19 @@ index 81ededc79..adb3d073e 100644 cb(inpL, "inp_noise_embd", -1); // the whole block shares the mask row of its first query (the anchor) +@@ -993,8 +1029,8 @@ llama_model_dflash::graph_mistral_large4::graph_mistral_large4(const llm_graph_p + cb(cur, "result_norm", -1); + res->t_embd = cur; + +- auto * output = get_lm_head(*this, model); +- ggml_tensor * logits = build_lora_mm(output, cur); ++ const auto [output, output_s] = get_lm_head(*this, model); ++ ggml_tensor * logits = build_lora_mm(output, cur, output_s); + + // softcap does not apply to the markov bias + if (hparams.f_final_logit_softcapping) { diff --git a/src/models/inkling2-loop.cpp b/src/models/inkling2-loop.cpp -index 1b9455b52..5327d4772 100644 +index 6d6732f8dd1723ff039cd7cbf59c32a519322fd9..c12a41820fb43d0c1cf0cac31a9ac7fc9dcb6570 100644 --- a/src/models/inkling2-loop.cpp +++ b/src/models/inkling2-loop.cpp @@ -78,7 +78,15 @@ llama_model_inkling2_loop::graph::graph(const llm_graph_params & params) : llama @@ -321,10 +379,10 @@ index 1b9455b52..5327d4772 100644 + return cur; +} diff --git a/src/models/inkling2.cpp b/src/models/inkling2.cpp -index d5834717b..9960a4fc1 100644 +index 4ccc8469406f568bf8f3596d15c751c7508402d7..5560c182021a9ba1e7beb22112ef9acb7e5b5671 100644 --- a/src/models/inkling2.cpp +++ b/src/models/inkling2.cpp -@@ -264,7 +264,7 @@ ggml_tensor * llama_model_inkling2::graph::control(ggml_tensor * cur, ggml_tenso +@@ -272,27 +272,17 @@ ggml_tensor * llama_model_inkling2::graph::control(ggml_tensor * cur, ggml_tenso return ggml_add(ctx0, ggml_sub(ctx0, cur, ggml_mul(ctx0, forget, cur)), ggml_mul(ctx0, gain, message)); } @@ -333,23 +391,27 @@ index d5834717b..9960a4fc1 100644 inp = build_inp_mem_hybrid_iswa_rel(hparams.n_relative_extent, hparams.n_swa); recr = inp->get_recr(); -@@ -275,15 +275,6 @@ ggml_tensor * llama_model_inkling2::graph::build_inputs() { - tau = ggml_scale_bias(ctx0, ggml_cast(ctx0, inp_pos, GGML_TYPE_F32), 1.0f, 1.0f); - tau = ggml_log(ctx0, ggml_clamp(ctx0, ggml_scale(ctx0, tau, 1.0f/hparams.n_log_scale_floor), 1.0f, INFINITY)); - tau = ggml_reshape_3d(ctx0, ggml_scale_bias(ctx0, tau, hparams.f_log_scale_alpha, 1.0f), 1, 1, n_tokens); -- + ggml_tensor * inp_pos = build_inp_pos(); + inp_out_ids = build_inp_out_ids(); + - ggml_tensor * cur = build_inp_embd(model.tok_embd); - - // important: do not normalize raw embeddings input (i.e. encoded image embeddings) - if (ubatch.token) { - cur = build_norm(cur, model.tok_norm, nullptr, LLM_NORM_RMS, -1); - } +- + // log-scaled positions: 1 + alpha*log(max(1, (pos + 1)/floor)), multiplies q and r of the full-attention layers + tau = ggml_scale_bias(ctx0, ggml_cast(ctx0, inp_pos, GGML_TYPE_F32), 1.0f, 1.0f); + tau = ggml_log(ctx0, ggml_clamp(ctx0, ggml_scale(ctx0, tau, 1.0f/hparams.n_log_scale_floor), 1.0f, INFINITY)); + tau = ggml_reshape_3d(ctx0, ggml_scale_bias(ctx0, tau, hparams.f_log_scale_alpha, 1.0f), 1, 1, n_tokens); +- ggml_build_forward_expand(gf, tau); - - return cur; } ggml_tensor * llama_model_inkling2::graph::build_layer(int il, int ip, ggml_tensor * cur, std::vector & blocks, -@@ -457,7 +448,14 @@ void llama_model_inkling2::graph::build_output(ggml_tensor * cur, const std::vec +@@ -468,7 +458,14 @@ void llama_model_inkling2::graph::build_output(ggml_tensor * cur, const std::vec } llama_model_inkling2::graph::graph(const llm_graph_params & params) : llm_graph_context(params) { @@ -366,10 +428,10 @@ index d5834717b..9960a4fc1 100644 std::vector blocks; for (int il = 0; il < n_layer; ++il) { diff --git a/src/models/lilicorr.cpp b/src/models/lilicorr.cpp -index 0c5527a65..bcffe0044 100644 +index a60780d6a2de86326e04cc182424727cb3a26468..180b080a599056bd68e964d7a392722b9ce9ec77 100644 --- a/src/models/lilicorr.cpp +++ b/src/models/lilicorr.cpp -@@ -249,6 +249,16 @@ llama_model_dflash::graph_lilicorr::graph_lilicorr(const llm_graph_params & para +@@ -243,6 +243,16 @@ llama_model_dflash::graph_lilicorr::graph_lilicorr(const llm_graph_params & para return; } @@ -386,7 +448,7 @@ index 0c5527a65..bcffe0044 100644 // only a full block per sequence has the anchors the scorer needs const bool is_block = ubatch.embd_state && n_tokens == (int64_t) hparams.dflash_block_size * ubatch.n_seqs_unq; -@@ -270,11 +280,11 @@ llama_model_dflash::graph_lilicorr::graph_lilicorr(const llm_graph_params & para +@@ -264,11 +274,11 @@ llama_model_dflash::graph_lilicorr::graph_lilicorr(const llm_graph_params & para inp_tokens = build_inp_tokens(); } @@ -401,7 +463,7 @@ index 0c5527a65..bcffe0044 100644 } } diff --git a/src/models/models.h b/src/models/models.h -index 040d8ce59..ea5fce231 100644 +index 0dfab747277346622d59de18f99dbfc6dab110bc..ea5fce2317336b1b6be91b94fd13f2e93e0006ac 100644 --- a/src/models/models.h +++ b/src/models/models.h @@ -1767,13 +1767,16 @@ struct llama_model_dflash : public llama_model_base { @@ -427,7 +489,8 @@ index 040d8ce59..ea5fce231 100644 // graph helpers shared by the backbones static ggml_tensor * build_inject_inp(llm_graph_context & g, const llama_model & model); - static ggml_tensor * get_tok_embd(const llm_graph_context & g, const llama_model & model); - static std::pair get_lm_head(const llm_graph_context & g, const llama_model & model); +- static ggml_tensor * get_lm_head(const llm_graph_context & g, const llama_model & model); ++ static std::pair get_lm_head(const llm_graph_context & g, const llama_model & model); // DFlash2 local conv, run by the base layers of DFlash2 and LiliCorr drafts static ggml_tensor * build_dflash2_conv(llm_graph_context & g, ggml_tensor * hidden, ggml_tensor * dynamic, ggml_tensor * base, int side); @@ -462,7 +525,7 @@ index 040d8ce59..ea5fce231 100644 std::unique_ptr build_arch_graph(const llm_graph_params & params) const override; diff --git a/src/models/zonos3.cpp b/src/models/zonos3.cpp -index c5f62fe29..6877e1725 100644 +index dd0a88f321c1f08280fc7e6c77b006ed3e007b93..4cc0f19ccb704156e199c34d33c2e34d047cf2ed 100644 --- a/src/models/zonos3.cpp +++ b/src/models/zonos3.cpp @@ -105,8 +105,6 @@ llama_model_zonos3::graph::graph(const llm_graph_params & params) : @@ -528,15 +591,12 @@ index c5f62fe29..6877e1725 100644 + cb(inpL, "result_norm", -1); + res->t_embd = inpL; -- cur = build_lora_mm(model.output, cur, model.output_s); +- cur = build_lora_mm(model.output, cur); - cb(cur, "result_output", -1); - res->t_logits = cur; -+ inpL = build_lora_mm(model.output, inpL, model.output_s); ++ inpL = build_lora_mm(model.output, inpL); + cb(inpL, "result_output", -1); + res->t_logits = inpL; } void llama_model_zonos3::graph::attn_res_push(ggml_tensor * cur) { --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0019-gemma4-register-shared-kv-pruning-inputs.patch b/llama_cpp/patches/model_support/0019-gemma4-register-shared-kv-pruning-inputs.patch index e39df672..b2965e58 100644 --- a/llama_cpp/patches/model_support/0019-gemma4-register-shared-kv-pruning-inputs.patch +++ b/llama_cpp/patches/model_support/0019-gemma4-register-shared-kv-pruning-inputs.patch @@ -1,4 +1,4 @@ -From 248c32feafadda2df6cb72629181b10e8c4e699a Mon Sep 17 00:00:00 2001 +From 69236abc5860ec8f08fedbc82902c5e8bf8c71c0 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:34:04 +1100 Subject: [PATCH] gemma4: register request inputs for shared KV pruning @@ -8,7 +8,7 @@ Subject: [PATCH] gemma4: register request inputs for shared KV pruning 1 file changed, 5 insertions(+) diff --git a/src/models/gemma4.cpp b/src/models/gemma4.cpp -index 0e1e68087..d8bf44a12 100644 +index 3f0e604cd71631c17f9b23cf126f2c02d5bf0afd..26ac9201a4cb88998b66f6aad01859e931ae1c1d 100644 --- a/src/models/gemma4.cpp +++ b/src/models/gemma4.cpp @@ -258,6 +258,11 @@ llama_model_gemma4::graph::graph(const llm_graph_params & params) : @@ -23,6 +23,3 @@ index 0e1e68087..d8bf44a12 100644 inp_prune_ids = prune_input->inp_prune_ids; inp_prune_keep = prune_input->inp_prune_keep; --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0020-minimax-m3-load-indexer-tensors-by-attention-role.patch b/llama_cpp/patches/model_support/0020-minimax-m3-load-indexer-tensors-by-attention-role.patch index adc14dcd..04a08eb3 100644 --- a/llama_cpp/patches/model_support/0020-minimax-m3-load-indexer-tensors-by-attention-role.patch +++ b/llama_cpp/patches/model_support/0020-minimax-m3-load-indexer-tensors-by-attention-role.patch @@ -1,4 +1,4 @@ -From bec53d97df709f183fb1b72bdc91d30961421988 Mon Sep 17 00:00:00 2001 +From 7b677287f536041f8a853093cbe5080e53e1bb98 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] minimax-m3: load indexer tensors by attention role @@ -8,7 +8,7 @@ Subject: [PATCH] minimax-m3: load indexer tensors by attention role 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/models/minimax-m3.cpp b/src/models/minimax-m3.cpp -index 313c8301d..eca20f30a 100644 +index af245931e4462bb80fc8afc643c632bfc0f7a950..94abd8ba63576884dc6cc3a294f77132247de491 100644 --- a/src/models/minimax-m3.cpp +++ b/src/models/minimax-m3.cpp @@ -98,14 +98,13 @@ void llama_model_minimax_m3::load_arch_tensors(llama_model_loader &) { @@ -33,6 +33,3 @@ index 313c8301d..eca20f30a 100644 } } } --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0021-inkling-preserve-media-aware-template-routing.patch b/llama_cpp/patches/model_support/0021-inkling-preserve-media-aware-template-routing.patch index 395e3095..099bd6ce 100644 --- a/llama_cpp/patches/model_support/0021-inkling-preserve-media-aware-template-routing.patch +++ b/llama_cpp/patches/model_support/0021-inkling-preserve-media-aware-template-routing.patch @@ -1,4 +1,4 @@ -From 779ee4e02788db743f4b2d180e5ba54cf6b558ee Mon Sep 17 00:00:00 2001 +From bc853f5475f4f5ca0ad7acbf3cc368ae08b44fbf Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] inkling: preserve media-aware template routing @@ -9,10 +9,10 @@ Subject: [PATCH] inkling: preserve media-aware template routing 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/chat.cpp b/common/chat.cpp -index e1e7249f5..7b6dbeb75 100644 +index e888a807f2d188390f1dec61440ee03b623d979e..10147d61d7dbc7374d8a099eb27762b1e22c1072 100644 --- a/common/chat.cpp +++ b/common/chat.cpp -@@ -1475,10 +1475,12 @@ static common_chat_params_init_fn common_chat_template_detect_params_init(const +@@ -1488,10 +1488,12 @@ static common_chat_params_init_fn common_chat_template_detect_params_init(const return common_chat_params_init_cohere2moe; } @@ -28,7 +28,7 @@ index e1e7249f5..7b6dbeb75 100644 return common_chat_params_init_inkling; } diff --git a/common/parsers/inkling.cpp b/common/parsers/inkling.cpp -index 8009b793c..19a2438e4 100644 +index 8009b793c70d1ec3716d1a62ef8e1800397f79db..19a2438e49291cc271743cb8abc6c627f7479761 100644 --- a/common/parsers/inkling.cpp +++ b/common/parsers/inkling.cpp @@ -181,6 +181,7 @@ common_chat_params common_chat_params_init_inkling(const common_chat_template & @@ -39,6 +39,3 @@ index 8009b793c..19a2438e4 100644 data.format = COMMON_CHAT_FORMAT_PEG_NATIVE; data.supports_thinking = true; data.thinking_start_tag = THINK; --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0022-dspine-populate-the-graph-owned-lattice-stash.patch b/llama_cpp/patches/model_support/0022-dspine-populate-the-graph-owned-lattice-stash.patch index 2de544ee..d71a65a8 100644 --- a/llama_cpp/patches/model_support/0022-dspine-populate-the-graph-owned-lattice-stash.patch +++ b/llama_cpp/patches/model_support/0022-dspine-populate-the-graph-owned-lattice-stash.patch @@ -1,4 +1,4 @@ -From cfde64498b78539e8d42b2172c5289fa08e81d4e Mon Sep 17 00:00:00 2001 +From 141436f2f5a63d09a9bbdc6dcf6b88302c2f0d7e Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] dspine: populate the graph-owned lattice stash @@ -8,10 +8,10 @@ Subject: [PATCH] dspine: populate the graph-owned lattice stash 1 file changed, 2 deletions(-) diff --git a/src/models/dflash.cpp b/src/models/dflash.cpp -index 797a306b5..6a493a353 100644 +index 15f1d5f129a61417e01562864d75bc2ceb72890b..360a6269d8739b69e2f8c44734814be8154d8eb2 100644 --- a/src/models/dflash.cpp +++ b/src/models/dflash.cpp -@@ -707,8 +707,6 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * tok_emb +@@ -709,8 +709,6 @@ ggml_tensor * llama_model_dflash::graph_base::build_layers(ggml_tensor * tok_emb } cb(inpL, "inp_noise_embd", -1); @@ -20,6 +20,3 @@ index 797a306b5..6a493a353 100644 for (int il = 0; il < n_layer; ++il) { const auto & layer = model.layers[il]; --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0023-muse-glimmer-retain-token-aware-turn-boundaries.patch b/llama_cpp/patches/model_support/0023-muse-glimmer-retain-token-aware-turn-boundaries.patch index 0ae0ac49..73b48dbd 100644 --- a/llama_cpp/patches/model_support/0023-muse-glimmer-retain-token-aware-turn-boundaries.patch +++ b/llama_cpp/patches/model_support/0023-muse-glimmer-retain-token-aware-turn-boundaries.patch @@ -1,4 +1,4 @@ -From 2db82ad2f04d00bdcdd85740a83562e6f177d1e7 Mon Sep 17 00:00:00 2001 +From 6305583004c3406063961e2d123a0e15f2b16d54 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 08:04:02 +1100 Subject: [PATCH] muse-glimmer: retain token-aware continuation and turn @@ -9,7 +9,7 @@ Subject: [PATCH] muse-glimmer: retain token-aware continuation and turn 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/parsers/muse-glimmer.cpp b/common/parsers/muse-glimmer.cpp -index f31845702..85e67fad9 100644 +index f31845702cbdf91c5d30568ec6c994c967c0b255..85e67fad98f7bf90420a3e1710a3bcfa2f2a4ec2 100644 --- a/common/parsers/muse-glimmer.cpp +++ b/common/parsers/muse-glimmer.cpp @@ -17,7 +17,7 @@ common_chat_params common_chat_params_init_muse_glimmer(const common_chat_templa @@ -48,6 +48,3 @@ index f31845702..85e67fad9 100644 if (has_response_format) { auto response_json = p.content(p.schema(p.json(), "response-format-schema", inputs.json_schema)); --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0024-models-preserve-checkpoint-layouts-and-head-scales.patch b/llama_cpp/patches/model_support/0024-models-preserve-checkpoint-layouts-and-head-scales.patch index 7c2f7326..5951f9c2 100644 --- a/llama_cpp/patches/model_support/0024-models-preserve-checkpoint-layouts-and-head-scales.patch +++ b/llama_cpp/patches/model_support/0024-models-preserve-checkpoint-layouts-and-head-scales.patch @@ -1,4 +1,4 @@ -From 3367ee913365bf8ac6989328e27b40d58d0b761f Mon Sep 17 00:00:00 2001 +From 9a3e0f3de999f6048f41fdc3fb2bfeaef6a5f985 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 11:11:17 +1100 Subject: [PATCH] models: preserve checkpoint layouts and head scales @@ -7,11 +7,10 @@ Subject: [PATCH] models: preserve checkpoint layouts and head scales src/models/granite-swa.cpp | 8 +++++--- src/models/granite-switch.cpp | 18 ++++++++++++------ src/models/minimax-m3.cpp | 2 +- - src/models/nemotron-h-moe.cpp | 2 +- - 4 files changed, 19 insertions(+), 11 deletions(-) + 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/models/granite-swa.cpp b/src/models/granite-swa.cpp -index fcbeb5a70..21a7ad401 100644 +index 0246e11365d7ee2adfb64768651b823c259fca73..cafc5957f6f9adef71cdb4e70245a39e987be4d2 100644 --- a/src/models/granite-swa.cpp +++ b/src/models/granite-swa.cpp @@ -107,9 +107,11 @@ void llama_model_granite_swa::load_arch_tensors(llama_model_loader & ml) { @@ -30,7 +29,7 @@ index fcbeb5a70..21a7ad401 100644 layer.ffn_down_shexp = create_tensor(tn(LLM_TENSOR_FFN_DOWN_SHEXP, "weight", i), {hparams.n_ff_shexp, n_embd}, 0); } else { diff --git a/src/models/granite-switch.cpp b/src/models/granite-switch.cpp -index a84743b7e..8cf7fef89 100644 +index cb9a2eaacbfe98fa612a51ef1f62631c7f6a01a0..ee47217101beaf14aa9a2e73b3c76d392887e7bb 100644 --- a/src/models/granite-switch.cpp +++ b/src/models/granite-switch.cpp @@ -122,12 +122,18 @@ void llama_model_granite_switch::load_arch_tensors(llama_model_loader &) { @@ -59,7 +58,7 @@ index a84743b7e..8cf7fef89 100644 sl.a_o = create_tensor(tn(LLM_TENSOR_ATTN_OUT, "lora_a", i), {n_embd_q, n_rank, n_slots}, 0); sl.b_o = create_tensor(tn(LLM_TENSOR_ATTN_OUT, "lora_b", i), {n_rank, n_embd, n_slots}, 0); diff --git a/src/models/minimax-m3.cpp b/src/models/minimax-m3.cpp -index eca20f30a..6e4831209 100644 +index 94abd8ba63576884dc6cc3a294f77132247de491..18bdd1cc5fc5db39687a49bad7b70689ba28e41e 100644 --- a/src/models/minimax-m3.cpp +++ b/src/models/minimax-m3.cpp @@ -39,7 +39,7 @@ void llama_model_minimax_m3::load_arch_hparams(llama_model_loader & ml) { @@ -71,19 +70,3 @@ index eca20f30a..6e4831209 100644 if (!indexer_present) { hparams.indexer_n_head = 0; hparams.indexer_head_size = 0; -diff --git a/src/models/nemotron-h-moe.cpp b/src/models/nemotron-h-moe.cpp -index 684aeed66..a5885cca6 100644 ---- a/src/models/nemotron-h-moe.cpp -+++ b/src/models/nemotron-h-moe.cpp -@@ -155,7 +155,7 @@ llama_model_nemotron_h_moe::graph_mtp::graph_mtp(const llm_graph_params & params - : (model.output ? model.output - : (trunk ? trunk->output : nullptr)); - ggml_tensor * head_s = layer.nextn.shared_head_head ? layer.nextn.shared_head_head_s -- : (model.output_s ? model.output_s -+ : (model.output ? model.output_s - : (trunk ? trunk->output_s : nullptr)); - GGML_ASSERT(head_w != nullptr && "NEMOTRON_H_MOE MTP requires an output projection (own or shared trunk)"); - cur = build_lora_mm(head_w, cur, head_s); --- -2.56.1 - diff --git a/llama_cpp/patches/model_support/0025-abi-distinguish-b12780-upstream-c-layouts.patch b/llama_cpp/patches/model_support/0025-abi-distinguish-b12780-upstream-c-layouts.patch index 5aaadefc..4f15148d 100644 --- a/llama_cpp/patches/model_support/0025-abi-distinguish-b12780-upstream-c-layouts.patch +++ b/llama_cpp/patches/model_support/0025-abi-distinguish-b12780-upstream-c-layouts.patch @@ -1,4 +1,4 @@ -From cc6c860292ebae40a212b27dc386cfa396ef2c72 Mon Sep 17 00:00:00 2001 +From 7c5b38c9d0dafef5037bd6b6380c1ca544648e98 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Sat, 28 Nov 2026 12:09:27 +1100 Subject: [PATCH] abi: distinguish b12780 upstream C layouts @@ -8,7 +8,7 @@ Subject: [PATCH] abi: distinguish b12780 upstream C layouts 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/skippy/common.h b/include/skippy/common.h -index e06e491d5..ee9bb3f1f 100644 +index e06e491d546c2d8497d49092cdee347f1d9cbd39..ee9bb3f1f928885d3256ebcb2a6fe4b46fdbb386 100644 --- a/include/skippy/common.h +++ b/include/skippy/common.h @@ -46,7 +46,7 @@ extern "C" { @@ -20,6 +20,3 @@ index e06e491d5..ee9bb3f1f 100644 #if defined(_MSC_VER) #define SKIPPY_DEPRECATED(message) __declspec(deprecated(message)) --- -2.56.0 - diff --git a/llama_cpp/upstream.txt b/llama_cpp/upstream.txt index 770f6943..3bc11288 100644 --- a/llama_cpp/upstream.txt +++ b/llama_cpp/upstream.txt @@ -1 +1 @@ -09c1410642fa0395ca234571980093bc5c7f2ef5 +918fe468dbaae80bcdaf975c1b368023f2578ead From 045d7d746d25c5a4e9de2cec4d87f6f8ee3e7142 Mon Sep 17 00:00:00 2001 From: James Dumay Date: Mon, 30 Nov 2026 10:35:42 +1100 Subject: [PATCH 2/2] fix: preserve LoRA and expert scaling in b12843 graphs --- crates/skippy-api/src/native-recipe.json | 2 +- ...e-lora-and-scaled-expert-projections.patch | 356 ++++++++++++++++++ .../generated/0006-family-bailingmoe3.patch | 2 +- llama_cpp/patches/generated/series.json | 4 +- ...01-models-add-inkling-family-support.patch | 8 +- ...-residual-checkpoint-activation-port.patch | 2 +- ...03-llama-port-diffusiongemma-support.patch | 2 +- ...-add-diffusiongemma-system-one-reads.patch | 4 +- ...skippy-query-diffusion-canvas-length.patch | 2 +- ...dels-add-laya-decision-model-support.patch | 4 +- ...-parse-implicit-reasoning-continuati.patch | 2 +- ...0008-models-add-qwen3-moe-native-mtp.patch | 4 +- ...kippy-add-whisper-speech-recognition.patch | 4 +- ...rd-per-token-logprobs-while-sampling.patch | 4 +- ...pose-glm5-next-stage-graph-semantics.patch | 6 +- ...skippy-add-clef-joint-decision-reads.patch | 4 +- ...expose-metis16-delegated-pass-layers.patch | 2 +- ...-skippy-cover-head-input-publication.patch | 8 +- ...0015-models-add-laguna-dflash-drafts.patch | 2 +- ...spine-block-parallel-drafter-support.patch | 2 +- ...e-callback-backed-checkpoint-serving.patch | 4 +- ...ing2-zonos3-builders-for-stage-proof.patch | 2 +- ...a4-register-shared-kv-pruning-inputs.patch | 2 +- ...ad-indexer-tensors-by-attention-role.patch | 2 +- ...reserve-media-aware-template-routing.patch | 2 +- ...pulate-the-graph-owned-lattice-stash.patch | 2 +- ...r-retain-token-aware-turn-boundaries.patch | 2 +- ...e-checkpoint-layouts-and-head-scales.patch | 2 +- ...istinguish-b12780-upstream-c-layouts.patch | 2 +- 29 files changed, 400 insertions(+), 44 deletions(-) create mode 100644 llama_cpp/patches/0063-graph-preserve-lora-and-scaled-expert-projections.patch diff --git a/crates/skippy-api/src/native-recipe.json b/crates/skippy-api/src/native-recipe.json index e09b80a6..2a8af891 100644 --- a/crates/skippy-api/src/native-recipe.json +++ b/crates/skippy-api/src/native-recipe.json @@ -1,4 +1,4 @@ { "llama_upstream_sha": "918fe468dbaae80bcdaf975c1b368023f2578ead", - "patch_queue_sha256": "ef915b25ba3f425f9f6c04ce5eab253c5d94fecb9c16153d80d6ee2b08f9eb82" + "patch_queue_sha256": "eca168e13f2535d5c7f0efd20a837e96ac9741a61aa6b77f4a6380ffd9807986" } \ No newline at end of file diff --git a/llama_cpp/patches/0063-graph-preserve-lora-and-scaled-expert-projections.patch b/llama_cpp/patches/0063-graph-preserve-lora-and-scaled-expert-projections.patch new file mode 100644 index 00000000..c04dd63f --- /dev/null +++ b/llama_cpp/patches/0063-graph-preserve-lora-and-scaled-expert-projections.patch @@ -0,0 +1,356 @@ +From 19b9e086a5ba804892a5611206c327ebe2f30622 Mon Sep 17 00:00:00 2001 +From: Skippy CI +Date: Mon, 30 Nov 2026 10:05:49 +1100 +Subject: [PATCH] skippy: preserve LoRA and expert-scale layouts across b12843 + graphs + +--- + src/CMakeLists.txt | 3 + + src/llama-graph.cpp | 46 ++++-- + src/models/bailingmoe3.cpp | 4 +- + src/skippy/tests/expert_scales.cpp | 219 +++++++++++++++++++++++++++++ + 4 files changed, 257 insertions(+), 15 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 1985b193a40d2ab166dd58cf983c70a7ded75fe8..3ef703016283a8a3d0806019c4e9584a590ec380 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -390,6 +390,9 @@ if (LLAMA_STAGE_BUILD_TESTS) + target_link_libraries(skippy-expert-scales PRIVATE llama) + add_test(NAME skippy_expert_scales COMMAND skippy-expert-scales) + add_test(NAME skippy_moe_scale_routing COMMAND skippy-expert-scales --routing) ++ add_test(NAME skippy_expert_channel_scales COMMAND skippy-expert-scales --channel-layouts) ++ add_test(NAME skippy_expert_nvfp4_graph COMMAND skippy-expert-scales --nvfp4) ++ add_test(NAME skippy_lora_contiguous_projection COMMAND skippy-expert-scales --lora-layout) + + add_executable(skippy-graph-build-inputs + skippy/tests/graph_build_inputs.cpp) +diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp +index 4bb2489eb84cfddc7f78bba201fee272f31a3b74..49229263a58c6fe971a451e4fca257a3fa77ebd4 100644 +--- a/src/llama-graph.cpp ++++ b/src/llama-graph.cpp +@@ -2483,31 +2483,51 @@ ggml_tensor * llm_graph_context::build_lora_mm_id( + ggml_tensor * w_s, + ggml_tensor * slots, + bool cached) const { ++ ggml_tensor * registered_scale = get_weight_scale(w); ++ const bool override_scale = w_s && w_s != registered_scale; + if (!w_s) { +- w_s = model.w_scales.get(w); ++ w_s = registered_scale; + } + + // as in build_lora_mm: the folded weight reads the transformed input, the LoRA delta reads `cur` + ggml_tensor * cur_mm = build_hadamard_input(w, cur); + // the experts in the MoE cache are selected by their slots +- ggml_tensor * res = slots == nullptr ? +- ggml_mul_mat_id(ctx0, w, cur_mm, ids) : +- ggml_mul_mat_id(ctx0, cached ? moe_cache->get_experts(w) : w, cur_mm, slots); ++ const bool intrinsic_scale = ggml_needs_scale(w->type); ++ ggml_tensor * res; ++ if (intrinsic_scale) { ++ // Cache scale banks follow cache slots. A caller-owned override is not ++ // represented by those banks: use its original experts and IDs instead. ++ const bool use_cache = slots && cached && !override_scale; ++ ggml_tensor * product_ids = slots && (!cached || use_cache) ? slots : ids; ++ ggml_tensor * input_scale = get_input_scale(w); ++ res = ggml_mul_mat_id_ext(ctx0, use_cache ? moe_cache->get_experts(w) : w, cur_mm, product_ids, ++ use_cache ? moe_cache->get_scales(w, LLAMA_MOE_CACHE_SCALE_WEIGHT) : w_s, ++ use_cache && input_scale ? moe_cache->get_scales(w, LLAMA_MOE_CACHE_SCALE_INPUT) : input_scale); ++ } else { ++ res = slots == nullptr ? ggml_mul_mat_id(ctx0, w, cur_mm, ids) : ++ ggml_mul_mat_id(ctx0, cached ? moe_cache->get_experts(w) : w, cur_mm, slots); ++ } + + if (w->type == GGML_TYPE_NVFP4) { + ggml_prec_set_acc(res, GGML_PREC_BF16); + } + + // after the NVFP4 default, so that the policy can request a higher precision +- prec_policy.apply(res); +- +- if (w_s) { +- const int64_t n_expert = w_s->ne[0]; +- const int64_t n_tokens = cur->ne[2]; +- ggml_tensor * s = ggml_reshape_3d(ctx0, w_s, 1, n_expert, 1); +- s = ggml_repeat_4d(ctx0, s, 1, n_expert, n_tokens, 1); +- s = ggml_get_rows(ctx0, s, ids); +- res = ggml_mul(ctx0, res, s); ++ prec_policy.apply(res, w); ++ ++ if (w_s && !intrinsic_scale) { ++ ggml_tensor * selected_scale = w_s; ++ if (!ggml_is_scalar(w_s)) { ++ const bool per_expert = ggml_is_vector(w_s) && w_s->ne[0] == w->ne[2]; ++ GGML_ASSERT(w_s->ne[2] == 1 && w_s->ne[3] == 1); ++ GGML_ASSERT(per_expert ? w_s->ne[0] == w->ne[2] : ++ w_s->ne[0] == w->ne[1] && w_s->ne[1] == w->ne[2]); ++ const int64_t channels = per_expert ? 1 : w_s->ne[0]; ++ selected_scale = ggml_reshape_3d(ctx0, w_s, channels, w->ne[2], 1); ++ selected_scale = ggml_repeat_4d(ctx0, selected_scale, channels, w->ne[2], cur->ne[2], 1); ++ selected_scale = ggml_get_rows(ctx0, selected_scale, ids); ++ } ++ res = ggml_mul(ctx0, res, selected_scale); + } + for (const auto & lora : *loras) { + llama_adapter_lora_weight * lw = lora.first->get_weight(w); +diff --git a/src/models/bailingmoe3.cpp b/src/models/bailingmoe3.cpp +index 06295e71b6fad4e07c6599e1205a3dedbcc4004a..e1c9c3c146e9332652e82e2310a4b08c7f9b9121 100644 +--- a/src/models/bailingmoe3.cpp ++++ b/src/models/bailingmoe3.cpp +@@ -324,7 +324,7 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : + cur = ggml_reshape_3d(ctx0, cur, v_head_dim, n_head, n_tokens); + cur = ggml_mul(ctx0, cur, attn_gate); + cur = ggml_cont_2d(ctx0, cur, v_head_dim * n_head, n_tokens); +- cur = ggml_mul_mat(ctx0, layer.wo, cur); ++ cur = build_lora_mm(layer.wo, cur); + cb(cur, "mla_out", il); + } + +@@ -478,7 +478,7 @@ llama_model_bailingmoe3::graph_mtp::graph_mtp(const llm_graph_params & params) : + cur = ggml_reshape_3d(ctx0, cur, v_head_dim, n_head, n_tokens); + cur = ggml_mul(ctx0, cur, attn_gate); + cur = ggml_cont_2d(ctx0, cur, v_head_dim * n_head, n_tokens); +- cur = ggml_mul_mat(ctx0, layer.wo, cur); ++ cur = build_lora_mm(layer.wo, cur); + + ggml_tensor * ffn_inp = ggml_add(ctx0, cur, inpSA); + cur = build_norm(ffn_inp, layer.ffn_norm, nullptr, LLM_NORM_RMS, il); +diff --git a/src/skippy/tests/expert_scales.cpp b/src/skippy/tests/expert_scales.cpp +index c268725c802f8940a755c4036b041cc763db96cf..71d2f11748b6e1cdb51315f1950c95c861fb5553 100644 +--- a/src/skippy/tests/expert_scales.cpp ++++ b/src/skippy/tests/expert_scales.cpp +@@ -10,6 +10,8 @@ + #include + #include + #include ++#include ++#include + + static bool check_expert_scales(bool use_slots) { + std::unique_ptr model(llama_model_create(LLM_ARCH_LLAMA, llama_model_default_params())); +@@ -175,7 +177,224 @@ static bool check_moe_routing(bool explicit_scales, bool random_routing) { + return true; + } + ++static bool check_channel_scales(bool scalar, bool use_slots, bool single_expert) { ++ std::unique_ptr model(llama_model_create(LLM_ARCH_LLAMA, llama_model_default_params())); ++ model->hparams.n_layer_all = 1; ++ model->hparams.n_embd = 2; ++ model->hparams.n_head_arr[0] = 1; ++ model->hparams.n_head_kv_arr[0] = 1; ++ const int64_t experts = single_expert ? 1 : 3; ++ model->hparams.n_expert = experts; ++ model->hparams.n_expert_used_arr[0] = 1; ++ llm_graph_result result(256); ++ llama_adapter_loras loras; ++ llm_graph_params params{}; ++ params.model = model.get(); ++ params.res = &result; ++ params.loras = &loras; ++ params.ubatch.n_tokens = 2; ++ params.w_scales = &model->w_scales; ++ llm_graph_context graph(params); ++ auto * ctx = result.get_ctx(); ++ auto * weight = ggml_new_tensor_3d(ctx, GGML_TYPE_F32, 2, 2, experts); ++ auto * input = ggml_new_tensor_3d(ctx, GGML_TYPE_F32, 2, 1, 2); ++ auto * ids = ggml_new_tensor_2d(ctx, GGML_TYPE_I32, 1, 2); ++ auto * slots = use_slots ? ggml_new_tensor_2d(ctx, GGML_TYPE_I32, 1, 2) : nullptr; ++ auto * registered = scalar ? ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 1) : ++ ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 2, experts); ++ auto * explicit_scale = scalar ? ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 1) : ++ ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 2, experts); ++ model->w_scales.scale.emplace(weight, registered); ++ auto * fallback = graph.build_lora_mm_id(weight, input, ids, nullptr, slots, false); ++ auto * overridden = graph.build_lora_mm_id(weight, input, ids, explicit_scale, slots, false); ++ for (auto * output : {fallback, overridden}) ggml_build_forward_expand(result.get_gf(), output); ++ std::unique_ptr backend(ggml_backend_cpu_init(), ggml_backend_free); ++ if (!backend) return false; ++ ggml_backend_cpu_set_n_threads(backend.get(), 1); ++ std::unique_ptr buffer( ++ ggml_backend_alloc_ctx_tensors(ctx, backend.get()), ggml_backend_buffer_free); ++ if (!buffer) return false; ++ const std::array weights = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; ++ const std::array inputs = {1, 2, 3, 4}; ++ const std::array selected = {single_expert ? 0 : 2, 0}; ++ const std::array slot_indices = {0, single_expert ? 0 : 2}; ++ const std::array scales = {2, 17, 3, 19, 5, 23}; ++ const std::array overrides = {7, 29, 11, 31, 13, 37}; ++ ggml_backend_tensor_set(weight, weights.data(), 0, ggml_nbytes(weight)); ++ ggml_backend_tensor_set(input, inputs.data(), 0, sizeof(inputs)); ++ ggml_backend_tensor_set(ids, selected.data(), 0, sizeof(selected)); ++ if (slots) ggml_backend_tensor_set(slots, slot_indices.data(), 0, sizeof(slot_indices)); ++ ggml_backend_tensor_set(registered, scales.data(), 0, ggml_nbytes(registered)); ++ ggml_backend_tensor_set(explicit_scale, overrides.data(), 0, ggml_nbytes(explicit_scale)); ++ if (ggml_backend_graph_compute(backend.get(), result.get_gf()) != GGML_STATUS_SUCCESS) return false; ++ const std::array raw = single_expert ? std::array{5, 11, 11, 25} : use_slots ? std::array{5, 11, 67, 81} : ++ std::array{29, 35, 11, 25}; ++ const std::array outputs = {fallback, overridden}; ++ for (size_t mode = 0; mode < outputs.size(); ++mode) { ++ std::array actual{}; ++ ggml_backend_tensor_get(outputs[mode], actual.data(), 0, sizeof(actual)); ++ for (size_t i = 0; i < actual.size(); ++i) { ++ const size_t scale_index = scalar ? 0 : 2 * selected[i / 2] + i % 2; ++ const float expected = raw[i] * (mode == 0 ? scales[scale_index] : overrides[scale_index]); ++ if (!std::isfinite(actual[i]) || std::fabs(actual[i] - expected) > 1e-5f) { ++ std::fprintf(stderr, "channel scale scalar=%d slots=%d override=%zu value=%zu: got %g, expected %g\n", ++ scalar, use_slots, mode, i, actual[i], expected); ++ return false; ++ } ++ } ++ } ++ return true; ++} ++ ++static bool check_nvfp4_graph(bool use_slots, bool explicit_scale, bool cached = false) { ++ std::unique_ptr model(llama_model_create(LLM_ARCH_LLAMA, llama_model_default_params())); ++ model->hparams.n_layer_all = 1; ++ model->hparams.n_embd = 64; ++ model->hparams.n_head_arr[0] = 1; ++ model->hparams.n_head_kv_arr[0] = 1; ++ llm_graph_result result(128); ++ llama_adapter_loras loras; ++ llm_graph_params params{}; ++ params.model = model.get(); ++ params.res = &result; ++ params.loras = &loras; ++ params.ubatch.n_tokens = 2; ++ params.w_scales = &model->w_scales; ++ llm_graph_context graph(params); ++ auto * ctx = result.get_ctx(); ++ auto * weight = ggml_new_tensor_3d(ctx, GGML_TYPE_NVFP4, 64, 2, 3); ++ auto * input = ggml_new_tensor_3d(ctx, GGML_TYPE_F32, 64, 1, 2); ++ auto * ids = ggml_new_tensor_2d(ctx, GGML_TYPE_I32, 1, 2); ++ auto * slots = use_slots ? ggml_new_tensor_2d(ctx, GGML_TYPE_I32, 1, 2) : nullptr; ++ auto * registered = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 2, 3); ++ auto * override = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 2, 3); ++ auto * input_scale = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 3); ++ model->w_scales.scale.emplace(weight, registered); ++ model->w_scales.input_scale.emplace(weight, input_scale); ++ auto * output = graph.build_lora_mm_id(weight, input, ids, explicit_scale ? override : nullptr, slots, cached); ++ // Both scales belong to the primitive; an additional post-multiply would apply the weight scale twice. ++ if (output->op != GGML_OP_MUL_MAT_ID || output->src[0] != weight || ++ output->src[2] != (slots && !cached ? slots : ids) || ++ output->src[3] != (explicit_scale ? override : registered) || ++ output->src[4] != input_scale) return false; ++ ggml_build_forward_expand(result.get_gf(), output); ++ std::unique_ptr backend(ggml_backend_cpu_init(), ggml_backend_free); ++ if (!backend || !ggml_backend_supports_op(backend.get(), output)) return false; ++ ggml_backend_cpu_set_n_threads(backend.get(), 1); ++ std::unique_ptr buffer( ++ ggml_backend_alloc_ctx_tensors(ctx, backend.get()), ggml_backend_buffer_free); ++ if (!buffer) return false; ++ std::array original{}; ++ original.fill(1.0f); ++ std::vector packed(ggml_nbytes(weight)); ++ if (ggml_quantize_chunk(GGML_TYPE_NVFP4, original.data(), packed.data(), 0, 6, 64, nullptr) != packed.size()) { ++ return false; ++ } ++ std::array decoded{}; ++ ggml_get_type_traits(GGML_TYPE_NVFP4)->to_float(packed.data(), decoded.data(), decoded.size()); ++ const float dot = std::accumulate(decoded.begin(), decoded.end(), 0.0f); ++ std::array inputs{}; ++ inputs.fill(1.0f); ++ const std::array selected = {2, 0}; ++ const std::array other_slots = {0, 2}; ++ const std::array scales = {2, 3, 5, 7, 11, 13}; ++ const std::array overrides = {17, 19, 23, 29, 31, 37}; ++ const std::array input_scales = {2, 3, 5}; ++ ggml_backend_tensor_set(weight, packed.data(), 0, packed.size()); ++ ggml_backend_tensor_set(input, inputs.data(), 0, sizeof(inputs)); ++ ggml_backend_tensor_set(ids, selected.data(), 0, sizeof(selected)); ++ if (slots) ggml_backend_tensor_set(slots, cached ? other_slots.data() : selected.data(), 0, sizeof(selected)); ++ ggml_backend_tensor_set(registered, scales.data(), 0, sizeof(scales)); ++ ggml_backend_tensor_set(override, overrides.data(), 0, sizeof(overrides)); ++ ggml_backend_tensor_set(input_scale, input_scales.data(), 0, sizeof(input_scales)); ++ if (ggml_backend_graph_compute(backend.get(), result.get_gf()) != GGML_STATUS_SUCCESS) return false; ++ std::array actual{}; ++ ggml_backend_tensor_get(output, actual.data(), 0, sizeof(actual)); ++ for (size_t i = 0; i < actual.size(); ++i) { ++ const size_t scale_index = 2 * selected[i / 2] + i % 2; ++ const float expected = dot * (explicit_scale ? overrides[scale_index] : scales[scale_index]); ++ // CPU's activation Q8 conversion is approximate; missing/double scales are far outside this tolerance. ++ if (!std::isfinite(actual[i]) || std::fabs(actual[i] - expected) > 0.002f * std::fabs(expected)) { ++ std::fprintf(stderr, "NVFP4 slots=%d override=%d cached=%d value=%zu: got %g, expected %g\n", ++ use_slots, explicit_scale, cached, i, actual[i], expected); ++ return false; ++ } ++ } ++ return true; ++} ++ ++static bool check_contiguous_lora_projection() { ++ std::unique_ptr model(llama_model_create(LLM_ARCH_LLAMA, llama_model_default_params())); ++ model->hparams.n_layer_all = 1; ++ model->hparams.n_embd = 2; ++ model->hparams.n_head_arr[0] = 1; ++ model->hparams.n_head_kv_arr[0] = 1; ++ llm_graph_result result(128); ++ llama_adapter_loras loras; ++ llm_graph_params params{}; ++ params.model = model.get(); ++ params.res = &result; ++ params.loras = &loras; ++ params.ubatch.n_tokens = 2; ++ params.w_scales = &model->w_scales; ++ llm_graph_context graph(params); ++ auto * ctx = result.get_ctx(); ++ auto * weight = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 2, 1); ++ ggml_set_name(weight, "blk.0.attn_output.weight"); ++ auto * input = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 2, 2); ++ auto * contiguous = ggml_cont_2d(ctx, ggml_transpose(ctx, input), 2, 2); ++ auto * base = graph.build_lora_mm(weight, contiguous); ++ auto * a = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 2, 1); ++ auto * b = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 1, 1); ++ llama_adapter_lora adapter(model.get()); ++ adapter.alpha = 0.0f; ++ adapter.ab_map.emplace(weight->name, llama_adapter_lora_weight(a, b)); ++ loras.emplace(&adapter, 0.5f); ++ auto * adapted = graph.build_lora_mm(weight, contiguous); ++ for (auto * output : {base, adapted}) ggml_build_forward_expand(result.get_gf(), output); ++ std::unique_ptr backend(ggml_backend_cpu_init(), ggml_backend_free); ++ if (!backend) return false; ++ ggml_backend_cpu_set_n_threads(backend.get(), 1); ++ std::unique_ptr buffer( ++ ggml_backend_alloc_ctx_tensors(ctx, backend.get()), ggml_backend_buffer_free); ++ if (!buffer) return false; ++ const std::array weights = {1, 2}; ++ const std::array inputs = {1, 2, 3, 4}; ++ const std::array lora_a = {2, 3}; ++ const float lora_b = 5; ++ ggml_backend_tensor_set(weight, weights.data(), 0, sizeof(weights)); ++ ggml_backend_tensor_set(input, inputs.data(), 0, sizeof(inputs)); ++ ggml_backend_tensor_set(a, lora_a.data(), 0, sizeof(lora_a)); ++ ggml_backend_tensor_set(b, &lora_b, 0, sizeof(lora_b)); ++ if (ggml_backend_graph_compute(backend.get(), result.get_gf()) != GGML_STATUS_SUCCESS) return false; ++ const std::array outputs = {base, adapted}; ++ const std::array, 2> expected = {{{7, 10}, {34.5f, 50}}}; ++ for (size_t mode = 0; mode < outputs.size(); ++mode) { ++ std::array actual{}; ++ ggml_backend_tensor_get(outputs[mode], actual.data(), 0, sizeof(actual)); ++ for (size_t i = 0; i < actual.size(); ++i) { ++ if (!std::isfinite(actual[i]) || std::fabs(actual[i] - expected[mode][i]) > 1e-5f) return false; ++ } ++ } ++ return true; ++} ++ + int main(int argc, char ** argv) { ++ if (argc == 2 && std::strcmp(argv[1], "--lora-layout") == 0) return check_contiguous_lora_projection() ? 0 : 1; ++ if (argc == 2 && std::strcmp(argv[1], "--channel-layouts") == 0) { ++ for (bool scalar : {false, true}) for (bool slots : {false, true}) for (bool single : {false, true}) { ++ if (!check_channel_scales(scalar, slots, single)) return 1; ++ } ++ return 0; ++ } ++ if (argc == 2 && std::strcmp(argv[1], "--nvfp4") == 0) { ++ for (bool slots : {false, true}) for (bool explicit_scale : {false, true}) { ++ if (!check_nvfp4_graph(slots, explicit_scale)) return 1; ++ } ++ // An override cannot reuse cache scale banks with different values. ++ if (!check_nvfp4_graph(true, true, true)) return 1; ++ return 0; ++ } + if (argc == 2 && std::strcmp(argv[1], "--routing") == 0) { + bool passed = true; + for (bool random : {false, true}) { diff --git a/llama_cpp/patches/generated/0006-family-bailingmoe3.patch b/llama_cpp/patches/generated/0006-family-bailingmoe3.patch index 18168514..3cb5ca8b 100644 --- a/llama_cpp/patches/generated/0006-family-bailingmoe3.patch +++ b/llama_cpp/patches/generated/0006-family-bailingmoe3.patch @@ -9,7 +9,7 @@ separately and remain outside the primary decoder stage interval. --- diff --git a/src/models/bailingmoe3.cpp b/src/models/bailingmoe3.cpp -index 06295e71b6fad4e07c6599e1205a3dedbcc4004a..4a3a9cbc9ab0cba608b515fcb7c5f8467deea224 100644 +index e1c9c3c146e9332652e82e2310a4b08c7f9b9121..aa8b8439d770659329ee86322285c37103840216 100644 --- a/src/models/bailingmoe3.cpp +++ b/src/models/bailingmoe3.cpp @@ -225,6 +225,8 @@ llama_model_bailingmoe3::graph::graph(const llm_graph_params & params) : diff --git a/llama_cpp/patches/generated/series.json b/llama_cpp/patches/generated/series.json index b8826a37..f0e527c4 100644 --- a/llama_cpp/patches/generated/series.json +++ b/llama_cpp/patches/generated/series.json @@ -1,5 +1,5 @@ { - "full_patch_sha256": "c09a7108de0f9c3f68be61d9c5450ba70c77a86d02cc110c838fcd0f63d4733f", + "full_patch_sha256": "c198eae0c4308d3f12b3d0390e7e27169585d98dfb8da4264a36015879ba8c03", "generator_version": "0.5.0", "schema_version": 1, "shards": [ @@ -59,7 +59,7 @@ "bailingmoe3" ], "file": "0006-family-bailingmoe3.patch", - "sha256": "c851908b90ba8d44080f178e289af8a7bf065d6e47c5b42b632a4d801511be97", + "sha256": "4e442f8f709f06ea6a788d28a8cde61a4d98e1a8a2259b3aaf58bf1cd89e5407", "sources": [ "src/models/bailingmoe3.cpp" ] diff --git a/llama_cpp/patches/model_support/0001-models-add-inkling-family-support.patch b/llama_cpp/patches/model_support/0001-models-add-inkling-family-support.patch index 3f1d2efd..84d2bd99 100644 --- a/llama_cpp/patches/model_support/0001-models-add-inkling-family-support.patch +++ b/llama_cpp/patches/model_support/0001-models-add-inkling-family-support.patch @@ -1,4 +1,4 @@ -From dda949784471439daee190e9cc6263ba25229097 Mon Sep 17 00:00:00 2001 +From d5a40d3f75704cfcc46e186c8e919f8db7296a05 Mon Sep 17 00:00:00 2001 From: James Dumay Date: Fri, 6 Nov 2026 10:32:22 -0800 Subject: [PATCH] models: add inkling family support @@ -887,10 +887,10 @@ index 5d106837bf2cd451fa5f2339ebb7dcf128577a8d..8f6cb7345600940b5b6f70fba88acc55 // the trunk tensors through ctx_other (see graph_mtp in nemotron-h-moe.cpp). // Without this clause the constructor silently drops params.ctx_other and diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp -index 4bb2489eb84cfddc7f78bba201fee272f31a3b74..0c98759ee508544c86317dd9b6cef7862d0e3359 100644 +index 49229263a58c6fe971a451e4fca257a3fa77ebd4..562424754b98100a26f4e1666b92d1b973a84da2 100644 --- a/src/llama-graph.cpp +++ b/src/llama-graph.cpp -@@ -3889,10 +3889,27 @@ ggml_tensor * llm_graph_context::build_attn_mha( +@@ -3909,10 +3909,27 @@ ggml_tensor * llm_graph_context::build_attn_mha( ggml_tensor * cur; @@ -920,7 +920,7 @@ index 4bb2489eb84cfddc7f78bba201fee272f31a3b74..0c98759ee508544c86317dd9b6cef786 if (k_scale) { q = ggml_mul(ctx0, q, k_scale); -@@ -3912,10 +3929,10 @@ ggml_tensor * llm_graph_context::build_attn_mha( +@@ -3932,10 +3949,10 @@ ggml_tensor * llm_graph_context::build_attn_mha( } if (kv_rows) { diff --git a/llama_cpp/patches/model_support/0002-fix-kimi-k3-name-residual-checkpoint-activation-port.patch b/llama_cpp/patches/model_support/0002-fix-kimi-k3-name-residual-checkpoint-activation-port.patch index 6e814432..e8a24391 100644 --- a/llama_cpp/patches/model_support/0002-fix-kimi-k3-name-residual-checkpoint-activation-port.patch +++ b/llama_cpp/patches/model_support/0002-fix-kimi-k3-name-residual-checkpoint-activation-port.patch @@ -1,4 +1,4 @@ -From b8286ee042e500706ff5775e4027363b43e285a0 Mon Sep 17 00:00:00 2001 +From 53a6c958328a2500d213f0df2d57ffe57f90ed9b Mon Sep 17 00:00:00 2001 From: James Dumay Date: Mon, 21 Sep 2026 05:48:09 +1000 Subject: [PATCH] fix(kimi-k3): name residual checkpoint activation ports diff --git a/llama_cpp/patches/model_support/0003-llama-port-diffusiongemma-support.patch b/llama_cpp/patches/model_support/0003-llama-port-diffusiongemma-support.patch index aefdc152..05625ba9 100644 --- a/llama_cpp/patches/model_support/0003-llama-port-diffusiongemma-support.patch +++ b/llama_cpp/patches/model_support/0003-llama-port-diffusiongemma-support.patch @@ -1,4 +1,4 @@ -From c8738568e1c4bff0d19cf8db3a68b3f632e33a15 Mon Sep 17 00:00:00 2001 +From 1600c63a2945a80792c1776bebfb5c1313452467 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 6 Nov 2026 10:33:32 -0800 Subject: [PATCH] llama: port DiffusionGemma support diff --git a/llama_cpp/patches/model_support/0004-skippy-add-diffusiongemma-system-one-reads.patch b/llama_cpp/patches/model_support/0004-skippy-add-diffusiongemma-system-one-reads.patch index 06aedae5..b2d44e35 100644 --- a/llama_cpp/patches/model_support/0004-skippy-add-diffusiongemma-system-one-reads.patch +++ b/llama_cpp/patches/model_support/0004-skippy-add-diffusiongemma-system-one-reads.patch @@ -1,4 +1,4 @@ -From e6dc3f58489d1dc6c3bdb90fdbbbe27c78107814 Mon Sep 17 00:00:00 2001 +From 3adcfd949c23cff1de394a99a8b805a24c412963 Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 20 Sep 2026 11:19:07 +1000 Subject: [PATCH] skippy: add DiffusionGemma system-one reads @@ -118,7 +118,7 @@ index 0000000000000000000000000000000000000000..4faf057ba9d302358e7924642ffbe5e7 + +#endif // SKIPPY_SYSTEM_ONE_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 1985b193a40d2ab166dd58cf983c70a7ded75fe8..f8c872fe76f70ed6166afc47357711d8a44b7bc9 100644 +index 3ef703016283a8a3d0806019c4e9584a590ec380..7e174b4d3e96ee60f91a6e515cc1dab22af53cf6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,6 +100,7 @@ add_library(llama diff --git a/llama_cpp/patches/model_support/0005-skippy-query-diffusion-canvas-length.patch b/llama_cpp/patches/model_support/0005-skippy-query-diffusion-canvas-length.patch index cb72490f..099f4a24 100644 --- a/llama_cpp/patches/model_support/0005-skippy-query-diffusion-canvas-length.patch +++ b/llama_cpp/patches/model_support/0005-skippy-query-diffusion-canvas-length.patch @@ -1,4 +1,4 @@ -From 424de48160a20b4d4cd8520aaa9733041ba99a10 Mon Sep 17 00:00:00 2001 +From 05e9d4cdc8386fe9a196f83599ecb5ca4d548174 Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 20 Sep 2026 11:38:59 +1000 Subject: [PATCH] skippy: query diffusion canvas length diff --git a/llama_cpp/patches/model_support/0006-models-add-laya-decision-model-support.patch b/llama_cpp/patches/model_support/0006-models-add-laya-decision-model-support.patch index cd0f60ba..d00b6354 100644 --- a/llama_cpp/patches/model_support/0006-models-add-laya-decision-model-support.patch +++ b/llama_cpp/patches/model_support/0006-models-add-laya-decision-model-support.patch @@ -1,4 +1,4 @@ -From 99eefce3e9f5eb45b6ea3818f8f80d60b3cfeef9 Mon Sep 17 00:00:00 2001 +From 6b2c9ce9fd4a43dfa9d6f6dcc8bf79ab82f23e43 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Sun, 27 Sep 2026 21:12:21 +1000 Subject: [PATCH] models: add Laya decision model support @@ -264,7 +264,7 @@ index 0000000000000000000000000000000000000000..002fac5980f2d02c84d0408640e21d5a + +#endif // SKIPPY_LAYA_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index f8c872fe76f70ed6166afc47357711d8a44b7bc9..ee12298b47a7f389095d2ab7d3207ef4b477d666 100644 +index 7e174b4d3e96ee60f91a6e515cc1dab22af53cf6..3a5c175308f6b82f8beb2f4a8d036e5fe5f756f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -101,6 +101,8 @@ add_library(llama diff --git a/llama_cpp/patches/model_support/0007-fix-muse-glimmer-parse-implicit-reasoning-continuati.patch b/llama_cpp/patches/model_support/0007-fix-muse-glimmer-parse-implicit-reasoning-continuati.patch index a105c999..3d306375 100644 --- a/llama_cpp/patches/model_support/0007-fix-muse-glimmer-parse-implicit-reasoning-continuati.patch +++ b/llama_cpp/patches/model_support/0007-fix-muse-glimmer-parse-implicit-reasoning-continuati.patch @@ -1,4 +1,4 @@ -From 8da2b300ceb57e4467cb55a8e09e50ca33b9301a Mon Sep 17 00:00:00 2001 +From 25016d389aed7f8bb59117caa6553914c3431f54 Mon Sep 17 00:00:00 2001 From: James Dumay Date: Sat, 17 Oct 2026 03:37:10 +1100 Subject: [PATCH] fix(muse-glimmer): parse implicit reasoning continuations diff --git a/llama_cpp/patches/model_support/0008-models-add-qwen3-moe-native-mtp.patch b/llama_cpp/patches/model_support/0008-models-add-qwen3-moe-native-mtp.patch index d38d23ca..606c05ac 100644 --- a/llama_cpp/patches/model_support/0008-models-add-qwen3-moe-native-mtp.patch +++ b/llama_cpp/patches/model_support/0008-models-add-qwen3-moe-native-mtp.patch @@ -1,4 +1,4 @@ -From 939a774fc16d3644d3bd3ba89507799979d44539 Mon Sep 17 00:00:00 2001 +From f30c5396d2faca77387db2f9341013784cbded1f Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Fri, 6 Nov 2026 10:37:00 -0800 Subject: [PATCH] models: add Qwen3-MoE native MTP @@ -149,7 +149,7 @@ index 347378e612fa754e1235ab1f5b25143de1d440f3..8f101e52f5f9676d917023d78eaefad8 MODEL_ARCH.FLINT: [ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index ee12298b47a7f389095d2ab7d3207ef4b477d666..a961445c68c5ac1bef7ba2a0a9d1c629ba5c5db0 100644 +index 3a5c175308f6b82f8beb2f4a8d036e5fe5f756f7..c36c211cf2f37ceac6599520eb81da15e3e56d76 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -262,6 +262,14 @@ if (LLAMA_STAGE_BUILD_TESTS) diff --git a/llama_cpp/patches/model_support/0009-skippy-add-whisper-speech-recognition.patch b/llama_cpp/patches/model_support/0009-skippy-add-whisper-speech-recognition.patch index 2c33a52f..3ba51ba6 100644 --- a/llama_cpp/patches/model_support/0009-skippy-add-whisper-speech-recognition.patch +++ b/llama_cpp/patches/model_support/0009-skippy-add-whisper-speech-recognition.patch @@ -1,4 +1,4 @@ -From 9108b7de60d43a2c7975b4ef8c185fe8d1911064 Mon Sep 17 00:00:00 2001 +From 92d6facd904e512a759d5ec9b2a3750a7759cfff Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Thu, 22 Oct 2026 17:15:05 +1100 Subject: [PATCH] skippy: add Whisper speech recognition @@ -238,7 +238,7 @@ index 2c9342d9168d2663babb5922f68d6ddfa9e706dc..cc08d38990445089e9fc86d30fbb2bb9 enum skippy_status { SKIPPY_STATUS_OK = 0, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index a961445c68c5ac1bef7ba2a0a9d1c629ba5c5db0..00b9dac516d37dd84973e538bee9650f648ee86d 100644 +index c36c211cf2f37ceac6599520eb81da15e3e56d76..8ad230e423fbd379b9315d6c318c9d92134018ad 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,6 +103,7 @@ add_library(llama diff --git a/llama_cpp/patches/model_support/0010-skippy-record-per-token-logprobs-while-sampling.patch b/llama_cpp/patches/model_support/0010-skippy-record-per-token-logprobs-while-sampling.patch index f0208512..abe3d7ad 100644 --- a/llama_cpp/patches/model_support/0010-skippy-record-per-token-logprobs-while-sampling.patch +++ b/llama_cpp/patches/model_support/0010-skippy-record-per-token-logprobs-while-sampling.patch @@ -1,4 +1,4 @@ -From 521de5142d36430bb764e4c6eff0dcd9ebb63dd2 Mon Sep 17 00:00:00 2001 +From 43e00e94929da1ab48dae0740b7bf509f414f5c4 Mon Sep 17 00:00:00 2001 From: Virgile-pct Date: Wed, 21 Oct 2026 23:42:33 +0200 Subject: [PATCH] skippy: record per-token logprobs while sampling @@ -144,7 +144,7 @@ index 1b42f32c0c68b206273cdb4d992bad2419b6e6be..c1a755c4cc795170d3a71ae89f91a05e #ifdef __cplusplus diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 00b9dac516d37dd84973e538bee9650f648ee86d..37d87b23c3a8b69f4687f425f1d7398f2269aa2c 100644 +index 8ad230e423fbd379b9315d6c318c9d92134018ad..2746e6bf87969a515b8f2bfb3994a3570073375c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -89,6 +89,7 @@ add_library(llama diff --git a/llama_cpp/patches/model_support/0011-models-expose-glm5-next-stage-graph-semantics.patch b/llama_cpp/patches/model_support/0011-models-expose-glm5-next-stage-graph-semantics.patch index 15aa538a..b5447a13 100644 --- a/llama_cpp/patches/model_support/0011-models-expose-glm5-next-stage-graph-semantics.patch +++ b/llama_cpp/patches/model_support/0011-models-expose-glm5-next-stage-graph-semantics.patch @@ -1,4 +1,4 @@ -From 97a47650770401855cf3979d055aaa5ff26e09ff Mon Sep 17 00:00:00 2001 +From 723e9278c3c33c2e2eb901b0fd16691a1b3b313a Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Fri, 6 Nov 2026 10:37:22 -0800 Subject: [PATCH] models: expose glm5-next stage graph semantics @@ -12,7 +12,7 @@ Subject: [PATCH] models: expose glm5-next stage graph semantics 5 files changed, 217 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 37d87b23c3a8b69f4687f425f1d7398f2269aa2c..fda659913208dd73888ae1ea85705926123048e9 100644 +index 2746e6bf87969a515b8f2bfb3994a3570073375c..41fc936e93d78accb11bc0dc1a9447e3892d2852 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -308,6 +308,17 @@ if (LLAMA_STAGE_BUILD_TESTS) @@ -33,7 +33,7 @@ index 37d87b23c3a8b69f4687f425f1d7398f2269aa2c..fda659913208dd73888ae1ea85705926 set(MULTIDEPTH_MTP_FIXTURE_DIR "${CMAKE_CURRENT_BINARY_DIR}/multidepth-mtp-models") file(MAKE_DIRECTORY "${MULTIDEPTH_MTP_FIXTURE_DIR}") add_test(NAME skippy_generate_multidepth_mtp COMMAND skippy-model-fixture-generator -@@ -497,6 +508,7 @@ if (LLAMA_STAGE_BUILD_TESTS) +@@ -500,6 +511,7 @@ if (LLAMA_STAGE_BUILD_TESTS) add_skippy_verify_rollback_test(qwen4exp qwen4exp-moe.gguf) # lfm2's fixture slides its attention window, so it checkpoints every window. add_skippy_verify_rollback_test(lfm2 lfm2-dense.gguf sliding-window) diff --git a/llama_cpp/patches/model_support/0012-skippy-add-clef-joint-decision-reads.patch b/llama_cpp/patches/model_support/0012-skippy-add-clef-joint-decision-reads.patch index 5b27bd72..8987b4c5 100644 --- a/llama_cpp/patches/model_support/0012-skippy-add-clef-joint-decision-reads.patch +++ b/llama_cpp/patches/model_support/0012-skippy-add-clef-joint-decision-reads.patch @@ -1,4 +1,4 @@ -From 447b53c655d73c7b6fd0513b5629f93c951ab1df Mon Sep 17 00:00:00 2001 +From 9674df70ea5b4cf4264c4b608f42df18e7b39f89 Mon Sep 17 00:00:00 2001 From: Michael Neale <14976+michaelneale@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:27:44 +1100 Subject: [PATCH] skippy: add clef joint decision reads @@ -202,7 +202,7 @@ index d014c10da1e5fe6fd0cbd957a4ee61bbe3c2b884..63a16bd85b67620114d5a76537140610 enum skippy_status { SKIPPY_STATUS_OK = 0, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index fda659913208dd73888ae1ea85705926123048e9..761a427f56f331db2608a23ac449b5bcd46e1d3b 100644 +index 41fc936e93d78accb11bc0dc1a9447e3892d2852..4f568de0fac3147fea085e7132fba962463a8a61 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,6 +103,8 @@ add_library(llama diff --git a/llama_cpp/patches/model_support/0013-models-expose-metis16-delegated-pass-layers.patch b/llama_cpp/patches/model_support/0013-models-expose-metis16-delegated-pass-layers.patch index 536302ea..1b6d1f53 100644 --- a/llama_cpp/patches/model_support/0013-models-expose-metis16-delegated-pass-layers.patch +++ b/llama_cpp/patches/model_support/0013-models-expose-metis16-delegated-pass-layers.patch @@ -1,4 +1,4 @@ -From 504ec6a7a4b6e2b79a29282fe43e7ce3c6d05554 Mon Sep 17 00:00:00 2001 +From d3b11fb9480b6581f96f4a616064c9294c121b6b Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Fri, 6 Nov 2026 10:38:07 -0800 Subject: [PATCH] models: expose Metis16 delegated pass layers diff --git a/llama_cpp/patches/model_support/0014-test-skippy-cover-head-input-publication.patch b/llama_cpp/patches/model_support/0014-test-skippy-cover-head-input-publication.patch index 964d715d..f4dfc0a4 100644 --- a/llama_cpp/patches/model_support/0014-test-skippy-cover-head-input-publication.patch +++ b/llama_cpp/patches/model_support/0014-test-skippy-cover-head-input-publication.patch @@ -1,4 +1,4 @@ -From fc5cf2c232255c7508c024306cc7e955c6c4ca92 Mon Sep 17 00:00:00 2001 +From f6cd476f77ac6a540e6f66bda6118e07e2765906 Mon Sep 17 00:00:00 2001 From: Mesh-LLM CI Date: Mon, 9 Nov 2026 09:20:42 +1100 Subject: [PATCH] test(skippy): cover head-input publication and stage capture @@ -15,10 +15,10 @@ case runs in native-rollback mode. 3 files changed, 134 insertions(+), 17 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 761a427f56f331db2608a23ac449b5bcd46e1d3b..ac5698b88969c4859c2bd5de11c330e209e7f8ed 100644 +index 4f568de0fac3147fea085e7132fba962463a8a61..6d41c77f9a7ac91e1794f0d08d5b5a150400a1a3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -529,6 +529,9 @@ if (LLAMA_STAGE_BUILD_TESTS) +@@ -532,6 +532,9 @@ if (LLAMA_STAGE_BUILD_TESTS) # lfm2's fixture slides its attention window, so it checkpoints every window. add_skippy_verify_rollback_test(lfm2 lfm2-dense.gguf sliding-window) add_skippy_verify_rollback_test(glm5-next glm5-next-moe.gguf) @@ -28,7 +28,7 @@ index 761a427f56f331db2608a23ac449b5bcd46e1d3b..ac5698b88969c4859c2bd5de11c330e2 add_executable(skippy-backend-sample-capacity skippy/tests/backend_sample_capacity.cpp) target_include_directories(skippy-backend-sample-capacity PRIVATE .) target_compile_features(skippy-backend-sample-capacity PRIVATE cxx_std_17) -@@ -848,6 +851,19 @@ if (LLAMA_STAGE_BUILD_TESTS) +@@ -851,6 +854,19 @@ if (LLAMA_STAGE_BUILD_TESTS) set_tests_properties(skippy_noalloc_graph_planning_recurrent_rollback PROPERTIES FIXTURES_REQUIRED skippy-noalloc-nemotron-h-fixture) diff --git a/llama_cpp/patches/model_support/0015-models-add-laguna-dflash-drafts.patch b/llama_cpp/patches/model_support/0015-models-add-laguna-dflash-drafts.patch index 83e7441a..381d1d0a 100644 --- a/llama_cpp/patches/model_support/0015-models-add-laguna-dflash-drafts.patch +++ b/llama_cpp/patches/model_support/0015-models-add-laguna-dflash-drafts.patch @@ -1,4 +1,4 @@ -From 8edeaee5da0f9073d3a56f8ba59f4443abdfe78b Mon Sep 17 00:00:00 2001 +From dbad0486ee4b1ef2c5fa3ee5c6f31ebfacf399ec Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Mon, 9 Nov 2026 15:52:17 +1100 Subject: [PATCH] models: add Laguna DFlash drafts diff --git a/llama_cpp/patches/model_support/0016-models-add-dspine-block-parallel-drafter-support.patch b/llama_cpp/patches/model_support/0016-models-add-dspine-block-parallel-drafter-support.patch index 4b9a60a5..d0ab3462 100644 --- a/llama_cpp/patches/model_support/0016-models-add-dspine-block-parallel-drafter-support.patch +++ b/llama_cpp/patches/model_support/0016-models-add-dspine-block-parallel-drafter-support.patch @@ -1,4 +1,4 @@ -From 6370bffcbe9f903089f48b4c1940087418c90751 Mon Sep 17 00:00:00 2001 +From 8893f7b6f1b4066c3103aa05c78a7357cec53561 Mon Sep 17 00:00:00 2001 From: AjHomelab <31621065+Ajay9o9@users.noreply.github.com> Date: Mon, 9 Nov 2026 07:03:22 +1100 Subject: [PATCH] dflash : add DSpine draft model support diff --git a/llama_cpp/patches/model_support/0017-skippy-remove-callback-backed-checkpoint-serving.patch b/llama_cpp/patches/model_support/0017-skippy-remove-callback-backed-checkpoint-serving.patch index d4764683..ab43c3ef 100644 --- a/llama_cpp/patches/model_support/0017-skippy-remove-callback-backed-checkpoint-serving.patch +++ b/llama_cpp/patches/model_support/0017-skippy-remove-callback-backed-checkpoint-serving.patch @@ -1,4 +1,4 @@ -From f2ccd14fd945ab6f6ca989105114a2eaffdcfb38 Mon Sep 17 00:00:00 2001 +From 51faa21157da606d0b098667d6b62aba0c80a744 Mon Sep 17 00:00:00 2001 From: Skippy Date: Fri, 20 Nov 2026 16:34:51 +1100 Subject: [PATCH] skippy: remove callback-backed checkpoint serving @@ -142,7 +142,7 @@ index 5d77f4804b3a34f9ccb7057d82846060c587ef37..00000000000000000000000000000000 - -#endif // SKIPPY_MODEL_SOURCE_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index ac5698b88969c4859c2bd5de11c330e209e7f8ed..a4952c269472d2bb0aa430b75f08288039fdd003 100644 +index 6d41c77f9a7ac91e1794f0d08d5b5a150400a1a3..74622f4ea1d92b687ef84ee8b954ae9e24eb069d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,7 +56,6 @@ add_library(llama diff --git a/llama_cpp/patches/model_support/0018-models-shape-dflash-inkling2-zonos3-builders-for-stage-proof.patch b/llama_cpp/patches/model_support/0018-models-shape-dflash-inkling2-zonos3-builders-for-stage-proof.patch index 6818d166..6d939b94 100644 --- a/llama_cpp/patches/model_support/0018-models-shape-dflash-inkling2-zonos3-builders-for-stage-proof.patch +++ b/llama_cpp/patches/model_support/0018-models-shape-dflash-inkling2-zonos3-builders-for-stage-proof.patch @@ -1,4 +1,4 @@ -From 8a0723fe2e966bd2dc6cc0b0c83ff0a7b85270cc Mon Sep 17 00:00:00 2001 +From f26ad9bfb75d0c07e50a20ca42a44477a392bc78 Mon Sep 17 00:00:00 2001 From: Skippy Date: Tue, 24 Nov 2026 12:35:20 +0000 Subject: [PATCH] models: shape dflash inkling2 zonos3 builders for stage diff --git a/llama_cpp/patches/model_support/0019-gemma4-register-shared-kv-pruning-inputs.patch b/llama_cpp/patches/model_support/0019-gemma4-register-shared-kv-pruning-inputs.patch index b2965e58..477cce57 100644 --- a/llama_cpp/patches/model_support/0019-gemma4-register-shared-kv-pruning-inputs.patch +++ b/llama_cpp/patches/model_support/0019-gemma4-register-shared-kv-pruning-inputs.patch @@ -1,4 +1,4 @@ -From 69236abc5860ec8f08fedbc82902c5e8bf8c71c0 Mon Sep 17 00:00:00 2001 +From 9aa97fa0b80f2749cc0e01247245dc2bca19162e Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:34:04 +1100 Subject: [PATCH] gemma4: register request inputs for shared KV pruning diff --git a/llama_cpp/patches/model_support/0020-minimax-m3-load-indexer-tensors-by-attention-role.patch b/llama_cpp/patches/model_support/0020-minimax-m3-load-indexer-tensors-by-attention-role.patch index 04a08eb3..eb920611 100644 --- a/llama_cpp/patches/model_support/0020-minimax-m3-load-indexer-tensors-by-attention-role.patch +++ b/llama_cpp/patches/model_support/0020-minimax-m3-load-indexer-tensors-by-attention-role.patch @@ -1,4 +1,4 @@ -From 7b677287f536041f8a853093cbe5080e53e1bb98 Mon Sep 17 00:00:00 2001 +From e5dc90f7cc818083b3a33ee5024de7c5516673db Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] minimax-m3: load indexer tensors by attention role diff --git a/llama_cpp/patches/model_support/0021-inkling-preserve-media-aware-template-routing.patch b/llama_cpp/patches/model_support/0021-inkling-preserve-media-aware-template-routing.patch index 099bd6ce..be53ed5b 100644 --- a/llama_cpp/patches/model_support/0021-inkling-preserve-media-aware-template-routing.patch +++ b/llama_cpp/patches/model_support/0021-inkling-preserve-media-aware-template-routing.patch @@ -1,4 +1,4 @@ -From bc853f5475f4f5ca0ad7acbf3cc368ae08b44fbf Mon Sep 17 00:00:00 2001 +From 7d204d6b5c149f9ea3eeb799d07e243e5dbeed06 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] inkling: preserve media-aware template routing diff --git a/llama_cpp/patches/model_support/0022-dspine-populate-the-graph-owned-lattice-stash.patch b/llama_cpp/patches/model_support/0022-dspine-populate-the-graph-owned-lattice-stash.patch index d71a65a8..bb669424 100644 --- a/llama_cpp/patches/model_support/0022-dspine-populate-the-graph-owned-lattice-stash.patch +++ b/llama_cpp/patches/model_support/0022-dspine-populate-the-graph-owned-lattice-stash.patch @@ -1,4 +1,4 @@ -From 141436f2f5a63d09a9bbdc6dcf6b88302c2f0d7e Mon Sep 17 00:00:00 2001 +From 007146d28673959df693e31020f1ff79fa4377ff Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 07:49:52 +1100 Subject: [PATCH] dspine: populate the graph-owned lattice stash diff --git a/llama_cpp/patches/model_support/0023-muse-glimmer-retain-token-aware-turn-boundaries.patch b/llama_cpp/patches/model_support/0023-muse-glimmer-retain-token-aware-turn-boundaries.patch index 73b48dbd..377b0a45 100644 --- a/llama_cpp/patches/model_support/0023-muse-glimmer-retain-token-aware-turn-boundaries.patch +++ b/llama_cpp/patches/model_support/0023-muse-glimmer-retain-token-aware-turn-boundaries.patch @@ -1,4 +1,4 @@ -From 6305583004c3406063961e2d123a0e15f2b16d54 Mon Sep 17 00:00:00 2001 +From 62cd0406bbf6812ab7c40601293367605d66615f Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 08:04:02 +1100 Subject: [PATCH] muse-glimmer: retain token-aware continuation and turn diff --git a/llama_cpp/patches/model_support/0024-models-preserve-checkpoint-layouts-and-head-scales.patch b/llama_cpp/patches/model_support/0024-models-preserve-checkpoint-layouts-and-head-scales.patch index 5951f9c2..4b991e14 100644 --- a/llama_cpp/patches/model_support/0024-models-preserve-checkpoint-layouts-and-head-scales.patch +++ b/llama_cpp/patches/model_support/0024-models-preserve-checkpoint-layouts-and-head-scales.patch @@ -1,4 +1,4 @@ -From 9a3e0f3de999f6048f41fdc3fb2bfeaef6a5f985 Mon Sep 17 00:00:00 2001 +From 58e22ee815648a150ed21dfa8bb3bf7c23a8eda7 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Wed, 25 Nov 2026 11:11:17 +1100 Subject: [PATCH] models: preserve checkpoint layouts and head scales diff --git a/llama_cpp/patches/model_support/0025-abi-distinguish-b12780-upstream-c-layouts.patch b/llama_cpp/patches/model_support/0025-abi-distinguish-b12780-upstream-c-layouts.patch index 4f15148d..f84a64a3 100644 --- a/llama_cpp/patches/model_support/0025-abi-distinguish-b12780-upstream-c-layouts.patch +++ b/llama_cpp/patches/model_support/0025-abi-distinguish-b12780-upstream-c-layouts.patch @@ -1,4 +1,4 @@ -From 7c5b38c9d0dafef5037bd6b6380c1ca544648e98 Mon Sep 17 00:00:00 2001 +From 8457e3ccad89b36fe7fc0bc8c9f1cc25c88032c9 Mon Sep 17 00:00:00 2001 From: Skippy CI Date: Sat, 28 Nov 2026 12:09:27 +1100 Subject: [PATCH] abi: distinguish b12780 upstream C layouts