[DSv4 fix proposal — pending upstream support] deepseek4 - #1
Draft
leon7609 wants to merge 1 commit into
Draft
Conversation
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.
PR #1: deepseek4: cast padded KV to f32 on FA reserve path
Description
Follow-up to the DeepSeek V4 Flash support work (originally PR ggml-org#22378). When the FA path emits
kq_maskand pads KV to 256 (introduced in commitc77f14368of that work), the padded KV tensor is kept in F16 while the downstream FA op expects F32. This causes aGGML_ASSERTdeep in the FA path duringgraph_reserve, only surfaced once-np >= 2is attempted on antirez's IQ2XXS DSv4 GGUF.Single-file delta in
src/models/deepseek4.cppto insert aggml_cast(..., GGML_TYPE_F32)on the padded KV path before it is consumed by the FA reserve graph.Reproduction (before fix)
Without the F32 cast, server crashes during
sched_reservewith a GGML_ASSERT walking the worst-case graph for the second slot.After fix
Same command, server boots in <60 s.
np=2×c=524288(256 K per slot) reaches steady state. End-to-end probes (smoke / latency / tps / json_obj / json_schema strict / tools / long_ctx_12k / long_ctx_32k / chinese_prose / thinking) all pass 10/10.Hardware tested
cmake -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120 -DGGML_CUDA_FA=ONWhy upstream
Independent of the broader batched-prefill chain in nisparks PR ggml-org#22378 (which is closed and marked reference-only). This single fix is required for any DSv4 multi-slot path that relies on
c77f14368's KV padding. Should apply cleanly to whichever branch eventually upstreams DSv4 support.Related
fix/deepseek4-swa-multislot-views(handles a separate 4D-cache-view multi-slot issue)