fix(miles): make shrink_engines post-sleep VRAM assert unconditional#21
Open
zhenyulincs wants to merge 2 commits into
Open
fix(miles): make shrink_engines post-sleep VRAM assert unconditional#21zhenyulincs wants to merge 2 commits into
zhenyulincs wants to merge 2 commits into
Conversation
shrink_engines exposed `post_sleep_vram_threshold_gb: float | None = None`, gating the Step-5 post-sleep VRAM assert behind an opt-in parameter. No caller (in-repo or the external RLix coordinator RPC) ever passed it, and the arg it documented (`args.miles_post_sleep_vram_threshold_gb`) was never defined — so the leak check was dead code. A colocated GPU is time-shared (only one of train/infer holds VRAM at a time), so a full release_memory_occupation must always drop residency to near-zero. That makes the assert a handoff correctness floor, not a tuning knob. Remove the parameter, hardcode POST_SLEEP_VRAM_THRESHOLD_GB = 1.0 as a module constant, and run the assert unconditionally (Anti-regression invariant #8). Fix the stale sglang_engine docstring that referenced the non-existent arg.
The prior commit hardcoded POST_SLEEP_VRAM_THRESHOLD_GB = 1.0 and made the shrink_engines post-sleep VRAM assert unconditional, so nothing reads args.miles_post_sleep_vram_threshold_gb anymore. Remove the now-dead argparse flag (its default of 1.0 already matched the hardcoded constant). Correction to the previous commit message: that flag WAS in fact defined (arguments.py: --miles-post-sleep-vram-threshold-gb, default 1.0). The earlier "the arg was never defined" claim was wrong — the check used a grep with underscores that missed the dashed argparse flag. What is actually true is narrower: no caller ever threaded the value into shrink_engines, so the assert never executed regardless.
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.
Problem
RolloutManager.shrink_enginesexposed an opt-in parameter for its Step-5 post-sleep VRAM leak check:This made the handoff correctness check effectively dead: there is no static call site for
shrink_enginesin the repo (it is invoked dynamically by the external RLix coordinator via Ray RPC), and the parameter is keyword-only with defaultNone, so no caller ever threaded a value into it — the Step-5 assert never executed.Why it should not be a parameter
A colocated GPU is time-shared — only one of train/infer holds VRAM at any moment.
shrink_enginescallsrelease_memory_occupation(tags=None)(full release of weights/KV/cuda_graph), so post-release residency must drop to near-zero or the next phase OOMs. That makes this assert a correctness floor for the GPU handoff, not a tunable knob. It should always run, with a fixed threshold.Change
post_sleep_vram_threshold_gbparameter fromshrink_engines.POST_SLEEP_VRAM_THRESHOLD_GB = 1.0(GiB) with a comment explaining why it's a fixed floor.sglang_engine.pydocstring that referenced the (now-removed) arg.--miles-post-sleep-vram-threshold-gbargparse flag (arguments.py): nothing readsargs.miles_post_sleep_vram_threshold_gbafter the value is hardcoded, and its default of1.0already matched the constant.Safety
shrink_enginesin the repo, and the external coordinator could not have been passing it (the value was never wired in).miles_post_sleep_vram_threshold_gb(attribute) or--miles-post-sleep-vram-threshold-gb(flag) across the repo after the change.Test plan
ast.parseclean on all changed filespost_sleep_vram_threshold_gbparameter references