Support sleep and destroy deepep buffer#4246
Merged
lvhan028 merged 4 commits intoInternLM:mainfrom Jan 28, 2026
Merged
Conversation
grimoire
approved these changes
Dec 31, 2025
Collaborator
|
May upgrade dlblas after dlblas is released. |
Collaborator
Author
Will test later. |
ae4d038 to
3b4db0b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for explicit destruction of DeepEP buffer during the sleep operation to properly manage GPU memory resources. The changes introduce a sleep/wakeup state management mechanism and modify the sleep method to be asynchronous to coordinate buffer destruction across distributed workers.
Changes:
- Added
SleepWakeupStatedataclass to manage sleep/wakeup synchronization using asyncio events - Converted
sleep()method to async to support coordinated buffer cleanup across distributed processes - Integrated explicit DeepEP buffer destruction by calling
DeepEPBuffer.destroy()during sleep if available - Added
set_explicitly_destroy()call during DeepEP initialization to enable explicit cleanup mode
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| lmdeploy/pytorch/engine/model_agent/agent.py | Added SleepWakeupState for synchronization, converted sleep to async, added DeepEP buffer destruction logic, and sleep/wakeup coordination |
| lmdeploy/pytorch/engine/executor/base_worker.py | Updated sleep method to be async and await the model agent's sleep |
| lmdeploy/pytorch/engine/executor/base.py | Updated sleep method signature to be async in the base interface |
| lmdeploy/pytorch/backends/cuda/moe/default.py | Added call to set_explicitly_destroy() during DeepEP initialization |
| lmdeploy/pytorch/backends/cuda/moe/blocked_fp8.py | Added call to set_explicitly_destroy() during DeepEP initialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RunningLeon
commented
Jan 21, 2026
| raise NotImplementedError('Not Implemented.') | ||
|
|
||
| def sleep(self, level: int = 1): | ||
| async def sleep(self, level: int = 1): |
Collaborator
Author
There was a problem hiding this comment.
TODO: uni and mp executor may implement
grimoire
approved these changes
Jan 22, 2026
lvhan028
approved these changes
Jan 28, 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
Require PR: DeepLink-org/DLBlas#96
dlblas>=0.0.7Modification
Please briefly describe what modification is made in this PR.
BC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
Checklist