Repository navigation
feat(mega): capture MXFP4 L1 pool across ring wraps - #12
Conversation
There was a problem hiding this comment.
Stale comment
Risk: medium. Left a non-blocking comment and did not approve: this PR changes a performance-critical MXFP4 MegaMoE dispatch/capture path (CUDA kernel, JIT, and public API), which is above the low-risk auto-approval threshold. Cursor Bugbot completed with no issues; human review is needed. No reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Approver
There was a problem hiding this comment.
Risk: medium. Left a non-blocking comment and did not approve: this PR changes a performance-critical MXFP4 MegaMoE dispatch/capture path (CUDA kernel, JIT, and public API), which is above the low-risk auto-approval threshold. Cursor Bugbot completed with no issues; human review is needed. No reviewers were assigned.
Sent by Cursor Approval Agent: Pull Request Approver
|
Sealed at The full 8×B300 DSV4-Flash 262K native-MXFP4 MegaMoE E2E passed forced-rank-imbalance correctness, three bitwise-identical 262K forward replays, DPO, DCP save/fresh-trainer replay/same-trainer resume, weights-only RL restore, four RL hotloads (all K3 below |


Fix native MXFP4 MegaMoE training when the block-padded expert pool exceeds the reusable communication ring. The forward kernel now optionally persists the exact dispatched FP8 L1 rows and column-major UE8M0 scales in a full-pool destination while continuing to use the bounded ring for compute. Includes a distributed extreme-routing regression with active pool 1536 rows and ring capacity 768 rows; forward capture and backward pass on 2x B300.
Note
Medium Risk
Touches a hot SM100 fused MoE forward path and backward synchronization; optional buffers default off, but incorrect capture or barriers could affect distributed training correctness.
Overview
Adds optional
saved_l1_acts/saved_l1_acts_sfto FP8×FP4 MegaMoE so training can keep the full block-padded expert pool when it is larger than the reusable L1 ring. The dispatch path still feeds the ring for compute, but when capture is enabled it also writes the exact FP8 rows and column-major UE8M0 scales into caller-provided pool buffers.The change threads through Python → C++ bindings → JIT launcher →
sm100_fp8_fp4_mega_moe, with compile-timekSaveL1Actsand stricter tensor layout checks (includingblock_malignment for saved preact/down pools). Backward gets a full-grid barrier when route gradients run without W13 dgrad, so route reduction sees L2-dgrad/SwiGLU rows from every CTA; PRE_DOWN unweighted h-weighting is gated onkCompileW13Dgrad.Tests extend
--active-saved-poolto the FP8 path (ring-wrap regression, capture vs gathered inputs, backward using saved L1), tighten POST_DOWN semantics, and broaden wgrad/route-only checks (including multi-rank backward).Reviewed by Cursor Bugbot for commit affab4d. Bugbot is set up for automated code reviews on this repo. Configure here.