Commit Graph

4836 Commits

Author SHA1 Message Date
Samuel Oliveira Alves 85a784505d
cast embeds for F32 if necessary (#2319) 2026-08-15 06:21:56 +02:00
Kawrakow 43afea46c2
Adapt Muse-Glimmer loading (#2314) 2026-08-14 07:55:11 +02:00
Samuel Oliveira Alves 981e5ea0d7
DSpark: gather BF16 Markov rows (#2304)
* DSpark: gather BF16 Markov rows

* DSpark: gather Markov rows by type
2026-08-13 18:02:46 +02:00
Samuel Oliveira Alves cf711918e2
Synch DFlash Tokens ID (#2303)
* llama: synchronize DFlash argmax readback

* llama: synchronize DFlash token access
2026-08-13 18:02:08 +02:00
Kawrakow 37d82c2313
Change the default amb value from 0 to 256 (#2312) 2026-08-13 17:47:37 +02:00
Kawrakow 6e7378f616
Another minor optimization on CUDA for split mode graph (#2298)
* CUDA: fuse rms -> add -> rms

* Another minor optimization on CUDA for split mode graph
2026-08-13 15:25:28 +02:00
Kawrakow 8b276c08ef
CUDA: fuse rms -> add -> rms (#2297) 2026-08-13 15:24:45 +02:00
Kawrakow 3c949f3399
Add work buffer size calculation for the ds4_comp op (#2307) 2026-08-13 15:23:38 +02:00
Kawrakow ff141691a1
Use f32 accumulation in CUDA DSA implementation (#2311) 2026-08-13 15:22:01 +02:00
Joel Farthing a10ef3eb00
laguna: compacted sliding-window KV cache (--swa-compress) (#2310)
* laguna: compacted sliding-window KV cache (--swa-compress)

* llama: fold the model-level ctx-shift gate into get_can_shift

---------

Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-13 14:54:36 +02:00
Joel Farthing 2cda8d2daf
speculative: Allow --swa-compress with DeepSeek4 MTP (#2309)
Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-13 11:45:39 +02:00
Kawrakow 4b0320381a
Fix #2183 (#2308) 2026-08-13 09:58:03 +02:00
Kawrakow ee77f7ffb8
Fix MXFP4 non-interlevaed type (#2306) 2026-08-13 08:41:39 +02:00
Marian M. 79c1e16a41
Update docs (#2299)
* Update parameters.md

- Add new parameters
- Update modified parameters
- Add graph parallel new arch
- Fix some words case

* Update README.md

- Update supported models list
- Add the new features
2026-08-13 08:05:27 +02:00
Joel Farthing 87644e36bc
model: Ling-3.0 (bailingmoe3) runtime support (#2295)
* model: Ling-3.0 (bailingmoe3) runtime support

* model: Ling-3.0-tiny support

---------

Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-13 08:02:50 +02:00
rumas77 c46ffaa566
fix dspark: seed draft block at id_last's true position (+1 off-by-one) (#2296)
The draft block was seeded at last_target_pos (the newest committed
feature row = id_last's predecessor), placing the whole block one
position early vs mainline's [id_last @ n_past, ...] convention and
colliding the seed with the newest cross-KV row. Shift the common-side
batch and the graph-side SWA mask base coherently.
2026-08-12 18:21:30 +02:00
Kawrakow 1dede1d79e
Adding Muse-Glimmer support (#2293)
* Adding Muse-Glimmer support

* Different rms_eps for post norm ops

* Need attn_post_norm split for Muse-Flimmer

* WIP: split mode graph

* Forgot this file

* Clean it up

* Minor

* Muse-glimmer: Slightly better split mode graph (+2% TG)
2026-08-12 15:53:54 +02:00
Joel Farthing 26ceed9d40
CUDA: clear MMQ row padding on partially offloaded quantized weights (#2292)
Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-11 09:07:01 +02:00
mb8565 b382ebd848
llama: pass rope freq factors to build_std_attention (#2291)
build_llama passes nullptr for the rope_factors_in argument, so
rope_freqs.weight never reaches ggml_rope_ext and llama3 rope frequency
scaling is not applied. The LLAMA_SPLIT_MODE_GRAPH branch inside
build_std_attention falls back to model.layers[il].rope_freqs, so only
the standard path is affected.
2026-08-11 08:17:25 +02:00
mb8565 c8772a8429
Fix rope type for 39 architectures (#2290)
The DFLASH case was inserted into the NEOX fall-through group in
llama_rope_type(), so the 39 cases above it now return LLAMA_ROPE_TYPE_NORM
instead of LLAMA_ROPE_TYPE_NEOX.

Move DFLASH into the NORM group so it keeps its intended rope type and the
others fall through to NEOX again.
2026-08-11 08:09:24 +02:00
Kawrakow 5763a901de
DSA: do not copy V rows when V == K (#2287) 2026-08-10 18:49:05 +02:00
Kawrakow b37189aae4
Actually fix quantized indexer cache on CUDA (#2286) 2026-08-10 18:46:02 +02:00
Kawrakow b8b3034b0f
Indexer topk: on the CPU repack Q8_0 indexer cache (#2285) 2026-08-10 18:45:43 +02:00
Samuel Oliveira Alves 7ebbb906d2
Initial implementation of DSpark (#2280)
* Implement initial arch for DSpark

* feat: Add Dspark architecture support

* avoid to many splits in graph and improve rope logic
2026-08-10 08:46:03 +02:00
abc-nix a7c81affa4
GLM-5.2 vision hack (#2283) 2026-08-09 15:54:53 +02:00
Joel Farthing 7c57e445b7
state: include compacted sliding-window rows in partial sequence state (#2281)
Co-authored-by: Joel Farthing <joel.farthing@gmail.com>
2026-08-09 11:45:05 +02:00
Kawrakow f2328aa0c1 Fix -ctk / -ctv / -ictk that I broke earlier 2026-08-08 14:41:48 +00:00
Kawrakow da5884a2db Fix not commented out fprintf 2026-08-08 14:37:35 +00:00
Kawrakow 7642ac3eca
Fix massive inefficiency in CUDA Q->f32/f16 and f32/f16->Q copies (#2279)
* CUDA indexer topk: this is better for PP

* Don't overstep

* Cleanup

* Allow Q8_0 cache in the CUDA DSA implementation

* DS4: do not cast caches to f32

* Fix massive inefficiency in CUDA Q->f32/f16 and f32/f16->Q copies

* Re-enable -ictk | --indexer-cache-type-k
2026-08-08 17:26:59 +03:00
Kawrakow daa54abd0b
DS4: do not cast caches to f32 (#2278)
* CUDA indexer topk: this is better for PP

* Don't overstep

* Cleanup

* Allow Q8_0 cache in the CUDA DSA implementation

* DS4: do not cast caches to f32
2026-08-08 17:19:23 +03:00
Kawrakow 76c1942716
Allow Q8_0 cache in the CUDA DSA implementation (#2276)
* CUDA indexer topk: this is better for PP

* Don't overstep

* Cleanup

* Allow Q8_0 cache in the CUDA DSA implementation
2026-08-08 17:18:36 +03:00
Kawrakow c5f37f0fba
Indexer topk optimization (#2274)
* CUDA indexer topk: this is better for PP

* Don't overstep

* Cleanup
2026-08-08 17:14:18 +03:00
Joel Farthing 1ce4bb9736
sweep-bench: fixes and new options (#2273)
* sweep-bench: fixes and new options

* sweep-bench: enable TG profiling markers

---------

Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-08 16:53:35 +03:00
Kawrakow 86ad770f2a
DS4: enable graph reuse (#2270)
* DS4: enable graph reuse

* Minor
2026-08-08 11:18:21 +03:00
Joel Farthing 40dffce685
CUDA: Fix non-F16 indexer top-k (#2272)
* CUDA: Fix non-F16 indexer top-k

* CUDA: Handle strided F32 indexer keys

---------

Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-07 19:35:17 +03:00
Kawrakow 61b37f5f44
Reduce the indexer temporary buffer size (#2271) 2026-08-07 17:09:18 +03:00
Kawrakow 36925b86c1 Compiler warning 2026-08-07 06:10:32 +00:00
Joel Farthing e21eed5f58
deepseek4: compacted sliding-window KV cache (--swa-compress) (#2266)
Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-07 08:36:08 +03:00
Kawrakow 466d9bb15f
Merged up/gate for DS4 (#2257)
* Merged up/gate for DS4

* Just in case

* WIP

* Fix CUDA silu kernel for merged up/gate with limit
2026-08-07 07:51:58 +03:00
Kawrakow da2293ded3
Better placement of MoE tensors with -ncmoe and 1 GPU (#2262) 2026-08-07 07:51:35 +03:00
Kawrakow 113f426a3c
Do not include ggml-impl.h in ggml-cuda.cu (#2264) 2026-08-07 07:23:43 +03:00
Samuel Oliveira Alves ea791ac569
speculative : add Step 3.7 MTP support (#2250)
* speculative : add Step 3.7 MTP support

* clean unnecesary comments

* remove duplicated function and fix split graph mode to work

* Simplify speculative MTP compatibility checks
2026-08-07 07:23:21 +03:00
ShubhamPriyadarshi 21819724b3
Compute the sequence fingerprint once per decode (#2265)
Compute it before the reuse check, pass it to can_reuse_graph(), and reuse the same
value when the graph is rebuilt, so it is computed exactly once whether the existing
graph is kept or rebuilt.

Verified at np=6, same binary, only IK_LEGACY_GRAPH_REUSE differing: legacy 6/12
replies kept their own codeword, this branch 12/12. The value at the call site matched
the value at the store site on 50 of 50 rebuilds sampled at np=2 and np=6.
2026-08-06 17:34:42 +03:00
ShubhamPriyadarshi 4a4a6d3c14
Fix wrong output for hybrid/recurrent models at -np > 1 (graph reuse key) (#2260)
* Fix wrong output for hybrid/recurrent models at -np > 1 (graph reuse key)

Hybrid and recurrent architectures return silently wrong output when more than
one sequence is resident. No crash and no warning: every slot keeps producing
fluent text, it is just no longer conditioned on that slot's prompt, and slots
degenerate into repetition loops. Reported in #1932.

Three things have to line up, and on these architectures they do:

  1. can_reuse_graph() keys reuse on the ubatch SHAPE. Two consecutive decode
     steps for different sequences match on every field it checks.
  2. update_cache_copies() re-points the baked view_offs for K/V, but only for
     attention layers -- it skips recurrent ones via
     is_attn_layer = !hparams.is_recurrent(il).
  3. The delta-net bakes the recurrent state row into the graph as a
     compile-time view offset, not as an input tensor.

So a graph built for sequence A is reused to decode sequence B and nothing
re-points the recurrent state: every sequence reads and writes sequence A's
state. On Qwen3.6-35B-A3B only 10 of 40 layers carry a KV cache, so the 30
layers that silently share state are three quarters of the network.

Fix: extend the reuse key with a fingerprint of the ubatch's sequence
composition -- which sequences, in what order, and which start at position 0.
That last term matters because a state reset is baked into the graph as a node;
it mirrors exactly the condition the builder itself uses (batch.pos[i] == 0 in
build_layer_attn_linear). Gated on llm_arch_is_hybrid() ||
llm_arch_is_recurrent() on both the compare and the compute side, so
architectures that never consult the fingerprint do not pay to build it.

Evidence, RTX 3090 / sm_86, Qwen3.6-35B-A3B-UD-IQ4_XS, 6 concurrent requests
each carrying a unique codeword, 600-token generations, two rounds:

  before (IK_LEGACY_GRAPH_REUSE=1):  7/12 replies degenerate
  after:                             0/12

np=1 is unaffected. Throughput is 132.9 tok/s against 132.4 before, and the
fingerprint is a pure additional invalidation -- it can only ever add reuse
misses, never remove them -- so counting the misses it causes on its own bounds
its cost exactly. Over 13000 can_reuse_graph() calls at np=1:

  calls=13000  hit=12949  miss_other=51  miss_fingerprint_only=0

Zero, so np=1 graph reuse is bit-identical to before this patch. That covers
MTP, which runs at n_parallel == 1: its draft/verify ubatch alternation was
already keyed by the existing n_tokens / mtp_op_type / mtp_step_idx /
mtp_n_heads checks, and all the fingerprint adds beyond those is per-token
seq_ids and the pos == 0 flags, both constant at np=1 during decode. prev and
prev_mtp are populated through the same reference binding, so the MTP cache
carries the fingerprint too.

IK_LEGACY_GRAPH_REUSE restores the previous behaviour so the before/after above
can be reproduced from a single build.

* Address review: fold the arch and legacy checks into the fingerprint

llama_graph_bakes_seq_state moves above the fingerprint; the fingerprint takes the arch
and returns 0 for architectures that do not bake sequence state, and when
IK_LEGACY_GRAPH_REUSE is set. Both call sites become a plain call and the two guards
live in one place.

Returning 0 keeps behaviour identical for everything else: stored and computed values
are both 0, so the comparison always matches and reuse proceeds as before this patch.

Re-verified at np=6, same binary, only the env var differing:
  legacy  6/12 sequences degenerated  -> DIRTY
  fixed   0/12                        -> clean
2026-08-06 16:45:20 +03:00
Joel Farthing d44e2cbe57
openpangu: per-sequence state save/restore with --swa-compress (#2261)
Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-06 11:00:14 +03:00
Joel Farthing cf1aa57e1a
openpangu: opt-in compacted sliding-window KV cache (--swa-compress) (#2253)
* openpangu: opt-in compacted sliding-window KV cache (--swa-compress)

* openpangu: shrink the compacted window and drop the zero fill

* openpangu: correct the --swa-compress state I/O refusal message

---------

Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-05 18:00:32 +03:00
Kawrakow b4be4b17a0
Another minor indexer optimization on the CPU (#2231)
* Convert and repacl f16 K to 4-row-interleaved f32 on AVX2

* Cleanup
2026-08-05 08:15:41 +03:00
Kawrakow 1474935e31
Bucket top_k (CPU): ~3% better TG at 128k context (#2225) 2026-08-05 07:50:41 +03:00
Kawrakow 7257cabc49
Fix #2201 (#2255) 2026-08-05 07:48:20 +03:00
Kawrakow 6633d19df8
Fix Antirez DS4 GGUFs (#2256)
* Fix Antirez DS4 GGUFs

* Let's tell the user what we did
2026-08-05 07:47:42 +03:00