[BugFix] Fix DS/Kimi crash on non-first PP ranks when resolving input length - #31752
Merged
Merged
Conversation
ZhengWG
requested review from
Fridge003,
ch-wan,
fzyzcjy,
ispobock and
merrymercy
as code owners
July 20, 2026 06:02
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Collaborator
Author
|
@Fridge003 Could you review this when you get a chance? Thanks! |
ch-wan
approved these changes
Jul 24, 2026
jinzhenfan
pushed a commit
to jinzhenfan/sglang
that referenced
this pull request
Jul 29, 2026
jakki-amd
pushed a commit
to jakki-amd/sglang
that referenced
this pull request
Sep 9, 2026
Atituiset
pushed a commit
to Atituiset/sglang
that referenced
this pull request
Sep 10, 2026
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
DeepseekV2ForCausalLM.forwardcomputeslen_input_idsfor prefill CP metadata before the model body runs. The previous fallback only covered the multimodal case (input_idsis None → useinput_embeds). With pp_size > 1, non-first PP ranks receive activations viapp_proxy_tensorsand bothinput_idsandinput_embedsare None, which triggers an AttributeError on.shape. This blocks DeepSeek / Kimi serving under pipeline parallelism.Modifications
In
python/sglang/srt/models/deepseek_v2.py, resolve sequence length as:input_ids.shape[0]when presentinput_embeds.shape[0](multimodal)pp_proxy_tensors["hidden_states"].shape[0](non-first PP rank)No behavior change on PP rank 0 or single-stage PP.
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #29720769565
Latest PR Test (Extra): ❌ Run #29720769440