Repository navigation
app, gpu, qwen38: a load captures its rounds' passes and each slot's step and draft walks before it serves - #1096
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: stopping generation can leave an ahead-step device fault unreported and save its state.
Must fix
1. Check the last ahead step before its state can be saved (kind A)
crates/gpu/src/model.rs:1441 copies the previous step's fault words before launching the ahead step. With one slot, graph mode, no draft, and token budget remaining, a greedy EOS answer is evaluated ahead. A non-finite value in its untied BF16 embedding raises a device fault, but the call returns the previous step's clean result. Generation stops without another readback. crates/gpu/src/arch/qwen3moe/body38.rs:5423 checks only recorded poison and saves that state. crates/gpu/src/model.rs:1159 then clears the unread fault on a one-slot reset.
Catch this before prompt caches can retain condemned recurrent state across requests. Track and validate the pending ahead result before save/reset. Until that lifecycle check exists, insert this after the served match to validate the launched step before returning:
let served = served.and_then(|()| {
head.copy_tokens(gpu)?;
head.copied_token().map(|_| ())
});This conservative fix waits for the ahead step. Add a device gate that raises a fault only in the ahead step, stops on its input token, and requires an error before a snapshot succeeds.
Non-blocking
⚠ Refresh the revision evidence: crates/gpu/src/model.rs:1385. The reported gates and A/B name 0dbe02c → 3c70dec; this review covers 547a846 → 59d1df5. Attach the owning gates and dispatch A/B for this pair, or establish that the tested patches are identical. Resolving that now makes the reported speed change attributable to the code being merged.
Checked
Silent failure: traced the copied readback, host service on a card-only load, poison recording, synchronous and asynchronous snapshots, and reset. Successful results do not read the ahead step's fault.
Tests: the added API test compares plain and ahead mock answers and saved token counts. It does not exercise device faults.
Gates: the unsafe-count change carries a dated PIN reason. The PR supplies no FAIL-first output for the added tests.
Escape catalog: no matching pattern. Ledger: no lessons in force.
Notes
Static review only. No build or device gate was run here.
Card check: gpu-evidence. This pull request changes crates/app/src/lib.rs, crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs, crates/gpu-gates/src/bin/generate_qwen3moe.rs … and carries a gate run on the author's card, which counts as verified.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
…s launch, read on the host under it
…ts answer is read back A greedy request that reads no row feeds every answer back unless it stops there. The server now tells the engine so (Engine::next_ahead), and on one slot the engine may launch the answer's step on the card, its input copied from the head's argmax there, before the host reads the answer back. The next next_ahead of that answer takes the launched step and feeds nothing; any other call keeps the answer fed. The engine says which it did (Ahead), and the slot books what the engine fed, so what the slot holds is what the engine holds at every end of a request. GpuModel::step_ahead chains the step behind the one in flight: the body stages its input from the card (ChainBody::refresh_chained), the head's readback is copied behind the step before, the replay is launched, and the body hears the answer before its host service (ChainBody::chained_token). The Qwen3.8 body takes it: its PLE arrival flag is lowered by the stream between the two walks, and the answer's PLE rows are named and delivered once it is read back.
…step and draft walks before it serves A pass of several slots was captured on the first round that ran its key (the busy slots and their row counts), so a decode paid the capture and the instantiation of each new key. A parked slot's own graphs, its one-token step and its MTP draft's walks, were captured the same way on its first lone step or chain, and so were the live slot's draft walks on a load of one slot. Session::capture_rounds captures every key the rounds of the load's slots run, each busy set in slot order at each row count, cut as a round cuts them, then each slot's own graphs (GpuModel::capture_each_slot: the step, and GpuModel::capture_seq, which ChainBody::capture_seq answers; Body38 with every walk key its draft replays). The Qwen3.8 seat calls it at load for two slots: the drafted rounds up to a verify's rows a slot, the plain rounds of a row. The shared SlotDrafts::open captures each slot's draft walks beside its verify widths, so a load of any slot count serves its first proposal from captured walks.
59d1df5 to
f372621
Compare
There was a problem hiding this comment.
Since the last review:
- Must-fix 1 fixed: crates/gpu/src/model.rs:1488 reads pending faults before saves and state changes, records poison, and preserves a clean pending answer.
- Evidence question still open: crates/gpu/src/model.rs:1394; the PR body still names the earlier tested revisions.
Verdict: CLEAN: the interdiff closes the pending-fault defect and introduces no proven blocker.
Non-blocking
⚠ Refresh the revision evidence: crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs:2363. The gate and A/B evidence names 0dbe02c → 3c70dec; this review covers e9f238b → f372621. Attach current-revision owning-gate output, FAIL-first output for ahead_fault, and the dispatch A/B, or establish tested-patch equivalence. This ties the reported results to the code being merged.
Checked
Duplicates: 3 new items checked; no duplicate owner. Both dryer pairs read: builders share syntax but set different facts; their patches are unchanged since the prior review.
Complexity: new ahead_fault is 22, from four handoffs and result formatting. run grows 57 → 59 by calling the new clause. The remaining flags (launch_chained, SeatEngine::spawn, card_structure, Head::with_gain) are unchanged in the interdiff.
Silent failure: 7 handoff sites followed. Saves, reset, rollback, seed-depth changes and slot switches propagate pending faults before changing state. A second save is refused by poison; a subsequent reset clears it.
Tests: static mutation analysis of the new gate: deleting body38.rs:5426 or model.rs:1154 makes its fault check fail. Clearing ahead on a clean read makes next.took fail. The gate aggregates these checks into its error result.
Gates: no pins or thresholds moved in the interdiff.
Escape catalog: C1–C4 do not match. No ledger lessons are in force.
Notes
Static review only. No build or device gate was run here.
Card check: gpu-evidence. This pull request changes crates/app/src/lib.rs, crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs, crates/gpu-gates/src/bin/generate_qwen3moe.rs … and carries a gate run on the author's card, which counts as verified.
🔨 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. |
Qwen3.8 디코드에서 다음 스텝을 응답 읽기 전에 먼저 실행하고, 로드 때 모든 슬롯의 그래프를 미리 캡처해서 FP4-Local 단일 요청 디코드를 1.05% 올립니다.
What and why
A greedy request's next step is now launched before the previous answer is read back (device token chaining), and a step's PLE rows are read on the host while the launch runs, so the GPU stays busy across tokens. A load also captures every round's passes, each slot's step and verify widths, and each slot's draft walks before the server accepts a request, so no request pays a graph capture on its first use. A save, a rollback, a reset or a slot change settles a step still launched ahead first, so a device fault that step raised is returned by that call instead of reaching the prompt cache. On FP4-Local Qwen3.8 at C=1 without a draft, decode goes from 31.44 to 31.77 tok/s (+1.05%, ranges apart); the other measured arms are within the measurement's resolution.
Release notes: Changed: Qwen3.8 decode launches a greedy request's next step before reading back the last answer, and a load captures every slot's graphs before serving.
Code shape
The review reads these first. A box left unticked needs one line of why.
copying it (
AGENTS.md"Common code first",docs/rust-quality.mdR14). Where I found an existing copy, Inamed it below.
(tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
tools/check-comments.sh).PIN(YYYY-MM-DD):and its reason.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line): the step's node census had two copies (the Qwen3.8 seat andgenerate_qwen3moe); both now callstep_census(crates/gpu-gates/src/nodes.rs:67, used atcrates/gpu-gates/src/bin/shared/serve_seats/qwen38.rs:2896andcrates/gpu-gates/src/bin/generate_qwen3moe.rs:3239).What I ran
Base is upstream
cd7d88052e2f36dbf1b49e7c3996f49f7657f33a; PR head isf372621dbe91e1ed120dbf7b03e8b394406037b9.Card (
nvidia-smi):Model:
nvidia/Qwen3.8-Flash-Next-FP4-Local, revisionb9ce18a6887e18c089fdea8509a33e63429a3300(MODEL_FP4Lbelow is its folder). SHA-256 of its files:SHA256SUMS
Decode A/B, PR head against base. Both builds:
Plain decode at C=1 (
fp4l-off), one server per round, 8 windows of 4,096-id prompts and 128 generated tokens, six rounds (three base, three head) after one discarded lead-in, base and head servers started from their own build folders. The base server and one client call (LOAD_CLIENTis the load-generating client script that posts the windows to/completionand writes the per-window decode tok/s):The client line repeats at offsets 50000, 100000, 150000, 200000, 250000, 300000 and 350000. The other arms use the same client with these servers:
with
--count 2 --conc 2 --temperature 0.7 --seed 42on the C=2 arms. Corpora SHA-256: code-fn7520b471436fb307e91ee22640ad8100701d48e63e3da7de9160b705b92915d1, prose-end10c7044df8884fdd200304604772d81a4b56a228f802d5f05db724b245ef77a. Greedy output is equal on base and head.Decode tok/s, median of three rounds (base and head rounds on one card):
Only the first row separates from run-to-run spread; the rest are inside it, and no arm is slower beyond its spread.
Captures at load, none while serving. Each arm ran
./target/release/bloomery-serve --host 127.0.0.1 --port 18731 --parallel N --ctx-size 16896(BLOOMERY_DRAFT=<off|mtp|lookup>,BLOOMERY_HOST_ROOM=96G,BLOOMERY_MTP_WIDTH=costformtp) under a CUDA API trace from the server start, with consecutive requests (three for the C=1 arm, two for the others) ofpython3 "${LOAD_CLIENT}" load --port 18731 --ids "${CODE_IDS}" --prompt-len 4096 --n-predict 128 --count N --conc N --offset <k*50000> --bound 0 --temperature 0, N being the slot count; thecuGraphInstantiatecalls after the first request began were counted from the exported trace:Load log of the
--parallel 2MTP arm:Fixture gates, run with
BLOOMERY_BOX_LOCAL=1 BLOOMERY_BOX_CARD=local BLOOMERY_TIER=fixture just <recipe>:The e2e gate's
ahead faultclause (a fault raised behind a step launched ahead is returned by the next save, lane save, rollback and reset), run asBLOOMERY_BOX_LOCAL=1 BLOOMERY_BOX_CARD=local BLOOMERY_TIER=fixture just gate-gpu-qwen4exp-e2e:Compile check of the changed crates:
Both finish with rc 0.
Hardware (if the change is for a machine)
All numbers above were measured on this card.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.