Repository navigation
gpu::draft: one executor for a draft's walks of several slots, with Qwen3.8's MTP and GLM's NextN as its programs - #1102
Conversation
…wen3.8's MTP and GLM's NextN as its programs A store walk of several resident sequences' rows and a round of several slots' window chains were Qwen3.8's own code (Body38's mtp_store_slots, mtp_chain_slots and mtp_chain_round), and GLM's NextN walked its slots in turn, one readback a slot. The rounds now have one owner in gpu::draft: GpuModel::draft_store_slots and GpuModel::draft_chain_slots refuse a slot named twice, cut the chains into rounds at the program's row and readback bounds, make the homes canonical (on_slots), walk each depth over every chain that reaches it with each chain's append and attention on its own sequence, read the round back once and poison every slot of a call a fault met. A program implements SlotDraft: its staging, its row-wise launches, its per-sequence append and attention, its head and readback. Body38 implements it with Mtp38's existing phases, so Qwen3.8's walks and proposals are the same launches as before. GLM's Body implements it by splitting the NextN walk into the same phases (stage, front, append, full part): a round stages each slot's refresh at its own arena rows, runs the embedding norms, eh_proj and the joined projection once over every slot's rows, then each slot's append and full part over its own store, and reads every slot's proposal back once (head::read_tokens over a buffer laid out as the head's argmax words). The one-sequence walk runs the same four phases. app::mtp's chains_at_once and write_proposal serve both adapters' chain_slots; Proposal (the readback's ids and probabilities) moved from qwen3moe to gpu::draft.
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix finding remains; the evidence requests are non-blocking.
Non-blocking
⚠ Supply the PTX comparison: crates/gpu/src/draft.rs:638 moves Qwen3.8's executor. The body reports gates and timing but no PTX comparison. Attach just canon-check 1dfd2c2b86d21f1a117cff8bd94d381864d95fed output for the move/split class.
⚠ Measure GLM's changed geometry: crates/gpu-glm5next/src/nextn.rs:1516 combines the slots' refresh rows into one projection width and reduces proposal readbacks from one per slot to one per round. The timing table covers Qwen3.8. Attach a GLM two-slot base/head A/B on the contributor's card for the geometry class.
Optimization headroom
- D, More at once: crates/gpu-glm5next/src/nextn.rs:1372 opens the existing BatchLeg with one column per slot. For S slots, batching these rows through that port would reduce route-download groups, host union calls and sum uploads from S to one each per draft round.
Checked
Ownership: the shared executor replaces Qwen3.8's slot orchestration; both model implementations use it.
Complexity: NextN's existing walk is split into staging, projection, store append and full-row phases.
Silent failure: empty chain lists do not enter a round; GLM refuses probability requests before dispatch.
Tests: static mutation inspection at crates/app/src/mtp.rs:442 and crates/gpu/src/draft.rs:392: dropping the token copy or changing the depth filter from >= to > would fail the new assertions.
Gates: the changed Qwen gate follows API renames without changing assertions. The bounded-wait selector follows read_tokens with a dated PIN and reason.
Escape catalog: none of its four shell patterns appears in the changed script lines.
Notes
Review was static; tests and card gates were not rerun. Posted runs identify 39ed53b→4fe6f97, while this review covers 1dfd2c2→54f76b0. Current-head GPU evidence is absent.
Card check: needs-gpu. This pull request changes crates/app/src/arch/glm5next/mtp.rs, crates/app/src/arch/qwen3moe/mtp.rs, crates/app/src/mtp.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
여러 slot의 draft walk를 공용 executor 하나로 옮겨 Qwen3.8 MTP와 GLM NextN이 함께 쓰게 했고, Qwen3.8의 launch는 그대로이며 측정한 모든 arm에서 손실이 없습니다.
What and why
A draft that walks several sequences in one pass needs the same steps whatever the model: refuse a slot named twice, cut the chains into rounds the program's limits allow, give each chain's attention its own sequence, and read the proposals back. Qwen3.8's MTP kept that assembly in its own files (
body38.rs,mtp38.rs), and GLM's NextN had none, so its slots ran one after another with one readback each.crates/gpu/src/draft.rsnow owns it: theSlotDrafttrait,GpuModel::draft_store_slotsandGpuModel::draft_chain_slots. A program supplies only its steps. Qwen3.8'sBody38and GLM'sBodyimplement the trait, so a new model's MTP has to write only those steps. Qwen3.8 issues the same launches in the same order as before. GLM's NextN round now runs the embedding norm,eh_projand the joined projection once for every slot's row and reads the proposals back once per round, where it read back once per slot.Release notes: Under the hood: Qwen3.8 MTP and GLM NextN walk several slots through one shared executor, and GLM's NextN reads its proposals back once per round.
Code shape
The review reads these first. A box left unticked needs one line of why.
crates/gpu/src/draft.rs.ChainBlock,Proposaland the chain type moved there from Qwen3.8's files, andHead::tokensnow calls the sharedread_tokens, which the GLM round readback reuses.impl SlotDraft<TargetRows> for Body38andimpl SlotDraft<GlmArena> for Bodyeach call their program's own steps. The common owner gained no per-model branch, flag or trait method.mtp_store_slots,mtp_chain_slots,mtp_chain_round,SlotChain38,MtpDraftandchain_spansare removed.gate_qwen4exp_mtp.rsonly follows the renamed functions.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": the slot round incrates/gpu/src/arch/qwen3moe/body38.rs(mtp_store_slots,mtp_chain_slots,mtp_chain_round) andChainBlock,MtpDraftandchain_spansincrates/gpu/src/arch/qwen3moe/mtp38.rs, removed after the move intocrates/gpu/src/draft.rs.What I ran
Every check below ran on a DGX Spark. The card line is from:
The upstream base is
39ed53b875a0811cdaf587dd19963da24a650c48and the PR head is4fe6f97960d0999531eb85a3cd35cea616337e45.Host test and lint on the PR head:
Gates on the changed paths, fixture tier on the card (
BLOOMERY_BOX_LOCAL=1,BLOOMERY_TIER=fixture):./tools/box.sh 'bash tools/gate.sh --gpu --oxide -p bloomery-gpu --release --lib -- draft::tests' just gate-gpu-qwen4exp-mtp just gate-gpu-glm5next-mtpThe real Qwen3.8 server binary, built with the gate feature set, with MTP at
--parallel 2, drafted and plain arms:Both arms exit 0, no check line fails, and 96 check lines print PASS across the two arms.
Speed, TP=1, P=4096, K=128, three rounds per side on one GB10, base and head built and timed in one run. Each side is built in its own checkout (
baseorhead):The servers, with
MODEL_FP4Lset to the FP4-Local folder (Hardware below), for the draft-off arm, the MTP C=1 arm and the MTP C=2 arm:Each request is a
POST /completionwhose prompt is 4,096 token ids from a fixed window of a token-id corpus (code-fn, SHA-2567520b471436fb307e91ee22640ad8100701d48e63e3da7de9160b705b92915d1; prose-en,d10c7044df8884fdd200304604772d81a4b56a228f802d5f05db724b245ef77a), withn_predict128. The draft-off and MTP C=1 arms send one request at a time at temperature 0 (draft off on code-fn only). The MTP C=2 arm sends two at once at temperature 0.7 with seed 42. Each arm times eight windows 50,000 ids apart after two warm-up windows. Prefill and decode tok/s come from the server's timings, TTFT p95 and total tok/s from the client clock. Each cell is the median of three rounds with their range in parentheses. A positive change is faster. Head and base print the same 128 token ids per request, and draft on and off print the same ids on each side:The change claims no speed gain. Qwen3.8 issues the same launches as before, and the base and head ranges overlap in every row except MTP C=1 prose-en decode (+0.90%).
Hardware (if the change is for a machine)
NVIDIA GB10 (DGX Spark), driver 595.84, CUDA 13.3. Model:
model.safetensors.index.json5fa166bbb1cf25adda455117563efa72a2072272001f459eedece131ffc913e1)AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.