[Bugfix] Fix illegal memory access from a forward during a partial wake_up (#44483)
Signed-off-by: Meihan-chen <zr010426ztt@outlook.com> Signed-off-by: aoshen02 <aoshen@inferact.ai> Co-authored-by: aoshen02 <aoshen@inferact.ai> Co-authored-by: Nick Hill <nickhill123@gmail.com>
meihanc committed
Jun 24, 2026 at 22:12 UTC
93ec6458781b50a89f967126419312388c5505a3
1 file changed
+12
-4
vllm/v1/engine/core.py
+12
-4
@@ -809,8 +809,10 @@ class EngineCore:
809
if tags is None or tags:
810
self.model_executor.wake_up(tags)
811
812
- # Resume scheduling (applies to all levels)
813
- self.resume_scheduler()
812
+ # Partial wakes intentionally keep the remaining allocations asleep.
813
+ # Resume scheduling only once all executor memory is resident again.
814
+ if not self.model_executor.is_sleeping:
815
+ self.resume_scheduler()
816
817
def is_sleeping(self) -> bool:
818
"""Check if engine is sleeping at any level."""
@@ -1947,10 +1949,16 @@ class DPEngineCoreProc(EngineCoreProc):
1949
# All engines are idle.
1950
continue
1951
1952
+ # Execute a dummy pass when no ready requests ran, unless the
1953
+ # engine is sleeping. self.is_sleeping() also covers the KV-offload
1954
+ # window before model_executor.is_sleeping flips.
1955
+ elif not self.is_sleeping():
1956
+ with self.log_iteration_details(None):
1957
# We are in a running state and so must execute a dummy pass
1958
# if the model didn't execute any ready requests.
1952
- with self.log_iteration_details(None):
1953
- self.execute_dummy_batch()
1959
+ if not self.model_executor.is_sleeping:
1960
+ with self.log_iteration_details(None):
1961
+ self.execute_dummy_batch()
1962
1963
# 3) All-reduce operation to determine global unfinished reqs.
1964
self.engines_running = self._has_global_unfinished_reqs(