-
Notifications
You must be signed in to change notification settings - Fork 13.7k
CUDA: Hide latency of bias and gate-loading for fused mul_mat_vec_q
#16847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
am17an
merged 1 commit into
ggml-org:master
from
ORippler:osimons/prefetch_gate_bias_in_fused_mmvq
Oct 30, 2025
Merged
CUDA: Hide latency of bias and gate-loading for fused mul_mat_vec_q
#16847
am17an
merged 1 commit into
ggml-org:master
from
ORippler:osimons/prefetch_gate_bias_in_fused_mmvq
Oct 30, 2025
Conversation
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
This is realised by loading them into registers before computation of the dot-product, effectively batching them together with said dot-product. As a lot of threads are alive here, the warp scheduler has enough threads available to effectively hide the cost of additionally loading those two floats.
|
Fixes #16815, benchmarks for affected devices (ampere cards with low memory bandwidth) can be found in the comments. Results on the RTX A4000:
|
am17an
approved these changes
Oct 30, 2025
ORippler
added a commit
to ORippler/llama.cpp
that referenced
this pull request
Oct 30, 2025
Pointed out [here](ggml-org#16847 (comment)) that only a single value is needed per target col per thread
am17an
pushed a commit
that referenced
this pull request
Nov 1, 2025
* CUDA: Remove unneded bias/gate dims in fused mmvq Pointed out [here](#16847 (comment)) that only a single value is needed per target col per thread * Apply suggestions from code review Co-authored-by: Johannes Gäßler <[email protected]> * Fix "Error 991-D: extra braces are nonstandard" during compilation --------- Co-authored-by: Johannes Gäßler <[email protected]>
LostRuins
added a commit
to LostRuins/koboldcpp
that referenced
this pull request
Nov 2, 2025
…is resolved revert ggml-org#16715 (+2 squashed commit) Squashed commit: [289af2ee2] Revert "Hide latency of bias and gate-loading (ggml-org#16847)" This reverts commit 8b11dee. [a3e5c1e95] Revert "CUDA: add unused vars to mmvf and mmvq (ggml-org#16807)" This reverts commit 463bbf2.
ggerganov
pushed a commit
to ggml-org/ggml
that referenced
this pull request
Nov 9, 2025
* CUDA: Remove unneded bias/gate dims in fused mmvq Pointed out [here](ggml-org/llama.cpp#16847 (comment)) that only a single value is needed per target col per thread * Apply suggestions from code review Co-authored-by: Johannes Gäßler <[email protected]> * Fix "Error 991-D: extra braces are nonstandard" during compilation --------- Co-authored-by: Johannes Gäßler <[email protected]>
ggerganov
pushed a commit
to ggml-org/ggml
that referenced
this pull request
Nov 9, 2025
* CUDA: Remove unneded bias/gate dims in fused mmvq Pointed out [here](ggml-org/llama.cpp#16847 (comment)) that only a single value is needed per target col per thread * Apply suggestions from code review Co-authored-by: Johannes Gäßler <[email protected]> * Fix "Error 991-D: extra braces are nonstandard" during compilation --------- Co-authored-by: Johannes Gäßler <[email protected]>
ggerganov
pushed a commit
to ggml-org/whisper.cpp
that referenced
this pull request
Nov 9, 2025
* CUDA: Remove unneded bias/gate dims in fused mmvq Pointed out [here](ggml-org/llama.cpp#16847 (comment)) that only a single value is needed per target col per thread * Apply suggestions from code review Co-authored-by: Johannes Gäßler <[email protected]> * Fix "Error 991-D: extra braces are nonstandard" during compilation --------- Co-authored-by: Johannes Gäßler <[email protected]>
ggerganov
pushed a commit
to ggml-org/whisper.cpp
that referenced
this pull request
Nov 9, 2025
* CUDA: Remove unneded bias/gate dims in fused mmvq Pointed out [here](ggml-org/llama.cpp#16847 (comment)) that only a single value is needed per target col per thread * Apply suggestions from code review Co-authored-by: Johannes Gäßler <[email protected]> * Fix "Error 991-D: extra braces are nonstandard" during compilation --------- Co-authored-by: Johannes Gäßler <[email protected]>
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
Nvidia GPU
Issues specific to Nvidia GPUs
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.
This PR hides latency of bias and gate-loading for fused
mul_mat_vec_qkernel by loading them into registers before computation of the dot-product, effectively batching them together with said dot-product. As a lot of threads are alive in this part of the kernel still, the warp scheduler has enough threads available to effectively hide the cost of loading those two single floats.This gives 3-14% E2E speed-up for gpt-oss models (qwen3moe does not use bias and gate, and I am unaware of any other MoE model that uses bias and gate which I could run E2E perf tests on). The kernel themselves are up to 20% faster for gpt-oss.