Skip to content

[Feat] [AMD] mori: Allow MoRI for DeepSeek-V4.1 DSpark PD - #42457

Merged
HaiShaw merged 1 commit into
sgl-project:mainfrom
AMD-yanfeiwang:feat/mori-dsv41-dspark-pd
Oct 28, 2026
Merged

HaiShaw merged 1 commit into
sgl-project:mainfrom
AMD-yanfeiwang:feat/mori-dsv41-dspark-pd

Conversation

@AMD-yanfeiwang

@AMD-yanfeiwang AMD-yanfeiwang commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

validate_deepseek_v41_features only accepts Mooncake and NIXL (#43734) for DeepSeek-V4.1 DSpark PD, so --disaggregation-transfer-backend mori fails at startup. The V4.1 DSpark PD support is backend-agnostic: the layout and TP checks run in CommonKVManager.try_ensure_parallel_info, and MoRI already transfers the target and draft SWA states through its generic state path.

Modifications

Accept mori next to mooncake and nixl in the V4.1 DSpark PD check and update the error message.

Accuracy Tests

DeepSeek-V4.1-Flash, 1P1D on one 8x MI355X node (prefill TP4 + decode TP4), DSpark, MoRI, lmsysorg/sglang-rocm:v0.5.21-rocm724-mi35x-20261003 + this PR:

Test 1P1D MoRI Aggregated (reference)
Needle at 213 / 1.1K / 2.7K / 5.4K / 21K / 110K prompt tokens all correct all correct
GSM8K 5-shot, 400 questions 0.907 0.900 - 0.910
DSpark accept length (decode) 3.46 3.4 - 3.5
Chat with thinking, tool call correct correct

With the UMBP direct linker on the prefill side (#42197), a 110K-token prompt after flush_cache on both servers restores 110,080 cached tokens and produces greedy output identical to the cold run.

These runs use CP=1 on both servers. Since #40323 the same check also admits prefill CP; MoRI with prefill CP is not covered here.

Speed Tests and Profiling

N/A: this only widens a startup check; the transfer path is unchanged.

Checklist


CI States

Latest PR Test (Base): ❌ Run #38333740714
Latest PR Test (Extra): ❌ Run #38333740578
Latest PR Test (AMD ROCm 10): ❌ Run #38333740698

@AMD-yanfeiwang
AMD-yanfeiwang force-pushed the feat/mori-dsv41-dspark-pd branch 2 times, most recently from 3ea388b to d36e680 Compare October 12, 2026 14:10
@AMD-yanfeiwang
AMD-yanfeiwang force-pushed the feat/mori-dsv41-dspark-pd branch from d36e680 to f0dc923 Compare October 13, 2026 01:46
ChangLi811 added a commit to ChangLi811/sglang that referenced this pull request Oct 21, 2026
The target and draft SWA rings already ship as SWA_RING components; let the
DSpark PD spec-layout handshake accept them, drop the unified + DSpark + PD
rejection, and allow MoRI as the DSpark PD transfer backend (as sgl-project#42457).
ChangLi811 added a commit to ChangLi811/sglang that referenced this pull request Oct 23, 2026
The target and draft SWA rings already ship as SWA_RING components; let the
DSpark PD spec-layout handshake accept them, drop the unified + DSpark + PD
rejection, and allow MoRI as the DSpark PD transfer backend (as sgl-project#42457).
ChangLi811 added a commit to ChangLi811/sglang that referenced this pull request Oct 26, 2026
The target and draft SWA rings already ship as SWA_RING components; let the
DSpark PD spec-layout handshake accept them, drop the unified + DSpark + PD
rejection, and allow MoRI as the DSpark PD transfer backend (as sgl-project#42457).
@HaiShaw HaiShaw changed the title [PD][MoRI] Allow MoRI for DeepSeek-V4.1 DSpark PD [Feat] [AMD] mori: Allow MoRI for DeepSeek-V4.1 DSpark PD Oct 28, 2026
@HaiShaw
HaiShaw enabled auto-merge (squash) October 28, 2026 09:25
@HaiShaw
HaiShaw disabled auto-merge October 28, 2026 09:25
@HaiShaw
HaiShaw merged commit b85d6a8 into sgl-project:main Oct 28, 2026
106 of 122 checks passed
AMD-yanfeiwang added a commit to AMD-yanfeiwang/sgl-amd-mono that referenced this pull request Oct 28, 2026
sgl-project/sglang#42457 lets SGLang serve DeepSeek-V4.1 DSpark PD over MoRI,
so the gate goes back to MoRI only, the backend these kernels were tested on
(Mooncake fails at prefill startup on the MI355X ionic NICs, monokernels off).
AMD-yanfeiwang added a commit to AMD-yanfeiwang/sgl-amd-mono that referenced this pull request Oct 28, 2026
Allow the DeepSeek-V4.1-Flash target and DSpark draft monokernels on a MoRI
PD decode server, as sgl-project#67 does for DeepSeek-V4-Pro; SGLang serves V4.1 DSpark
PD over MoRI since sgl-project/sglang#42457. The kernels cover decode and
DSpark verify steps only, so the KV, compressor-state and index-key buffers
they read are the ones MoRI fills. Prefill servers and other transfer backends
stay refused. The README names the index-key layout switch that both peers
must share, since the PD handshake does not compare it.
HaiShaw pushed a commit to sgl-project/sgl-amd-mono that referenced this pull request Oct 29, 2026
## Motivation

The DeepSeek-V4.1-Flash monokernels refuse every PD server today: the
target and DSpark draft specs do not declare `PD_DISAGGREGATION`, so
`--enable-amd-monokernel` on a decode server stops with "PD
disaggregation is in use and the spec does not accept it". #67 enabled
MoRI PD decode for DeepSeek-V4-Pro; this does the same for V4.1. SGLang
serves V4.1 DSpark PD over MoRI since sgl-project/sglang#42457.

## Modifications

- `deepseek_v41/spec.py` and `deepseek_v41/draft.py` declare
`PD_DISAGGREGATION`.
- `_config_disable_reasons` refuses a prefill server and transfer
backends other than MoRI, with the same reasons as V4-Pro.
- `SGLANG_READS` pins `disaggregation_mode` and
`disaggregation_transfer_backend`.
- A unit test covers the gate; the README's MoRI PD note names both
models.

The kernels and their layouts are unchanged. They run decode and DSpark
verify steps only, so all the state they read (paged SWA KV, compressor
states, index keys, the draft's KV) lives in SGLang's own pools, which
MoRI fills on the decode server.

With a per-node shared Engram host table, decode also needs #65. Both
peers must leave `SGLANG_HIP_DSV41_INDEX_K_PAGE8` unset: it changes the
index keys' bytes but not their size, so SGLang's PD handshake does not
catch a mismatch (the README says so).

## Accuracy Tests

DeepSeek-V4.1-Flash + DSpark (block size 5), 1P1D on one MI355X node
over MoRI with `SGLANG_RAGGED_VERIFY_MODE=static`: prefill without
monokernels at the decode's TP. TP2 keeps the Engram tables in per-rank
host memory on both peers (`--engram-config '{"placement":"cpu"}'`), as
the AgentX TP2 recipe does; on GPU they leave TP2 no room for the KV
cache. `lmsysorg/sglang-rocm:v0.5.22-rocm10-mi35x-20261028` running
SGLang main. GSM8K is `sglang.test.few_shot_gsm8k` with 1319 questions,
sent through the PD router.

| decode | TP | `--enable-amd-monokernel` | startup | parallel 64 |
parallel 8 | DSpark accept length |
|---|---|---|---|---:|---:|---:|
| `main` | any | yes | refused: PD not accepted | - | - | - |
| this PR | 4 | no | serves | 0.889 | 0.908 | 3.39 |
| this PR | 4 | yes | serves; target and draft kernels built on all
ranks | 0.895 | 0.915 | 3.39 |
| this PR | 2 | no | serves | 0.908 | 0.904 | 3.37 |
| this PR | 2 | yes | serves; target and draft kernels built on all
ranks | 0.904 | 0.906 | 3.38 |

The monokernels run verify steps of up to 8 requests, so parallel 8 runs
every verify step on them; at parallel 64 most steps are wider and take
SGLang's own path. The spread matches run-to-run nondeterminism. Without
PD, on the same image, the monokernels score 0.904 to 0.909 at parallel
64 and 0.903 to 0.914 at parallel 8 across Engram table placements.

CPU, same image: `test_deepseek_v41_spec.py` passes, including the new
PD test, and so does the `deepseek_v41` contract. The two `minimax` /
`minimax_m31` contract failures are the same on `main`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants