Skip to content

[npu] decoding procedure optimization on qwen3.5/3.6 - #35958

Merged
sglang-npu-bot merged 18 commits into
sgl-project:mainfrom
MatsueYu:feature/npu-perf-opt
Sep 23, 2026
Merged

sglang-npu-bot merged 18 commits into
sgl-project:mainfrom
MatsueYu:feature/npu-perf-opt

Conversation

@MatsueYu

@MatsueYu MatsueYu commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Notice: Please ensure sgl-project/sgl-kernel-npu#740 is applied to your sgl-kernel-npu.

Motivation

This commit is mainly about optimization on decoding procedure of qwen3.5 35b on npu, including

  1. fused kernel of sigmoid and element-wise multiplication applied
  2. optimized decoding GDN updating kernel applied
  3. fused qkvzba split kernel applied

Modifications and usage

  1. now fused_qkvzba_split_reshape_cat_contiguous is induced in NPU, just like other platforms. When self.num_v_heads // self.num_k_heads in _GDN_FUSED_QKVZBA_RATIOS satisfies, triton kernel fused_qkvzba_split_reshape_cat_contiguous will be used to split and arrange qkvzba matrices, instead of the fallback view/slice/reshape/cat procedure. Only in models using qwen3_5.py
  2. sigmoid and the following multiplication is now fused in qwen3_5 and qwen2_moe
  3. GDN update kernel is now replaced with the new faster GDN update kernel in decoding procedure.

Accuracy Tests

we test the performance on Qwen3.6 35B A3B, with tp4 dp4 dpa ep4

  • AIME26
Pasted image 20260820183104 with recommended parameters. Official accuracy: 92.7%.
  • MMMU
Pasted image 20260821114659 with recommended parameters. Official accuracy: 81.2%.

Speed Tests and Profiling

throughput and topk

tp4 dp4 dpa ep4, 2k/32k

  • before optimization
Pasted image 20260731133438
  • after optimization
Pasted image 20260821153403

profiling

GDN_update decode optimization

  • before optimization
Pasted image 20260826100047
  • after optimization
Pasted image 20260826095042

fused_split_qkvzba optimization

  • before optimization
Pasted image 20260826095956
  • after optimization
Pasted image 20260826094542

fused sigmoid multiplication

  • before optimization
Pasted image 20260826100321
  • after optimization
Pasted image 20260826100401

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
  • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  1. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

Conversation Answer:

Radix Cache testing
qwen35_radixcache (1)
There is no accuracy loss if radixcache is turned on


CI States

Latest PR Test (Base): 🚫 Run #35730090468
Latest PR Test (Extra): ❌ Run #35730089901
Latest PR Test (AMD ROCm 10): ❌ Run #35730090386

@MatsueYu
MatsueYu force-pushed the feature/npu-perf-opt branch 3 times, most recently from fe02a6a to 3670e5d Compare August 24, 2026 03:03
@github-actions github-actions Bot added the npu label Aug 24, 2026
@MatsueYu
MatsueYu force-pushed the feature/npu-perf-opt branch 2 times, most recently from cde18c9 to 749daff Compare August 25, 2026 12:23
@MatsueYu
MatsueYu marked this pull request as ready for review August 25, 2026 12:25
@MatsueYu MatsueYu changed the title [npu] decoding procedure optimization on qwen3.5 [npu] decoding procedure optimization on qwen3.5/3.6 Aug 26, 2026
@MatsueYu

Copy link
Copy Markdown
Contributor Author

/tag-and-rerun-ci

@MatsueYu

Copy link
Copy Markdown
Contributor Author

/tag-run-ci-label

@MatsueYu
MatsueYu force-pushed the feature/npu-perf-opt branch from cc7ef35 to 584adc8 Compare August 27, 2026 06:38
@MatsueYu
MatsueYu force-pushed the feature/npu-perf-opt branch 2 times, most recently from 408ff0c to eeaf643 Compare September 8, 2026 07:36
…sigmoid-mul, fused GDN decode update, fused qkvzba split
@MatsueYu
MatsueYu force-pushed the feature/npu-perf-opt branch from eeaf643 to 85a3b48 Compare September 8, 2026 07:39
@sglang-npu-bot

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@sglang-npu-bot

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

@sglang-npu-bot

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

@sglang-npu-bot

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

Comment thread python/sglang/srt/models/qwen2_moe.py Resolved
Comment thread python/sglang/srt/models/qwen2_moe.py Resolved
Comment thread python/sglang/srt/models/qwen2_moe.py Resolved
Comment thread python/sglang/srt/models/qwen2_moe.py Resolved
Comment thread python/sglang/srt/models/qwen3_5.py Resolved
@sglang-npu-bot

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

@sglang-npu-bot

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

@sglang-npu-bot

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

1 similar comment
@sglang-npu-bot

Copy link
Copy Markdown
Collaborator

/rerun-failed-ci

@sglang-npu-bot
sglang-npu-bot merged commit d4dcce1 into sgl-project:main Sep 23, 2026
149 of 170 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-fastfail npu run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants