fix(moe): expose safe shared-expert overlap plans#60
Conversation
Keep native NVFP4 overlap where supported, reject resident split-decode overlap, and expose W4A16 pre-resident capability.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe change adds environment-gated native NVFP4 split decode, reports auxiliary-stream overlap support for TP MoE plans, exposes the helper through the fused MoE API, and adds plan-level and CUDA graph replay tests. ChangesNVFP4 auxiliary-stream overlap
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Test
participant plan_supports_aux_stream_overlap
participant tp_moe_plan_supports_aux_stream_overlap
participant sparkinfer_moe_fp4
participant AuxiliaryStream
Test->>plan_supports_aux_stream_overlap: evaluate TP MoE plan
plan_supports_aux_stream_overlap->>tp_moe_plan_supports_aux_stream_overlap: delegate overlap check
tp_moe_plan_supports_aux_stream_overlap-->>Test: return supported or rejected
Test->>sparkinfer_moe_fp4: replay captured NVFP4 graph
Test->>AuxiliaryStream: run concurrent torch.mm work
sparkinfer_moe_fp4-->>Test: produce replay output
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing after revalidating the original root-cause evidence. The claimed shared-expert overlap failure was not reproduced. On both 2829061 and current 695c011, M=1/4/7 pass serial eager, serial CUDA graph, routed-first overlap, and aux-first overlap. M=8 differs even in pure serial eager execution with no graph and no auxiliary stream, while heavy auxiliary work stays within the same variation range. The exact M=4 stress workload also passes on both commits, and no deadlock was observed. Therefore the M<=7 capability boundary and caller-facing overlap policy were inferred from a pre-existing M=8 numerical/race behavior rather than an overlap-specific failure. Commit 695c011 now expresses the all-CTA admission requirement at the kernel launch through a cooperative launch, which is the appropriate layer for that contract. The M=8 behavior is being investigated separately against real checkpoint weights and an independent oracle. |
|
Final M=8 result from a real GLM-5.2 NVFP4 layer (K=6144, local N=256, E=256, top-k=8): this case does not execute fused micro. The production planner selects M=7 was bitwise identical across all repeats and matched the independent oracle at cosine 0.9999105. M=8 used the default BF16 atomic scatter of the dynamic kernel; its expected reduction-order variation was small (pairwise cosine about 0.999977, max absolute difference 0.000366) and was present in serial execution. Setting Therefore there is no remaining evidence of a shared-expert auxiliary-stream race or corruption in this report. The M=8 signal came from comparing different kernel families and requiring exact equality from the dynamic atomic-output path. PR #71 adds a CPU planner regression test that pins the real GLM M=7/M=8 dispatch boundary. |
Summary
Why
Resident-grid MoE kernels can deadlock when auxiliary work occupies an SM required by a grid-wide barrier. The caller must query the concrete launch plan instead of treating every SparkInfer kernel as equally overlap-safe.
This PR contains only the MoE execution-model half of #58 and is based directly on
master.Validation
tests/moe/test_moe_execution_model.pytests/moe/test_w4a8_tp_moe.pySummary by CodeRabbit