Repository navigation
[Feat] deepseek_v41: Serve decode and verify steps under prefill CP - #78
Open
ChangLi811 wants to merge 1 commit into
Open
ChangLi811 wants to merge 1 commit into
ChangLi811 wants to merge 1 commit into
Conversation
ChangLi811
force-pushed
the
dsv41-prefill-cp
branch
from
October 29, 2026 15:26
f96eb40 to
f0923c2
Compare
This was referenced Oct 29, 2026
ChangLi811
marked this pull request as ready for review
October 29, 2026 15:27
With --enable-prefill-cp SGLang keeps all 64 attention heads on every rank (attention TP 1) and the whole KV and index caches on every rank, but decode and verify steps never run CP. K1 and K2 therefore run this rank's TP share of the heads as without CP: wq_b's and wo_a's rows are views of the replicated weights, wo_b's columns (in aiter's (16, 16) preshuffle too) and its block codes a copy. The kernels are unchanged. The gate accepts CP only as prefill CP over the whole TP group; decode CP or a narrower CP group is refused. The README names sgl-project/sglang#43465 (prefill CP on HIP) among its requirements.
ChangLi811
force-pushed
the
dsv41-prefill-cp
branch
from
October 29, 2026 16:20
f0923c2 to
06ebd67
Compare
ChangLi811
requested review from
HaiShaw,
alexnails and
kevin-mii
as code owners
October 29, 2026 16:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
With prefill context parallelism (
--enable-prefill-cp, sgl-project/sglang#43465 on HIP),--enable-amd-monokernelrefuses to start: the spec does not acceptCONTEXT_PARALLEL, and the attention layers hold all 64 heads instead of a TP share. Long-context serving then has to choose between prefill CP and the monokernels at low concurrency.Modifications
wq_b's andwo_a's rows are views of the replicated weights,wo_b's columns (in aiter's (16, 16) preshuffle too) and its block codes a copy. The kernels are unchanged._config_disable_reasonsaccepts CP only as prefill CP over the whole TP group; decode CP or a narrower CP group is refused.draft.pyaccepts the DSpark draft's replicated heads the same way.Accuracy Tests
DeepSeek-V4.1-Flash + DSpark (block size 5), one MI355X node,
rocm/sgl-dev:v0.5.22-rocm10-mi35x-20261025, SGLang: a local merge of #43465 (15e93db9e), #44730, #44031 and #46036 (aa6e51982). GSM8K: sgl-eval, 1319 questions, max tokens 4096. Monokernels on and off on fresh servers of the same configuration (prefill CP +--enable-cp-decode-attn-tp+ decoder SWA bounded replay).Decode-vs-prefill KL stays within the spec's bounds; long-context needles (to 100k), CP's zero-row request groups, c16 / c32 stress and image prompts (MMMU-Pro) match the monokernels-off server. These were taken on an earlier base; after rebasing onto
mainthe kernel checks pass at TP2 and TP4 and a TP4 / CP4 server (FP8 unified KV and the page8 index pool on, #79 and #80) scores 0.964.GSM8K above runs 64 threads, so most verify steps are wider than 8 requests and take SGLang's path. With AgentX's c1 recipe (
max-running-requests 2, its 19 environment variables,SGLANG_HIP_DSV41_INDEX_K_PAGE8=1), every verify step runs on the monokernels; on #70 (now inmain) plus this PR, #79 and #80 (DeepSeek-V4.1-Flash-1017 weights, fresh servers):(GSM8K / DSpark accept length. TP4 "off" accept lengths are left out: with the recipe's
--disable-shared-experts-fusion, SGLang's own path accepts less at batch 1–3, which--enforce-shared-experts-fusion, as the README uses, restores.)Speed Tests and Profiling
TP4 / CP4, ShareGPT through the chat API, 500 output tokens: output throughput (tok/s) / mean TPOT (ms).
Checklist
pre-commit run --all-filespasses (ruff, isort, codespell).test/cover the change.aa6e51982:pytest test/unitpasses 264 (262 onmain), including the new CP tests and thedeepseek_v41contract, which also passes against SGLang main (c6c753395). The 7 failures and 3 collection errors (GLM-5.3, MiniMax and DeepSeek-V4-Pro tests) are the same onmainand unrelated to this PR..github/CODEOWNERSthat names its owner. (No new model.)