Skip to content

(feat): Add MiMo v2.6 Flash DP Attention Support - #35

Merged
sammysun0711 merged 17 commits into
mimo-opt-mxfp4-dflashfrom
feat/mimo-flash-dp-attention
Nov 2, 2026
Merged

sammysun0711 merged 17 commits into
mimo-opt-mxfp4-dflashfrom
feat/mimo-flash-dp-attention

Conversation

@sammysun0711

@sammysun0711 sammysun0711 commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Motivation

Enable MiMo-V2.6-Flash on gfx942 DP Attention (DPA) support with global TP8, DP2 attention (two TP4 groups), EP1 and DFlash speculative decoding based on upstream DP attention support for DFlash

Modifications

Based on upstream for DP attention support with DFlash

  • Add DP attention support via --enable-dp-attention, --enable-dp-lm-head for attention-TP collectives and graph capture, draft placement, idle-DP handling, and draft KV budgeting/graph controls.
  • Support multimodal DP encoding via --mm-enable-dp-encoder (not enabled by default)
  • Fix FlyDSL decode dispatch and FlyPA V-tail masking and fix perf regression;
  • Add opt-in router fusion SGLANG_MIMO_FUSED_STABLE_ROUTER_WEIGHTS and SWA eviction tuning SGLANG_DFLASH_SWA_TOKEN_INTERVAL, default off.
  • Update evaluate guide and script for both static mxfp4->fp8 model prefill and decode with DPA support

Accuracy Tests

Launch server

CHUNKED_PREFILL_SIZE=32768 \
MEM_FRACTION_STATIC=0.75 \
SWA_FULL_TOKENS_RATIO=0.03 \
MAX_RUNNING_REQUESTS=96 \
DISABLE_RADIX_CACHE=1 \
ENABLE_TWO_BATCH_OVERLAP=0 \
SGLANG_FLYPA_MIMO_PREFILL=1 \
SGLANG_AITER_PA_DECODE_IMPL=flydsl \
./launch_mimo_v26_flash_dp2_tp8_ep1_dpa_accuracy_baseline.sh

Run evalscope GSM8K accuracy verification

MODEL_PATH=/models/MiMo-V2.6-Flash-MOPD/ \
MIN_ACCEPT_LENGTH=4.0 \
python3 ./run_evalscope_gsm8k_accuracy.py
┌──────────────────────┬───────────┬────────────┬──────────┬───────┬─────────┐
│ Model                │ Dataset   │ Metric     │ Subset   │   Num │ Score   │
├──────────────────────┼───────────┼────────────┼──────────┼───────┼─────────┤
│ MiMo-V2.6-Flash-MOPD │ GSM8K     │ Accuracy ↑ │ main     │  1319 │ 97.6%   │
└──────────────────────┴───────────┴────────────┴──────────┴───────┴─────────┘ 
"mean_worker_accept_length": 5.56

Benchmarking and Profiling

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • /tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci
  4. After green CI and required approvals, ask Merge Oncalls to merge.

sammysun0711 and others added 16 commits October 26, 2026 07:15
Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Enable PyNccl for DP attention reductions and LM-head gathers.
- Include attention TP groups in graph capture without duplicate entries.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Keep draft projections, sampling and graph batches within attention TP.
- Let idle DP groups join target collectives and defer eager verify planning.
- Require DP LM head and reject DP with CP or TBO.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Shard image and video encoding while preserving order and empty-rank output shapes.
- Forward vision attention windows and sinks to AITER.
- Synchronize DP attention SHM consumers before unlinking features.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Normalize unindexed devices before checking buffer reuse.
- Preserve explicit indices, CPU pinning and capacity growth.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Resolve dense-draft placement once and restore target parallel state.
- Align model loading, forwards and graph setup with the draft group.
- Keep seed broadcasts tied to world ranks.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Price draft KV from its actual dtype, layers and attention TP width.
- Include padding pages in standard and hybrid-SWA pool sizing.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Defer DP verify planning and preserve embedding shard semantics.
- Account for cached embeddings and initialize idle mRoPE positions.
- Initialize runtime buffers independently of optional mask files.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Add a draft-only graph toggle while retaining target graphs.
- Apply the low-memory guard on HIP and report draft graph mode.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Honor the full-decode selector and warm qlen1 before graph capture.
- Reuse DFlash workspaces and slice page tables to active batch rows.
- Validate with 25 targeted decode, context-length, and graph cases.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Zero V lanes beyond the final page's valid KV length.
- Prevent zero-probability NaN contamination while preserving valid NaNs.
- Validate with 15 BF16/FP8, partial-page, and long-context GPU cases.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Fuse selected-logit weighting and stable normalization into one Triton kernel.
- Preserve FP32 weights, scaling, and NaN behavior behind the opt-in ROCm flag.
- Add AMD CI coverage for strides, extreme logits, and updated-input graph replay.

Validation: 33 GPU tests pass in a clean checkout.
Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Convert the SWA token interval to iterations using the DFlash block size.
- Preserve overlap guards and eviction boundaries behind an opt-in flag.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Reduce register pressure while preserving V-tail masking.
- Cover penultimate query tiles and mixed partial-page batches.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
- Combine DP attention and the FlyPA tail-mask repair with PR #34.
- Retain native MXFP4 A16W4/A8W4 MoE support.

Signed-off-by: Xiake Sun <xiake.sun@amd.com>
@sammysun0711
sammysun0711 force-pushed the feat/mimo-flash-dp-attention branch from 167d12e to e4080a1 Compare November 2, 2026 07:13
@sammysun0711
sammysun0711 requested a balanced review from Copilot November 2, 2026 07:27
@sammysun0711
sammysun0711 marked this pull request as ready for review November 2, 2026 07:31

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

Missing test registration and a pytest entry point block CI collection, while the benchmark calls a nonexistent analyzer and a valid DFlash configuration can crash.

5 open issues
What changed in this PR

Adds MiMo V2.6 Flash data-parallel attention support on gfx942, combining global TP8 with two attention TP4 groups and DFlash speculative decoding.

Changes:

  • Isolates draft execution groups, accounts for draft KV memory, and handles idle attention replicas and graph capture.
  • Updates FlyDSL decode dispatch and FlyPA tail masking, with optional router fusion and sliding-window eviction tuning.
  • Adds regression tests, deployment launchers, and prefill/decode benchmarking guidance.
File Description
test/​registered/​unit/​spec/​test_dflash_swa_eviction_interval.py Tests eviction timing and live-page preservation.
test/​registered/​unit/​layers/​moe/​test_mimo_stable_router_weights.py Tests fused router numerics and graph replay.
test/​registered/​attention/​test_mimo_flypa_nan_tail.py Tests masking of unused KV tails containing NaNs.
test/​registered/​attention/​test_mimo_flydsl_full_decode.py Tests FlyDSL decode correctness, warmup, and replay.
test/​registered/​attention/​test_aiter_mimo_vectorized_5d.py Extends decode dispatch and compilation coverage.
python/​sglang/​srt/​speculative/​draft_parallel.py Resolves draft placement and isolates execution state.
python/​sglang/​srt/​speculative/​dflash_worker_v2.py Integrates attention-local drafts, memory budgeting, and idle handling.
python/​sglang/​srt/​speculative/​dflash_info.py Supports verification padding and deferred metadata initialization.
python/​sglang/​srt/​speculative/​dflash_info_v2.py Normalizes device identity for reusable buffers.
python/​sglang/​srt/​speculative/​dflash_dp.py Gathers embeddings when collectives would cross independent drafts.
python/​sglang/​srt/​models/​mimo_vl.py Exposes vision output dimensions.
python/​sglang/​srt/​models/​mimo_v2.py Enables data-parallel image and video encoding.
python/​sglang/​srt/​models/​dflash.py Declares the draft’s single-group execution layout.
python/​sglang/​srt/​model_executor/​runner/​decode_cuda_graph_runner.py Reformats an existing graph configuration call.
python/​sglang/​srt/​model_executor/​pool_configurator.py Includes draft KV and fixed allocations in pool sizing.
python/​sglang/​srt/​model_executor/​model_runner.py Stores draft configuration, layout, and memory budget.
python/​sglang/​srt/​model_executor/​forward_batch_info.py Initializes empty multimodal positions for idle batches.
python/​sglang/​srt/​mem_cache/​draft_kv_budget.py Calculates draft KV memory from its attention geometry.
python/​sglang/​srt/​managers/​tp_worker.py Uses the world-group rank for seed broadcasts.
python/​sglang/​srt/​managers/​scheduler_components/​request_receiver.py Synchronizes shared-memory consumers within attention groups.
python/​sglang/​srt/​managers/​schedule_batch.py Adds block-aware DFlash eviction intervals.
python/​sglang/​srt/​layers/​moe/​topk.py Adds opt-in fused stable router weights.
python/​sglang/​srt/​layers/​moe/​stable_router_weights.py Implements stable selected-expert weights in Triton.
python/​sglang/​srt/​layers/​attention/​vision.py Forwards window and sink parameters to attention.
python/​sglang/​srt/​layers/​attention/​flydsl_pa.py Masks unused V tails and adjusts tile scheduling.
python/​sglang/​srt/​layers/​attention/​aiter_utils.py Shares FlyDSL decode/verification handling and adds warmup.
python/​sglang/​srt/​layers/​attention/​aiter_backend.py Prepares ordinary decode alongside speculative verification.
python/​sglang/​srt/​environ.py Adds eviction and draft graph controls.
python/​sglang/​srt/​distributed/​parallel_state.py Supports attention-group capture and isolated draft groups.
python/​sglang/​srt/​configs/​draft_parallel.py Defines draft execution and placement metadata.
python/​sglang/​srt/​arg_groups/​speculative_hook.py Permits DFlash DP attention with configuration constraints.
evaluation/​run_benchmark_mimo_pro_prefill.sh Adds benchmark matrices, dataset overrides, and failure reporting.
evaluation/​mimo_v26_flash/​mimo-v2.6-flash-mopd-evaluation-guide.md Documents DP-attention deployment and benchmark procedures.
evaluation/​mimo_v26_flash/​launch_mimo_v26_flash_dp2_tp8_ep1_dpa_decode_fake_prefill_baseline.sh Adds a TP8 DP-attention fake-prefill decode launcher.
evaluation/​mimo_v26_flash/​launch_mimo_v26_flash_dp2_tp8_ep1_dpa_accuracy_baseline.sh Adds a DP-attention accuracy launcher with optional vision DP.
evaluation/​mimo_v26_flash/​launch_mimo_v26_flash_dp2_tp4_ep1_dflash_decode_fake_prefill_baseline.sh Adds native MXFP4 recipe selection.
evaluation/​benchmark_sglang_prefill.sh Adds a fixed-concurrency prefill benchmark matrix.
evaluation/​bench_sglang_prefill_sweep.sh Adds request-rate tuning against a target first-token latency.

Review effort: Balanced

Comment thread evaluation/benchmark_sglang_prefill.sh Resolved
@sammysun0711
sammysun0711 force-pushed the feat/mimo-flash-dp-attention branch from e4080a1 to 1e843cb Compare November 2, 2026 07:40
Signed-off-by: Xiake Sun <xiake.sun@amd.com>
@sammysun0711
sammysun0711 force-pushed the feat/mimo-flash-dp-attention branch from 1e843cb to 349c046 Compare November 2, 2026 07:43
@sammysun0711
sammysun0711 merged commit f07c190 into mimo-opt-mxfp4-dflash Nov 2, 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.

3 participants