Repository navigation
qwen38: run the delta rule's z and the attention's q on the side stream - #697
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: The moved projections join before their readers, and no must-fix defect was found.
Non-blocking
⚠ Attach validation evidence: program38.rs:1069.
The move class needs identical PTX, graph counts, and eager/replay equality; the PR has no scan or owning-gate output. Attach those results before further scheduling changes depend on this ordering.
Each eager layer also adds two event records, two event waits, and one capture query [derived]. Include short eager-pass timing with both source commit hashes and benchmark commands/output; binary SHA256s do not identify the source commits.
Checked
Duplicates: 1 new item checked (dense_gemv_on); it reuses site::resident_gemv_cols_on and removes repeated call setup. Dryer reported 0 pairs.
Complexity: crapper flagged qsa 23 → 25 and gdn 20 → 21; growth is propagated join errors, with no new scheduling decision.
Silent failure: 0 new suppression sites. Launch and join errors propagate; early returns retain the existing Forked drop join.
Ordering: checked GDN norm, QSA single-sequence and slot readers, and branch reuse before the shared expert. Forks order the input producer; joins precede readers and buffer reuse.
Tests: none added or changed, so no test mutation applies. GPU builds and gates were not run during this review.
Gates: no pins, tolerances, tests, or clauses changed.
Escape catalog: C1–C4 do not match. No ledger lessons are in force.
Card check: needs-gpu. This pull request changes 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의 GDN 층과 QSA 층에서 큰 projection 하나를 side stream으로 옮겨 다른 projection과 겹쳐 돌리므로, MTP를 켠 짧은 요청의 처리량이 올라갑니다.
Part of #565. It closes the open line "GDN projections on a side stream beside the routed experts, on Qwen3.8".
What and why
In a delta (GDN) layer, the
zprojection is read only by the gated norm, after the delta step. In a selecting (QSA) layer, the q projection is read only by the q/k norm, after the indexer's keys and queries. Each is a large gemv, and each runs next to a chain of small, latency-bound launches that do not read its output. The walk now forks its existingBranch(the stream owner the shared expert already uses), runszor q on the branch beside that chain, and joins before the first reader. The kernels, launches and bytes are the same. The captured graphs keep their node counts, 1295 for a decode step and 1331 for a 4-row verify, and each fork and join adds one event record and wait that a capture turns into edges.Ctx38::dense_gemv_onis the stream form ofdense_gemv.sharednow calls it too, which removes its three spelled-outsite::resident_gemv_cols_oncalls. All three walks that go throughParts38::fronttake the change: the captured step, the captured verify (MTP verify and multi-slot decode) and the eager walk of up to 8 rows. Prompt batches of 9 rows or more use the GEMM walk inwide38, which this PR does not touch.The gain is limited to MTP with two short requests. With MTP on and two short requests, total tok/s rose by 2.04% and 2.49% in two sittings, and the steady all-active rate by 2.55% and 2.48%. The same tree varied by 0.34% (main) and 0.11% (head) between the two sittings. With the draft off no group moved beyond that spread, and none was slower beyond it.
Release notes: Changed: Qwen3.8 runs the delta rule's
zand the attention's q projection beside the other launches of the layer, which raises decode throughput with MTP at two short requests.Code shape
graph::Branchand the walk's existing branch.dense_gemv_onis the only new item, with five callers, anddense_gemvdelegates to it.program38.rs. The common ownergraph::Branchis unchanged.sharedare removed.fork, every launch andjoinpropagate with?. On an early error the fork's drop joins, so a capture never ends with an open branch.cargo fmtpasses on the file.cargo clippyhas not been run on this head, so the lint count is unchecked.Duplication found or removed (
path:line), or "none": none.tools/dup-scan.pylists one candidate in the diff,qsa_qkvagainstqsa_query; they share only an arena destructure and adense_gemvcall.What I ran
GPU Evidence
On an NVIDIA GB10, inside the build container and on the host:
just gate-gpu-qwen4exp-e2eandjust gate-qwen38-servenot run: they load the Qwen3.8 GGUF set and reference sets, which the DGX Spark used here does not hold.Throughput with MTP and with the draft off
One GB10 loaded the server once per arm with FP4-Local as shipped (
nvidia/Qwen3.8-Flash-Next-FP4-Localatb9ce18a6887e18c089fdea8509a33e63429a3300),--parallel 4, 128 generated ids per request, greedy, prompts from a code corpus. The prompts are 256 or 4096 ids and are sent at once. The GPU clock cap was lifted for each arm and restored afterwards. MTP arms ran at a fixed draft width, so both trees verify the same work; the width chooser would pick different counts per tree and compare different work. The second sitting ran the two MTP arms again in the opposite order, head first. The plain read ceiling of the card was 235.2 GB/s in the first sitting and 233.5 GB/s in the second.Main binary SHA256
14f95cd480aadbc5338e8ac79438fa911b7062f64c93eedbdd01f3d9b3a4706e, headacaaac695917db4b4ca87c17978473fb6f87108d2e8b6b9938a846559e8aa26e.Change is computed from the two columns. With MTP on and two short requests, total tok/s rose 2.04% and 2.49% in two sittings.
Greedy ids equal main in all 13 requests of the first sitting for draft off and for MTP, and in all 13 requests of the second sitting for MTP.
What I ran into
This does not block the PR. Outside MTP at two short requests the change is flat in this measurement: one 4096-id request with the draft off moved by -0.02% and -0.30%, inside a sitting spread of 0.08% to 0.20%. In four-request groups the two trees sometimes drafted different counts, because which request drafts at each step follows arrival timing, so those rows do not compare the walk and are not used here.
One latency cell is worse. With MTP and two short requests, TPOT p95 in the second sitting is 11.41% higher on head, although the total rate rose by 2.49%. The two requests split unevenly at 29.62 and 39.85 tok/s, against 34.21 and 33.00 on main, with the same drafted and accepted counts, and p95 follows the slower request. At two to four requests this metric swings by about 11% either way across the sittings (-1.85% and -11.44% in the first). The cause of the split is not traced.
The measurements above ran on this patch before it was rebased onto the current main. The head that goes up is that patch rebased, and
git range-diffshows it unchanged. The files main changed in between do not touch the forked launches orBranch.Hardware
One NVIDIA DGX Spark (GB10), driver 595.84, CUDA 13.3 build image.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.