Repository navigation
Conversation
|
👋 Hi zeroRains! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe SGLang pause controller now tracks released GPU memory tags. Partial resumes keep generation paused. The request handler re-registers the endpoint only after all released tags are restored. Tests cover partial and complete tagged resume behavior. ChangesSGLang memory resume
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized SGLang pause/resume change preserves ordered memory restoration and delays worker re-registration until readiness; no actionable merge-blocking risk remains after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the problem, implementation, reviewer focus, validation, and no-related-issue status. It is mostly complete, although the unused linked-issue path remains and the reviewer-start section names a reviewer instead of specific files.
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Comment |
| self._released_tags -= set(tags) if tags else set(GPU_MEMORY_ALL_TYPES) | ||
| if self._released_tags: | ||
| # Generation must stay paused until every released region is back. | ||
| return True | ||
| self._is_paused = False |
There was a problem hiding this comment.
🔴 Registration failure after resume leaves worker permanently unregistered
Restoring the last released region clears the paused flag before the worker re-registers with discovery. When register_endpoint_instance then fails, the controller is already marked resumed, so a retry short-circuits as "Memory already resumed" (resume_memory_occupation) and never rejoins the routing pool.
Prompt for agents
resume() in components/src/dynamo/sglang/pause.py sets self._is_paused = False as soon as the last released tag is resumed. The handler resume_memory_occupation (handler_base.py) reads pause_controller.is_paused AFTER calling resume() to decide whether to re-register with discovery and call mark_resumed(). Because resume() already cleared _is_paused, if register_endpoint_instance() raises, the controller no longer reports as paused (is_paused False, needs_resume_recovery False), so a retry of resume_memory_occupation returns early with 'Memory already resumed' and the worker is never re-registered — it stays out of the routing pool. This also fails the existing test test_resume_keeps_paused_state_when_register_fails, which requires is_paused to remain True when register fails after a full resume. The original design deliberately left _is_paused set until mark_resumed() (called only after a successful register). Rework so that (a) resume() signals 'all released regions restored' without prematurely clearing the paused state that the handler and retry logic depend on, and (b) the paused/recovery state is only cleared after registration succeeds (i.e. in mark_resumed). One approach: keep _is_paused True until mark_resumed, track completion via _released_tags being empty, and have the handler decide to register based on a dedicated 'fully resumed but not yet re-registered' condition rather than on is_paused becoming False. Ensure both test_partial_resume_waits_for_all_memory_tags and test_resume_keeps_paused_state_when_register_fails pass.
Was this helpful? React with 👍 or 👎 to provide feedback.
| raise | ||
|
|
||
| self._is_paused = True | ||
| self._released_tags = set(tags) if tags else set(GPU_MEMORY_ALL_TYPES) |
There was a problem hiding this comment.
🔍 Empty tags list is treated as all memory types
set(tags) if tags else set(GPU_MEMORY_ALL_TYPES) in pause and resume treats an empty tags=[] identically to None, recording all regions as released. This round-trips only if SGLang also interprets an empty tags list as "all regions"; if SGLang treats [] as "nothing", the controller records regions as released that were not, and is_paused stays stuck True.
Was this helpful? React with 👍 or 👎 to provide feedback.
| raise | ||
|
|
||
| self._is_paused = True | ||
| self._released_tags = set(tags) if tags else set(GPU_MEMORY_ALL_TYPES) |
There was a problem hiding this comment.
Untagged releases record SGLang's full GPU_MEMORY_ALL_TYPES, which includes cuda_graph, so a Dynamo/GMS restore that resumes only weights and kv_cache leaves _released_tags non-empty and the worker never re-registers. Fix: track Dynamo-supported memory tags for GMS or require/resume cuda_graph consistently in the partial-resume flow.
🤖 AI Fix
In components/src/dynamo/sglang/pause.py, update SGLangEnginePauseController.pause and resume to normalize tags is None to Dynamo's supported GMS tag set {"weights", "kv_cache"} instead of GPU_MEMORY_ALL_TYPES, or update the partial resume contract and test_partial_resume_waits_for_all_memory_tags to include cuda_graph in both tracking and final resume.
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
This PR has been closed due to inactivity. If you believe this PR is still relevant, please feel free to reopen it with additional context or information. |
Overview:
In the RL rollout weight-update flow,
weightsandkv_cacheare released together before the new weights are transferred. They must be resumed in two ordered calls:weightsfirst, so the new weights can be loaded, andkv_cachesecond, so its size can be recomputed from the GPU memory remaining after the weight load. This ordering is required by the RL workflow and is not equivalent to one all-tags resume call.Previously, the first
weightsresume cleared Dynamo's single boolean pause state. The laterkv_cacheresume was therefore treated as an idempotent no-op, leaving SGLang's KV cache pages unmapped. The worker could also be re-registered with discovery between the two calls and receive traffic before it was ready, causing the first post-update prefill to fail in a Triton kernel.co-auther: @gongshaotian
Details:
SGLangEnginePauseController.weightsandkv_cacheresumes.Validation
python -m compileall -q components/src/dynamo/sglang/pause.py components/src/dynamo/sglang/request_handlers/handler_base.py components/src/dynamo/sglang/tests/test_sglang_memory_occupation_handlers.pygit diff --checksglangpackage is not installed; the repository test conftest skips these tests when that dependency is unavailable.uvcould not resolve the uncachedai-dynamo-runtime==1.5.0dependency with offline package access.Where should the reviewer start?
@galletas1712
Related Issues
🔗 This PR is linked to an issue:
No
🚫 This PR is NOT linked to an issue:
Summary by CodeRabbit
Bug Fixes
Tests