Deprecate the parallel getters the context answers, and ratchet them shut (#40342)

This commit is contained in:
Cheng Wan
2026-09-21 12:25:32 -07:00
committed by GitHub
parent 65be3fa71a
commit 73f071db52
44 changed files with 933 additions and 501 deletions
@@ -297,7 +297,9 @@ class TestPPMambaPoolSizing(unittest.TestCase):
server_args=SimpleNamespace(),
spec_algorithm=SimpleNamespace(is_none=lambda: True),
layer_info=SimpleNamespace(start_layer=start, end_layer=end),
ps=SimpleNamespace(attn_dp_size=1, pp_size=pp_size),
# The runner carries its placement as plain attributes.
attn_dp_size=1,
pp_size=pp_size,
hybrid_gdn_config=None,
model_config=SimpleNamespace(
hf_config=SimpleNamespace(), num_hidden_layers=cls.TOTAL_LAYERS
@@ -304,16 +304,13 @@ class TestHostMemoryBudget(CustomTestCase):
def test_ranks_per_host_divides_world_size_by_nodes(self):
# The launcher slices ranks uniformly across nodes, so the co-located
# rank count is world_size // nnodes — no hostname collective.
fake_group = unittest.mock.Mock(world_size=16)
# tp_size=16 states the launch width the count divides -- the
# published configuration is where ranks_per_host reads it from.
with (
get_context().override_server_args(nnodes=2),
get_context().override_server_args(nnodes=2, tp_size=16),
unittest.mock.patch.object(
torch.distributed, "is_initialized", return_value=True
),
unittest.mock.patch(
"sglang.srt.distributed.parallel_state.get_world_group",
return_value=fake_group,
),
):
self.assertEqual(base.ranks_per_host(), 8)
@@ -248,7 +248,7 @@ class TestUnifiedMLATokenToKVPool(unittest.TestCase):
] = float(layer + 1)
with (
get_parallel().override(dcp_enabled=False),
get_parallel().override(dcp_enabled=False, attn_dcp_rank=0),
mock.patch(
"sglang.srt.mem_cache.memory_pool.current_platform.synchronize"
),
@@ -411,7 +411,9 @@ class TestMambaAllocatorCpuCopyIsPhysical(unittest.TestCase):
_FakeKVCache(pool.max_slots("full")),
_FakeKVCache(pool.max_slots("mamba")),
)
with get_parallel().override(dcp_enabled=False, attn_dcp_size=1):
with get_parallel().override(
dcp_enabled=False, attn_dcp_size=1, attn_dcp_rank=0
):
allocator = UnifiedMambaTokenToKVPoolAllocator(
unified_buffer=pool, kvcache=kvcache, device=_DEV, page_size=ps
)