Skip to content

ggml-cuda: optimize single-token MMVQ dispatch for RDNA3 architecture - #28003

Draft
maci0 wants to merge 1 commit into
ggml-org:masterfrom
maci0:perf/rdna3-mmvq-fastpath
Draft

ggml-cuda: optimize single-token MMVQ dispatch for RDNA3 architecture#28003
maci0 wants to merge 1 commit into
ggml-org:masterfrom
maci0:perf/rdna3-mmvq-fastpath

Conversation

@maci0

@maci0 maci0 commented Aug 30, 2026

Copy link
Copy Markdown

PR 2: ggml-cuda: optimize single-token MMVQ dispatch for RDNA3 architecture

Target: ggml-org/llama.cpp
Files: ggml/src/ggml-cuda/mmvq.cu


Motivation

During single-token autoregressive generation (ncols_dst == 1), execution is bound by kernel launch latency and per-wave register allocation.

On AMD RDNA3 (gfx1100 / Navi 31), the generalized multi-batch launch parameter checks introduce extra branching in the launch prologue, causing Clang to allocate additional VGPRs that slightly degrade warp occupancy for single-token dispatches.

Changes

Added a direct fast-path dispatch for ncols_dst == 1 when targeting MMVQ_PARAMETERS_RDNA3_0 without MoE IDs. This avoids multi-batch evaluation checks and issues the optimal wave32 single-token tile configuration directly.

Benchmark Results

Tested on AMD Radeon RX 7900 XTX with Qwen3.8-27B-Q4_K_M:

  • Per-kernel Q4_K GEMV average duration: 68.91 µs $\rightarrow$ 62.58 µs (-9.1%).
  • Total time spent in GEMVs across 32 tokens: 493.9 ms $\rightarrow$ 448.5 ms (-45.4 ms).
  • Reclaims ~2.1 ms per token of pure compute execution time during generation.

@maci0
maci0 requested a review from a team as a code owner August 30, 2026 05:57
@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning CUDA Related to the CUDA backend labels Aug 30, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Aug 30, 2026

Copy link
Copy Markdown

Hi @maci0, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

  • Multiple open PRs from a new contributor: We limit new contributors (those without a previously merged PR) to 1 open PR at a time. You currently have 2 open PRs.


Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Aug 30, 2026
@github-actions
github-actions Bot marked this pull request as draft August 30, 2026 06:05
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CUDA Related to the CUDA backend ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant