llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized - #25871
Merged
ggerganov merged 3 commits intoJul 31, 2026
Merged
Conversation
…FA if V cache is quantized
fairydreaming
commented
Jul 18, 2026
| } | ||
| } | ||
|
|
||
| if (model->arch == LLM_ARCH_DEEPSEEK4 && params.type_k != params.type_v) { |
Contributor
Author
There was a problem hiding this comment.
I think this currently applies also to DeepSeek V3.2 and models where hparams.is_mla() is true since they use a view of K cache as V cache, maybe it's worth extending the condition?
ggerganov
approved these changes
Jul 27, 2026
| } | ||
| } | ||
|
|
||
| if (model->arch == LLM_ARCH_DEEPSEEK4 && params.type_k != params.type_v) { |
ggerganov
approved these changes
Jul 28, 2026
edwinbrowwn
pushed a commit
to edwinbrowwn/llama.cpp-rdna2
that referenced
this pull request
Aug 1, 2026
…FA if V cache is quantized (ggml-org#25871) * llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized * llama : enforce the same K and V cache types for MLA models --------- Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
kashif
pushed a commit
to kashif/llama.cpp
that referenced
this pull request
Aug 2, 2026
…FA if V cache is quantized (ggml-org#25871) * llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized * llama : enforce the same K and V cache types for MLA models --------- Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
huaxel
pushed a commit
to huaxel/CachyLLama
that referenced
this pull request
Aug 2, 2026
…FA if V cache is quantized (ggml-org#25871) * llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized * llama : enforce the same K and V cache types for MLA models --------- Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
smalinin
pushed a commit
to smalinin/llama.cpp
that referenced
this pull request
Aug 4, 2026
…FA if V cache is quantized (ggml-org#25871) * llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized * llama : enforce the same K and V cache types for MLA models --------- Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
NighmareGit
pushed a commit
to NighmareGit/atomic-llama-cpp-turboquant
that referenced
this pull request
Aug 8, 2026
Merges 251 upstream commits on top of the fork's 392. Base was 22b208b (2026-07-15). What this brings in for DeepSeek V4: - CUDA kernels for the hyper-connection ops and the lightning indexer (dsv4-hc.cu, lightning-indexer.cu, upstream ggml-org#25585 and ggml-org#25545). These landed upstream after our base, so the graph no longer needs a CPU fallback for those ops. - MTP and DSpark support (ggml-org#25784), the wo_a reshape fix on load, and the same-K/V-cache-type enforcement (ggml-org#25871). - Exclusion of the i32 ffn_gate_tid2eid routing table from quantization, which the fork did not carry. Conflict resolution kept both architectures everywhere the two sides touched the same code: - llama-kv-cache: kept the fork's default-off attention-rotation policy and its env overrides, took upstream's GLM_DSA addition to the DSA indexer arch list. - llama-context: moved the TurboQuant flash-attention auto-enable above upstream's generic quantized-V check, which would otherwise reject turbo cache types under -fa off, and dropped the fork's older V-cache check in favour of upstream's. - mmq.cuh: kept the fork's int64 offsets in all three of upstream's new NVFP4 branches. - fattn.cu: dropped the WMMA block, since upstream removed that kernel and its helpers entirely; kept the RDNA4 turbo path. - ggml-cuda.cu: kept the host-staged cross-device copy and routed its peer copy through upstream's new virtual-to-physical device mapping. - chat.cpp: rebuilt on upstream's file with the fork's Inkling and Laguna parsers and the leading-whitespace tolerance reapplied; thinking_end_tag became thinking_end_tags upstream. - laguna.cpp/laguna.py and mtmd-image.cpp: took upstream, which already carries the fork's own upstreamed review fixes plus later refinements. - Removed the inherited upstream workflows again, per 0c9a069. GGML_OP_COUNT is 103: upstream's 101 plus the fork's TURBO_WHT and FLASH_ATTN_EXT_BANDED. Also drops a duplicate LLM_ARCH_LAGUNA case in test-llama-archs that the merge would otherwise have left in moe_mandatory.
satindergrewal
pushed a commit
to satindergrewal/llama.cpp
that referenced
this pull request
Aug 11, 2026
…FA if V cache is quantized (ggml-org#25871) * llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized * llama : enforce the same K and V cache types for MLA models --------- Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
satindergrewal
pushed a commit
to satindergrewal/llama.cpp
that referenced
this pull request
Aug 12, 2026
…FA if V cache is quantized (ggml-org#25871) * llama : enforce the same K and V cache types for DeepSeek V4; enable FA if V cache is quantized * llama : enforce the same K and V cache types for MLA models --------- Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes issue described in detail here. It does it by:
Fixes #25851
Requirements