Repository navigation
gpu: fuse the hostless Qwen3.8 card sum with the shared add - #974
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: the changed graph-node pins lack the required dated reasons.
Must fix
1. Add PIN comments to both changed graph-node expectations
crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs:3626 and crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs:3876 lower the decode and verify expectations by one node per hostless layer. Neither change carries the dated PIN(YYYY-MM-DD): reason required for a moved gate pin (kind B).
Record the derivation now, while the launch change and its evidence are available.
Replace the decode expectation with:
// PIN(2026-10-29): each hostless layer folds its card sum into the shared add.
let want_nodes =
shape().nodes_decode_card(plan.card_layers) - (memops() - want_memops) - hostless(plan);Replace the verify expectation with:
let want = (
// PIN(2026-10-29): each hostless layer folds its card sum into the shared add.
shape().nodes_verify_card(plan.card_layers) - (memops() - want_memops) - hostless(plan),
want_memops,
);Non-blocking
⚠ Tie GPU evidence to the reviewed head: crates/gpu/src/arch/qwen3moe/card38.rs:686. The gate results name f3c21d9; the reviewed head is bb03180. Supply the nvidia-smi line and gate/A/B commands with output for this head, or establish patch equivalence. This connects the required launch-fold proof to the code being merged.
Checked
- Duplicates: 2 new functions checked; no duplicate owner. Dryer reported 0 pairs; the gate changes were grepped manually.
- Complexity: crapper flagged no functions; no kernel body changed.
- Silent failure: 4 optional-state sites followed. Missing card buffers error; absent host/tier selects the intended path; an absent run owns zero bytes. Device faults still reach the head.
- Tests: static mutation check. Restoring the separate hostless sum adds a node and fails the exact graph counts. Dropping the fused join fails logits comparisons against the kept-host path.
- Gates: decode and verify count expectations move; missing PIN comments are item 1. No band or tolerance changes.
- Escape catalog: no patterns matched. Retained rows are consumed before reuse; the fused kernel reuses the same reduction and explicit rounding.
Notes
Dryer did not search crates/gpu-gates. Validation was static; CUDA gates were not rerun.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs, crates/gpu/src/arch/qwen3moe/card38.rs, crates/gpu/src/arch/qwen3moe/program38.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)
| let ([k, b], other) = count_kinds(&m.step_graph_nodes()?, [kernel, memop]); | ||
| let want_memops = shape().memops_card(hostless(plan)); | ||
| let want_nodes = shape().nodes_decode_card(plan.card_layers) - (memops() - want_memops); | ||
| let want_nodes = |
There was a problem hiding this comment.
The changed decode node-count pin needs a dated reason.
| let want_nodes = | |
| // PIN(2026-10-29): each hostless layer folds its card sum into the shared add. | |
| let want_nodes = |
| let want_memops = shape().memops_card(hostless(plan)); | ||
| let want = ( | ||
| shape().nodes_verify_card(plan.card_layers) - (memops() - want_memops), | ||
| shape().nodes_verify_card(plan.card_layers) - (memops() - want_memops) - hostless(plan), |
There was a problem hiding this comment.
The changed verify node-count pin needs a dated reason.
| shape().nodes_verify_card(plan.card_layers) - (memops() - want_memops) - hostless(plan), | |
| // PIN(2026-10-29): each hostless layer folds its card sum into the shared add. | |
| shape().nodes_verify_card(plan.card_layers) - (memops() - want_memops) - hostless(plan), |
bb03180 to
607d0ec
Compare
There was a problem hiding this comment.
Since the last review:
- Must fix 1: fixed. Both graph-node expectations now have the requested dated PIN reasons.
- GPU-evidence question: still open at crates/gpu/src/arch/qwen3moe/card38.rs:686.
Verdict: CLEAN: the interdiff supplies both requested PIN comments and introduces no behavior change.
Non-blocking
⚠ Connect GPU evidence to this head: crates/gpu/src/arch/qwen3moe/card38.rs:686. The results name tested head f3c21d9; this head is 607d0ec. Supply the required nvidia-smi line and either establish patch equivalence or attach gate and timed A/B commands with output for this head. This connects the launch-fold proof to the code being merged.
Checked
- Duplicates: 0 new functions, types or constants in the interdiff. Dryer reported 0 pairs; no duplicate candidates to read.
- Complexity: crapper flagged no functions. The interdiff changes comments only.
- Silent failure: 0 new sites. Rechecked missing-card refusal and hostless selection; no fallback output added.
- Tests: no assertion changes in the interdiff. Static mutation check: restoring the separate sum at program38.rs:754 adds a verify node and fails card_rows' exact count.
- Gates: both dated PIN reasons are present at gate_qwen4exp_e2e.rs:3625 and :3877. No values change in the interdiff.
- Escape catalog: no patterns matched. Signed-zero behavior retains combine(0.0, acc, ...); the branch joins before retained rows are consumed.
Notes
Dryer did not search crates/gpu-gates. Validation was static; CUDA gates were not rerun.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs, crates/gpu/src/arch/qwen3moe/card38.rs, crates/gpu/src/arch/qwen3moe/program38.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. |
Qwen3.8의 hostless decode 층에서 card 합산과 shared add를 기존 fused kernel 한 번으로 합쳐 step당 launch를 48개 줄이는 PR입니다.
What and why
On a Qwen3.8 layer that runs without a host leg, the step, the verify and the pass launched a zero fill, a card sum and a separate shared add. This PR keeps the card slots' down rows and runs the existing
q38_card_sum_shared_addkernel once per layer, so each hostless layer saves one launch, the accumulator write and read, and the zero read. The slot reduction and the(0 + acc) + shared * weightorder are unchanged, and no kernel is added.crates/gpu/src/arch/qwen3moe/card38.rs: a hostless layer retains the down rows and joins throughenqueue_hostless_join. The zero buffer is gone.crates/gpu/src/arch/qwen3moe/program38.rs: the hostless path selection and the graph launch count follow.crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs: the expected graph node count of the hostless layers drops by the fused launch. No band or tolerance moved.Decode throughput does not change beyond the run-to-run range (table below). The change removes launches and memory traffic without a measurable regression.
Release notes: Under the hood: the hostless Qwen3.8 decode layer sums the card slots and adds the shared expert in one launch.
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), or "none": none. The fused kernel is the existing one;enqueue_hostless_joinonly assembles its arguments.What I ran
Checks:
cargo fmt --allandgit diff --checkexit 0.Card gates on the changed path, DGX Spark, tested head
f3c21d96c60d018715c83aac626168a6cb15c190:BLOOMERY_FIXTURE_ROOT="$sa_q2_fresh" BLOOMERY_BOX_LOCAL=1 just gate-fixture-budget BLOOMERY_BOX_LOCAL=1 BLOOMERY_TIER=fixture just gate-gpu-qwen4exp-e2e BLOOMERY_BOX_LOCAL=1 BLOOMERY_TIER=real just gate-ptx-spillReal binary A/B. Base
7163db37ff5c25f41870df1692bce5777536f22e, headf3c21d96c60d018715c83aac626168a6cb15c190. Modelnvidia/Qwen3.8-Flash-Next-FP4-Localat revisionb9ce18a6887e18c089fdea8509a33e63429a3300, with the MTP draft from the same folder. Prompt 4096 tokens, 128 generated, one request at a time, 8 windows per corpus, one warm-up then 3 measured rounds per revision. Server:Medians of three rounds. Prefill and TTFT ranges also overlap on every row, and the generated tokens match between base and head.
Hardware (if the change is for a machine)
sm_121aAI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.