Skip to content

[CUDA] Add 128-row variant for qmm - #4851

Merged
zcbenz merged 2 commits into
ml-explore:mainfrom
dhiltgen:cuda-perf-m128
Nov 23, 2026
Merged

zcbenz merged 2 commits into
ml-explore:mainfrom
dhiltgen:cuda-perf-m128

Conversation

@dhiltgen

@dhiltgen dhiltgen commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

This PR adds a new 128-row variant for qmm to improve prompt performance for large prompts, tuned to enable only where the row reuse pays off. It uses GPU processor count to determine if the 128-row variant will nearly halve the scheduling rounds.

Tested with mlx-lm p2048/g128 using the community/gemma-4-12B-it-4bit and mlx-community/Qwen3.6-27B-nvfp4

GPU / model main -> this branch: Prompt TPS Change
RTX6000 Ada / Gemma12 2656 -> 3240 +22%
RTX5090 / Gemma12 5507 -> 6434 +16.8%
RTX5090 / Qwen27 440 -> 461 +4.8%
  • ☑️ I understand it is strictly prohibited to use AI to write PR description
  • AI usage disclosure: co-developed with coding agent

@zcbenz zcbenz changed the title [cuda] Add 128-row variant for qmm [CUDA] Add 128-row variant for qmm Nov 23, 2026
@zcbenz
zcbenz merged commit 13d65be into ml-explore:main Nov 23, 2026
24 checks passed
rcfa pushed a commit to cubiculum-ai/mlx that referenced this pull request Nov 26, 2026
Ported: use_128_row_tiles goes into the anonymous namespace (Apple puts
it after get_quantized_batch_count, which the fork does not have), with
the 3-argument make_cta_tiler. The gather_qmm_rhs_sm80 hunk is not
taken: that function comes with ml-explore/mlx PR 4554, which the fork
does not have.

(cherry picked from commit 13d65be)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants