From e0ab91e3ca42a2ece49752ef201f62c45f831e82 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Thu, 8 Oct 2026 17:50:51 -0700 Subject: [PATCH] [MemCache] Rename `SWAChunkCapPoolConfigurator` to `SWARequestCapPoolConfigurator` (#43202) --- .../srt/model_executor/pool_configurator.py | 6 ++--- .../model_executor/test_pool_configurator.py | 26 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/python/sglang/srt/model_executor/pool_configurator.py b/python/sglang/srt/model_executor/pool_configurator.py index 15c5492f15..38da3198b7 100644 --- a/python/sglang/srt/model_executor/pool_configurator.py +++ b/python/sglang/srt/model_executor/pool_configurator.py @@ -926,7 +926,7 @@ def compute_swa_request_cap( ) -class SWAChunkCapPoolConfigurator(HybridSWAPoolConfigurator): +class SWARequestCapPoolConfigurator(HybridSWAPoolConfigurator): """Hybrid SWA with the SWA pool sized from the explicit max_running_requests worst case instead of swa_full_tokens_ratio; the rest goes to the full pool.""" @@ -1614,8 +1614,8 @@ def create_memory_pool_configurator( if is_deepseek_v4(kvc.model_config.hf_config) and kvc.is_hybrid_swa: return DSV4PoolConfigurator(kvc) if kvc.is_hybrid_swa: - if SWAChunkCapPoolConfigurator.is_applicable(kvc): - return SWAChunkCapPoolConfigurator(kvc) + if SWARequestCapPoolConfigurator.is_applicable(kvc): + return SWARequestCapPoolConfigurator(kvc) return HybridSWAPoolConfigurator(kvc) # Future: MambaPoolConfigurator return DefaultPoolConfigurator(kvc) diff --git a/test/registered/unit/model_executor/test_pool_configurator.py b/test/registered/unit/model_executor/test_pool_configurator.py index 73bd2a4161..7d20eb7be6 100644 --- a/test/registered/unit/model_executor/test_pool_configurator.py +++ b/test/registered/unit/model_executor/test_pool_configurator.py @@ -558,7 +558,7 @@ class TestHybridSWAConfigurator(CustomTestCase): int(config.full_max_total_num_tokens * 0.5), ) - def test_chunk_cache_cap_accounts_for_spec_topk_page_rounding(self): + def test_swa_request_cap_accounts_for_spec_topk_page_rounding(self): available = 1_000_000 mr = _make_model_runner( self, @@ -593,7 +593,7 @@ class TestHybridSWAConfigurator(CustomTestCase): self.assertEqual(config.swa_max_total_num_tokens, 104) self.assertLessEqual(_actual_memory_used(mr, config), available) - def test_chunk_cache_cap_doubles_decode_alloc_for_spec_v2_overlap(self): + def test_swa_request_cap_doubles_decode_alloc_for_spec_v2_overlap(self): # Overlap on -> spec-v2: decode_alloc = 2 * get_alloc_len_per_decode = # 2 * max(steps*topk, max_draft) = 2 * max(6, 5) = 12 (page=1, since the # v2 allocator does not support page>1 & topk>1). trailing = 8 + 20 + @@ -629,7 +629,7 @@ class TestHybridSWAConfigurator(CustomTestCase): self.assertEqual(config.swa_max_total_num_tokens, 91) self.assertLessEqual(_actual_memory_used(mr, config), available) - def test_chunk_cache_cap_accounts_for_draft_swa_layers(self): + def test_swa_request_cap_accounts_for_draft_swa_layers(self): """Draft SWA tensors consume the same fixed-capacity pool as target SWA.""" available = 1_000_000 mr = _make_model_runner( @@ -663,7 +663,7 @@ class TestHybridSWAConfigurator(CustomTestCase): self.assertLessEqual(used, available) self.assertGreater(used, available * 0.99) - def test_chunk_cache_cap_drops_prefill_for_disagg_decode(self): + def test_swa_request_cap_drops_prefill_for_disagg_decode(self): available = 1_000_000 mr = _make_model_runner( self, @@ -691,7 +691,7 @@ class TestHybridSWAConfigurator(CustomTestCase): self.assertEqual(config.swa_max_total_num_tokens, 100) self.assertLessEqual(_actual_memory_used(mr, config), available) - def test_chunk_cache_cap_prefill_holds_window_plus_chunk(self): + def test_swa_request_cap_prefill_holds_window_plus_chunk(self): available = 1_000_000 mr = _make_model_runner( self, @@ -722,7 +722,7 @@ class TestHybridSWAConfigurator(CustomTestCase): self.assertEqual(config.swa_max_total_num_tokens, 76) self.assertLessEqual(_actual_memory_used(mr, config), available) - def test_chunk_cache_cap_disagg_decode_pre_alloc(self): + def test_swa_request_cap_disagg_decode_pre_alloc(self): # decode adds disaggregation_decode_extra_slots in-transfer slots to the # request count (num_reserved_decode_tokens is a full-pool concern, not SWA). available = 2_000_000 @@ -1003,7 +1003,7 @@ class TestFactory(CustomTestCase): self.assertIsInstance(cfg, HybridSWAPoolConfigurator) def test_chunk_cap_configurator_selection(self): - # SWAChunkCapPoolConfigurator is selected only when max_running_requests is set. + # SWARequestCapPoolConfigurator is selected only when max_running_requests is set. def _cfg(max_running_requests, chunked_prefill_size=4): mr = _make_model_runner( self, @@ -1024,14 +1024,14 @@ class TestFactory(CustomTestCase): return create_memory_pool_configurator(mr) from sglang.srt.model_executor.pool_configurator import ( - SWAChunkCapPoolConfigurator, + SWARequestCapPoolConfigurator, ) - self.assertIsInstance(_cfg(2), SWAChunkCapPoolConfigurator) - self.assertNotIsInstance(_cfg(None), SWAChunkCapPoolConfigurator) + self.assertIsInstance(_cfg(2), SWARequestCapPoolConfigurator) + self.assertNotIsInstance(_cfg(None), SWARequestCapPoolConfigurator) # Chunked prefill off: a whole prompt can exceed the cap. self.assertNotIsInstance( - _cfg(2, chunked_prefill_size=-1), SWAChunkCapPoolConfigurator + _cfg(2, chunked_prefill_size=-1), SWARequestCapPoolConfigurator ) @@ -1525,7 +1525,7 @@ class TestFusedDraftPricing(unittest.TestCase): def test_chunk_cap_solve_prices_the_fused_entry(self): from sglang.srt.model_executor.pool_configurator import ( - SWAChunkCapPoolConfigurator, + SWARequestCapPoolConfigurator, ) available = 50_000_000 @@ -1538,7 +1538,7 @@ class TestFusedDraftPricing(unittest.TestCase): sliding_window_size=8, max_running_requests=2, ) - self.assertIsInstance(cfg, SWAChunkCapPoolConfigurator) + self.assertIsInstance(cfg, SWARequestCapPoolConfigurator) config = cfg.calculate_pool_sizes(available, 1) self._assert_unified_bytes_price_the_fused_entry(cfg, config, available)