Guard DP dummy inputs around pending work#4738
Open
grimoire wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces unnecessary dummy forward inputs when data-parallel (DP) workers have real inputs pending in the CPU-side preprocess queue, improving DP forward efficiency and avoiding wasted dummy steps.
Changes:
- Update
DPForwardInputsMakerto treat_pre_in_queas pending real work, waiting briefly for preprocessing to complete before falling back to dummy inputs. - Add a small “yield to RPC delivery” window to reduce dummy forwards caused by event-loop/RPC scheduling gaps.
- Add targeted unit tests covering the new DP input selection behavior; minor docstring punctuation normalization in guided spec tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
lmdeploy/pytorch/engine/model_agent/inputs_maker.py |
Adds pending-real-input detection via _pre_in_que, preprocessing wait, and RPC-yield logic before dummy fallback. |
lmdeploy/pytorch/engine/model_agent/agent.py |
Clarifies preprocess-loop contract: _pre_in_que represents pending real work until moved to _in_que. |
tests/pytorch/engine/test_model_agent.py |
Adds unit tests verifying DPForwardInputsMaker.get() behavior across pending, RPC-yield, and sleeping scenarios. |
tests/pytorch/spec_decode/test_guided_spec_integration.py |
Minor docstring character normalization (ASCII arrow/dash). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pr could reduce numbers of dummy inputs when dp>1 is enabled.