Repository navigation
gemm: retain checked integer conversion for native activation launches - #984
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: No behavior defect or proven quality defect remains.
Non-blocking
⚠ Complete the launch-fold evidence: crates/gpu/src/gemm/nvfp4mma.rs:2072.
At K=2560, input quantization changes from 20 Q8 CUDA blocks plus one FP4 block per column to one 64-thread block using 2,888 shared bytes [derived]. This touches decode and prefill.
Attach the registers/occupancy calculation and timed A/B commands with output for both tested hashes, as required for a launch fold with changed geometry. This establishes the cost of reduced parallelism before relying on the timing table.
Checked
Duplicates: 5 new functions checked; none duplicated. dryer reported 0 pairs. Changed gpu-gates code was checked manually.
Complexity: operands (44) moves existing validation and adds the Q8 guard; CardRoute38::new (27) adds load-time allocation choices; nvfp4_gate_up_case (72) adds case selection; fused_swiglu (18) adds conditional stores inside the device core.
Silent failure: 4 sites followed: skipped Q8 stores, zero-tile return, listed-prefix return, and discarded test fault. Q8 consumers are refused by name; route faults remain observable; the test propagates readback errors.
Tests, static mutation: forcing Q8 stores at nvfp4mma.rs:212 would fail the native-only zero assertions; changing >= to > at nvfp4mma.rs:1132 would fail the inactive-slot sentinel assertions. The PR supplies a numerical FAIL-first run for the wrong live-6 arm. Removing package-scoped cfg emission matching at recipes.py:9059 would fail the declared-only fixture assertion.
Bounds: the new hardware test covers K=64, 128, 192, 448, 2560 and Q8ACT_MAX_K, non-finite values, unaligned identity inputs and inactive-slot sentinels.
Gates: no tolerance or pin moved; existing cases remain. The new hardware test is ignored and hw_-prefixed. Python syntax passed.
Escape catalog: C1–C4 do not match the changed code.
Notes
GPU gates were not run during this review. The PR lacks the nvidia-smi line and the tested head hash required by CONTRIBUTING.md; GPU evidence is incomplete.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_gemm.rs, crates/gpu/src/arch/qwen3moe/wide38.rs, crates/gpu/src/gemm/act32.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. |
FP4 입력 quantizer를 launch 1개로 합치고, 쓰이지 않는 gate/up scratch를 할당하지 않도록 했습니다.
What and why
When every routed expert of a Qwen load runs the native NVFP4 path, the input is quantized in two launches (Q8, then FP4) through a global Q8 plane that only the FP4 step reads. The fused gate/up path also keeps
ganduscratch buffers that it never writes. After the routed gate/up, the FP4 conversion also walked every slot, including ones that are not listed.This change:
quant32_lane), and a native-only input skips the global Q8 stores. Inputs that other consumers share keep them.ganduwith zero cells when the load only uses the native fused gate/up. Mixed-format loads keep the existing scratch.Gemm32Launch::check, so the fused path can validate without aybuffer.The saving at 4096 routed slots per run is
2 * run * 10 * 640 * 4bytes, 209715200 bytes. It is derived from the allocation formula, not measured on a full model. The A/B run below shows no prefill or decode change.Release notes: Under the hood: native NVFP4 routed layers quantize their input in one launch and no longer allocate unused gate/up scratch.
Code shape
fused_swiglu); only their input checks differ.wide38.rsonly decides whether the load is native-only; the common owners gained no per-model branch.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none.What I ran
Base
4c549a477835d471929aa3c04718062488864d3bfor the A/B. Gate runs used the head named in each result.Gate commands (DGX Spark,
BLOOMERY_ARCH=sm_121a):BLOOMERY_BOX_LOCAL=1 just gate-gpu-gemm --case nvfp4_gate_up BLOOMERY_BOX_LOCAL=1 ./tools/box.sh 'bash tools/gate.sh --gpu --oxide --release -p bloomery-gpu --lib -- --ignored --exact gemm::nvfp4mma::tests::hw_native_activation_planes --nocapture'To check that the Varied cases are live, I changed
$live <= 4to$live <= 6ingate_up_nvfp4_mma. The gate failed on the live-6 case, and passed again after restoring the original:The same
nvfp4_gate_upgate also ran on an RTX 5090 withBLOOMERY_ARCH=sm_120a(partly resident, host and refused routes, Varied live arms, emptyg/u, eager and graph equal).Prefill and decode A/B on the real model,
nvidia/Qwen3.8-Flash-Next-FP4-Localrevisionb9ce18a6887e18c089fdea8509a33e63429a3300, one DGX Spark, prompt 4096 tokens, 128 generated, median of three rounds per revision, order base/head/head/base/base/head:Each revision was built and served this way in turn. A client sent code prompts of 4096 tokens, greedy, 128 tokens generated, one at a time.
The differences are below the 0.500% resolution, so I claim no speed change. Greedy output was equal.
Hardware (if the change is for a machine)
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.