Commit Graph
4814 Commits
Author SHA1 Message Date
KawrakowandGitHub b8b3034b0f Indexer topk: on the CPU repack Q8_0 indexer cache (#2285) 2026-08-10 18:45:43 +02:00
Samuel Oliveira AlvesandGitHub 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-nixandGitHub a7c81affa4 GLM-5.2 vision hack (#2283) 2026-08-09 15:54:53 +02:00
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
KawrakowandGitHub 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
KawrakowandGitHub 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
KawrakowandGitHub 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
KawrakowandGitHub 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
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
KawrakowandGitHub 86ad770f2a DS4: enable graph reuse (#2270)
* DS4: enable graph reuse

* Minor
2026-08-08 11:18:21 +03:00
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
KawrakowandGitHub 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
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
KawrakowandGitHub 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
KawrakowandGitHub da2293ded3 Better placement of MoE tensors with -ncmoe and 1 GPU (#2262) 2026-08-07 07:51:35 +03:00
KawrakowandGitHub 113f426a3c Do not include ggml-impl.h in ggml-cuda.cu (#2264) 2026-08-07 07:23:43 +03:00
Samuel Oliveira AlvesandGitHub 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
ShubhamPriyadarshiandGitHub 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
ShubhamPriyadarshiandGitHub 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
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
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
KawrakowandGitHub 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
KawrakowandGitHub 1474935e31 Bucket top_k (CPU): ~3% better TG at 128k context (#2225) 2026-08-05 07:50:41 +03:00
KawrakowandGitHub 7257cabc49 Fix #2201 (#2255) 2026-08-05 07:48:20 +03:00
KawrakowandGitHub 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
Yap Sok AnnandGitHub 6b55d2c750 Fix DSV4 tool calls and reasoning (#2242)
* Fix DSV4 tool calls and reasoning

There are multiple changes. The most important one is the wiring, to
avoid falling back to the autoparser. With autoparser, all arguments
will be forced by the generated grammar to have the `string="true"`
attribute, which then breaks prompt caching, as it would diverge from
what is rendered by the template. Parallel tool calls also doesn't work
when falling back to autoparser.

Other changes:
* Order tool results by tool call order.
* Consume `</think>` instead of `<think></think>` when thinking is
  disabled.
* Use "preserved thinking" mode when any tool is defined, otherwise use
  "interleaved thinking" mode, e.g. for multi-turns chat. Set template
  arg `drop_thinking` to false to force "preserved thinking" mode even
  when no tool is defined.
* Add a message to system prompt when reasoning effort is set to max.

The changes were made by following:
1. The Technical Report: https://arxiv.org/abs/2606.19348
2. Reference implementatin: https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731/blob/main/encoding/encoding_dsv4.py
3. VLLM implementation: https://github.com/vllm-project/vllm/blob/main/vllm/tokenizers/deepseek_v4_encoding.py

For the last bullet point about max reasoning effort, the reference
implementation diverges from the other 2, so we follow the techinical
report and the VLLM implementation, for now. This needs more testing.

* Add back trailing newline

* Update the reasoning effort instruction to follow the reference impl

Using the prompt counting test from @coder543, 0731 does have a special
instruction for "high" and another special instruction for "max".

This will break preview, but assuming most people will use the 0731
release, it should be fine.

[1] https://www.reddit.com/r/DeepSeek/comments/1vdqjwr/openrouter_reasoning_effort_levels_are_broken_for/
2026-08-04 19:28:06 +03:00
Petr VilímandGitHub af4e0cbdb6 ggml : fuse the delta-net recurrent state copy into the op (#2251)
* ggml : assert the delta-net value head dim equals the key head dim

The CPU forward sizes its result from the value head dim (src[2]->ne[0]) but
indexes it with the key head dim (src[0]->ne[0]). A model where the two differ
was mis-indexed silently. The CUDA op has asserted this all along.

* ggml : fuse the delta-net recurrent state copy into the op

The problem: the delta-net op produces the new recurrent state into the tail of
its result. Then llama copies that tail into the KV slot the state was read
from. The copy buys nothing - the kernel could write the slot itself.

The change: the slot's two halves are written by two narrow CPY nodes instead of
one CONCAT. That isolates the state write in an ordinary node, which the
scheduler places by the rules it already has. A backend that recognises the
pattern lets the kernel write the slot directly and skips that node. One that
does not implement the fusion runs the copy as before. No public header changes.

Notes: this leaves ggml_concat_inplace(), added in #1777 for exactly this site,
without a caller.
2026-08-04 19:27:27 +03:00
ForkozandGitHub 0a93e73a72 Make antirez GGUFs run at least (#2254) 2026-08-04 16:00:19 +03:00
NexesenexandGitHub f8b5664c18 Chores : Typos fixing round 3 (project wide, ggml dir included, comments and user facing msg only) (#2249)
* ggml: fix typos in comments across ggml/src

Corrects misspellings found in source comments (no code/logic changes):

CUDA:
- quantize.cu / quantize_id.cu: 'memroy' -> 'memory', stray 'Exchange' word in reduction comment
- fattn-mma-f16.cuh / fattn-new-mma.cu: 'synchonization' -> 'synchronization'
- fattn-new-mma.cu / fattn-vec-common.cuh: 'at lease' -> 'at least'
- fattn-vec-f32.cuh: 'Currenlty'/'dose' -> 'Currently'/'does'
- mmq_id_common.cuh: 'alays' -> 'always'
- softmax.cu: 'noncontigous' -> 'noncontiguous'

CPU / quantization:
- ggml-quants.c: 'At leat' -> 'At least'
- ggml.c: 'repeatition' -> 'repetition'

CANN:
- aclnn_ops.cpp: 'alloced' -> 'allocated', 'contigous' -> 'contiguous'
- kernels/dup.cpp: 'contigous' -> 'contiguous'

IQK:
- iqk_gemm_1bit.cpp: 'explicitely' -> 'explicitly'
- iqk_gemm_ktquants.cpp: 'nn AVX2' -> 'in AVX2'

Vulkan:
- ggml-vulkan.cpp: duplicated 'in in' -> 'in'

* ggml: fix less-common typos in comments (spellchecker pass)

Second sweep using a spell-check pass with edit-distance filtering to catch
typos missed by the common-misspelling list. Comment/comment-context fixes
only, no code changes:

- aclnn_ops.cpp: 'performace' -> 'performance'
- acl_tensor.cpp: 'shoule in' -> 'should be in'
- common.h: 'opertors'/'available' -> 'operators'/'available'
- ggml-cuda.cu: 'resepctive' -> 'respective', 'resinding' -> 'residing'
- conv2d.cu: 'ouptut_chanles' -> 'output_channels'
- scale.cu: 'Whehn' -> 'When'
- mmq_id_common.cuh: 'renameing' -> 'renaming'
- solve_tri.cu: 'supress' -> 'suppress'
- ggml-quants.c: 'ptoducts' -> 'products', 'quckly' -> 'quickly',
  'Acummulate' -> 'Accumulate'
- ggml-sycl.cpp: 'solutino'/'walkaroud' -> 'solution'/'workaround'
- ggml-vulkan.cpp: 'aross' -> 'across'
- ggml.c unified base: signficantly -> significantly (recorded in iqk too)

Also fixed duplicate word 'get get' in the quckly comments (line 14272/14488).

* Fix typo: correct hard-to-count words in comments/docs across common/examples

Spellcheckedtypos across common/, examples/, tests/ and include/ (from
typos2.txt): preserve->preserving, replacement->replacemnt,
enhance->enchance, imatrix/ima->imatrix, correct->corerct,
parameter->parmeter, utilizing->utilitizing, backward->backwrad,
manipulate->manupulate, together->togather, incomplete->parial,
sentence->dentence, retrieval->retie, prepared->prepa, partial->parial,
randomly->Randonly. Comment/prose only, no code changes.

* fixing typos (public_simplechat example)

* fixing typos (examples subdirs)
2026-08-04 07:15:28 +03:00
Samuel Oliveira AlvesandGitHub 60389410a1 Apply helper functions to the MTP graph (#2238)
* refactor: streamline MTP state handling and input building functions

* move reshape logic outside mtp helper function
2026-08-03 19:27:19 +03:00
Samuel Oliveira AlvesandGitHub 276e4ea1eb fix: isolate DFlash cross-device IO (#2243)
* fix: isolate DFlash cross-device IO

* remove unnecesary syncronization and simplify logic for tensors copies
2026-08-03 19:22:29 +03:00
KawrakowandGitHub c013cd876b Do not quantize integer tensors (#2246) 2026-08-03 10:42:17 +03:00
87eeec9f74 openpangu: support server context checkpoints and prompt reuse (#2245)
Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-03 09:23:01 +03:00
KawrakowandGitHub bee545824a Allow concatenating quantized tensors (#2232)
* Allow concatenating quantized tensors

* Missed this assert

* Allow K to be f32 in ggml_cuda_op_indexer_topk
2026-08-03 08:01:57 +03:00
NexesenexandGitHub c3b075f069 Chores : tidy up more typos project wide (ggml directory excluded), new -ptcall alias (#2237)
* common: fix coding mistakes (typos in identifiers, flags and log strings)

Fix misspelled identifiers and user-facing strings across common, server
and model loading:

- allow_ruless -> allow_rules (misspelled identifier used in the allowlist
  CLI parsing and the server slot/context code)
- get_formated_timings/get_formated_generation -> get_formatted_*
- 'termionated' -> 'terminated' in the fit-margin assert message
- 'defaulr' -> 'default' in the YAML dump
- 'overriden' -> 'overridden' in tensor buffer type override logs
- 'becausee' -> 'because' in the output-tensor split log
- 'etected NaNs' -> 'detected NaNs' in the imatrix error message

* common: fix comment typos across src, common, include and examples

Fix misspelled words in code comments:

- llama.h: 'typy' -> 'type', 'transfrom' -> 'transform', 'ecoder' ->
  'encoder', 'indicies' -> 'indices', 'Intializes' -> 'Initializes'
- common.h: 'embendings' -> 'embeddings', 'pr' -> 'or' in the
  fused-indexer-topk comment
- chat.cpp: 'overridde' -> 'override'
- ngram-map: 'occurences' -> 'occurrences', 'stastistics' -> 'statistics'
- speculative.cpp: 'dont'/'inehit' -> 'don't'/'inherit'
- llama-mmap.cpp: 'dont't' -> 'don't'
- llama-model.h: 'hcurrently andle' -> 'currently handle'
- build_gemma3/4.cpp: 'emdeddings' -> 'embeddings'
- examples: 'quantizuation', 'logprobe', 'throught', 'retrun', 'swich',
  'convinient', 'temporally' (-> 'temporary'), 'temproal', 'preceed'

* common: remove duplicate definitions and duplicate help entries

- clip-impl.h: drop the second, identical #define TN_FFN_GATE
- common.cpp: remove the duplicate '-t, --threads N' help entry that was
  misplaced in the export-lora section (already listed in the general
  section)
- common.cpp: merge the two 'embedding' help groups into a single group
  so the embedding options are listed together
- llama.cpp: remove the redundant LLAMA_MAX_LAYERS define (llama-hparams.h
  already defines the same value and is included by llama.cpp)

* common: fix remaining typos (accomodate, recommanded, occurences, occassionally)

- accomodate -> accommodate in src/llama.cpp comment
- recommanded -> recommended in quantize.cpp user-facing output
- occurences -> occurrences in test-chat.cpp JSON string
- occassionally -> occasionally in vendor/stb/stb_image_resize2.h comment

Note: tokenizer.ggml.seperator_token_id kept as-is to match GGUF spec

* common: remove duplicate help entries

- remove the duplicate '--reasoning-budget N' help entry that was repeated
  in the main section (introduced in e0596bf614 'Autoparser - complete
  refactoring of parser architecture (PR 1376)')
- remove the second '--parallel-tool-calls' help entry that advertised the
  '-ptc' short flag, which belongs to '--print-token-count' (introduced in
  e0596bf614 'Autoparser - complete refactoring of parser architecture
  (PR 1376)'); the '-ptc' alias was non-functional for '--parallel-tool-calls'
  because the parser only binds it to '--print-token-count'

The canonical help entries are kept:
- '--reasoning-budget N' is listed once
- '--parallel-tool-calls' is listed once (without the conflicting '-ptc' alias)

* common: remove duplicate LOG_ENABLE define

- the '#undef LOG_ENABLE / #define LOG_ENABLE() // dummy stub' pair was
  repeated verbatim inside the LOG_DISABLE_LOGS section
- remove the second occurrence (introduced in a2588b53e1 'main : log
  file (PR 2748)')

* llama-bench: align MLA and attention-max-batch flags with common tools

llama-bench used '--mla-attn' and '--attn-max-batch' while the common
CLI parsing (common/common.cpp) uses '--mla-use' and
'--attention-max-batch' for the same features. This made the flags
inconsistent across tools.

- update the help text to advertise the canonical names
  '--mla-use' and '--attention-max-batch'
- keep the old '--mla-attn' and '--attn-max-batch' spellings working
  as aliases so existing scripts are not broken

The divergent names were introduced in 3e536b95b0 'Add optional MLA
(PR 188)'.

* fix typos in comments and user-facing strings

- ngram-map.cpp: 'Do we haven a existing' -> 'Do we have an existing'
  (introduced in 1cb7e1bf39 'spec : add self speculative decoding,
  ngram and refactor (PR 1261)')
- build_mamba.cpp: 'weigth' -> 'weight' (introduced in 8befd92ea5
  'Refactor model compute graphs (PR 1651)')
- gguf-split.cpp: 'one of splits have 0 tensors' -> 'one of the splits
  has 0 tensors' (introduced in 75b580db0a 'split: allow
  --split-max-size option (PR 6343)')
- gguf-split.cpp: 'merged from %d split' -> 'merged from %d splits'
  (introduced in 1b5523dc79 'gguf-split: split and merge gguf per
  batch of tensors (PR 6135)')
- convert-llama2c-to-ggml.cpp: missing opening quote in the help line,
  '(default %s\\')' -> '(default '%s\\')' (introduced in bb9ebb4394
  'Adding support for llama2.c models (PR 2559)')

* harmonize British and American spelling to American English

The codebase uses American English (e.g. --embd-normalize, --color),
but a few strings/comments still used British spellings. Unify them:

- 'normalisation' -> 'normalization' in common.h, common.cpp help text
  and code comment, and llama-build-context.cpp comment
- 'colorise' -> 'colorize' in the --color help text (common.cpp)
- 'behaviour' -> 'behavior' in a chat.cpp warning and a llama.cpp comment
- also fix 'openai' -> 'OpenAI' capitalization in the embedding help
  text and common.h comment (embedding output format is OpenAI-style)

* common: fix help text formatting inconsistencies

- '-smf16'/'--split-mode-f16' and '-smf32'/'--split-mode-f32' help
  entries displayed hardcoded 'true'/'false' as the default value;
  show the actual state derived from params.reduce_type instead
- '-no-mmad' help entry had 'fused_mmad?' without a space before the
  ternary operator
- '--reasoning-tokens' help continuation lines used tab characters for
  indentation while the sibling '--reasoning-format' entry uses spaces;
  convert to consistent space indentation

* common: revert smf16/smf32 help text default display change

Revert the '-smf16'/'--split-mode-f16' and '-smf32'/'--split-mode-f32'
help entries back to their original hardcoded 'true'/'false' default
display. The change to derive the default from params.reduce_type was
not desired; the split-mode options are legacy and the hardcoded
defaults reflect their intended meaning.

The other formatting fixes in the same area (fused_mmad ternary
spacing and the reasoning-tokens tab-to-space indentation) are kept.

* llama-bench: fix help text column alignment

The --mla-use and --attention-max-batch help lines introduced by the
flag alignment landed one column off from the sibling entries
((default: at column 51 instead of 50). Adjust the padding so all
help lines align.

* common: fix help text defaults for graph-reduce-type and log-format

Mismatch 1: -grt, --graph-reduce-type help shows default "f32", but actual default (common.h:463) is "f16" and llama.cpp uses GGML_TYPE_F16.

Mismatch 2: --log-format help shows default "json", but actual default (common.h:536 log_json=false) is text.

* common: add -ptcall short flag for --parallel-tool-calls

* typo
2026-08-03 08:01:18 +03:00
Kawrakow cb9147fd0d Fix the fix 2026-08-02 15:16:03 +00:00
KawrakowandGitHub 96938a1094 Disable quantized indexer cache (#2236) 2026-08-02 18:07:31 +03:00
KawrakowandGitHub 5692312327 Fix IQ4_NL_R4 GEMM on CPUs with FANCY_SIMD enabled (#2233) 2026-08-02 11:15:36 +03:00
4b6b167cd7 openpangu: build mHC through the shared fused helpers (#2230)
Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-02 09:47:52 +03:00
Samuel Oliveira AlvesandGitHub 0be97a7a5a DeepSeek 4 MTP implementation (#2216)
* add standalone DeepSeek V4 MTP

* fix openPangu indexer tensor identities

* spec-bench: checkpoint DeepSeek V4 before draft

* minor changes in comments
2026-08-01 16:45:48 +03:00
replikeitandGitHub bd2d8e1029 speculative : fix MTP warmup conditioning row 0 on a future hidden state (#2222)
common_speculative_on_target_batch stored this batch's last hidden into target_hidden_by_seq before reading the map back for the shifted warmup conditioning, so row 0 was conditioned on this batch's last hidden (a future state) instead of the previous call's, and the position-0 zeros fallback was unreachable. Snapshot the previous value before the store; other readers are unaffected. Warmup-only; affects draft acceptance, not correctness.
2026-08-01 16:40:30 +03:00
KawrakowandGitHub f2bde5749b Faster indexer top_k for very long context (CPU) (#2206)
* Faster indexer top_k for very long context (CPU)

* Minor
2026-08-01 09:17:51 +03:00
8ba790e8ad state: fix V cache compatibility check for models with no V cache (#2212)
read_kv_cache_data gated the restore on kv_self.v_trans != (v_state == 1).
v_state == 2 records that the writer had no V cache, while v_trans tracks
flash attention rather than V allocation, so with -fa 0 on a K-only or MLA
cache the two disagree and the restore is refused.

Compare V cache presence in both directions, and transposition only when a
V cache exists on both sides. The write path and serialized layout are
unchanged.

Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-01 09:17:04 +03:00
NexesenexandGitHub 7064b7b6b7 Chores: tidy up common.cpp + 5 new aliases (#2220)
* Short aliases for context checkpoints

* common: fix typos and add/document obvious short aliases

Typos fixed in --help output:
- Swapped long names for -ctv-last/-ctk-last: --cache-type-k-last and
  --cache-type-v-last now match their K/V semantics
- --scheduler-async (was --scheduler_async) and fix stray ')' in its help text
- Remove stray trailing commas in --merge-qkv, --merge-up-gate-experts,
  --k-cache-hadamard, --v-cache-hadamard, --split-mode-f16, --split-mode-f32,
  --split-mode-graph-scheduling
- 'top-n-sigma parmeter' -> 'parameter'
- 'embendings' -> 'embeddings' (2x)

Short aliases:
- New: -okv alias for --override-kv
- Document previously undocumented aliases in --help: -rtr, -cmoe, -ncmoe,
  -thp (also adds the previously missing --transparent-huge-pages entry),
  -ofreq, -to, -spf

* common: standardize arg parser to short-alias-first ordering

gpt_params_find_arg now consistently lists the short alias before the
full --long-name argument, matching the dominant convention (103 short-first
lines). Reordered 19 options that had the long name first: -gan, -gaw, -dt,
-mea, -ps, -mtprot, -mg, -sm, -ts, -ot, -gfm, -cmoe, -ncmoe, -dr, -op,
-no-ooae, -to, -sps, -wb. Pure style change, no functional impact.

* common: systematize cache-type help order, fix -cram-n-min help

- Reorder the mixed KV cache-type help entries to k-first, k-last,
  v-first, v-last for logical grouping (short alias, then full name,
  matching the parser convention)
- -cram-n-min now shows its N argument in --help (was missing)
2026-08-01 09:14:16 +03:00
replikeitandGitHub 8802ed2dc5 sampling : fix use-after-scope in grammar trigger_words path (#2221)
llama_sampler_init_grammar_impl built the trigger_words pattern in a block-scoped std::string, stored a pointer into it (trigger_pattern_c), pointed trigger_patterns at that pointer, then let the block drop both locals before llama_grammar_init_impl dereferenced trigger_patterns -- a read of a dangling pointer into freed std::string storage (UB). Hoist trigger_pattern and trigger_pattern_c to function scope so both outlive the call.
2026-08-01 08:55:31 +03:00
KawrakowandGitHub a8ae4fb36f Fix IQ3_XXS CPU GEMM (#2224) 2026-08-01 08:51:59 +03:00
KawrakowandGitHub 3f53a05902 Fix constants.py (#2219) 2026-07-31 12:59:26 +03:00