From 0ac6c63ae43fe19fa0cccc0c1675b0371c9fc22d Mon Sep 17 00:00:00 2001 From: hzh0425 Date: Mon, 9 Mar 2026 00:39:26 +0800 Subject: [PATCH] [SpecV2-Mamba]: Refactor additional_ratio calculation when init mamba pool (#19660) --- .../srt/model_executor/model_runner_kv_cache_mixin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/sglang/srt/model_executor/model_runner_kv_cache_mixin.py b/python/sglang/srt/model_executor/model_runner_kv_cache_mixin.py index c46ff0a38..32cf5d7e8 100644 --- a/python/sglang/srt/model_executor/model_runner_kv_cache_mixin.py +++ b/python/sglang/srt/model_executor/model_runner_kv_cache_mixin.py @@ -342,10 +342,11 @@ class ModelRunnerKVCacheMixin: additional_ratio = 0 if self.server_args.enable_mamba_extra_buffer(): - if not self.spec_algorithm.is_none(): - additional_ratio = MAMBA_CACHE_V2_ADDITIONAL_RATIO_NO_OVERLAP - else: + # ping-pong buffer size is 2 when overlap schedule is on, 1 otherwise. + if not self.server_args.disable_overlap_schedule: additional_ratio = MAMBA_CACHE_V2_ADDITIONAL_RATIO_OVERLAP + else: + additional_ratio = MAMBA_CACHE_V2_ADDITIONAL_RATIO_NO_OVERLAP return MAMBA_CACHE_SIZE_MAX_RUNNING_REQUESTS_RATIO + additional_ratio