feat(mla): serve a block drafter from the CuteDSL MLA backend - #1222
Merged
Conversation
DSpark proposes a whole block in one decode forward, so the attention backend must record spec_num_tokens rows per request and re-derive their lengths on every replay. This backend already named the buffer the drafter reaches for (draft_seq_lens_attr) but allocated one row per request and never implemented the hook, so a DSpark run with --drafter-attention-backend tokenspeed_mla died at startup on a missing fill_block_decode_seq_lens. Each request now expands into spec_num_tokens single-query rows that share the block-end length, which is how the other backends spell it: the kernel takes each row's mask from its own cache length, so equal lengths let every block query attend over the whole block including the positions after it. The page ids repeat across a request's rows and the lengths are written inside the captured graph from the live draft length. The three GB300 DSpark gates move onto it. They had inherited `mla` from the AMD gate they were modelled on, where it is the only MLA backend there is; on NVIDIA that costs the draft its split-KV, and the five-layer draft then spends more per layer than the target's tuned kernel does. The AMD gates keep `mla`, which is the portable spelling. Measured on GB200 with a four-node TP16 serve, decode goes from 324.2 tok/s to 450.8 tok/s, against 436.9 for trtllm_mla. Accepted tokens per round are unchanged from the mla baseline (6.905/5.479 against 6.905/5.453), so the block keeps its non-causal semantics rather than trading draft quality for speed. The tests cover what would silently change what a block query attends to, and one of them spies on the decode call: the helper-level cases all pass even when the expansion never reaches the kernel, because reshaping the block back onto the query axis restores exactly the causal order the draft must not have. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DxaFPVQF6L13TGgrbwnDdh Signed-off-by: Nicolas Perrin <nperrin.ai@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.
DSpark proposes a whole block in one decode forward, so the attention backend must record spec_num_tokens rows per request and re-derive their lengths on every replay. This backend already named the buffer the drafter reaches for (draft_seq_lens_attr) but allocated one row per request and never implemented the hook, so a DSpark run with --drafter-attention-backend tokenspeed_mla died at startup on a missing fill_block_decode_seq_lens.
Each request now expands into spec_num_tokens single-query rows that share the block-end length, which is how the other backends spell it: the kernel takes each row's mask from its own cache length, so equal lengths let every block query attend over the whole block including the positions after it. The page ids repeat across a request's rows and the lengths are written inside the captured graph from the live draft length.
The three GB300 DSpark gates move onto it. They had inherited
mlafrom the AMD gate they were modelled on, where it is the only MLA backend there is; on NVIDIA that costs the draft its split-KV, and the five-layer draft then spends more per layer than the target's tuned kernel does. The AMD gates keepmla, which is the portable spelling.Measured on GB200 with a four-node TP16 serve, decode goes from 324.2 tok/s to 450.8 tok/s, against 436.9 for trtllm_mla. Accepted tokens per round are unchanged from the mla baseline (6.905/5.479 against 6.905/5.453), so the block keeps its non-causal semantics rather than trading draft quality for speed.
The tests cover what would silently change what a block query attends to, and one of them spies on the decode call: the helper-level cases all pass even when the expansion never reaches the kernel, because reshaping the block back onto the query axis restores exactly the causal order the draft must not have.
Summary
Test Plan