You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the P100, MMVQ is faster than the alternative for MUL_MAT_ID on all batch sizes up to 8, so include it in the list of architectures that always use MMVQ.
I believe some of the quantization types will also run faster with fewer warps active (calc_nwarps), but not all of them benefited from halving the number of warps. I'll follow up on that, either in this PR or a next one. See below, there are some speedups to be had from tuning the number of warps and enabling small_k for more quantization types. Tuning seems benefitial, but my first attempts ended in regressions on larger models and will have to wait.
Additional information
All tests were done on a single P100, powerlimited to 150 W, CUDA 12.9.2, driver 575.64.05.
For some types, halving warps improves performance for B=1, especially when re-enabling small_k as well. B=2+ is unaffected.
I really want to test a dense model too before this merges, but I would appreciate a review and possibly tests on other cards (especially sm_61, sm_70) regarding the type filter in mul_mat_vec_q_switch_ncols_dst::should_use_small_k and halving warps.
Very sorry for the spam, but testing another model at Q8_0 I think I get regressions again.
I think I'll have to leave the tuning for the future, and will drop everything except the MMVQ_MAX_BATCH_SIZE change which gave me good results on other models as well.
dfriehs
changed the title
cuda: tune MMVQ for sm_60
cuda: always use MMVQ for MUL_MAT_ID on sm_60
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CUDARelated to the CUDA backendggmlchanges relating to the ggml tensor library for machine learning
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
On the P100, MMVQ is faster than the alternative for MUL_MAT_ID on all batch sizes up to 8, so include it in the list of architectures that always use MMVQ.
I believe some of the quantization types will also run faster with fewer warps active (Tuning seems benefitial, but my first attempts ended in regressions on larger models and will have to wait.calc_nwarps), but not all of them benefited from halving the number of warps. I'll follow up on that, either in this PR or a next one. See below, there are some speedups to be had from tuning the number of warps and enablingsmall_kfor more quantization types.Additional information
All tests were done on a single P100, powerlimited to 150 W, CUDA 12.9.2, driver 575.64.05.
scripts used for testing
results for Ling 3.0 Tiny
Bolded values previously exceeded
get_mmvq_mmid_max_batch_pascal_older.Q1_0
Q2_0
Q4_0
Q4_1
Q5_0
Q5_1
Q8_0
IQ1_S
IQ1_M
IQ2_XXS
IQ2_XS
IQ2_S
IQ3_XXS
IQ3_S
IQ4_XS
IQ4_NL
Q2_K
Q3_K
Q4_K
Q5_K
Q6_K
MXFP4
NVFP4
Requirements