mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2995] [CLOSED] [Engine] prefill: per-expert NVFP4 scales on the peer-prefill route (opt-in) #4387
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4387
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2995
Author: @florian862-art
Created: 10/18/2026
Status: ❌ Closed
Base:
main← Head:f-nvfp4-peer📝 Commits (3)
70d6f94prefill: wire per-expert NVFP4 scales through the peer-prefill route (config C)0b69db5prefill: opt-in sums mode on the P2P peer route (STRATA_PF_PEER_SUMS_P2P)17f93f4docs: generation-path P2P micro-bench - the direct host ring wins at every decode row size (10 KB..2.6 MB), 1.7-3x📊 Changes
3 files changed (+450 additions, -19 deletions)
View changed files
➕
src/prefill/README-nvfp4-peer.md(+350 -0)📝
src/prefill/prefill.cpp(+96 -18)📝
src/program/generate.cpp(+4 -1)📄 Description
Problem and result
On a
--peer-devicesetup the peer GPU computes its experts' MoE rows for every prompt chunk, but on NVFP4 packs its MMQ products ran without any per-expert scales (grp_tailnull, nos_gate/s_up, nos_down, noy_scale) - so every peer-computed row was numerically wrong andset_peerrefused the combination. Before: the peer-prefill route was unusable on NVFP4; opening it by env alone recites a long prompt but cannot recall it (silent KV corruption, 0 non-finite). After this change, withSTRATA_PF_PEER_NVFP4=1the route carries the scales end to end: a cold ~25k-token recall prompt finds both needles, 0 non-finite logits, and prefill runs ~2.7k tok/s vs ~2.4k without the peer tier (+12.5 % measured, decode +27 %).Related discussion
none - focused bug fix, opt-in behind an env gate, no default path touched.
Approach
gather_nativecarries the tail scales,swiglu_scaledappliess_gate/s_up,scale_down_rowsscales Dm rows in place on both GPUs (this also fixes the sums-mode path wheres_downwas dropped androw_sdread OOB behind the 31 non-finite logits seen earlier), andy_scalefeeds the w4a4 dequant. The whole route stays behindSTRATA_PF_PEER_NVFP4=1(prefill.cpp refusal gate + generate.cpp rows==0 skip), so nothing changes unless the env is set. A second, separate and droppable commit addsSTRATA_PF_PEER_SUMS_P2P=1(sums over the P2P link): correct but slower than the host route on this box (5.5 vs 14.3 GB/s), documented insrc/prefill/README-nvfp4-peer.mdfor boxes where P2P beats PCIe. Design + measurement notes live in that README.Validation
Revision tested: branch head
e7580cca, rebased onto main @cbfd5b92(v0.2.1.3). Environment: 2x RTX 5070 Ti 16 GB (PCIe, no NVLink), Ubuntu, kernel 7.0.0-38, driver 595.99.02, CUDA build via CMake/Ninja.Passed:
cmake --build build -j4on v0.2.1.3: 331/331 targets, 0 errors (binary md51059259999e587d492da5272e8a840f4).recall-test.py(cold ~25k-token prompt, two needles, greedy): both needles found, 0 non-finite - the gate that the earlier scale-less route failed.pfmeasure.py(unique ~21k-token prompts, max_tokens=1): median ~2.7k tok/s, GPU1 rx ~20 GB/s confirms the peer streams; route banner names "no P2P: through mapped host memory in FP16, one weighted sum per token back". Exact per-run numbers are posted as a comment on this PR.Failed: none observed on this revision.
Not run: HIP / SYCL / Metal builds (no hardware available); the route is CUDA-only code behind the same env gate. Non-NVFP4 packs: untouched code path, not re-validated. Multi-GPU topologies other than this PCIe pair not tested.
Limits
Opt-in only (
STRATA_PF_PEER_NVFP4=1); performance numbers are for this PCIe-only box and will differ on NVLink systems. The sums-P2P commit is independently droppable. The P2P-vs-host route analysis and the generation-path micro-bench in the README apply to consumer GeForce BAR1 P2P.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.