config: the KV-cache configurator reads the bags (#34096)
This commit is contained in:
@@ -191,25 +191,20 @@ class TestGetDcpLens(CustomTestCase):
|
||||
)
|
||||
allocators = {}
|
||||
|
||||
# The configurator's bag reads (disaggregation_mode / page_size /
|
||||
# enable_hisparse) come from the published context; the per-iteration
|
||||
# dcp_size stays on the injected instance stand-in.
|
||||
self._sa_override = rc.get_context().override_server_args(
|
||||
# The configurator's own inputs are published leaves now, so the case
|
||||
# publishes them once. The DCP *scale* is not one of them: the allocator
|
||||
# widens from the live get_parallel().attn_dcp_size, which the per-size
|
||||
# override inside the loop drives.
|
||||
override = rc.get_context().override_server_args(
|
||||
disaggregation_mode="null",
|
||||
page_size=physical_page_size,
|
||||
enable_hisparse=False,
|
||||
)
|
||||
self._sa_override.install()
|
||||
self.addCleanup(self._sa_override.restore)
|
||||
|
||||
override.install()
|
||||
self.addCleanup(override.restore)
|
||||
for dcp_size in (1, 4):
|
||||
configurator = SimpleNamespace(
|
||||
server_args=SimpleNamespace(
|
||||
disaggregation_mode="null",
|
||||
enable_hisparse=False,
|
||||
page_size=physical_page_size,
|
||||
dcp_size=dcp_size,
|
||||
),
|
||||
server_args=SimpleNamespace(),
|
||||
hybrid_gdn_config=None,
|
||||
is_hybrid_swa=False,
|
||||
kv_cache_dtype=torch.bfloat16,
|
||||
|
||||
@@ -110,22 +110,22 @@ class TestMambaRatioEnvGate(unittest.TestCase):
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.mem_cache.kv_cache_configurator import KVCacheConfigurator
|
||||
|
||||
server_args = SimpleNamespace(
|
||||
disable_radix_cache=False,
|
||||
disable_overlap_schedule=disable_overlap,
|
||||
enable_mamba_extra_buffer=lambda: extra_buffer,
|
||||
enable_mamba_extra_buffer_lazy=lambda: lazy,
|
||||
fake = SimpleNamespace(server_args=SimpleNamespace())
|
||||
# Every input is a published leaf now: the extra-buffer predicates read
|
||||
# the radix-cache strategy off the bags, so the fixture publishes the
|
||||
# strategy that produces the combination under test.
|
||||
strategy = (
|
||||
"extra_buffer_lazy"
|
||||
if lazy
|
||||
else "extra_buffer" if extra_buffer else "no_buffer"
|
||||
)
|
||||
fake = SimpleNamespace(server_args=server_args)
|
||||
# The bag reads (disable_radix_cache / disable_overlap_schedule) come
|
||||
# from the published context; the derived-method calls stay on the
|
||||
# injected stand-in.
|
||||
from sglang.srt import runtime_context as rc
|
||||
|
||||
with envs.SGLANG_OPT_MAMBA_SKIP_DECODE_LOCK.override(skip):
|
||||
with rc.get_context().override_server_args(
|
||||
disable_radix_cache=False,
|
||||
disable_overlap_schedule=disable_overlap,
|
||||
mamba_radix_cache_strategy=strategy,
|
||||
):
|
||||
return KVCacheConfigurator._calculate_mamba_ratio(fake)
|
||||
|
||||
|
||||
@@ -85,6 +85,11 @@ _CONFIGURED_SIZE_CALL_SITES = {
|
||||
"point, since with PP off the group is never touched, which is what lets "
|
||||
"the Indexer be constructed before distributed init"
|
||||
),
|
||||
("srt/mem_cache/kv_cache_configurator.py", "configured_pp_size"): (
|
||||
"decides whether the token capacity needs a cross-PP all-reduce at all; "
|
||||
"asking the configured size keeps that decision independent of whether a "
|
||||
"PP group is installed in this process"
|
||||
),
|
||||
("srt/layers/dp_attention.py", "configured_attn_cp_size"): (
|
||||
"compared against the configured moe_dp_size below"
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user