Repository navigation
Conversation
…² leg (R3) A routed relu² stack of NVFP4 or NVFP4_ROWS now runs on the card: `kernels::card_relu2_runs` (sel32's types, or a type the planes path runs) picks the relu² leg for it, and the callers that mean "a relu² leg runs this type" read it; `card_sel32_runs` keeps its meaning. `Relu2Leg` carries the NVFP4 sel kernels, and `Sel32` gains the `Nvfp4Stack` arm: up, relu² with the 32-value quantize, then down, both through `nvfp4_gemv_sel32` (the up call is `enqueue_sel32`). The shared expert takes NVFP4 as a `Shared::Site` through R2's one sel32 owner. The prompt's routed GEMM asks `GemmAct32::new_routed_for`, so a native build takes W4A4 at k % 64 == 0 and sm_86 keeps W4A8; `StackW::resident` gains the NVFP4 arm the prompt's stack upload needs. The host tier runs NVFP4 relu² rows through the common planes row. New clauses: `nvfp4_relu2_pair_lightning_widths` (gate-gpu-nvfp4), `card_relu2_runs_admits_nvfp4_planes`, the accepts and place tests, and the host union-call transcription test. No kernel was added; the scan is the base's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Verdict: MUST_FIX: the behavior I traced holds, but the diff adds a pass-through method and a copied stage block that should not merge.
Must fix
1. enqueue_down is now a wrapper with the same signature as enqueue_sel32
mxfp4_sel.rs:1960 The PR renames the launch to enqueue_sel32 and adds enqueue_down(&self, stream, a, fault, y) that only calls it. Two names launch the same kernel: card_leg.rs:1428 and card_leg.rs:1620 call it by different names. The wrapper has no behavior of its own, so it is an unneeded element. Removing it now costs 6 call sites; later it costs more.
Fix: delete the enqueue_down wrapper. Change the callers to enqueue_sel32: card_leg.rs:1428, card_leg.rs:2921, gate_nvfp4.rs (the three nv.enqueue_down calls), site.rs:825. Change the doc references in crates/gguf/src/card.rs (lines 185 and 280) and the link in the Nvfp4Down doc comment (mxfp4_sel.rs:1774) to enqueue_sel32.
2. The up and down stages of relu2::run are one block written twice
gate_nvfp4.rs:1357 Both stages run the same steps: judge each slot, collect the card slots, tally, check the HOST sentinel, check finite, print. They differ only in the stack index, the row count and the labels. About 35 lines are copied; a later change to the judging must be made twice. One local closure removes the copy and adds one name.
Fix: define this closure inside for m in RUNS, after card, and delete both stage blocks:
let stage = |name: &str, part: usize, y: &[f32], cols: &[(Vec<i8>, Vec<f32>)], fault_none: bool| {
let rows = parts[part].1;
let per: Vec<(bool, f64, f64)> = par_map(slots * rows, |at| {
let (s, r) = (at / rows, at % rows);
if sel[s] == HOST {
return (true, 0.0, 0.0);
}
let (q, d) = &cols[s];
judge(y[at], rule(part, sel[s], r, q, d))
});
let cards: Vec<(bool, f64, f64)> = (0..slots)
.filter(card)
.flat_map(|s| per[s * rows..][..rows].iter().copied())
.collect();
let (bits, band, worst) = tally(&cards);
let host = (0..slots)
.filter(|s| !card(s))
.all(|s| y[s * rows..][..rows].iter().all(|v| *v == SENT));
let pass = fault_none
&& host
&& bits == cards.len()
&& band
&& (0..slots)
.filter(card)
.all(|s| y[s * rows..][..rows].iter().all(|v| v.is_finite()));
println!(
"nvfp4 clause=nvfp4_relu2_pair_lightning_widths {tag} stage={name} \
fault_none={fault_none} host_slots_sentinel={host} bits_equal={bits}/{} \
worst_err_over_band={worst:.3e} {}",
cards.len(),
verdict(pass)
);
pass
};Then let pass_up = stage("up", 0, &h, &cols_x, up_fault.is_none()); and let pass_down = stage("down", 1, &y, &cols_h, down_fault.is_none());. The output lines keep their text.
Non-blocking
⚠ Stale doc: prefill.rs:1194 says gemm32_stack takes "blocks as words, or Q5_0 packed". StackW::resident now also returns NVFP4 planes, so the sentence is wrong. Add "or NVFP4's planes".
Checked
- Duplicates: 9 new items checked. Hits: items 1 and 2. The plan and body
k % 64filters mirror the existinggemm32_actssplit. dryer: 0 pairs. - Complexity:
relu2::run0 → 50 is the copied stage block (item 2). The others are added branches for the NVFP4 arm. - Silent failure: 6 sites followed, no defect. Tests: named mutants turn an assertion red.
- Gates: no band, tolerance or
KNOWN_DIVERGENCEmoved. Performance: four launches, no per-step allocation. Escape catalog: none matched.
Notes
- The PR body has no
nvidia-smiline, commit hashes or gate output, sogpu.jsonisevidence: false. The native W4A4 prompt path (bloomery_nvfp4_mma) was not run on any card.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_nemotron_h_moe_card32.rs, crates/gpu-gates/src/bin/gate_nvfp4.rs, crates/gpu/src/arch/nemotron_h_moe/moe.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)
…relu² up and down stages are one closure Review fixes for the R3 pull request: Nvfp4SelKernels::enqueue_down only called enqueue_sel32, so it is gone and its callers and doc links name enqueue_sel32; relu2::run judges its up and down stages through one `stage` closure, with the printed lines unchanged; gemm32_stack's doc names NVFP4's planes. gate-gpu-nvfp4 and gate-gpu-lib green on the box, lint clean. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Verdict: CLEAN: the new commits fix both earlier must-fix items and the stale doc, and add no new defect.
Since the last review:
- Must fix 1 (
enqueue_downwrapper): fixed. mxfp4_sel.rs:1954 no longer has the wrapper. All callers (card_leg.rs,site.rs,gate_nvfp4.rs, the unit tests) and the doc links incard.rsandNvfp4Downuseenqueue_sel32. A Grep finds noenqueue_downleft onNvfp4SelKernels. The remainingenqueue_downhits belong toMxfp4SelKernels,MxExpertKernelsandQuantSelKernels, which still define it. - Must fix 2 (
relu2::runstage block written twice): fixed. gate_nvfp4.rs:1335 has onestageclosure.parts[0].1isFFandparts[1].1isN, so the row counts match the old code. The output line text is unchanged. - ⚠ Stale doc in
gemm32_stack: fixed at prefill.rs:1194.
Checked
- Duplicates: 1 new item checked (
stage), none duplicated. It replaces two copies and adds one name. dryer: 0 pairs. - Complexity:
relu2::runis 50 → 45 after the closure. The closure is the former copy, now written once. No other function grew in these commits. - Silent failure: 0 new sites in these commits. Tests: the
stageclosure keeps the same assertions, so the earlier FAIL-first (leg quantizer swapped) still turnsstage=legred. - Gates: no band, tolerance or
KNOWN_DIVERGENCEmoved. Performance: renames and a gate-side closure only; no PTX or launch change. Escape catalog: none matched.
Notes
- The PR body has no
nvidia-smiline, commit hashes or gate output, sogpu.jsonisevidence: false. The native W4A4 prompt path was not run on any card.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_nemotron_h_moe_card32.rs, crates/gpu-gates/src/bin/gate_nvfp4.rs, crates/gpu/src/arch/nemotron_h_moe/moe.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)
What and why
Third step for NVIDIA's Nemotron-H ModelOpt folders (after #921 and #928): the routed NVFP4 experts run the relu² card leg.
kernels::card_relu2_runsadmits NVFP4 and NVFP4_ROWS beside sel32's types;Relu2Leg/Sel32gain theNvfp4Stackarm (up → relu² + 32-value quantize → down, both throughnvfp4_gemv_sel32); the shared expert takes NVFP4 through R2'sShared::Sitesel32 owner; the prompt's routed GEMM asksGemmAct32::new_routed_for, so a native sm_120a/sm_121a build takes W4A4 at k % 64 == 0 and sm_86 keeps W4A8.Release notes: internal — the folder does not open end to end yet (the folder seat and its e2e gate are next).
Code shape
card_relu2_runs); the leg, sel32 and planes kernels are reused; no new kernel.Sel32Run.slots_per_col0 is a named shape error.gate_nemotron_h_moe_card32'sFormsliteral names the newfp4: false; its check is unchanged.cargo fmtandcargo clippyare clean on what I touched.Duplication found or removed: none.
What I ran
just canon-check origin/main:4 bins, 1726 entries: 1726 identical(no PTX moved).tools/gate-batch.sh --tier fixture --ledger: gate-gpu-nvfp4, gate-gpu-lib, gate-gpu-gates-lib, gate-gpu-nemotron-h-moe-card32, gate-gpu-nemotron-h-moe-e2e, gate-nemotron-h-moe-meta, gate-gpu-head, gate-placement:red=0; gate-model-host first red on a full box/tmp(the sidecar needs 1803168 bytes, 0 are free), green alone after space was freed.nvfp4_relu2_pair_lightning_widths: the leg'senqueue_quantize_q8_sel_relu_sqr→enqueue_quantize_q8_selturnsstage=leg rows_equal_the_hand_pair=falseat m=1 and m=3 (gate red); restored.just lint: clean.Hardware
The maintainer's box (RTX 3090 / RTX A6000, sm_86): the W4A8 decode and prompt paths. The native W4A4 prompt path needs an RTX 5090 or a DGX Spark (#926).
🤖 Generated with Claude Code