Repository navigation
[Perf] [NVIDIA] moe: Re-land the JIT moe_finalize_fuse_shared with the shared row read after the PDL wait - #48174
Conversation
|
/rerun-test test/registered/e2e/models/test_dsa_glm52_hisparse.py |
|
@BBuf for review |
|
🚀 |
BBuf
left a comment
There was a problem hiding this comment.
[BBuf Review Agent] One thing to fix before this can go in.
91c696a to
d25144a
Compare
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed::test_block_fp8_live_routes_and_deferred_finalize test/registered/e2e/models/test_dsa_glm52_hisparse.py |
|
🚀 🚀 |
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed.test_block_fp8_live_routes_and_deferred_finalize |
|
🚀 |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
d25144a to
2db836c
Compare
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed::test_block_fp8_live_routes_and_deferred_finalize test/registered/e2e/models/test_dsa_glm52_hisparse.py |
|
🚀 🚀 |
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed.test_block_fp8_live_routes_and_deferred_finalize |
|
🚀 |
|
/rerun-failed-ci |
2db836c to
703e5a9
Compare
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed::test_block_fp8_live_routes_and_deferred_finalize test/registered/e2e/models/test_dsa_glm52_hisparse.py |
|
🚀 🚀 |
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed.test_block_fp8_live_routes_and_deferred_finalize |
@BBuf |
|
🚀 |
…e shared row read after the PDL wait Re-land sgl-project#47784 (reverted by sgl-project#47994) with one change: the shared-expert row is read after PDLWaitPrimary; the routing still loads before it. In a CUDA graph, the shared expert's cross-stream join into the finalize is a programmatic edge too, so an early-triggering shared expert let the old kernel read the row before it was written. Co-Authored-By: Claude Opus 5.5 <[email protected]>
703e5a9 to
557a75d
Compare
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed::test_block_fp8_live_routes_and_deferred_finalize test/registered/e2e/models/test_dsa_glm52_hisparse.py |
|
🚀 🚀 |
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed.test_block_fp8_live_routes_and_deferred_finalize |
|
🚀 |
…nalize kernel > (auto generated by Claude) sgl-project#48366 removed the packed fp32x2 FMA / multiply helpers from sgl_kernel/math.cuh as unused, but moe_finalize_fuse_shared.cuh uses math::fma_f32x2. Restore both helpers verbatim, as they were before sgl-project#48366. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
/rerun-test test/registered/moe/test_flashinfer_fp8_routed.py::TestFlashinferFp8Routed.test_block_fp8_live_routes_and_deferred_finalize test/registered/kernels/ops/moe/test_moe_finalize_fuse_shared.py |
|
🚀 🚀 |
What
Re-lands #47784 (the JIT
moe_finalize_fuse_shared, reverted by #47994) with one fix: the shared-expert row is now read afterPDLWaitPrimary. The routing tensors still load before the wait whenrouting_ready=True. It also drops the device guard #47784 added around the launch.cc @hnyls2002 @BBuf
Why the revert happened
#47994 suspected the early
shared_outputload, and that is the cause.shared_outputis written by the shared expert onalt_streamand joined withwait_streambefore the finalize. In a CUDA graph, that cross-stream join into a PDL launch is a programmatic edge as well, so a shared expert that triggers its dependents early lets the finalize start before the row is written. Only the PDL wait orders it.Reproduced on B300 with a shared-expert stand-in on a side stream that triggers at entry and spins 300 us before writing, joined with
wait_stream, followed by the PDL finalize:The reproduction needs a purpose-built early-triggering writer kernel, so it is not added as a registered test.
Performance
B300, hidden 7168, top-k 8, bf16 with fp32 weights, CUDA graph behind a real PDL producer that triggers before its final stores. Finalize cost = pair time minus producer-only time, medians of 2 x 15 replays.
Issuing the shared load right after the wait is as fast as or faster than issuing it in use order (after the gathers): for one-wave grids ptxas places it after the gathers either way, and the persistent kernel is up to 0.6 us faster with the early issue.
Tests
test_moe_finalize_fuse_shared.pyon B300: 132 passed, 6 skipped (unchanged from #47784). SASS: the sharedLDG.E.128is after the grid-dependency wait; no stack or spills in any instance.Needs before merge:
/rerun-testof the nightlytest_dsa_glm52_hisparse.pyon 8-gpu-b200, which caught the regression and is not part of the per-PR runs.🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ✅ Run #42153621680
Latest PR Test (Extra): ❌ Run #42153621818
Latest PR Test (AMD ROCm 10): ⏳ Run #42153621640
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: