Repository navigation
[Perf] dsv41: Write large eager mHC output directly into MegaMoE buffers - #46056
alphabetc1 wants to merge 2 commits into
Conversation
|
/rerun-test test_mega_moe_deepgemm_api.py test_deepseek_v4_boundary.py test_mhc_kernels.py test_mega_moe_pre_dispatch.py test_deepseek_v41_flash_gb300_tp2ep2.py test_deepseek_v41_flash_gb300_dp2ep2.py test_deepseek_v4_flash_fp4_megamoe_b200.py |
|
🚀 🚀 🚀 🚀 |
|
/rerun-test test_mega_moe_deepgemm_api.py test_deepseek_v4_boundary.py test_mhc_kernels.py test_mega_moe_pre_dispatch.py test_deepseek_v41_flash_gb300_tp2ep2.py test_deepseek_v41_flash_gb300_dp2ep2.py test_deepseek_v4_flash_fp4_megamoe_b200.py |
|
🚀 🚀 🚀 🚀 |
|
/rerun-test test/registered/unit/layers/moe/test_mega_moe_deepgemm_api.py test/registered/kernels/ops/moe/test_mega_moe_pre_dispatch.py test/registered/kernels/ops/layernorm/test_mhc_kernels.py test/registered/e2e/models/test_deepseek_v41_flash_gb300_dp2ep2.py |
|
🚀 🚀 🚀 🚀 |
Motivation
Remove an intermediate activation copy in large eager DeepSeek-V4.1 prefills by writing mHC output directly into MegaMoE's existing symmetric buffers.
Main's #46163 covers MegaGate decode/target-verify. This PR adds the large eager-prefill path, including routing metadata outside MegaGate, while reusing the shared Mega-mHC output interface.
Modifications
Adapted from the producer/buffer boundary in DeepInfer.
Accuracy Tests
Merge validation: pre-commit and local mocked control-flow checks passed (4 producer combinations, 24 consumer cases). The GSM8K and earlier exact-output results below predate the merge.
The current-head DSv4.1 DP2/EP2 model CI is a regression check, not coverage of this optimization: it uses
--moe-a2a-backend noneand does not exercise the >=16,384-row MegaMoE branch. Current-head directed numerical validation passed on two GPU ranks using production producer/consumer code with random weights at model dimensions: 27 records per rank cover 33,792-row batches, unequal and idle ranks, the 16,384-row boundary, routing metadata ownership, descriptor-identity fallback, and actual CUDA graph fallback. Valid quantized activation/scales/routing buffers, mHC boundary outputs, and final MoE outputs matched exactly. Buffer poisoning checks were included. This establishes the tested numerical boundary behavior; it is not a full-checkpoint accuracy evaluation.Current-head checkpoint-backed shadow validation also passed: 256 measured comparisons per rank at 33,792 rows, visiting source layers 0–19 with real checkpoint weights/activations. The tested mHC/MoE boundary outputs matched exactly. This exercised
routing_in_buffer=False; the alternate routing-buffer path is covered by the directed tests above. This is boundary validation, not a current-head full quality benchmark.Selected current-head
/rerun-testruns passed: MegaMoE API, pre-dispatch, mHC kernels, and DSv4.1 DP2/EP2 regression. The model regression's backend limitation above still applies.Earlier-head validation:
Speed Tests and Profiling
Current candidate
9387694b2a1c060ffd7d405a783a77294f481c24versus baseline1335d372f0a58857422e40b89a097daa7d3bf86c, using measured script revision32457f3689d4d38b1ecf774a02bc4de047e51d9b, based on #46006. The identical script file is now published in #46006 at1aa97c3865fb6b7667f0b8e43f9e316fe79804e4(SHA256c402a986dca6d9fdd59e4957eeaf53f37425fb78b39d9ef69c390d0661ec2dc3). This version fixes suffix assignment per rank and can retain raw completions after requests drain; scoring is unchanged.Matched ABBA, 4,096 requests per rank, 131,072 context tokens, 4,096 uncached suffix tokens, and 32,768 new tokens per rank per step. Both replay paths are enabled, producing 33,792 physical rows per rank. Resolved topology is TP2/EP2/attention-DP2/replica-DP1.
The mean throughput improvement is 0.1026%: repeatable within this matched comparison, but very small. Baseline span was 0.01169%, candidate span 0.02095%. All four arms passed the original benchmark guards, drained 8,192 requests, and reproduced their scores exactly from retained completions. Startup Engram huge-page counts matched across arms.
These are fixed-batch engine-step results. Agent/application E2E benefit has not been established. Earlier larger numbers used older code or the pre-fix input generator and are not substituted for this current-head result.
Measured configuration and reproduction command
Use the two source revisions above with the same model files and runtime. Recorded versions: PyTorch 2.14.1+cu130, FlashInfer 0.7.2, sgl-deep-gemm 0.2.3.post2, sgl-flash-mla 1.0.0, deepseek-recipe 0.2.0. Use two GB300 GPUs. Configure a fresh Mooncake master per arm, RDMA transport, and
MOONCAKE_GLOBAL_SEGMENT_SIZE=150gbper rank; supply deployment-specific Mooncake addresses and RDMA device externally. Local model/log/output paths are normalized below. The older--data-parallel-size 2 --enable-dp-attentionflags resolve to attention-DP2 with one replica for these revisions.Checklist
CI States
Latest PR Test (Base): ❌ Run #40067684925
Latest PR Test (Extra): ❌ Run #40067684945
Latest PR Test (AMD ROCm 10): ❌ Run #40067684950