diff --git a/python/sglang/srt/managers/cache_controller.py b/python/sglang/srt/managers/cache_controller.py index a78e140bb..c2c14707e 100644 --- a/python/sglang/srt/managers/cache_controller.py +++ b/python/sglang/srt/managers/cache_controller.py @@ -575,9 +575,11 @@ class HiCacheController: return operation.completed_tokens, operation.hash_value def append_host_mem_release(self, host_indices: torch.Tensor): - chunks = host_indices.split(self.mem_pool_host.page_size) - for chunk in chunks: - self.host_mem_release_queue.put(chunk) + if host_indices.numel() == 0: + return + pages = host_indices.split(self.mem_pool_host.page_size) + for page in pages: + self.host_mem_release_queue.put(page) def _page_get_zero_copy(self, operation, hash_values, host_indices): results = self.storage_backend.batch_get_v1(hash_values, host_indices)