From d11da2403ce2ab00b0248872e95c8f1d8d0a4ac0 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Sat, 11 Apr 2026 00:12:10 -0700 Subject: [PATCH] Add hisparse staging + decode offload guards to is_fully_idle() (#22577) --- python/sglang/srt/managers/scheduler.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/sglang/srt/managers/scheduler.py b/python/sglang/srt/managers/scheduler.py index 5493c0aa4..1ea27ba24 100644 --- a/python/sglang/srt/managers/scheduler.py +++ b/python/sglang/srt/managers/scheduler.py @@ -3013,6 +3013,12 @@ class Scheduler( if self.disaggregation_mode == DisaggregationMode.DECODE: idle &= len(self.disagg_decode_prealloc_queue.queue) == 0 idle &= len(self.disagg_decode_transfer_queue.queue) == 0 + if self.decode_offload_manager is not None: + idle &= len(self.decode_offload_manager.ongoing_offload) == 0 + + # HiSparse: staging requests transitioning prefill -> decode + if self.enable_hisparse: + idle &= not self.hisparse_coordinator.has_ongoing_staging() # HiCache: in-flight async ops (GPU↔Host↔L3) must drain before # destructive operations like attach/detach/flush_cache.