test: enforce early CP HiCache storage rejection
This commit is contained in:
@@ -1457,6 +1457,15 @@ class ServerArgs:
|
||||
def _handle_model_specific_adjustments(self):
|
||||
from sglang.srt.configs.model_config import is_deepseek_nsa
|
||||
|
||||
assert not (
|
||||
self.enable_nsa_prefill_cp_shared_kv
|
||||
and self.hicache_storage_backend is not None
|
||||
), (
|
||||
"enable_nsa_prefill_cp_shared_kv does not support "
|
||||
"hicache_storage_backend in the host-only CP HiCache stage. "
|
||||
"Disable hicache_storage_backend or disable CP shared KV."
|
||||
)
|
||||
|
||||
if parse_connector_type(self.model_path) == ConnectorType.INSTANCE:
|
||||
return
|
||||
|
||||
@@ -1586,11 +1595,6 @@ class ServerArgs:
|
||||
"Phase 2 shared KV initially supports NSATokenToKVPool only; "
|
||||
"HiSparseNSATokenToKVPool is not wired yet."
|
||||
)
|
||||
assert self.hicache_storage_backend is None, (
|
||||
"enable_nsa_prefill_cp_shared_kv does not support "
|
||||
"hicache_storage_backend in the host-only CP HiCache stage. "
|
||||
"Disable hicache_storage_backend or disable CP shared KV."
|
||||
)
|
||||
if self.disaggregation_mode == "prefill":
|
||||
assert envs.SGLANG_DISAGGREGATION_ALL_CP_RANKS_TRANSFER.get(), (
|
||||
"Phase 2 shared KV with PD disaggregation requires "
|
||||
|
||||
@@ -383,22 +383,39 @@ class TestHiCacheArgs(CustomTestCase):
|
||||
hicache_storage_backend="mooncake",
|
||||
tp_size=8,
|
||||
)
|
||||
pre_call_state = (
|
||||
args.enable_dp_attention,
|
||||
args.moe_dense_tp_size,
|
||||
args.moe_a2a_backend,
|
||||
args.ep_size,
|
||||
args.attn_cp_size,
|
||||
args.page_size,
|
||||
)
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
AssertionError,
|
||||
"enable_nsa_prefill_cp_shared_kv.*hicache_storage_backend",
|
||||
with (
|
||||
self.assertRaisesRegex(
|
||||
AssertionError,
|
||||
"enable_nsa_prefill_cp_shared_kv.*hicache_storage_backend",
|
||||
),
|
||||
patch.object(
|
||||
args,
|
||||
"get_model_config",
|
||||
side_effect=AssertionError("get_model_config should not be called"),
|
||||
),
|
||||
):
|
||||
model_config = MagicMock()
|
||||
model_config.hf_config.architectures = ["DeepseekV3ForCausalLM"]
|
||||
with (
|
||||
patch.object(args, "get_model_config", return_value=model_config),
|
||||
patch(
|
||||
"sglang.srt.configs.model_config.is_deepseek_nsa",
|
||||
return_value=True,
|
||||
),
|
||||
patch("torch.cuda.get_device_capability", return_value=(9, 0)),
|
||||
):
|
||||
args._handle_model_specific_adjustments()
|
||||
args._handle_model_specific_adjustments()
|
||||
|
||||
self.assertEqual(
|
||||
pre_call_state,
|
||||
(
|
||||
args.enable_dp_attention,
|
||||
args.moe_dense_tp_size,
|
||||
args.moe_a2a_backend,
|
||||
args.ep_size,
|
||||
args.attn_cp_size,
|
||||
args.page_size,
|
||||
),
|
||||
)
|
||||
|
||||
def test_hicache_io_backend_and_mem_layout_compatibility(self):
|
||||
cases = [
|
||||
|
||||
Reference in New Issue
Block a user