From 6ed56e04ff8aacffc60276817e3a49aa2ee23899 Mon Sep 17 00:00:00 2001 From: meihanc Date: Wed, 24 Jun 2026 22:12:23 +0800 Subject: [PATCH] [Bugfix] Fix illegal memory access from a forward during a partial wake_up (#44483) Signed-off-by: Meihan-chen Signed-off-by: aoshen02 Co-authored-by: aoshen02 Co-authored-by: Nick Hill (cherry picked from commit 93ec6458781b50a89f967126419312388c5505a3) --- vllm/v1/engine/core.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vllm/v1/engine/core.py b/vllm/v1/engine/core.py index 8f6baa46936..cfeec4456ea 100644 --- a/vllm/v1/engine/core.py +++ b/vllm/v1/engine/core.py @@ -809,8 +809,10 @@ class EngineCore: if tags is None or tags: self.model_executor.wake_up(tags) - # Resume scheduling (applies to all levels) - self.resume_scheduler() + # Partial wakes intentionally keep the remaining allocations asleep. + # Resume scheduling only once all executor memory is resident again. + if not self.model_executor.is_sleeping: + self.resume_scheduler() def is_sleeping(self) -> bool: """Check if engine is sleeping at any level.""" @@ -1947,10 +1949,16 @@ class DPEngineCoreProc(EngineCoreProc): # All engines are idle. continue + # Execute a dummy pass when no ready requests ran, unless the + # engine is sleeping. self.is_sleeping() also covers the KV-offload + # window before model_executor.is_sleeping flips. + elif not self.is_sleeping(): + with self.log_iteration_details(None): # We are in a running state and so must execute a dummy pass # if the model didn't execute any ready requests. - with self.log_iteration_details(None): - self.execute_dummy_batch() + if not self.model_executor.is_sleeping: + with self.log_iteration_details(None): + self.execute_dummy_batch() # 3) All-reduce operation to determine global unfinished reqs. self.engines_running = self._has_global_unfinished_reqs(