From 34af3ff38655e93533813f2e63b938ed47e47ff5 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Tue, 4 Aug 2026 13:23:08 -0700 Subject: [PATCH] Allow optimistic prefill with L2 hierarchical cache and write-back policy (#33545) Co-authored-by: cctry --- python/sglang/srt/server_args.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index b94e35eb5..d93983ee0 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -8100,8 +8100,14 @@ class ServerArgs: if self.pp_size > 1: logger.warning("Optimistic prefill does not support pp_size > 1") self.optimistic_prefill_attempts = 0 - elif self.enable_hierarchical_cache: - logger.warning("Optimistic prefill does not support hierarchical cache") + elif self.enable_hierarchical_cache and ( + self.hicache_storage_backend is not None + or self.hicache_write_policy != "write_back" + ): + logger.warning( + "Optimistic prefill only supports L2 hierarchical cache " + "with write-back policy" + ) self.optimistic_prefill_attempts = 0 elif resolved_view(self).uses_mamba_radix_cache: logger.warning(