Skip to content

dflash : run DFlash2 under split mode tensor - #89

Open
Piggidragon wants to merge 2 commits into
GenerelSchwerz:llama/devfrom
Piggidragon:spec/dflash2-split-mode-tensor
Open

dflash : run DFlash2 under split mode tensor#89
Piggidragon wants to merge 2 commits into
GenerelSchwerz:llama/devfrom
Piggidragon:spec/dflash2-split-mode-tensor

Conversation

@Piggidragon

Copy link
Copy Markdown

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 runs top_k and get_rows on them, and the meta backend cannot run either op on a vocab split:

ggml-backend-meta.cpp:543: GGML_ASSERT(src_ss[0].axis != GGML_BACKEND_SPLIT_AXIS_0) failed

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_k and get_rows on 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_tensor aborts 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 CUDA0 does not work around the bug. The draft then runs layer split and cannot read the target's output.weight from the meta buffer:

ggml-backend.cpp:941: pre-allocated tensor (output.weight) in a buffer (Meta()) that cannot run the operation (NONE)

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:

result
llama/dev aborts in warmup (assert above)
this PR 76 tok/s, draft acceptance 89.5% (94/105) and 91.2% (83/91) over two runs
this PR, -sm layer 67 tok/s, acceptance 94.3%, unchanged path

test-llama-archs -a qwen35 / llama / qwen3next: the Meta rows pass, the same as on llama/dev.

Not covered here:

  • Host-resident draft KV (--kv-gpu-layers-draft, or -nkvo) under split mode tensor does not crash on llama/dev with 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.
  • With host KV on the target, llama/dev aborts in warmup before the draft loads (i_start == cgraph->n_nodes). ggml-meta : split a host-resident KV cache by head #66 fixes that.
  • On the local stack with those PRs, the full config at 262k context runs at 68 tok/s, 94% acceptance.

The subgraph hunk touches the same loop as #66, so whichever PR merges second needs a small rebase.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - implemented by an agent on my instruction, see the Assisted-by: commit trailers.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W8hAxqSiBjFwK9CdBaYCut

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant