Skip to content

NPU port: streaming_session_extra + multi_instance_release_memory_occupation (cases 9, 10) - #1035

Merged
cherryblo merged 23 commits into
Ascend:testcasesfrom
hhhh1252023:test-npu-port-9-10
Jul 27, 2026
Merged

NPU port: streaming_session_extra + multi_instance_release_memory_occupation (cases 9, 10)#1035
cherryblo merged 23 commits into
Ascend:testcasesfrom
hhhh1252023:test-npu-port-9-10

Conversation

@hhhh1252023

@hhhh1252023 hhhh1252023 commented Jul 20, 2026

Copy link
Copy Markdown

Summary

Port two remaining test cases to Ascend NPU backend (用例 9、10 移植)。

Changes

1. test_npu_streaming_session_extra.py (new)

Ported from test/registered/sessions/test_streaming_session_extra.py. 5 variants:

  • TestNPUStreamingSessionRetractMixedChunk — retract + --enable-mixed-chunk
  • TestNPUStreamingSessionRetractLargePage — retract + page=128
  • TestNPUStreamingSessionEagle — EAGLE3 spec v1 (overlap disabled, offset=-1)
  • TestNPUStreamingSessionEagleV2 — EAGLE3 spec v2 (overlap on)
  • TestNPUStreamingSessionEagleRetractLargePage — EAGLE3 + retract + page=128

NPU adaptations:

  • Model: LLAMA_3_1_8B_INSTRUCT_WEIGHTS_PATH + EAGLE3_LLAMA3_1_INSTRUCT_8B_WEIGHTS_PATH
  • Server args: --attention-backend ascend, --disable-cuda-graph, --disable-piecewise-cuda-graph
  • page_size: 128/4 (Ascend default is 128; 256 unsupported)
  • chunked-prefill-size divisible by 128
  • Env: PYTORCH_NPU_ALLOC_CONF=expandable_segments:True, HCCL_EXEC_TIMEOUT=200

2. test_npu_multi_instance_release_memory_occupation.py (new)

Ported from test/registered/rl/test_multi_instance_release_memory_occupation.py. 4-NPU multi-process spawn test.

NPU adaptations:

  • torch.cudatorch.npu (mem_get_info, set_device, empty_cache)
  • dist.init_process_group backend=hccl (instead of nccl default)
  • Device cuda:{rank}npu:{rank}
  • Engine kwargs: attention_backend="ascend", disable_cuda_graph=True, disable_piecewise_cuda_graph=True
  • Model: LLAMA_3_2_1B_INSTRUCT_WEIGHTS_PATH + LLAMA_3_2_1B_WEIGHTS_PATH
  • mp.set_start_method("spawn", force=True) at module import

3. .github/workflows/single-test-npu.yml

  • Image: swr.cn-southwest-2.myhuaweicloud.com/base_image/dockerhub/lmsysorg/sglang:main-cann9.0.0-a3
  • Runner: linux-aarch64-a3-4 (multi_instance needs 4 NPUs for dp=2*tp=2)
  • test_cases: the two new files

CI Registration

Both test files use register_npu_ci(...):

  • test_npu_streaming_session_extra.py: suite="full-1-npu-a3", est_time=900, nightly=True
  • test_npu_multi_instance_release_memory_occupation.py: suite="full-4-npu-a3", est_time=600, nightly=True

Test Plan

  • test_npu_streaming_session_extra.py — 5 test classes pass on 1-NPU
  • test_npu_multi_instance_release_memory_occupation.py — 1 test class passes on 4-NPU

CI States

Latest PR Test (Base): ❌ Missing run-ci label -- add it to run CI tests.
Latest PR Test (Extra): ❌ Blocked -- run-ci is required first.

…ccupation

Port two remaining test cases to Ascend NPU backend:

1. test_npu_streaming_session_extra.py (ported from test_streaming_session_extra.py)
   - 5 variants: retract+mixed-chunk, retract+large-page, EAGLE3 v1/v2,
     EAGLE3+retract+large-page
   - Uses LLAMA_3_1_8B_INSTRUCT + EAGLE3_LLAMA3_1_INSTRUCT_8B weights
   - Adds --attention-backend ascend, --disable-cuda-graph,
     --disable-piecewise-cuda-graph; page_size adapted to 128/4

2. test_npu_multi_instance_release_memory_occupation.py (ported from
   test_multi_instance_release_memory_occupation.py)
   - 4-NPU (dp=2 * tp=2) multi-process spawn test
   - torch.cuda -> torch.npu (mem_get_info, set_device, empty_cache)
   - HCCL backend for dist.init_process_group
   - Engine kwargs: attention_backend=ascend, disable_cuda_graph=True
   - Uses LLAMA_3_2_1B_INSTRUCT + LLAMA_3_2_1B weights

CI: single-test-npu.yml updates
   - Image: swr.cn-southwest-2.myhuaweicloud.com/base_image/dockerhub/
     lmsysorg/sglang:main-cann9.0.0-a3
   - Runner: linux-aarch64-a3-4 (multi_instance needs 4 NPUs)
   - test_cases: the two new files
@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

hhhh1252023, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@github-actions github-actions Bot added the npu label Jul 20, 2026
Three errors occurred in PR sgl-project#1035's CI run:

1. TestNPUStreamingSessionEagle / EagleRetractLargePage:
   `RuntimeError: npu_rms_norm ... error code is 161002`
   `Io input dtype or format is not supported, get io input info is
    x(DT_BFLOAT16, ND) gamma(DT_FLOAT16, ND) ...`
   Server process killed (exit code -9).
   Root cause: EAGLE3-LLaMA3.1-Instruct-8B draft's RMSNorm weight is
   float16 while Llama-3.1-8B main model hidden state is bfloat16.
   NPU aclnnRmsNorm does not support this dtype combination.
   Fix: switch all EAGLE3 variants to Qwen3-8B + Qwen3-8B_eagle3 (the
   same pair already validated in test_npu_streaming_session.py).

2. TestNPUStreamingSessionEagleV2:
   `AttributeError: 'Envs' object has no attribute 'SGLANG_ENABLE_SPEC_V2'`
   The CI image's sglang version does not yet expose this attr.
   Fix: remove the `SGLANG_ENABLE_SPEC_V2` env override. The variable
   defaults to True in current sglang, so no explicit setting is needed.

3. RetractMixedChunk / RetractLargePage: switch from Llama-3.1-8B-Instruct
   to Qwen3-8B for consistency with the EAGLE3 variants (single model
   pair across the whole file reduces cache pressure and CI runtime).
@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

hhhh1252023, thanks for your pull request. All authors of the commits have signed the CLA. 👍

The upstream StreamingSessionKitMixin hard-codes `max_new_tokens=100000`
in test_nth_mid_abort_recovery and test_first_mid_abort_recovery. With
Qwen3-8B (context_length=40960) the server returns HTTP 400 and the test
fails with `KeyError: 'meta_info'` (see .claude/2.log).

Add NPUStreamingSessionKitMixin that overrides both methods to use
max_new_tokens=40000 (still > context, but fits because the abort fires
within 0.5s before the limit is reached; the original 100000 was also
never meant to be fully generated). All 5 test classes now inherit from
NPUStreamingSessionKitMixin instead of StreamingSessionKitMixin.
@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

hhhh1252023, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=["--enable-streaming-session"] + list(cls.extra_args),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--enable-streaming-session is already in _NPU_COMMON_ARGS

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@hhhh1252023 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
51c74546 Update single-test-npu.yml the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@cherryblo
cherryblo merged commit 592469f into Ascend:testcases Jul 27, 2026
8 checks passed
pip install zss pre-commit wandb>=0.16.0 tenacity==8.3.0 loguru openpyxl latex2sympy2 zstandard transformers-stream-generator tqdm-multiprocess pycocoevalcap
pip install yt-dlp sentencepiece==0.1.99 nltk av ftfy sqlitedict==2.1.0 sacrebleu>=1.5.0 pytablewriter black==24.1.0 isort==5.13.2 peft>=0.2.0 accelerate>=0.29.1
pip install jsonlines httpx==0.25.0 evaluate>=0.4.0 datasets==2.16.1 numexpr xgrammar==0.1.25 numpy==1.26.4 dotenv
pip install /root/.cache/torch_memory_saver-0.0.8-cp311-cp311-linux_aarch64.whl

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use /root/.cache/.cache/npu-pkgs/torch_memory_saver-0.0.8-cp311-cp311-linux_aarch64.whl instead of root path of nfs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants