dflash : run DFlash2 under split mode tensor - #89
Open
Piggidragon wants to merge 2 commits into
Open
Conversation
The scheduler keeps a view in the split where it sits, not where its data lives. A view of a CPU op can therefore end up in a meta split, where it has no simple tensors and aborted. Treat it like the existing host-leaf case, and let it close the last subgraph. Assisted-by: Claude Opus 5
Split mode tensor splits the logits over the vocab, and the meta backend cannot run top-k or get_rows on that. Copy the logits to the CPU for the candidate pick, the scheduler gathers the slices on the way. Assisted-by: Claude Opus 5
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
A DFlash2 draft aborts on the first decode under
--split-mode tensor.DFlash2 uses the target's
output.weight. Under split mode tensor that weight is split over the vocab, so the draft logits are too. The selector then runstop_kandget_rowson them, and the meta backend cannot run either op on a vocab split:The backend has no all-gather. The target has the same problem and turns off backend sampling under split mode tensor. This PR does the same for the selector: it copies the logits to the CPU for the candidate pick, and the scheduler gathers the slices on the way. Only the
top_kandget_rowson the logits run on the CPU. The rest of the selector stays tensor-parallel.The CPU copy exposes a second bug. The scheduler keeps a view in the split where it sits, not where its data lives. A reshape of the CPU copy can land in a meta split, and
ggml_backend_meta_buffer_simple_tensoraborts on it. The meta backend already skips one such case, a view of a host leaf (s_copy_main). This PR extends that check to any view whose data is outside the meta buffers, and lets that view close the last subgraph, as #66 does for the host cache.Pinning the drafter with
-devd CUDA0does not work around the bug. The draft then runs layer split and cannot read the target'soutput.weightfrom the meta buffer:Testing
Qwen3.8-27B-UD-Q4_K_XL target, Qwen3.8-27B-DFlash2-Q4_K_M draft, RTX 4070 + RTX 3060,
-sm tensor -ts 0.5,0.5 -np 2 -c 32768, KV on device,--spec-draft-n-max 7:llama/dev-sm layertest-llama-archs -a qwen35 / llama / qwen3next: theMetarows pass, the same as onllama/dev.Not covered here:
--kv-gpu-layers-draft, or-nkvo) under split mode tensor does not crash onllama/devwith this PR, but the draft acceptance drops to 0.2%. With ggml-meta : split a host-resident KV cache by head #66 and the other stacked split-mode-tensor PRs on top, the same setup reaches 91-94%. So this belongs to those PRs, not this one.llama/devaborts in warmup before the draft loads (i_start == cgraph->n_nodes). ggml-meta : split a host-resident KV cache by head #66 fixes that.The subgraph hunk touches the same loop as #66, so whichever PR merges second needs a small rebase.
Requirements
Assisted-by:commit trailers.🤖 Generated with Claude Code
https://claude.ai/code/session_01W8hAxqSiBjFwK9CdBaYCut