Skip to content

[Bugfix] fix npu get kv_item_lens in PD separation when use ASCEND_US…#15852

Merged
iforgetmyname merged 3 commits intosgl-project:mainfrom
XDaoHong:main
Mar 23, 2026
Merged

[Bugfix] fix npu get kv_item_lens in PD separation when use ASCEND_US…#15852
iforgetmyname merged 3 commits intosgl-project:mainfrom
XDaoHong:main

Conversation

@XDaoHong
Copy link
Copy Markdown
Contributor

@XDaoHong XDaoHong commented Dec 26, 2025

Motivation

Original k_buffer shape is (layer_num, size // page_size + 1, page_size, head_num, head_dim),
when enable ASCEND_USE_FIA k_buffer shape is (layer_num, (size // page_size + 1) * page_size, 1, head_num, head_dim).

The element size of self.get_key_buffer(i)[0] in def get_contiguous_buf_infos():
original is page_size * head_num * head_dim,
when enable ASCEND_USE_FIA is 1 * head_num * head_dim.

So when enable ASCEND_USE_FIA, The calculation of kv_item_lens requires the addition of * page_size.

Modifications

Fix kv_item_lens for FIA, in order to compute data size in PD transfer cases.

Accuracy Tests

python3 few_shot_gms8k.py --data-path "/PATH/TO/test.jsonl.txt" --parallel 32 --num-questions 200
Accuracy: 0.880
Invalid: 03000
Latency: 37.457

Benchmarking and Profiling

Checklist

…E_FIA

Co-authored-by: ZhengdQin <zhengdqin@gmail.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions Bot added the npu label Dec 26, 2025
@ping1jing2 ping1jing2 self-assigned this Dec 26, 2025
@iforgetmyname
Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

Talantan1102 pushed a commit to randgun/sglang that referenced this pull request Mar 13, 2026
@iforgetmyname
Copy link
Copy Markdown
Collaborator

this pr only affects npu and npu ci have all passed

@iforgetmyname iforgetmyname merged commit 2d288ba into sgl-project:main Mar 23, 2026
136 of 170 checks passed
0-693 pushed a commit to 0-693/sglang that referenced this pull request Mar 25, 2026
JustinTong0323 pushed a commit to JustinTong0323/sglang that referenced this pull request Apr 7, 2026
yhyang201 pushed a commit to yhyang201/sglang that referenced this pull request Apr 22, 2026
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