Repository navigation
gpu, gpu-gates, runtime: Qwen3.5/3.6 runs its GDN prompt, verify and closing call on the shared delta store - #1127
Conversation
45c76a0 to
03561b9
Compare
There was a problem hiding this comment.
Verdict: MUST_FIX: the new streamed-response reader silently accepts malformed draft counters.
Must fix
1. Read draft counters through their existing owner
Kind B: gate_qwen3_serve.rs:2048 converts a present string, null or negative draft_n into zero. The value reaches the sum at line 4577 and the drafted > 0 assertion at line 4620. One malformed response and one valid response with proposals can therefore leave the gate green.
serve_client.rs:346 already owns this contract: both counters omitted means no proposal; malformed counters return a named error. Reusing it is a one-line fix that avoids maintaining a second interpretation (R14, no silent failure). Replace line 2048 with:
drafted = serve_client::draft_counts(&v).map_err(|e| e.to_string())?.0;Non-blocking
⚠ Complete the numeric-change evidence: delta.rs:189 selects the chunked prompt rule, changing the reduction order. Attach the error-model comparison and gate-gpu-e2e count-pin output required by AGENTS.md's “float sum order or precision” class. Connect the reported benchmark head c86a491 to reviewed head 03561b9 through patch equivalence or a new run.
Checked
Duplicates: the existing draft-counter parser covers the new reader's fields. Dryer reported zero pairs in app/model/runtime; it excluded gpu and gpu-gates.
Complexity: diagnostics report 28 for lookup_slots_verify_together; its setup, requests and assertions form gate orchestration. No complexity finding is raised.
Silent failure: followed the counter from the SSE reader through the channel to the aggregate assertion. sse_event checks the terminal event and stop type, but does not validate draft counters.
Tests: a malformed counter contributes zero while another response can keep the aggregate positive. The existing parser has tests rejecting malformed counters and accepting their valid omission.
Gates: the PR body reports hardware gate results but omits the numeric diagnostic and count-pin evidence requested above.
Escape catalog: no entry applies to these findings. No ledger lessons are in force.
Notes
CUDA builds and gates were not run during validation. Hardware results were read from the PR body.
Card check: gpu-evidence. This pull request changes crates/app/src/arch/qwen3moe/mod.rs, crates/app/src/lib.rs, crates/gpu-gates/src/bin/gate_gemm.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)
Filed outside this PR: #1129
| let v = sse_event(e).map_err(|e| format!("curl {url}: {e}"))?; | ||
| if v.get("tokens").is_some() { | ||
| tokens = ids_of(&v["tokens"]).map_err(|e| format!("curl {url}: {e}"))?; | ||
| drafted = v["timings"]["draft_n"].as_u64().unwrap_or(0); |
There was a problem hiding this comment.
Reuse the existing counter parser so malformed present counters return an error before reaching the gate's aggregate.
| drafted = v["timings"]["draft_n"].as_u64().unwrap_or(0); | |
| drafted = serve_client::draft_counts(&v).map_err(|e| e.to_string())?.0; |
…rompt, verify and closing call on the shared delta store, its gated norm on the shared product epilogue and its gated head-256 prompt on the shared pack-4 flash
03561b9 to
e78705f
Compare
There was a problem hiding this comment.
Since the last review:
- Fixed: gate_qwen3_serve.rs:2048 now uses the existing draft-counter validator and propagates its error.
- Still open: the numeric-change evidence request at delta.rs:189.
Verdict: CLEAN: the one-line interdiff resolves the previous must-fix and introduces no new defect.
Non-blocking
⚠ Complete the numeric-change evidence: delta.rs:189 selects the chunked prompt rule, changing reduction order. Attach the error-model comparison (σ against exact-forced-32.tsv) and gate-gpu-e2e count-pin output required by AGENTS.md's “float sum order or precision” class. Connect the measured head c86a491 to the reviewed head through patch equivalence or a new run.
Checked
Duplicates: 0 new items; the changed call reuses serve_client::draft_counts. Dryer reported 0 pairs in app/model/runtime and excluded gpu/gpu-gates.
Complexity: the interdiff adds no branches. The functions flagged by crapper are unchanged since the previous review.
Silent failure: 1 changed site followed through the channel and receiver's ??. Malformed counters stop the gate before aggregation. Both counters omitted in a timings object still mean zero proposals, matching the server's writer.
Tests: no tests changed. Existing parser assertions reject malformed counts and accept valid omissions. Mutant: replacing the parser's error with Ok((0, 0)) fails those rejection assertions; this was checked by inspection.
Gates: no pin, threshold or test changes in the interdiff.
Escape catalog: no matching patterns. No ledger lessons are in force.
Notes
This re-review covers the interdiff and the previous findings. CUDA builds and tests were not run; hardware evidence was read from the PR body.
Card check: gpu-evidence. This pull request changes crates/app/src/arch/qwen3moe/mod.rs, crates/app/src/lib.rs, crates/gpu-gates/src/bin/gate_gemm.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. |
|
After this merge, main (e7180ea) is red on the 3090 fixture tier. Three causes:
I can re-record the budgets on the box and look at the place test if you like. Say which you prefer. |
|
@midagedev Thanks for the report. I will take all three in one pull request today: the (AI 코딩 에이전트가 작성한 코멘트입니다.) |
|
@midagedev #1134 fixes the place test and The fixture budget is not in the repository. It is the (AI 코딩 에이전트가 작성한 코멘트입니다.) |
|
Re-recorded the qwen35moe fixture on the box (old folder kept in /models/fixture-variants). On main b17e44a, fixture tier: One red is left in The fixture tier exports the fixture's budget to every command. The spawned command could drop it ( |
|
@midagedev Thanks a lot for re-recording the fixture, for narrowing the last red down to (AI 코딩 에이전트가 작성한 코멘트입니다.) |
|
@midagedev The nodes are back, so I took this one: #1136 is merged. The test's unplaced (AI 코딩 에이전트가 작성한 코멘트입니다.) |
|
@juliankang4 The 0.3.12 release batch (real tier, RTX 3090, main 2cd109a) has At 22ab722 (the parent of 1b28971) both pass: ratio 1.28 at layer 35, split worst 1.834e-1. The pass path is bit-identical before and after. Only the ubatch side moved: layer 0's GDN state gap grew from 2.9e-7 to 3.3e-6 (relative), and no layer shows a wiring-sized jump. So it reads as a rounding move in the prompt path's delta step, not a bug. I can re-pin the two bands ( |
|
@midagedev Thanks a lot for running the release batch and for narrowing this down so far. Since the pass path is bit-identical and the gap is only on the ubatch side of the delta step, re-pinning the two bands with a PIN line so 0.3.12 can tag sounds right to me, if that works on the maintainer side. In parallel I'll look at the delta-step rounding on the prompt path and send a PR if the shared step can get back to the old margins; that PR would move the pins back too. (AI 코딩 에이전트가 작성한 코멘트입니다.) |
Qwen3.5/3.6의 GDN prompt, verify, 닫는 호출을 Qwen3.8이 쓰는 공용 delta store와 공용 epilogue로 옮겨 Qwen3.6 prefill을 약 28에서 30 % 빠르게 하고 중복 코드를 지운 작업입니다.
What and why
On one RTX 5090, Qwen3.6-35B-A3B, 4,096-id prompts, 128 greedy tokens, one request at a time, base against head (medians of three rounds, each round eight windows):
The table under "What I ran" has the rounds' ranges. The greedy ids are not equal to base's after a few dozen tokens (first difference at token 42 of the first q36 code request): the chunked prompt computes the delta state in another order than the step path, so the decode continues from a different, equally valid state. Gate clause (h) below shows it for a 160-id prompt.
Qwen3.5/3.6 (
Body35) ran its own GDN code for the prompt, the verify of drafted rows and the closing call. This PR moves it onto the owners Qwen3.8 already runs:recur.rsRecStore::gdn,linear/seqs.rsGdnRun,enqueue_gdn,recovery_table): one stamped lane, the chunked rule's carry and, on a verifying load only, a verify record.Body35takes the chunked 16-row prompt pastGEMV_COLSrows and commits a verify by replaying every delta layer's kept rows in one launch. Its 8 stamped verify lanes are gone, and Qwen3.8 moved fromRecStore::carriedonto the same owner.gemm/f32tile.rs,gemm/kernels32.rs,gemm/nvfp4mma.rs,linear/norm_gate.rsgate_act,site::resident_gemm_norm_gate).check_sigmoidis removed. Qwen3.5/3.6's wide delta layer calls it (wide.rsdelta_gate) and writes the one q8 formssm_outreads.wide.rsflash_gates). Qwen3.6-35B's group-of-eight shape keeps its own flash.runtime::prompt::fold_marks,recur::close_point,body35.rscall_marks); the Qwen3 and Qwen3.8 seats callbind::prefill_closing, and the CLI's--last-stepmirrors the server.rounds::step_rows_lookupandpass_rows_lookup(serve_seats/qwen3.rs,served.rs), and a drafted round of both slots is one pass.SlotRows::refuse_verifyandkeep_slotrefuse a verify on a plain load.model/src/arch/qwen35moe/place.rs,PlanInputs::verifying): a verifying Qwen3.6 load adds 30 x 393,216 B of records.tools/unsafe-ratchet.txtis recounted (gpu2965 to 2967 blocks, 407 to 409 fns forrecovery_tableandrecovery_of), andtools/defaults-twins.tsvgets the lookup clause'sBLOOMERY_DRAFT=lookup.Release notes: Changed: Qwen3.5 and Qwen3.6 prompts prefill about 28 to 30 % faster on an RTX 5090 (time to first token down about 22 %), and their prompt, verify and closing-call paths now run on the code Qwen3.8 uses.
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).cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line):crates/gpu/src/recur.rs:162(close_point), shared with Body35.crates/gpu/src/linear/seqs.rs:63(enqueue_gdn) and:128(recovery_table); Body35's 8-lane verify andLaneRunare removed.crates/gpu-gates/src/bind.rs:2747(prefill_closing); it now calls it.crates/runtime/src/prompt.rs:174(fold_marks) for any body with mid-unit state copy.crates/gpu/src/linear/norm_gate.rs:466(gate_act); the sigmoid-onlycheck_sigmoidis removed.gate_qwen35moe_verifyandgate_qwen4exp_mtpiscrates/gpu-gates/src/prefill_gate.rs:199(closed_run).What I ran
Upstream base
7364a5f86917ee9f5cb8816b7cab7043bf7d65a0, PR headc86a49190a3bdb6c381ccb56e345bb6fad5bbd14.Card
RTX 5090 (the Qwen3.6 timing and gates below):
GB10 card (the Qwen3.8 check below):
Models
{"repo": "lmstudio-community/Qwen3.6-35B-A3B-GGUF", "revision": "68a34855558af61cbef0324d31f411be8a506b08", "file": "Qwen3.6-35B-A3B-Q4_K_M.gguf", "sha256": "4ac6a06bce551257267f49ad2226f8671a22519ccc1a4dde9d5b433d1f2a410d"} {"repo": "unsloth/Qwen3.6-35B-A3B-MTP-GGUF", "revision": "5bc3e238d916f48a861bac2f8a1990a0e9b7e98d", "file": "Qwen3.6-35B-A3B-UD-Q4_K_M.gguf", "sha256": "0b21525e972670ed59e1812e170b27c26355381f0656ecc4e25617ece7dac58b"}Qwen3.8
nvidia/Qwen3.8-Flash-Next-FP4-Localat revisionb9ce18a6887e18c089fdea8509a33e63429a3300, file checksums (SHA-256):21 tensor files and the config files
Gates on the RTX 5090
New SiLU rows of the epilogue case. With the epilogue's SiLU branch disabled (
if act == GATE_SILUchanged toif act == u32::MAXincrates/gpu/src/gemm/f32tile.rs), everygate=Silurow fails:With the real epilogue, the same command:
Verify gate, with the new clauses (f) an unread prompt call over a planted fault, (g) a pass beside a waiting verify, and (h) the closing call:
Linear gate (the shared delta, recovery and norm-gate kernels):
Fixture end-to-end gate for Qwen3.6 (
Qwen3.6-35B-A3B-Q4_K_M.gguf, the file listed under "Models"; the delta layers' prompt rule, the closing call and the slots, against the pass and step paths), aftercargo oxide build --arch sm_120a -- -p bloomery-gpu-gates --features gpu --release --bin gate_qwen35moe_e2e:Serve gate on the Qwen3.6
Q4_K_Mfile (BLOOMERY_REF_MODEL), including the two-slot lookup draft rounds:BLOOMERY_BOX_LOCAL=1 just checkexits 0.Speed on the RTX 5090
Each side built with
cargo oxide build --arch "$(bash tools/arch.sh)" -- -p bloomery-gpu-gates --features glm5next,clef,vision,mimo2,solar2,minimaxm3,flint,gemma-embedding2,hf,checkpoint --release --bin bloomery-serve, started fresh each round with--parallel 1 --ctx-size 16896, two warm requests, then eight windows of 4,096-id prompts with 128 greedy tokens (temperature 0), one lead-in round discarded, then three rounds a side in alternating order:${MODEL_Q36}is theQ4_K_Mfile and${MODEL_Q36M}theUD-Q4_K_Mfile. Each request is a/completioncall with a 4,096-id prompt window of the code or English prose corpus, 128 predicted tokens, temperature 0, one at a time. Median of three rounds [lowest to highest round], change is head against base:Greedy ids equal base's: no (first difference q36 code, request 0, token 42).
Qwen3.8 on the GB10
The diff also moves Qwen3.8's delta store, closing call and epilogue, so its three arms were timed on a GB10 with the same build and server commands as above and
-m "${MODEL_FP4L}"(FP4-Local), arms draft off, MTP at--parallel 1, and MTP at--parallel 2with two concurrent requests at temperature 0.7 with seed 42. Greedy ids equal base's: yes (24 requests, 3,072 tokens, no difference). Median of three rounds [lowest to highest round], change is head against base:No arm has a loss with ranges apart: every negative row overlaps (the sampled
--parallel 2rows spread the most). The saved kernel-time sums are within 0.6 % with the same launches per kernel for the two single-slot arms.Hardware (if the change is for a machine)
NVIDIA GeForce RTX 5090, 595.99.02, CUDA 13.2. Qwen3.6 gates and timings.NVIDIA GB10, 595.84, CUDA 13.3. Qwen3.8 timing.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.