Repository navigation
Stream exact NVFP4 operands in full BF16 projection tiles - #34065
Rui Ren (rui-ren) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain that require resolution before approval.
No open issues 🎉
What changed in this PR
This PR builds on #34003 to reduce NVFP4 projection overhead by streaming restored operand pairs into existing BF16 Tensor Core operations for aligned, full eight-row tiles.
Changes:
- Adds compact zero/sign reconstruction and pairwise operand decoding while preserving BF16 scaling, MMA order, and FP32 accumulation order.
- Keeps partial-row, tail, and unaligned fallback paths unchanged.
- Extends packed-operand-extremes coverage to both N=35 and N=8192, exercising boundary and full-tile paths.
| File | Description |
|---|---|
onnxruntime/test/contrib_ops/matmul_packed_precision_test.cc |
Extends operand-extremes tests to full projection widths. |
onnxruntime/contrib_ops/cuda/quantization/matmul_packed.cu |
Streams restored NVFP4 operand pairs into full-tile BF16 operations. |
Review effort: Balanced
61d27b9 to
a3f2076
Compare
a3f2076 to
de9e2b2
Compare
|
Review-fix handoff for stack #33967: six remaining review threads have isolated, tested patches on this branch. Aggregate diff.
Validation at The integrating workstream published the router-API removal while these tests were running and resolved that separate thread. All four per-PR patches apply cleanly to the new owning heads, through stack top Integration is still pending. I did not overwrite any active PR branch, change stack membership, or resolve the six remaining threads prematurely. Local per-PR patches, exact commands, hashes, XML results and preserved failures are in |
de9e2b2 to
caa17e4
Compare
Interleave each restored BF16 operand pair with its original MMA, retaining both BF16 scaling operations, GGUF zero/sign behavior, warp partitions and accumulation order. Preserve partial-row and unaligned fallbacks. Extend the independent operand-extremes regression to the large-N dispatch. Build on the current stack head and preserve its newer IQ2 occupancy and prefill qualifications. Do not transplant the older MT1 dispatch or unrelated Q8 optimization. Earlier paired runtime evidence is tied to its older source pins; current-head qualification is recorded separately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: rui-ren <ruiren1225@gmail.com>
Keep activations and expected outputs in scope while executing both initializer bindings for every row count and output width. The current-source native compilation caught the misplaced closing brace before runtime qualification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: rui-ren <ruiren1225@gmail.com>
caa17e4 to
65477ca
Compare
Description
Stream small restored NVFP4 operand pairs directly into the existing BF16 Tensor Core operations for aligned, full eight-row projection tiles on SM90.
Historical benchmark pins: parent #34003 at
623a725f5cf51ceeaba5725720c3c6effa2fbf3b, measured candidate61d27b9cad1a90fbf0d319048e47ca784875e5f2. The throughput, profiling and full-model qualification below apply to these pins, not the current rebased head.Motivation and Context
Reduce the NVFP4 projection cost in fixed-k7 Nemotron-Bolt speculative decoding without changing precision, routing, cache semantics, package graphs, generated output or workload counters.
Measured end-to-end result: a small incremental improvement, not a full resolution of the speculative TPS regression. On H100, 30 frozen prompts, ordinary and fixed-k7 modes, 240 complete measured generations and two reversed same-physical-GPU passes:
Both individual passes were positive in every bucket. Ordinary decoding was essentially unchanged. Throughput is pooled as
(generated_tokens - 1) / sum(decode_seconds), excluding the first token consistently with the synchronized timer. Frozen prompts, four warmups, mode order, EOS/512-token cap and all speculative workload counters are unchanged. No profiler or owned compilation ran during timing.Separate production CUPTI profiling verified the exact full-tile NVFP4 specialization: 1,200 calls, 47.1110 -> 41.7313 ms total affected-kernel time (-11.42%), with no dropped/invalid records. This is kernel time, not an end-to-end throughput percentage. Registers increased from 64 to 72; this is an operand-scheduling optimization, not a measured register-count reduction.
Historical benchmark validation (pins above)
git diff --checkpassed.The common GenAI binaries were actually built at
b9c6ee9ac579c2c2bff59804ce82e6c1f1c2a3f5. Live stack #2924 head7b7cc5a2821d15136904c1ebb66400c976593a87has byte-identical inference sources; only test include wiring and test whitespace differ. These binaries are not relabeled as a fresh build of that newer head.No new independent HF-reference validation or cross-GPU-architecture qualification is claimed. Original failed build/recovery attempts are preserved; recovered objects lack individual exit-code receipts from the original failed coordinator and were separately checked for source/recipe/log/ELF/hash consistency before all subsequent native/model/runtime gates.
Read-back-verified local evidence: 690 files, 27,562,698 uncompressed bytes. Archive SHA256:
194e008fc7c32751554fc7c34ee2691fd26dc0cbef9c70009228f1031bfc046a. Benchmark statistics SHA256:aa034152a1e7e561f025c26264935a386020a1e4e0ec4e872dacc4051010f566.The previously measured ~2.3% improvement was a different, combined older-source candidate; it is not the measured gain for this isolated follow-up.
Session-policy rebase validation
Current head:
a3f2076b65e0d1a5c7e9b82165ffab014e233876, based on #34003 at7b39b3f69b72812f563f8b727e81c4296c6ce362.Preserves the concurrently published #33994 CI narrowing-conversion fix and this
layer's streamed NVFP4 operands/full-tile regression.
Inherits #33962's default-rounded operands and session-only
ep.cuda.matmul_packed_allow_unrounded_gemvpolicy ("0"default,"1"permitseligible unrounded GEMV). Prefill always rounds. The removed model attribute is
not emitted by tests; existing exports carrying it need removal/re-export.
15 native CUDA + 15 compute75-only PTX projection tests, 5 Python format/policy/alignment
tests and 1 actual internal CUDA cancellation test passed, zero failures/skips.
CLANGFORMAT, Ruff/format and whitespace checks passed. These checks use fresh
changed objects over ABI-matched preserved support, not a clean full-source build,
full CI, performance remeasurement, or fresh full-model generation qualification.