Repository navigation
q8f32: an MXFP8 gemv of five to eight columns runs the staged walk over an eight-column stage - #1106
Conversation
…ms are reduced up_mix_value and up_mix_value_bf16 kept every column's four reduced sums in a [STREAMS][MAX_COLS] array until lane 0 mixed them all at the end, so the m-column entries held 32 sums beside the row's weights and took a block of 512 threads a SM. Lane 0 now mixes column c (mix_col) right after its sums are reduced; the sums, their order and the stores are the same.
…reads each column unit once for them nvfp4_gemv_sel32_cols ran one row a warp, so every warp of a verify's slots paid the id read, the first-slot check and the ballot walk for one row of 20 units (K 640), and a duplicate slot's warp paid them to return. A warp now takes four rows of its slot: those costs and the duplicate warps fall by four, and each column unit is read once for the four rows. Each row keeps its lanes, its unit order and the butterfly, so it is nvfp4_gemv_sel32's bit for bit.
…er an eight-column stage The staged walk read each step's activations once a block into shared memory only at four columns; five to eight columns (two sequences' verify rows) ran the unstaged walk, which reads them once a row. The walk now takes its stage width as a parameter: the four-column entry keeps its stage, and mxfp8_gemv_mcol_staged_wide runs five to eight columns over a stage of eight with the columns past the launch's idle. Column c stays the one-column walk's bit for bit. gate_mxfp8 adds six columns at attn_q_b and seven at the nine-row tail.
8ac2641 to
92eb943
Compare
There was a problem hiding this comment.
Verdict: CLEAN: The remaining findings are non-blocking evidence requests and optimization advice.
Non-blocking
⚠ Supply the geometry proof: crates/gpu/src/q8f32.rs:2482.
For m=5..8 with aligned activations and k a multiple of 512, staging adds 8,192 shared bytes per block [derived: 2 × 8 × 128 × 4].
The body includes a timed A/B and spill totals. Attach before/after PTX resource rows and the occupancy calculation from registers, shared memory, threads and SM count required by the occupancy/geometry class.
⚠ Show the added cases failing on a mutant: crates/gpu-gates/src/bin/gate_mxfp8.rs:159.
The added six-column and seven-column cases reject omitted col!(5) and col!(6) dots through their host-bit comparisons.
Attach a FAIL-first run with those omissions; the body contains only passing output.
Optimization headroom
- D. More at once: crates/gpu/src/mxfp4_sel.rs:1694. Each matching slot reloads the same weight units. Reuse decoded units across matching slots to remove 20(h−1) requested plane bytes per row per 32-value unit for h matching slots [derived: 16 code bytes + 4 scale-word bytes per load].
Checked
Duplicates: the staged entries share one body. Dryer reported 0 candidate pairs.
Complexity: nvfp4_gemv_sel32_cols 10→15 adds row reuse inside a kernel; enqueue_e4m3_gemv 26→30 adds staged dispatch guards.
Silent failure: the NVFP4 tail minimum selects live rows; staged dispatch checks activation alignment and k before the vector view.
Tests: the added m=6 and m=7 cases compare every output with the host rule. Omitting q8f32.rs:1683 or :1684 leaves the corresponding column's accumulator zero.
Gates: no accuracy band relaxed; added spill pins and the unsafe-count increase carry dated reasons.
Escape catalog: no C1–C4 pattern matched.
Notes
Dryer did not scan gpu-gates; its changed cases were read manually. GPU gates were not rerun here.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/gate_mxfp8.rs, crates/gpu/src/hc_gated.rs, crates/gpu/src/mxfp4_sel.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의 MTP 검증과 2요청 디코드에서 쓰는 여러 열 GEMV 세 가지가 가중치를 한 번만 읽도록 바꿔 처리량을 조금 높였습니다.
What and why
Three kernels that multi-column decode steps use (an MTP verify, or two parallel requests) now load each weight unit once for every row or column that needs it:
hc_gated: the up projection mixes each column as soon as its four partial sums are reduced.nvfp4_gemv_sel32_cols(the multi-token NVFP4 routed down): a warp takes four rows of a slot and reads each column unit once for them. Per row, the lane assignment, unit order and reduction match the single-token entry, so results are bit for bit the same.mxfp8_gemv_mcol_staged_wide(new entry): an MXFP8 gemv of five to eight columns runs the existing staged walk over an eight-column stage. The four-column entry is unchanged.Release notes: Changed: Qwen3.8 NVFP4 and MXFP8 multi-column decode steps read each weight once per step, which raises two-request decode throughput on a DGX Spark.
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 two MXFP8 staged entries share one body,blocks_gemv_mcol_stagedincrates/gpu/src/q8f32.rs.What I ran
Upstream base
55e23f17be68bcfddf090d37046c5f80503842f3, PR head92eb943d153ff2076cf026816eeaac1efa494769. The runs below are on GB10 DGX Spark machines, see Hardware.Card:
Gates for the changed kernels (
BLOOMERY_ARCH=sm_121a BLOOMERY_BOX_LOCAL=1 just <gate>):The new 5 to 8 column MXFP8 path and the four-row NVFP4 down are bit-checked against the one-column walk:
PTX spill check (
just gate-ptx-spill) on the generate binary:MTP draft gate, fixture tier (
env BLOOMERY_ARCH=sm_121a BLOOMERY_BOX_CARD=local BLOOMERY_TIER=fixture just gate-gpu-qwen4exp-mtp):Model:
nvidia/Qwen3.8-Flash-Next-FP4-Local, revisionb9ce18a6887e18c089fdea8509a33e63429a3300.MODEL_FP4Lbelow is the folder holding these files (SHA-256, then path):Speed A/B on the real server, base build against head build, same shipped feature set. Build, then serve and one timed client round for the two-request, no-draft arm (the base run uses
./base/target/release/bloomery-serve):The MTP arms start the server with
BLOOMERY_DRAFT=mtp BLOOMERY_MTP_WIDTH=cost(withenv -u BLOOMERY_MTP_DRAFT). The one-request arms use--parallel 1,--count 1 --conc 1and--temperature 0without--seed. Prompt length 4096, 128 new tokens, eight windows of the corpus, medians of three rounds per side.${CODE_IDS}is the code corpus; the prose arms use the prose corpus.Every difference above is positive. The total tok/s of the two-request, no-draft arm is the one result whose range does not overlap the base's and that lies above the run-to-run resolution (0.72%). The other differences are inside the resolution of their runs.
Hardware (if the change is for a machine)
NVIDIA GB10 (DGX Spark), driver 595.84, CUDA 13.3.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.