From e262b44eef1f2bf83e34345276e2bb91a086587e Mon Sep 17 00:00:00 2001 From: pllimax Date: Tue, 20 Oct 2026 21:35:49 +0800 Subject: [PATCH] [CI] [NPU] tests: Replace DeepSeek-V2-Lite-W8A8 cases with Moonlight (#43063) --- .../HiCache/test_npu_hicache_mla.py | 92 ------------------- .../dp_attn/test_npu_dp_attention.py | 12 ++- .../test_npu_mla_fia_hicache_bf16.py | 81 ++++++++++++++++ .../runtime_opts/test_npu_mla_fia_w8a8int8.py | 86 ----------------- .../runtime_opts/test_npu_mla_w8a8int8.py | 84 ----------------- 5 files changed, 88 insertions(+), 267 deletions(-) delete mode 100644 test/registered/npu/basic_function/HiCache/test_npu_hicache_mla.py create mode 100644 test/registered/npu/basic_function/runtime_opts/test_npu_mla_fia_hicache_bf16.py delete mode 100644 test/registered/npu/basic_function/runtime_opts/test_npu_mla_fia_w8a8int8.py delete mode 100644 test/registered/npu/basic_function/runtime_opts/test_npu_mla_w8a8int8.py diff --git a/test/registered/npu/basic_function/HiCache/test_npu_hicache_mla.py b/test/registered/npu/basic_function/HiCache/test_npu_hicache_mla.py deleted file mode 100644 index a11823b3b1..0000000000 --- a/test/registered/npu/basic_function/HiCache/test_npu_hicache_mla.py +++ /dev/null @@ -1,92 +0,0 @@ -import os -import unittest -from types import SimpleNamespace -from urllib.parse import urlparse - -from sglang.test.ascend.npu_eval_accuracy_kit import _is_pr_pipeline, run_npu_pr_smoke -from sglang.test.ci.ci_register import register_npu_ci -from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k -from sglang.test.test_utils import ( - DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, - DEFAULT_URL_FOR_TEST, - CustomTestCase, - popen_launch_server, - terminate_and_kill_process_tree, -) - -register_npu_ci(est_time=400, suite="base-b-test-4-npu-a3") -register_npu_ci(est_time=400, suite="nightly-4-npu-a3", nightly=True) - -TEST_MODEL_MATRIX = { - "/root/.cache/modelscope/hub/models/vllm-ascend/DeepSeek-V2-Lite-W8A8": { - "accuracy": 0.34, - "latency": 1000, - "output_throughput": 6, - }, -} - - -class TestAscendMlaHicache(CustomTestCase): - @classmethod - def setUpClass(cls): - cls.models = TEST_MODEL_MATRIX.keys() - cls.base_url = DEFAULT_URL_FOR_TEST - cls.url = urlparse(DEFAULT_URL_FOR_TEST) - cls.common_args = [ - "--trust-remote-code", - "--mem-fraction-static", - 0.8, - "--attention-backend", - "ascend", - "--tp-size", - 4, - "--enable-hierarchical-cache", - "--hicache-size", - 1 if _is_pr_pipeline else 10, - ] - - def test_a_gsm8k(self): - for model in self.models: - with self.subTest(model=model): - process = popen_launch_server( - model, - self.base_url, - timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, - env={ - **os.environ, - "PYTORCH_NPU_ALLOC_CONF": ( - "expandable_segments:True,pin_memory_expandable_segments:True" - ), - }, - other_args=[ - *self.common_args, - ], - ) - - try: - if _is_pr_pipeline: - run_npu_pr_smoke(self.base_url) - else: - print(f"##=== Testing accuracy: {model} ===##") - - args = SimpleNamespace( - num_shots=5, - data_path=None, - num_questions=1319, - max_new_tokens=512, - parallel=128, - host=self.url.hostname, - port=int(self.url.port), - ) - - metrics = run_eval_few_shot_gsm8k(args) - self.assertGreaterEqual( - metrics["accuracy"], - TEST_MODEL_MATRIX[model]["accuracy"], - ) - finally: - terminate_and_kill_process_tree(process) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/registered/npu/basic_function/dp_attn/test_npu_dp_attention.py b/test/registered/npu/basic_function/dp_attn/test_npu_dp_attention.py index e997784314..2d04618bd8 100644 --- a/test/registered/npu/basic_function/dp_attn/test_npu_dp_attention.py +++ b/test/registered/npu/basic_function/dp_attn/test_npu_dp_attention.py @@ -4,9 +4,11 @@ import requests from sglang.srt.environ import envs from sglang.srt.utils import kill_process_tree +from sglang.test.ascend.e2e.test_npu_performance_utils import ( + MOONLIGHT_16B_A3B_MODEL_PATH, +) from sglang.test.ascend.npu_eval_accuracy_kit import NPUGSM8KMixin from sglang.test.ascend.test_ascend_utils import ( - DEEPSEEK_V2_LITE_W8A8_WEIGHTS_PATH, IMAGES_EXAMPLE_PATH, KIMI_VL_A3B_INSTRUCT_WEIGHTS_PATH, QWEN3_32B_WEIGHTS_PATH, @@ -26,7 +28,6 @@ from sglang.test.test_utils import ( register_npu_ci( est_time=400, suite="base-b-test-4-npu-a3", - disabled="Temporarily disable this test case due to DTS2026091464350", ) register_npu_ci(est_time=2400, suite="nightly-4-npu-a3", nightly=True) @@ -76,11 +77,12 @@ class TestDPAttentionMixedChunk( ): # Use full GSM8K dataset to avoid sampling variance. gsm8k_num_examples = 1319 - gsm8k_accuracy_thres = 0.34 + # Moonlight bf16 GSM8K baseline is ~0.837. + gsm8k_accuracy_thres = 0.83 @classmethod def setUpClass(cls): - cls.model = DEEPSEEK_V2_LITE_W8A8_WEIGHTS_PATH + cls.model = MOONLIGHT_16B_A3B_MODEL_PATH cls.base_url = DEFAULT_URL_FOR_TEST cls.process = popen_launch_server( cls.model, @@ -113,7 +115,7 @@ class TestDPRetract( ): @classmethod def setUpClass(cls): - cls.model = DEEPSEEK_V2_LITE_W8A8_WEIGHTS_PATH + cls.model = MOONLIGHT_16B_A3B_MODEL_PATH cls.base_url = DEFAULT_URL_FOR_TEST cls.process = popen_launch_server( cls.model, diff --git a/test/registered/npu/basic_function/runtime_opts/test_npu_mla_fia_hicache_bf16.py b/test/registered/npu/basic_function/runtime_opts/test_npu_mla_fia_hicache_bf16.py new file mode 100644 index 0000000000..b484b7b004 --- /dev/null +++ b/test/registered/npu/basic_function/runtime_opts/test_npu_mla_fia_hicache_bf16.py @@ -0,0 +1,81 @@ +import os +import unittest + +from sglang.test.ascend.e2e.test_npu_performance_utils import ( + MOONLIGHT_16B_A3B_MODEL_PATH, +) +from sglang.test.ascend.npu_eval_accuracy_kit import NPUGSM8KMixin +from sglang.test.ci.ci_register import register_npu_ci +from sglang.test.test_utils import ( + DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, + DEFAULT_URL_FOR_TEST, + CustomTestCase, + popen_launch_server, + terminate_and_kill_process_tree, +) + +register_npu_ci( + est_time=800, + suite="base-b-test-2-npu-a3", +) +register_npu_ci(est_time=1400, suite="nightly-2-npu-a3", nightly=True) + +# The nightly pipeline is also triggered by pull requests via path filters, so the +# pipeline is identified by GITHUB_WORKFLOW_REF (inherited from the caller's github +# context) instead of the triggering event. +_is_pr_pipeline = "/.github/workflows/nightly-test-npu.yml" not in os.environ.get( + "GITHUB_WORKFLOW_REF", "" +) + + +class TestAscendMlaFiaHicacheBf16(CustomTestCase, NPUGSM8KMixin): + # The nightly pipeline runs the full GSM8K set to avoid sampling variance; the + # PR pipeline only runs the mixin smoke request. + gsm8k_num_examples = 1319 + gsm8k_accuracy_thres = 0.83 + + @classmethod + def setUpClass(cls): + os.environ["ASCEND_USE_FIA"] = "true" + cls.model = MOONLIGHT_16B_A3B_MODEL_PATH + cls.base_url = DEFAULT_URL_FOR_TEST + other_args = [ + "--trust-remote-code", + "--mem-fraction-static", + 0.8, + "--attention-backend", + "ascend", + "--device", + "npu", + "--dtype", + "bfloat16", + "--tp-size", + 2, + "--enable-hierarchical-cache", + "--hicache-size", + 2 if _is_pr_pipeline else 10, + ] + # The PR pipeline runs eager to shorten startup; the nightly pipeline + # covers the default decode graph path with FIA + HiCache. + if _is_pr_pipeline: + other_args.append("--disable-cuda-graph") + cls.process = popen_launch_server( + cls.model, + cls.base_url, + timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, + env={ + **os.environ, + "PYTORCH_NPU_ALLOC_CONF": ( + "expandable_segments:True,pin_memory_expandable_segments:True" + ), + }, + other_args=other_args, + ) + + @classmethod + def tearDownClass(cls): + terminate_and_kill_process_tree(cls.process) + + +if __name__ == "__main__": + unittest.main() diff --git a/test/registered/npu/basic_function/runtime_opts/test_npu_mla_fia_w8a8int8.py b/test/registered/npu/basic_function/runtime_opts/test_npu_mla_fia_w8a8int8.py deleted file mode 100644 index 81628175be..0000000000 --- a/test/registered/npu/basic_function/runtime_opts/test_npu_mla_fia_w8a8int8.py +++ /dev/null @@ -1,86 +0,0 @@ -import os -import unittest -from types import SimpleNamespace -from urllib.parse import urlparse - -from sglang.srt.utils import kill_process_tree -from sglang.test.ascend.npu_eval_accuracy_kit import _is_pr_pipeline, run_npu_pr_smoke -from sglang.test.ci.ci_register import register_npu_ci -from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k -from sglang.test.test_utils import ( - DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, - DEFAULT_URL_FOR_TEST, - CustomTestCase, - popen_launch_server, -) - -register_npu_ci(est_time=400, suite="base-b-test-2-npu-a3") -register_npu_ci(est_time=400, suite="nightly-2-npu-a3", nightly=True) - -TEST_MODEL_MATRIX = { - "/root/.cache/modelscope/hub/models/vllm-ascend/DeepSeek-V2-Lite-W8A8": { - "accuracy": 0.34, - "latency": 1000, - "output_throughput": 6, - }, -} - - -class TestAscendMlaW8A8Int8(CustomTestCase): - @classmethod - def setUpClass(cls): - cls.models = TEST_MODEL_MATRIX.keys() - cls.base_url = DEFAULT_URL_FOR_TEST - cls.url = urlparse(DEFAULT_URL_FOR_TEST) - cls.common_args = [ - "--trust-remote-code", - "--disable-cuda-graph", - "--mem-fraction-static", - 0.8, - "--attention-backend", - "ascend", - "--tp-size", - 2, - "--disable-radix-cache", - ] - - def test_a_gsm8k(self): - os.environ["ASCEND_USE_FIA"] = "true" - for model in self.models: - with self.subTest(model=model): - process = popen_launch_server( - model, - self.base_url, - timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, - other_args=[ - *self.common_args, - ], - ) - - try: - if _is_pr_pipeline: - run_npu_pr_smoke(self.base_url) - else: - print(f"##=== Testing accuracy: {model} ===##") - - args = SimpleNamespace( - num_shots=5, - data_path=None, - num_questions=1319, - max_new_tokens=512, - parallel=128, - host=self.url.hostname, - port=int(self.url.port), - ) - - metrics = run_eval_few_shot_gsm8k(args) - self.assertGreaterEqual( - metrics["accuracy"], - TEST_MODEL_MATRIX[model]["accuracy"], - ) - finally: - kill_process_tree(process.pid) - - -if __name__ == "__main__": - unittest.main() diff --git a/test/registered/npu/basic_function/runtime_opts/test_npu_mla_w8a8int8.py b/test/registered/npu/basic_function/runtime_opts/test_npu_mla_w8a8int8.py deleted file mode 100644 index 49a8a8812f..0000000000 --- a/test/registered/npu/basic_function/runtime_opts/test_npu_mla_w8a8int8.py +++ /dev/null @@ -1,84 +0,0 @@ -import unittest -from types import SimpleNamespace -from urllib.parse import urlparse - -from sglang.srt.utils import kill_process_tree -from sglang.test.ascend.npu_eval_accuracy_kit import _is_pr_pipeline, run_npu_pr_smoke -from sglang.test.ci.ci_register import register_npu_ci -from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k -from sglang.test.test_utils import ( - DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, - DEFAULT_URL_FOR_TEST, - CustomTestCase, - popen_launch_server, -) - -register_npu_ci(est_time=400, suite="base-b-test-4-npu-a3") -register_npu_ci(est_time=400, suite="nightly-4-npu-a3", nightly=True) - -TEST_MODEL_MATRIX = { - "/root/.cache/modelscope/hub/models/vllm-ascend/DeepSeek-V2-Lite-W8A8": { - "accuracy": 0.34, - "latency": 1000, - "output_throughput": 6, - }, -} - - -class TestAscendMlaW8A8Int8(CustomTestCase): - @classmethod - def setUpClass(cls): - cls.models = TEST_MODEL_MATRIX.keys() - cls.base_url = DEFAULT_URL_FOR_TEST - cls.url = urlparse(DEFAULT_URL_FOR_TEST) - cls.common_args = [ - "--trust-remote-code", - "--disable-cuda-graph", - "--mem-fraction-static", - 0.8, - "--attention-backend", - "ascend", - "--tp-size", - 4, - "--disable-radix-cache", - ] - - def test_a_gsm8k(self): - for model in self.models: - with self.subTest(model=model): - process = popen_launch_server( - model, - self.base_url, - timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, - other_args=[ - *self.common_args, - ], - ) - - try: - if _is_pr_pipeline: - run_npu_pr_smoke(self.base_url) - else: - print(f"##=== Testing accuracy: {model} ===##") - - args = SimpleNamespace( - num_shots=5, - data_path=None, - num_questions=1319, - max_new_tokens=512, - parallel=128, - host=self.url.hostname, - port=int(self.url.port), - ) - - metrics = run_eval_few_shot_gsm8k(args) - self.assertGreaterEqual( - metrics["accuracy"], - TEST_MODEL_MATRIX[model]["accuracy"], - ) - finally: - kill_process_tree(process.pid) - - -if __name__ == "__main__": - unittest.main()