Skip to content

[Feat][EP] Add MiMo-V2.6-Flash DP2+EP8+DP-ATTN prefill support in MI300X - #39

Merged
sammysun0711 merged 14 commits into
mimo-opt-mxfp4-dflashfrom
mimo_v26_flash_ep
Nov 3, 2026
Merged

sammysun0711 merged 14 commits into
mimo-opt-mxfp4-dflashfrom
mimo_v26_flash_ep

Conversation

@Richardyu114

@Richardyu114 Richardyu114 commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Enable and optimize MiMo-V2.6-Flash-MOPD prefill on MI300X with DP2 / attention TP4 / MORI EP8. Builds on the DFlash DP-attention support merged in #35 and requires the companion AITER #23.

Changes

  • Route MiMo MoE through MORI EP; mask padded expert IDs and skip unused expert-count kernels.
  • Enable custom collectives for attention TP groups and integrate AITER reduce-scatter/capture handling with existing fallbacks.
  • Quantize QKV inputs before all-gather and pack FP8 activations plus FP32 block scales into one collective using an FP32 bit-view. Write quantization outputs directly into the packet and transpose gathered scales once.
  • Add the EP8 launcher, tuned MORI AUTO configuration, capacity validation and evaluation instructions. Defaults: global chunk 32K / 16K per DP, DFlash and FP8 all-gather enabled, and PrefillDelayer enabled with a 100-pass budget. Use PERFORMANCE_MODE=0 for accuracy; the default performance mode uses fake expert routing.
  • Fix post-warmup cache-flush races and PrefillDelayer admission ordering that could stall long-input requests.

Upstream changes

Change Source Integration
Padded expert-ID masking sglang#28378 Adapted
Skip unused MORI expert counts sglang#30302 Adapted
Attention TP custom collectives sglang#31629, #35330 Selected portions
AITER reduce-scatter and capture handling sglang#29103, #34203, #43077 Selected collective portions
Wait for idle before cache flush sglang#33663 Adapted
PrefillDelayer admission fixes sglang#31835, #32389 Cherry-picked; sgl-project#31835 adapted to the local Req API

Validation and results

Validated with AITER #23 on MI300X, DFlash block 8, global chunk 32768 and seed 12345.

  • GSM8K: full 1319 questions, 4-shot, greedy, batch 32, real routing. Two runs scored 1286/1319 (97.4981%) and 1289/1319 (97.7255%); zero API errors. Mean worker acceptance lengths were 5.5964 / 5.5314, including the bonus token. The second run reused the server after a cache flush.
  • 64K/1, C32, 256 requests: four warmups, fake routing, TOKENIZE_PROMPT=0; 256/256 succeeded.
Metric PR
Input throughput (tok/s) 63,841.42
Mean TTFT (ms) 30,951.48
P99 TTFT (ms) 33,663.12

Earlier component comparisons, all with DFlash and global chunk 32K:

Optimization Case (ISL/OSL, concurrency, requests) Input-throughput gain
ASM + MORI tuning 64K/1, C16, 1024 +2.40%
Packed FP8 all-gather path 64K/1, C16, 1024 +4.86%
PrefillDelayer fixes 512K/1, C4, 32; 960K/1, C4, 16 +17.48%; +14.73%

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical registration-policy and AITER API mismatches can break graph replay and attention execution, while missing or incomplete test entry points block CI collection or leave regressions untested.

5 open issues
What changed in this PR

Adds MiMo-V2.6-Flash prefill support on MI300X using DP2, attention TP4, and MORI EP8, with optional DFlash decoding.

Changes:

  • Enables MORI routing and optimizes AMD collectives with packed FP8 activation/scale gathering.
  • Adjusts prefill admission coordination and adds backend-aware benchmark cache flushing.
  • Adds deployment instructions, tuning settings, regression tests, and multi-GPU smoke tests.
File Description
test/​registered/​unit/​models/​test_mimo_mori_ep.py Tests MORI routing, recording, and padding.
test/​registered/​unit/​managers/​test_prefill_adder.py Tests prefill admission and delayer coordination.
test/​registered/​unit/​layers/​quantization/​test_fp8_blockwise_all_gather.py Tests packed FP8 layouts and validation.
test/​registered/​unit/​distributed/​test_parallel_state.py Tests collective policies, capture modes, and fallbacks.
test/​registered/​bench_fn/​test_benchmark_datasets_api.py Tests cache-flush requests, timeout validation, and failures.
test/​manual/​amd/​test_mimo_ep_collectives.py Adds four-GPU collective and graph-replay checks.
test/​manual/​amd/​test_fp8_blockwise_all_gather.py Adds eight-GPU packed FP8 and QKV checks.
python/​sglang/​srt/​models/​mimo_v2.py Enables MORI all-to-all MoE execution.
python/​sglang/​srt/​managers/​schedule_policy.py Moves prefill negotiation after budget checks.
python/​sglang/​srt/​layers/​quantization/​fp8_utils.py Handles row-strided FP8 inputs with CK kernels.
python/​sglang/​srt/​layers/​quantization/​fp8_blockwise_all_gather.py Packs activations and scales into one all-gather.
python/​sglang/​srt/​layers/​moe/​topk.py Masks padded expert IDs on HIP without requiring load balancing.
python/​sglang/​srt/​layers/​moe/​token_dispatcher/​moriep.py Avoids unused recorder work during graph capture.
python/​sglang/​srt/​layers/​communicator.py Integrates fused quantization with packed attention gathering.
python/​sglang/​srt/​environ.py Adds platform-dependent defaults and collective controls.
python/​sglang/​srt/​distributed/​parallel_state.py Adds AITER reduce-scatter and capture-mode handling.
python/​sglang/​bench_serving.py Adds backend-aware cache flushing and an idle-wait timeout.
evaluation/​mimo_v26_flash/​mimo-v2.6-flash-mopd-evaluation-guide.md Documents MORI setup and EP8 benchmarking.
evaluation/​mimo_v26_flash/​launch_mimo_v26_flash_dp2_tp4_ep8_dflash_accuracy_baseline.sh Adds the deployment launcher and capacity checks.
evaluation/​mimo_v26_flash/​gfx942_mimo_v26_flash_ep8_mori_a2a.json Supplies MI300X MORI dispatch tuning rules.

Review effort: Balanced

Richardyu114 and others added 14 commits November 3, 2026 02:22
Mask padded top-k IDs to a valid expert even when EPLB is disabled,
while retaining zero routing weights for padded rows. Add a regression
for invalid padded IDs without an expert-location remap.

Adapted-from: sgl-project#28378
Upstream-commit: 6309fb9
Signed-off-by: Richardyu114 <zhentyu@amd.com>
Do not capture LocalExpertCount for the no-op recorder. Keep the
count kernel for configured recorders so recording can start after
capture. Cover inactive, active and capture-time recording policies.

Adapted-from: sgl-project#30302
Upstream-commit: 9ddea8d
Signed-off-by: Richardyu114 <zhentyu@amd.com>
Recognize MORI in the MiMo A2A initialization and forward-path gates.
Use the existing dispatcher-based forward with padded-token metadata
and avoid the tensor-parallel post-expert reduction path.

Add a regression for MORI forward-path selection.

Signed-off-by: Richardyu114 <zhentyu@amd.com>
Let attention TP groups inherit custom-allreduce and MSCCL++ policies
and participate in graph capture. Deduplicate aliased groups and retain
the existing PyNccl selection. Test policy inheritance and capture scope.

Selectively adapt the attention-group changes from the upstream PRs.

Adapted-from: sgl-project#31629
Adapted-from: sgl-project#35330
Signed-off-by: Richardyu114 <zhentyu@amd.com>
Use AITER for eligible reduce-scatter calls with ROCm defaults. Support
unregistered capture inputs for memory-saver and an opt-in AG/RS copy-in
path, retaining existing collective fallbacks.

Adapt the backport to keep RS inside the registered collective boundary
and check per-rank alignment, output shape/dtype/device and deterministic
policy. Add CPU dispatch tests and a four-GPU collective smoke test.

Only the collective portions are included; gfx950 EP decode kernels and
pre-dispatch token hints are not part of this change.

Adapted-from: sgl-project#29103
Adapted-from: sgl-project#34203
Adapted-from: sgl-project#43077
Signed-off-by: Richardyu114 <zhentyu@amd.com>
Backport the post-warmup cache-flush race fix. Add --flush-cache-timeout
with a 60-second default for SGLang and retain backend-specific endpoints.
Raise on HTTP failure before issuing measured requests. Cover deferred
flush completion, CLI validation and benchmark abort on flush failure.

Adapted-from: sgl-project#33663
Upstream-commit: 8a1637a
Signed-off-by: Richardyu114 <zhentyu@amd.com>
Configure global TP8/EP8 with DP2, MORI normal mode, dense TP1 and a DP
LM head. Size and validate dispatch capacity for prefill and DFlash blocks.

Default PERFORMANCE_MODE=1 to fake routing plus PD prefill; setting it
to 0 selects real routing and ordinary serving. Keep TBO and fused QKV
quantization disabled and leave collective workaround flags unset.

The launcher prepares the target topology; DFlash DP-attention support
is still pending and the existing admission guard is unchanged.

Signed-off-by: Richardyu114 <zhentyu@amd.com>
Signed-off-by: Richardyu114 <zhentyu@amd.com>
Add gfx942 tuning rules for FP8 dispatch and BF16 combine at
2048, 4096, and 8192 tokens per rank.

Default the MiMo-V2.6-Flash DP2/attention-TP4/EP8 launcher to AUTO
mode with the bundled JSON, while preserving environment overrides.
Validate config readability and log the active config path.

(cherry picked from commit 1c6b707)
Signed-off-by: Richardyu114 <zhentyu@amd.com>
Write fused QKV quantization outputs into a shared FP32 bit-view
buffer and reuse the existing AITER/RCCL collective path. Keep
activations as row-strided views and transpose scales once for
CK/CKTile GEMMs.

Enable the path through SGLANG_MIMO_FUSED_RMS_QKV_QUANT and default
it on in the EP8 launcher. Add layout and 8-GPU graph replay tests.

Validate DFlash GSM8K accuracy and improve input throughput by 4.86%
at global chunk 32K, input 64K, and concurrency 16 on MI300X.

Signed-off-by: Richardyu114 <zhentyu@amd.com>
- Enable coordinated prefill admission by default with a configurable
  maximum of 100 scheduler passes and an opt-out switch.
- Validate prefill delayer settings and log the resolved configuration.
- Expose stable router-weight fusion as an environment override,
  disabled by default.

Signed-off-by: Richardyu114 <zhentyu@amd.com>
…low_prefill invocation (sgl-project#32389)

Signed-off-by: Richardyu114 <zhentyu@amd.com>
Add executable pytest entry points for the packed FP8 and MORI tests.
Replace the partial parallel-state runner so direct CI invocation
executes all cases and propagates failures.

Signed-off-by: Richardyu114 <zhentyu@amd.com>
@sammysun0711
sammysun0711 merged commit e3c10a4 into mimo-opt-mxfp4-dflash Nov 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants