Skip to content

vulkan: optimize RMS_NORM_MUL_ROPE loop control - #31149

Merged
ggerganov merged 2 commits into
ggml-org:masterfrom
SG-Amadeus:vulkan-fused-rms-norm-loop-bounds
Nov 20, 2026
Merged

ggerganov merged 2 commits into
ggml-org:masterfrom
SG-Amadeus:vulkan-fused-rms-norm-loop-bounds

Conversation

@SG-Amadeus

Copy link
Copy Markdown
Contributor

Overview

The RoPE-fused path shares the loop-unrolling dispatch of rms_norm, which may be less efficient with its larger shader body.

This PR replaces the multi-call-site dispatch with a single call and row-width-bounded loops for the fused path.

Performance

Tested on an NVIDIA GeForce RTX 5070 Ti 16 GB with Vulkan on Windows.

Model Test Stock (t/s) Patched (t/s) Throughput Δ
Qwen3-4B Q4_K_M PP2048 7867.33 7959.06 +1.17%
Qwen3-4B Q4_K_M TG128 121.93 124.24 +1.90%
Qwen3-8B Q4_K_M PP2048 5229.36 5288.05 +1.12%
Qwen3-8B Q4_K_M TG128 74.12 75.04 +1.24%

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Yes, for analyzing the problem and writing code.

@github-actions github-actions Bot added Vulkan Issues specific to the Vulkan backend ggml changes relating to the ggml tensor library for machine learning labels Oct 25, 2026
@SG-Amadeus
SG-Amadeus marked this pull request as ready for review October 27, 2026 13:45
@SG-Amadeus
SG-Amadeus requested a review from a team as a code owner October 27, 2026 13:45
@jeffbolznv

Copy link
Copy Markdown
Contributor

There are a lot of different rope sizes in different models. Can you do broader perf testing?

@SG-Amadeus

SG-Amadeus commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Per-op latency change

Model ncols / RoPE dims PP Q/K TG Q/K
Qwen3-4B 128 / 128 −22.3% / −30.7% −38.8% / −54.5%
Ling-mini-2.0 128 / 64 −24.7% / −35.4% −22.8% / −24.7%
Gemma3-12B 256 / 256 −21.3% / −26.4% −44.3% / −42.0%
Gemma4-12B 256 / 256 −21.4% / −25.1% −47.4% / −49.2%
Gemma4-12B 512 / 512 −17.5% / −37.1% −47.1% / −49.1%

End-to-end throughput improvement

Model PP2048 TG128
Qwen3-4B Q4_K_M +1.17% +1.90%
Ling-mini-2.0 Q4_K_M +0.46% +0.55%
Gemma3-12B Q6_K +0.41% +1.77%
Gemma4-12B q4_0 +0.54% +0.89%

@0cc4m 0cc4m added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Nov 19, 2026
@ggerganov
ggerganov merged commit c0b97be into ggml-org:master Nov 20, 2026
17 of 19 checks passed
Kidplayer666 pushed a commit to Kidplayer666/llama.cpp that referenced this pull request Nov 20, 2026
Annieren pushed a commit to Annieren/llama.cpp-upstream that referenced this pull request Nov 23, 2026
Nindaleth pushed a commit to Nindaleth/llama.cpp that referenced this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. Vulkan Issues specific to the Vulkan backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants