diff --git a/scripts/ci/npu/npu_ci_install_dependency.sh b/scripts/ci/npu/npu_ci_install_dependency.sh index 9e5f5de3f1..3355ccaeff 100755 --- a/scripts/ci/npu/npu_ci_install_dependency.sh +++ b/scripts/ci/npu/npu_ci_install_dependency.sh @@ -8,6 +8,7 @@ DEVICE_TYPE=$1 CANN_VERSION="${CANN_VERSION:-9.1.0}" PYTORCH_VERSION="${PYTORCH_VERSION:-2.10.0}" SGLANG_KERNEL_NPU_TAG="${SGLANG_KERNEL_NPU_TAG:-2026.9.0.post9}" +PYARROW_VERSION="${PYARROW_VERSION:-23.0.1}" ASCEND_HOME_PATH="${ASCEND_HOME_PATH:-/usr/local/Ascend/cann-${CANN_VERSION}}" export ASCEND_HOME_PATH @@ -116,4 +117,4 @@ mkdir -p cann-custom-ops rm -rf cann-custom-ops rm -rf python/pyproject.toml && mv python/pyproject_npu.toml python/pyproject.toml -${UV_PIP_INSTALL} -v -e "python[dev_npu]" +${UV_PIP_INSTALL} -v -e "python[dev_npu]" "pyarrow==${PYARROW_VERSION}" diff --git a/test/manual/ascend/test_npu_piecewise_graph_prefill.py b/test/manual/ascend/test_npu_piecewise_graph_prefill.py new file mode 100644 index 0000000000..f02cb27bfd --- /dev/null +++ b/test/manual/ascend/test_npu_piecewise_graph_prefill.py @@ -0,0 +1,72 @@ +import subprocess +import unittest + +from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin +from sglang.test.ascend.test_ascend_utils import ( + QWEN2_5_7B_INSTRUCT_WEIGHTS_PATH, + write_results_to_github_step_summary, +) +from sglang.test.test_utils import ( + CustomTestCase, + run_bench_one_batch, +) + +TOKENS_TO_CAPTURE = [i for i in range(128, 4096, 128)] + + +class TestPiecewiseGraphPrefillCorrectness(GSM8KAscendMixin, CustomTestCase): + model = QWEN2_5_7B_INSTRUCT_WEIGHTS_PATH + other_args = [ + "--trust-remote-code", + "--mem-fraction-static", + 0.8, + "--attention-backend", + "ascend", + "--cuda-graph-bs-decode", + 128, + "--cuda-graph-backend-prefill=tc_piecewise", + "--cuda-graph-bs-prefill", + *TOKENS_TO_CAPTURE, + ] + accuracy = 0.84 + num_questions = 1319 + + +class TestPiecewiseGraphPrefillBenchmark(CustomTestCase): + model = QWEN2_5_7B_INSTRUCT_WEIGHTS_PATH + other_args = [ + "--trust-remote-code", + "--mem-fraction-static", + 0.8, + "--attention-backend", + "ascend", + "--cuda-graph-backend-prefill=tc_piecewise", + "--cuda-graph-bs-prefill", + ] + TOKENS_TO_CAPTURE + + latency = 0.045 + + def test_latency(self): + print(f"##=== Testing prefill latency: {self.model} ===##") + model_metrics = { + "server": subprocess.list2cmdline(map(str, self.other_args)), + "client": "bench_one_batch", + "latency_threshold": self.latency, + } + try: + prefill_latency, _, _ = run_bench_one_batch( + self.model, + other_args=self.other_args, + ) + model_metrics["latency"] = float(prefill_latency) + self.assertLess(prefill_latency, self.latency) + except Exception as e: + model_metrics["error"] = e + print(f"Error testing {self.model}: {e}") + self.fail(f"Test failed for {self.model}: {e}") + finally: + write_results_to_github_step_summary({self.model: model_metrics}) + + +if __name__ == "__main__": + unittest.main() 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 index c5a6eaaeec..873c4b9393 100644 --- a/test/registered/npu/basic_function/HiCache/test_npu_hicache_mla.py +++ b/test/registered/npu/basic_function/HiCache/test_npu_hicache_mla.py @@ -41,7 +41,7 @@ class TestAscendMlaHicache(CustomTestCase): 4, "--enable-hierarchical-cache", "--hicache-size", - 30, + 1 if _is_pr_pipeline else 10, ] def test_a_gsm8k(self): 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 f93f67d65b..e997784314 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 @@ -61,9 +61,6 @@ class TestDPAttentionDP2TP2( "--attention-backend", "ascend", "--disable-cuda-graph", - "--enable-torch-compile", - "--torch-compile-max-bs", - "2", ], ) diff --git a/test/registered/npu/basic_function/optimization_debug/test_npu_compile_graph_tp1_bf16.py b/test/registered/npu/basic_function/optimization_debug/test_npu_compile_graph_tp1_bf16.py deleted file mode 100644 index 08c29d8d24..0000000000 --- a/test/registered/npu/basic_function/optimization_debug/test_npu_compile_graph_tp1_bf16.py +++ /dev/null @@ -1,87 +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-1-npu-a3") -register_npu_ci(est_time=400, suite="nightly-1-npu-a3", nightly=True) - -TEST_MODEL_MATRIX = { - "/root/.cache/modelscope/hub/models/Qwen/Qwen2.5-7B-Instruct": { - "accuracy": 0.84, - "latency": 150, - "output_throughput": 30, - }, -} - -os.environ["ASCEND_USE_FIA"] = "true" - - -class TestAscendTp1Bf16(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.6, - "--attention-backend", - "ascend", - "--disable-radix-cache", - "--enable-torch-compile", - "--watchdog-timeout", - 30000, - ] - - 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=32, - 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/parallel_strategy/data_parallelism/test_npu_load_balance_method.py b/test/registered/npu/basic_function/parallel_strategy/data_parallelism/test_npu_load_balance_method.py index 2fbc3c1f43..3f44a4f9ce 100644 --- a/test/registered/npu/basic_function/parallel_strategy/data_parallelism/test_npu_load_balance_method.py +++ b/test/registered/npu/basic_function/parallel_strategy/data_parallelism/test_npu_load_balance_method.py @@ -42,9 +42,6 @@ class TestDPAttentionRoundBinLoadBalance(CustomTestCase): "16", "--attn-dp-size", "2", - "--enable-torch-compile", - "--torch-compile-max-bs", - "2", "--load-balance-method", cls.mode, "--attention-backend", diff --git a/test/registered/npu/rl/indexer_replay/test_npu_return_indexer_topk_deepseek_v4.py b/test/registered/npu/rl/indexer_replay/test_npu_return_indexer_topk_deepseek_v4.py index cb494a318d..9bcf5b16d7 100644 --- a/test/registered/npu/rl/indexer_replay/test_npu_return_indexer_topk_deepseek_v4.py +++ b/test/registered/npu/rl/indexer_replay/test_npu_return_indexer_topk_deepseek_v4.py @@ -89,7 +89,7 @@ class TestNPUDeepSeekV4ReturnIndexerTopk(CustomTestCase): "--disable-cuda-graph", "--enable-return-indexer-topk", "--json-model-override-args", - '{"num_hidden_layers": 6, "compress_ratios": [0, 0, 4, 128, 4, 128]}', + '{"num_hidden_layers": 6, "compress_ratios": [0, 0, 4, 128, 4, 128], "quantization_config": null}', "--host", host[2:], "--port", diff --git a/test/registered/npu/rl/indexer_replay/test_npu_return_indexer_topk_glm52.py b/test/registered/npu/rl/indexer_replay/test_npu_return_indexer_topk_glm52.py index 8caef443fd..c69a476b80 100644 --- a/test/registered/npu/rl/indexer_replay/test_npu_return_indexer_topk_glm52.py +++ b/test/registered/npu/rl/indexer_replay/test_npu_return_indexer_topk_glm52.py @@ -62,7 +62,7 @@ class TestNPUGLM52ReturnIndexerTopk(CustomTestCase): "--disable-cuda-graph", "--enable-return-indexer-topk", "--json-model-override-args", - '{"num_hidden_layers": 6}', + '{"num_hidden_layers": 6, "quantization_config": null}', ], ) try: