Skip to content

[Klaud Cold] minimaxm31flash-fp4-mi355x-sglang-agentic-dspark: day-zero MiniMax-M3.1-Flash MI355X SGLang recipe - #4445

Merged
Oseltamivir merged 7 commits into
mainfrom
feat/minimaxm31flash-mi355x-sglang
Oct 24, 2026
Merged

Oseltamivir merged 7 commits into
mainfrom
feat/minimaxm31flash-mi355x-sglang

Conversation

@Oseltamivir

Copy link
Copy Markdown
Collaborator

Summary

Day-zero MiniMax-M3.1-Flash (MiniMaxAI/MiniMax-M3.1-Flash, NVFP4) AgentX on MI355X with SGLang, following the SGLang cookbook: https://docs.sglang.io/cookbook/autoregressive/MiniMax/MiniMax-M3.1 (config source: docs/src/snippets/configs/MiniMaxAI/minimax-m3.1.jsx).

  • Image: lmsysorg/sglang:dev-minimax-m31-flash-mi35x, pinned by digest (verified on Docker Hub 2026-10-24).
  • Serve flags: the cookbook's MI355X Low-Latency (TP4, SGLANG_USE_AITER=1, --fp8-gemm-backend aiter) for conc 1–32 and High-Throughput (Low-Latency + HiCache + fp8 DSpark draft KV + --prefill-decode-interval 16) for conc 48–64. HiCache is pinned to 180 GB per rank (720 GB total), within the 1.5 TB allowed for 4 of 8 GPUs, instead of the cookbook's auto-sized ~350 GB per rank.
  • Common flags: --speculative-algorithm DSPARK --speculative-use-block-verification, --cuda-graph-backend-prefill breakable, minimax-m3 reasoning and tool parsers, --tokenizer-worker-num 8.
  • Speculative decoding: seven-token DSpark (--speculative-dspark-block-size 7, the bundled draft's dspark_block_size). It's set explicitly so throughput runs resolve synthetic acceptance from minimaxm31flash_dspark.yaml ([Klaud Cold] Add MiniMax-M3.1-Flash DSpark golden AL curve and SPEED-Bench collector / [Klaud Cold] 新增 MiniMax-M3.1-Flash DSpark 黄金 AL 曲线与 SPEED-Bench 采集脚本 #4425): AL 4.04 at 7 tokens, thinking on (adaptive, the default).
  • Scheduler batch: the TP4 arm uses 2× CONC for AgentX subagent fan-out, capped at the cookbook's 128, with the decode graph batch matching it.
  • Checked locally: infx generate binds every matrix point to exactly one recipe variant, with SGLANG_SIMULATE_ACC_LEN=4.04.

vLLM siblings: #4419 (GB300), #4420 (MI355X), #4421 (B300), #4422 (H100), #4423 (H200), #4426/#4431 (B200), #4433 (GB200).

….1-Flash SGLang AgentX on MI355X

Serve flags follow the SGLang cookbook's MiniMax-M3.1 cells with the day-zero
dev-minimax-m31-flash image. Seven-token DSpark with synthetic acceptance from
the minimaxm31flash_dspark golden curve.
@Oseltamivir
Oseltamivir requested a review from a team October 23, 2026 17:38
@Oseltamivir Oseltamivir added the full-sweep-fail-fast Full sweep with canary gate; first failure cancels the rest of that matrix (recommended) label Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the contribution!

  • Review: If this PR changes files owned by someone other than a repository admin or @SemiAnalysisAI/core, ask one eligible CODEOWNER to complete the latest PR_REVIEW_CHECKLIST.md before contacting a core maintainer on Slack. Follow the template exactly, including As a PR reviewer and CODEOWNER, I have reviewed this and have, so sign-off verification triggers.
  • PR verification: Sweeps run only when the PR appends an inferencex-e2e/perf-changelog.yaml entry and carries exactly one primary label: full-sweep-fail-fast (strongly recommended; canary plus per-matrix fail-fast), full-sweep-enabled (canary; matrix jobs continue after a failure), or non-canary-full-sweep-enabled (no canary or fail-fast). The modifiers all-evals, evals-only, and agentx-fast require a primary label. On fork PRs, a maintainer applies the label. See sweep labels and reuse.
  • After merging: PR authors must ensure all GitHub Actions jobs pass. Transient failures often pass on rerun; see how to rerun failed jobs.
中文

感谢你的贡献!

  • **审阅:**如果 PR 修改的文件归属于仓库管理员及 @SemiAnalysisAI/core 之外的 CODEOWNER,请先联系一位有资格的 CODEOWNER 填写最新的 PR_REVIEW_CHECKLIST.md,再通过 Slack 联系核心维护者。必须严格遵循模板,并保留 As a PR reviewer and CODEOWNER, I have reviewed this and have,才能触发签核验证。
  • **PR 验证:**只有当 PR 在 inferencex-e2e/perf-changelog.yaml 末尾追加了条目,并且恰好带有一个主标签时,才会运行扫描:full-sweep-fail-fast(强烈推荐;canary 加逐矩阵 fail-fast)、full-sweep-enabled(有 canary;矩阵任务在失败后继续运行)或 non-canary-full-sweep-enabled(无 canary,也无 fail-fast)。修饰标签 all-evals、evals-only 和 agentx-fast 必须与主标签一起使用。fork PR 的标签由维护者添加。参见扫描标签与复用。
  • **合并后:**PR 作者必须确保所有 GitHub Actions 任务通过。临时性失败通常可以通过重新运行恢复;参见重新运行失败任务的说明。

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Findings marked 🟡 are optional suggestions and need no follow-up push.

Comment thread inferencex-e2e/perf-changelog.yaml Outdated
- "Serve flags follow the cookbook's MI355X Low-Latency (TP4) and High-Throughput (TP4, HiCache, fp8 draft KV): DSpark with block verification, breakable prefill graphs, minimax-m3 reasoning and tool parsers, 8 tokenizer workers."
- "Seven-token DSpark (the bundled draft's dspark_block_size); throughput runs use synthetic acceptance from the minimaxm31flash_dspark golden curve (AL 4.04 at 7 draft tokens, #4425)."
- "Search space: Low-Latency TP4 at conc 1-32; TP4 + HiCache (180 GB per rank) and fp8 draft KV at conc 48-64."
pr-link: TBD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 The perf-changelog check will fail on this PR, and the entry will not get its real PR link at merge. pr-link: TBD is not one of the accepted placeholders. validate_added_pr_link (infx/workflows/validate_perf_changelog.py:147) accepts only the canonical https://github.com/SemiAnalysisAI/InferenceX/pull/<N> or an entry in PR_LINK_PLACEHOLDERS (XXX, .../pull/XXX). Fix: set pr-link to this PR's canonical URL, or to XXX so prepare_perf_changelog_merge fills it in.

Why this was flagged

The new block at inferencex-e2e/perf-changelog.yaml:11018 sets pr-link: TBD. On a PR run, validate_added_pr_link in inferencex-e2e/infx/workflows/validate_perf_changelog.py:146-150 raises ChangelogValidationError("new PR entry must use '.../pull/' or an XXX placeholder; found 'TBD'"), because PR_LINK_PLACEHOLDERS at lines 22-25 holds only "XXX" and "https://github.com/SemiAnalysisAI/InferenceX/pull/XXX". The merge-time rewriter inferencex-e2e/infx/workflows/prepare_perf_changelog_merge.py:108 also skips links that are not in PR_LINK_PLACEHOLDERS, so it would never replace TBD. On main, validation requires CANONICAL_PR_LINK (line 142), so TBD fails there as well. Every earlier block in the file uses a canonical URL, for example 11009.

Verification: The new block at inferencex-e2e/perf-changelog.yaml:11018 sets pr-link: TBD. PR_LINK_PLACEHOLDERS (validate_perf_changelog.py:22-25) holds only "XXX" and ".../pull/XXX". validate_added_pr_link (lines 146-150) raises "new PR entry must use ... or an XXX placeholder; found 'TBD'". Either way, the entry does not get its real PR link.

Comment on lines +1556 to +1561
# MiniMax-M3.1-Flash AgentX on MI355X with SGLang: day-zero image from the SGLang
# cookbook (https://docs.sglang.io/cookbook/autoregressive/MiniMax/MiniMax-M3.1),
# manifest digest verified 2026-10-24. Serve flags follow the cookbook's
# MI355X Low-Latency (TP4) and High-Throughput (TP4, HiCache, fp8 draft KV).
# Seven-token DSpark (bundled draft); synthetic acceptance follows
# infx/golden_al_distribution/minimaxm31flash_dspark.yaml.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 nit (optional): New header and provenance comments break the mandatory AGENTS.md comment rules, sweep:cookbook|Low-Latency|High-Throughput|cell|verified 2026. Two examples: the 6-line block above the config key at amd-master.yaml:1556 ("day-zero image from the SGLang cookbook", "manifest digest verified 2026-10-24") and the section headers in the recipe's agentic.yaml at lines 52 and 139. Fix: delete the header, section and source/date comments. Keep only short line-level reasons, for example why hicache-size is 180 or why max-running-requests is 2x CONC capped at 128.

Why this was flagged

AGENTS.md:64 says "No header comments" above a recipe, override or section, and bans describing what the file, topology or config is. AGENTS.md:65 says "No history", which covers where something came from and past results. The diff adds a config description and provenance block at amd-master.yaml:1556-1561, which says "day-zero image from the SGLang cookbook" and "manifest digest verified 2026-10-24". It also adds topology labels at amd-master.yaml:1574 and 1578. In minimaxm31flash/sglang/mi355x-fp4-mtp/agentic.yaml it adds a source-URL comment at lines 24-25, and section headers above overrides at lines 52-53 and 139-141 ("TP4 Low-Latency cell", "High-Throughput cell", "instead of the cookbook's auto-sized ~350 GB per rank"). The base branch has none of these lines. After merge, the repo carries comments its mandatory guidance forbids. The neighbouring entries also have header comments, but that is precedent, not permission.

Verification: AGENTS.md:64 forbids comments "above a recipe, override, or section" and says "Do not describe what the file, topology, or config is". AGENTS.md:65 forbids comments about "where it was derived from ... or past results". The 6-line block at amd-master.yaml lines 1556-1561 and the section headers at agentic.yaml lines 52 and 139 break this. Nothing breaks at runtime.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

…io 1.5

A fixed hicache-size of 180 GB per rank (host/device ~1.09) hit a HIP illegal
memory access in the first prefill's HiCache write backup, so the scheduler died
and the server never turned healthy. Use the cookbook's ratio sizing at 1.5
(~249 GB per rank) to stay inside the MI355X CPU DRAM budget.
@Oseltamivir Oseltamivir added full-sweep-fail-fast Full sweep with canary gate; first failure cancels the rest of that matrix (recommended) and removed full-sweep-fail-fast Full sweep with canary gate; first failure cancels the rest of that matrix (recommended) labels Oct 23, 2026
Keep main's perf-changelog and append the MI355X SGLang entry at the end.
Keep main's entries and re-add the MI355X SGLang changelog and master-config blocks.
The cookbook High-Throughput cell crashes on MI355X: the first prefill's HiCache
write backup hits a HIP illegal memory access with either a fixed hicache-size or
hicache-ratio 1.5. Run concurrency 48 and 64 GPU-resident on the Low-Latency cell.
@Oseltamivir

Copy link
Copy Markdown
Collaborator Author

/use 40065869885

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

@Oseltamivir staged run 40065869885.

This run remains available across future /stage-results requests. Staging the same run ID again updates its staged data. Staging workflow

@Oseltamivir
Oseltamivir merged commit a0287f0 into main Oct 24, 2026
26 checks passed
@Oseltamivir
Oseltamivir deleted the feat/minimaxm31flash-mi355x-sglang branch October 24, 2026 11:48
HaiShaw pushed a commit to sgl-project/sgl-amd-mono that referenced this pull request Oct 25, 2026
…rnel launch a layer (#56)

## Motivation

On SGLang's standard path, MiniMax-M3.1-Flash decodes at low concurrency
with about seven launches per sparse layer after attention:

- the attention all-reduce with residual add, norm and quant
- the router, fused with the shared expert's gate/up
- the shared expert's activation and down projection
- the routed MoE's two stages
- the MoE all-reduce

At c1 (TP4, MI350X, 150K context, DSpark with 7 drafts) that chain takes
about 76 µs per layer, roughly half of an 8.66 ms step. vLLM's
MiniMax-M3 ROCm path runs the same work as one persistent FlyDSL launch
per layer (`vllm/models/minimax_m3/amd/specialized_decode/mono`), and
MiniMax-M3.1-Flash has the same text architecture.

This PR brings that launch here for M3.1's decode and DSpark verify
steps of up to 16 rows, through the monokernel interface
(`--monokernel-backend amd`).

## Modifications

- **minimax_m31/** vendors vLLM's FFN launch at
vllm-project/vllm@a50259bb (Apache-2.0, attribution in the package
docstring). The first commit copies it with only the imports rewritten,
so each later commit is a reviewable change against upstream:
- The launch builds on the plugin's own `common` primitives (`ops`,
`plan`, `sync`, `peer`, `epoch`, `guard`), not on vLLM's copies of them.
The occupancy check loads the HIP runtime through
`common.peer.hip_runtime()`.
- **Fail-stop as every other model's launches.** Waits run under
`common.guard`: SGLang's deadline (`BuildContext.deadline_s`), the
peers' failure flags, and a stop at the null page on failure, so no
token of a failed step is sent. `SGLANG_AMD_MONO_FAULT_INJECT` works.
vLLM's own error words and step-end handshake are gone; vLLM reads them
in a host executor that SGLang has no place for.
- **No epoch limit.** The attention seam's triple pairs carry 16-bit
tags. vLLM resets the epoch from its host executor every ~2,000 steps;
here the tags cycle 1 .. 65535 per parity on the device, and the last
launch of a cycle zeroes that parity's receive half past its epoch
barrier.
- **The shared expert runs on the checkpoint's own MXFP8 values, from
tensors of its own (`a16w8.py`).** vLLM reads it as MXFP4 expert 128 of
the routed tensors. On M3.1 that requantization has about 4.6× the
output error of FP8 (relative 0.18–0.19 vs 0.04), and in a test build it
halved DSpark's real acceptance at one request (3.6 → 2.0 tokens per
step) while GSM8K still passed. Routed slots keep A16W4.
- **minimax_m31/spec.py**: the forward runs SGLang's embedding, dense
layers, input norms and attention, then one FFN launch per sparse layer,
which hands its output and residual back to SGLang's residual stream.
SGLang's final norm (with DSpark's last-layer capture) and logits close
the step. Attention and KV stay SGLang's, so NVFP4 and FP8 KV and
HiCache are untouched. The load hook keeps each rank's MXFP8
shared-expert shard. `SGLANG_AMD_MONO_CHECK=1` runs SGLang's layer on a
copy of each sparse layer's input in eager steps and logs the
differences; `NUMERICS` comes from those runs.
- **minimax/spec.py**: MiniMax-M3 and M3.1 share the `MiniMaxM3Sparse*`
architectures, and SGLang registers one spec per architecture. This spec
states only what both need, hands each checkpoint to its own spec, and
re-checks that spec's requirements as SGLang's guard does. Unit tests
pin that split to SGLang's `Requirements` and `MonoSpec` fields and the
two models' device limits, so a field SGLang adds or a divergence fails
CI. `minimax/check.py` holds the check-mode comparison both models log.
- **test/e2e/test_minimax_m31_server.py** (new): the DSpark verify and
decode servers' routing lines and chat GSM8K past the 16-row width,
check mode against `NUMERICS`, and a stalled rank stopping the server
without tokens.
- **README** and **CODEOWNERS**: M3.1's row, launch, requirements and
test command.

## Accuracy tests

MI350X (gfx950), SGLang `af6d50a85e` (sgl-project/sglang#45936 on
#45925) on a ROCm 10 image (torch 2.11, Triton 3.8, FlyDSL 0.4.0, HIP
7.15), `MiniMaxAI/MiniMax-M3.1-Flash`, TP4:

- `test/kernels/test_minimax_m31_ffn.py`: 6 passed. Every stage at 1, 3,
8 and 16 rows (TP=1 build): the routed experts against AITER's fused MoE
on SGLang's post-load MXFP4 layout, the shared expert against torch on
its MXFP8 values. A launch whose wait times out stops (fails with a
guard that does not stop), and a tag cycle ends with its receive half
zeroed and every launch matching one at epoch 0 (fails without the
clear).
- `test/unit`: 140 passed. One contract failure against this SGLang
branch: `deepseek_v41/spec.py` reads `mxfp8_aiter_preshuffled`, which
that branch lacks; unrelated to this PR.
- `test/e2e/test_minimax_m31_server.py`: 6 passed. Both servers' startup
lines show their tested batches on the launch; chat GSM8K past the
16-row width scores 0.985 (DSpark verify) and 0.975 (decode); every
checked launch is within `NUMERICS`; a rank stalled by
`SGLANG_AMD_MONO_FAULT_INJECT` stops all four GPUs with faults at the
null page and no tokens sent.
- Chat GSM8K (`sglang.test.run_eval`, 200 questions, greedy, DSpark
verify server, real acceptance): 0.975 with `--monokernel-backend amd`,
0.975 on the standard path. 8-shot completion prompts score under 0.1 on
either path, so the gate is chat.
- Check mode, two runs of 16 GSM8K prompts (49,476 and 44,004 launches),
worst case: residual rel 0.042, cosine 0.99831; MLP output on the rows
routed alike rel 0.28, cosine 0.66; 6.0–6.1% of rows routed to other
experts than SGLang's.

## Speed tests

c1 decode on the same stack, DSpark acceptance held at 3 tokens per step
(`SGLANG_SIMULATE_ACC_LEN=3`), 11K-token prompt, 1,024 greedy tokens,
median of 4:

| | decode tok/s |
|---|---:|
| standard path | 390.8 |
| `--monokernel-backend amd` | 422.3 (+8.1%) |

Chat GSM8K above (4 requests at a time, real acceptance): 24.8 s vs 26.8
s on the standard path, 1,312 vs 1,272 output tok/s.

The port to `common` and the guard leave the launch's time unchanged
(TP=1 build, 1 / 4 / 8 / 16 rows: 26.3 / 45.7 / 65.8 / 108.8 µs against
27.0 / 45.9 / 65.7 / 108.1 µs vendored).

On an earlier revision, AgentX c1 (900 s, TP4, DSpark with 7 drafts at
golden AL 4.04, SemiAnalysisAI/InferenceX#4445's c1 cell) measured 6,013
→ 6,151 tok/s/GPU, p90 449.5 → 470.2 and median 495.2 → 548.0
tok/s/user. c1 screens at 900 s move by several percent between
identical runs.

## Not covered

- MI355X, and TP other than 4.
- A TP4 kernel-level test. TP4 is covered end to end.
- Steps of more than 16 rows (DSpark at 3+ requests), which run SGLang's
path.
- On a ROCm 10 image, #45936's bf16 GEMM table carries hipBLASLt indices
that fit its ROCm 7.2 image only, so verify-graph capture fails until
those rows are left out (`AITER_CONFIG_GEMM_BF16`). These tests ran with
them left out on both paths.
- SGLang could select a spec per checkpoint, which would let
`minimax/spec.py` drop its re-check of the requirements.
- The launch reads at about 3.3 TB/s at 8 rows on MI350X. Its front
stages (norm → router → route → table) cost about 12–16 µs before any
routed weight is read, and a routed tile's loads wait for the previous
tile's tail. Overlapping them across tiles by unrolling was 6% slower
end to end; that's a follow-up.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Kevin Mi <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-sweep-fail-fast Full sweep with canary gate; first failure cancels the rest of that matrix (recommended)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant