-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[None][fix] add recompute_active_requests #17937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8576,6 +8576,37 @@ def _handle_speculative_decoding( | |
| def reset_prefix_cache(self): | ||
| self.kv_cache_manager.reset_reuse_state() | ||
|
|
||
| def recompute_active_requests(self) -> None: | ||
| """Discard live request caches so they are rebuilt with current weights. | ||
|
|
||
| This method is intended to run inside :meth:`control_action` after a | ||
| non-draining weight update. A prefix-cache reset alone is insufficient: | ||
| active requests still own KV and recurrent-state caches computed with | ||
| the previous weights, and completing those requests can register stale | ||
| blocks in the reuse pool after the reset. | ||
|
|
||
| Preserve already generated tokens by pausing each request. The normal | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| scheduler then treats those tokens as context and prefills them again | ||
| before decoding resumes. | ||
| """ | ||
| print( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a leftover debug sentinel — it writes to stdout unconditionally on every rank, bypassing the log level. Please drop it, or use |
||
| "TRTLLM_RECOMPUTE_ACTIVE_REQUESTS_CALLED " | ||
| f"active_requests={len(self.active_requests)}", | ||
| flush=True, | ||
| ) | ||
| # The overlap loop can have one completed GPU batch whose sampled tokens | ||
| # have not yet been applied to the requests. Consume it before freeing | ||
| # its cache resources or the loop would later access released entries. | ||
| self._consume_previous_batch_for_rebalance() | ||
|
|
||
| requests_to_recompute = list(self.active_requests) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| self._terminate_requests(requests_to_recompute) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When |
||
| self._pause_requests(requests_to_recompute) | ||
|
Comment on lines
+8600
to
+8604
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift Drain the PP microbatch ring before releasing request resources. When Either reject this operation for PP, or add an executor-loop state that stops queueing and drains the PP ring before lines 8603-8604 run. The current blocking control action cannot drain that ring after it enters this method. 🤖 Prompt for AI Agents
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. V2 evicts through |
||
|
|
||
| # free_resources() may register old-weight blocks for reuse. Clear the | ||
| # reuse tree only after every active request has released its caches. | ||
| self.reset_prefix_cache() | ||
|
|
||
| def _handle_guided_decoder_errors( | ||
| self, scheduled_batch: ScheduledRequests, | ||
| failed_requests: Optional[List[Tuple[int, str]]]): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method has no caller in the tree and no test. Given it touches request state transitions and KV release ordering, could the
control_actionwiring and at least one test (overlap loop, requests re-prefilled and completing correctly) land with it — or is that a follow-up PR?