[CP V1 Deprecation 3.5/5] Deprecate HIP/NPU/MUSA prefill CP and remove legacy implementation (#38293)

This commit is contained in:
Baizhou Zhang
2026-09-07 15:39:34 -07:00
committed by GitHub
parent f4b75b5c36
commit 85d39401c8
47 changed files with 213 additions and 2127 deletions
@@ -23,7 +23,10 @@ from sglang.test.test_utils import (
)
register_amd_ci(
est_time=5400, suite="nightly-amd-8-gpu-mi35x-deepseek-v4-pro", nightly=True
est_time=5400,
suite="nightly-amd-8-gpu-mi35x-deepseek-v4-pro",
nightly=True,
disabled="Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon.",
)
DEEPSEEK_V4_PRO_FP4_MODEL_PATH = os.environ.get(
@@ -49,6 +52,9 @@ FP4_ENV_VARS = {
}
@unittest.skip(
"Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon."
)
class TestDeepseekV4ProFp4CPInterleave(CustomTestCase):
"""DeepSeek-V4-Pro FP4 unified_kv prefill CP, interleave (round-robin-split), tp=8."""
@@ -36,7 +36,10 @@ from sglang.test.test_utils import (
)
register_amd_ci(
est_time=5400, suite="nightly-amd-8-gpu-mi35x-deepseek-v4-pro", nightly=True
est_time=5400,
suite="nightly-amd-8-gpu-mi35x-deepseek-v4-pro",
nightly=True,
disabled="Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon.",
)
DEEPSEEK_V4_PRO_FP4_MODEL_PATH = os.environ.get(
@@ -63,6 +66,9 @@ FP4_ENV_VARS = {
}
@unittest.skip(
"Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon."
)
class TestDeepseekV4ProFp4CPInterleaveTbo(CustomTestCase):
"""DeepSeek-V4-Pro FP4 unified_kv prefill CP (round-robin-split) + TBO, tp=8."""
+1 -2
View File
@@ -99,9 +99,8 @@ class TestCPStrategyUnit(CustomTestCase):
self.assertTrue(is_cp_enabled())
self.assertTrue(is_interleave())
def test_hip_dsa_cp_uses_protected_legacy_runtime_flag(self):
def test_hip_dsa_cp_is_disabled(self):
parallel = SimpleNamespace(
enable_dsa_prefill_context_parallel=False,
attn_cp_size=2,
)
model_config = SimpleNamespace(hf_config=SimpleNamespace())
@@ -13,7 +13,7 @@ register_npu_ci(
est_time=4800,
suite="",
nightly=True,
disabled="accuracy testcase",
disabled="Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon.",
)
GLM_5_1_PD_SEP_PREFILL_ENVS = {
@@ -164,6 +164,9 @@ GLM_5_1_PD_SEP_MODEL_CONFIG = {
}
@unittest.skip(
"Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon."
)
class TestNPUGLM5_1_W4A8_PD_SEP_AIME2026(TestNpuAccuracyMultiNodePdSepTestCaseBase):
"""Test NPU accuracy for GLM-5.1-w4a8 PD separation on AIME2026"""
@@ -6,9 +6,17 @@ from sglang.test.ascend.test_ascend_utils import QWEN3_30B_A3B_WEIGHTS_PATH
from sglang.test.ci.ci_register import register_npu_ci
from sglang.test.test_utils import CustomTestCase
register_npu_ci(est_time=500, suite="full-4-npu-a3", nightly=True)
register_npu_ci(
est_time=500,
suite="full-4-npu-a3",
nightly=True,
disabled="Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon.",
)
@unittest.skip(
"Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon."
)
class TestQwen330BAttnCP(GSM8KAscendMixin, CustomTestCase):
"""GSM8K accuracy test for Qwen3-30B-A3B mixed deployment on 4 NPUs.
@@ -13,7 +13,7 @@ register_npu_ci(
est_time=3600,
suite="",
nightly=True,
disabled="performance testcase",
disabled="Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon.",
)
GLM_5_1_PD_SEP_PREFILL_ENVS = {
@@ -172,6 +172,9 @@ GLM_5_1_PD_SEP_MODEL_CONFIG = {
}
@unittest.skip(
"Prefill CP on HIP/NPU/MUSA is deprecated; CP support will be refactored soon."
)
class TestNPUGLM5_1_W4A8_PD_SEP_In3k5_Out1k5(TestNpuPerfMultiNodePdSepTestCaseBase):
"""Test NPU performance for GLM-5.1-w4a8 PD separation 4 nodes in3k5 out1k5"""
@@ -17,7 +17,6 @@ from unittest import mock
from sglang.srt.layers.cp import base as cp_base
from sglang.srt.layers.cp import utils as cp_utils
from sglang.srt.layers.cp.zigzag import ZigzagCPStrategy
from sglang.srt.layers.utils import cp_utils as platform_cp_utils
from sglang.srt.model_executor.forward_batch_info import ForwardMode
from sglang.srt.models.deepseek_common import attention_backend_handler as abh
from sglang.srt.models.deepseek_common.attention_forward_methods.forward_methods import (
@@ -114,11 +113,6 @@ class TestCPMLADispatch(CustomTestCase):
mock.patch.object(abh, "_is_hip", False),
mock.patch.object(cp_utils, "enable_cp_v2", return_value=True),
mock.patch.object(cp_base, "_STRATEGY", ZigzagCPStrategy(cp_size=4)),
mock.patch.object(
platform_cp_utils,
"get_parallel",
return_value=SimpleNamespace(enable_prefill_context_parallel=False),
),
):
for prefix in (0, 32):
for capacity in (0, 8192):
@@ -92,14 +92,6 @@ class TestDeepseekNextNMmEmbed(CustomTestCase):
object.__setattr__(model, "embed_tokens", mock_embed)
with (
patch(
"sglang.srt.models.deepseek_nextn.dsa_use_prefill_cp",
return_value=False,
),
patch(
"sglang.srt.models.deepseek_nextn.mla_use_prefill_cp",
return_value=False,
),
patch(
"sglang.srt.models.deepseek_nextn.fused_eh_norm",
side_effect=lambda h, p, ew, hw, eps: torch.cat(
@@ -157,14 +149,6 @@ class TestDeepseekNextNMmEmbed(CustomTestCase):
embed_calls = mock_embed.call_args_list
with (
patch(
"sglang.srt.models.deepseek_nextn.dsa_use_prefill_cp",
return_value=False,
),
patch(
"sglang.srt.models.deepseek_nextn.mla_use_prefill_cp",
return_value=False,
),
patch(
"sglang.srt.models.deepseek_nextn.fused_eh_norm",
side_effect=lambda h, p, ew, hw, eps: torch.cat(
@@ -0,0 +1,84 @@
"""Reject deprecated platform CP before model loading or topology setup."""
import unittest
from sglang.srt.arg_groups.parallel_hook import (
handle_context_parallelism,
validate_prefill_cp_platform,
)
from sglang.srt.runtime_context import override_platform
from sglang.srt.server_args import ServerArgs
from sglang.test.ci.ci_register import register_cpu_ci
from sglang.test.test_utils import CustomTestCase
register_cpu_ci(est_time=2, suite="base-a-test-cpu")
class TestPlatformPrefillCPDeprecation(CustomTestCase):
def test_platform_cp_rejected_before_model_lookup(self):
for platform in ("is_hip", "is_npu", "is_musa"):
facts = dict(is_hip=False, is_npu=False, is_musa=False)
facts[platform] = True
for strategy in (None, "zigzag", "interleave"):
with self.subTest(platform=platform, strategy=strategy):
with override_platform(**facts):
args = ServerArgs(
model_path="missing-model-must-not-be-loaded",
enable_prefill_cp=True,
cp_strategy=strategy,
)
with self.assertRaisesRegex(ValueError, "deprecated.*refactor"):
validate_prefill_cp_platform(args)
def test_context_parallel_handler_rejects_before_model_lookup(self):
for platform in ("is_hip", "is_npu", "is_musa"):
facts = dict(is_hip=False, is_npu=False, is_musa=False)
facts[platform] = True
with self.subTest(platform=platform), override_platform(**facts):
args = ServerArgs(
model_path="missing-model-must-not-be-loaded",
enable_prefill_cp=True,
cp_strategy="interleave",
)
with self.assertRaisesRegex(ValueError, "deprecated.*refactor"):
handle_context_parallelism(args)
def test_resolution_rejects_even_dummy_models(self):
for platform in ("is_hip", "is_npu", "is_musa"):
facts = dict(is_hip=False, is_npu=False, is_musa=False)
facts[platform] = True
for model_path in ("dummy", "none", "missing-model-must-not-be-loaded"):
with self.subTest(platform=platform, model_path=model_path):
with override_platform(**facts):
args = ServerArgs(
model_path=model_path,
enable_prefill_cp=True,
cp_strategy="interleave",
)
with self.assertRaisesRegex(ValueError, "deprecated.*refactor"):
args.resolve_once()
def test_non_cp_and_decode_cp_are_not_rejected(self):
for platform in ("is_hip", "is_npu", "is_musa"):
facts = dict(is_hip=False, is_npu=False, is_musa=False)
facts[platform] = True
for dcp_size in (1, 2):
with self.subTest(platform=platform, dcp_size=dcp_size):
with override_platform(**facts):
args = ServerArgs(model_path="dummy", dcp_size=dcp_size)
validate_prefill_cp_platform(args)
@override_platform(is_hip=False, is_npu=False, is_musa=False)
def test_generic_cp_is_not_rejected_or_modified(self):
for strategy in ("zigzag", "interleave"):
with self.subTest(strategy=strategy):
args = ServerArgs(
model_path="dummy", enable_prefill_cp=True, cp_strategy=strategy
)
validate_prefill_cp_platform(args)
self.assertTrue(args.enable_prefill_cp)
self.assertEqual(args.cp_strategy, strategy)
if __name__ == "__main__":
unittest.main()
@@ -49,8 +49,6 @@ from sglang.srt.arg_groups.overrides import (
from sglang.srt.arg_groups.parallel_hook import (
handle_context_parallelism,
handle_data_parallelism,
handle_legacy_cp_runtime_compatibility,
handle_platform_cp_compatibility,
)
from sglang.srt.arg_groups.pd_disaggregation_hook import handle_pd_disaggregation
from sglang.srt.arg_groups.serving_hook import (
@@ -1026,13 +1024,9 @@ class TestContextParallelServerArgs(CustomTestCase):
def _new_cp_args(self, **overrides):
server_args = object.__new__(ServerArgs)
defaults = dict(
enable_prefill_context_parallel=False,
enable_dsa_prefill_context_parallel=False,
enable_prefill_cp=False,
cp_strategy=None,
model_path="instance://127.0.0.1:8000/dummy",
dsa_prefill_cp_mode="round-robin-split",
prefill_cp_mode="in-seq-split",
attn_cp_size=1,
tp_size=1,
dp_size=1,
@@ -1075,52 +1069,11 @@ class TestContextParallelServerArgs(CustomTestCase):
with self.assertRaisesRegex(ValueError, "DeepSeek V3.2.*interleave"):
handle_context_parallelism(server_args)
@override_platform(is_hip=False, is_npu=False, is_musa=False)
def test_generic_canonical_cp_does_not_enable_platform_runtime_fields(self):
cases = (
(
"zigzag_mla_or_gqa",
"zigzag",
"fa3",
),
(
"interleave_dsa",
"interleave",
"dsa",
),
)
for name, strategy, backend in cases:
with self.subTest(name=name):
server_args = self._new_cp_args(
enable_prefill_cp=True,
cp_strategy=strategy,
attention_backend=backend,
)
handle_platform_cp_compatibility(server_args)
handle_legacy_cp_runtime_compatibility(server_args)
self.assertFalse(
resolution_result(server_args, "enable_prefill_context_parallel")
)
self.assertFalse(
resolution_result(
server_args, "enable_dsa_prefill_context_parallel"
)
)
@override_platform(is_hip=False, is_npu=False, is_musa=False)
def test_non_platform_legacy_prefill_cp_is_rejected(self):
server_args = ServerArgs(
model_path="instance://127.0.0.1:8000/dummy",
enable_prefill_context_parallel=True,
)
with self.assertRaisesRegex(ValueError, "protected HIP, Ascend NPU, or MUSA"):
handle_platform_cp_compatibility(server_args)
def test_generic_v1_cp_options_are_not_public_cli(self):
removed_options = (
("--enable-prefill-context-parallel", []),
("--enable-nsa-prefill-context-parallel", []),
("--nsa-prefill-cp-mode", ["round-robin-split"]),
("--enable-dsa-prefill-context-parallel", []),
("--dsa-prefill-cp-mode", ["round-robin-split"]),
("--prefill-cp-mode", ["in-seq-split"]),
@@ -1130,55 +1083,6 @@ class TestContextParallelServerArgs(CustomTestCase):
with self.subTest(option=option), self.assertRaises(SystemExit):
self.parser.parse_args(["--model", "dummy", option, *values])
def test_npu_cp_compatibility_options_remain_public_cli(self):
args = self.parser.parse_args(
[
"--model",
"dummy",
"--enable-prefill-context-parallel",
"--enable-nsa-prefill-context-parallel",
"--nsa-prefill-cp-mode",
"round-robin-split",
]
)
self.assertTrue(resolution_result(args, "enable_prefill_context_parallel"))
self.assertTrue(resolution_result(args, "enable_dsa_prefill_context_parallel"))
self.assertEqual(
resolution_result(args, "dsa_prefill_cp_mode"), "round-robin-split"
)
def test_platform_interleave_cp_mirrors_to_dsa_runtime_aliases(self):
for platform in ("is_hip", "is_npu", "is_musa"):
facts = dict(is_hip=False, is_npu=False, is_musa=False)
facts[platform] = True
with self.subTest(platform=platform), override_platform(**facts):
server_args = self._new_cp_args(
enable_prefill_cp=True,
cp_strategy="interleave",
attention_backend="dsa",
)
handle_legacy_cp_runtime_compatibility(server_args)
handle_context_parallelism(server_args)
self.assertTrue(
resolution_result(
server_args, "enable_dsa_prefill_context_parallel"
)
)
self.assertFalse(
resolution_result(server_args, "enable_prefill_context_parallel")
)
self.assertEqual(
resolution_result(server_args, "dsa_prefill_cp_mode"),
"round-robin-split",
)
self.assertEqual(
resolution_result(server_args, "prefill_cp_mode"),
"round-robin-split",
)
def test_context_parallel_handler_initializes_cp_strategy(self):
server_args = self._new_cp_args(
enable_prefill_cp=True,
+1 -1
View File
@@ -925,7 +925,7 @@ class TestForwardFlags(_IsolatedServerArgs):
@torch.compile(fullgraph=True, backend="eager", dynamic=False)
def probe(x):
par = get_parallel()
if par.enable_prefill_context_parallel:
if par.enable_prefill_cp:
x = x + 1
if par.moe_dense_tp_size == 1:
x = x + 2