-
Notifications
You must be signed in to change notification settings - Fork 13k
CUDA: faster tile FA (Pascal/AMD), headsize 256 #15769
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
JohannesGaessler
merged 1 commit into
ggml-org:master
from
JohannesGaessler:cuda-fa-tile-256-7
Sep 6, 2025
Merged
CUDA: faster tile FA (Pascal/AMD), headsize 256 #15769
JohannesGaessler
merged 1 commit into
ggml-org:master
from
JohannesGaessler:cuda-fa-tile-256-7
Sep 6, 2025
+604
−769
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
FA on vs. off
|
Im currently traveling and wont be able to look at anything until the 13th. |
slaren
approved these changes
Sep 6, 2025
Hmm. I was excited for the headsize 256 support but Flash Attention + Partial Offloading + Quantized KV Cache still destroys prompt processing performance for Gemma 3 12B (but not 27B). |
The support for the combination of head size 256 + quantized KV cache still has other issues and requires a refactor of the "vector" kernels. |
walidbr
pushed a commit
to walidbr/llama.cpp
that referenced
this pull request
Sep 7, 2025
Nexesenex
added a commit
to Nexesenex/croco.cpp
that referenced
this pull request
Sep 9, 2025
…)" This reverts commit 79bc429.
njsyw1997
pushed a commit
to aizip/llama.cpp
that referenced
this pull request
Sep 10, 2025
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 refactors and deduplicates the CUDA "tile" FlashAttention kernels, adds support for head size 256, and improves performance for Pascal/AMD without FP16 mma. If fast FP16 math is available it is now used, but the KQ accumulation and the softmax are always down with FP32 precision (as these seem to be the numerically problematic parts of the kernel). The kernel now has a more flexible parameterization, I tuned
kq_stride
andkq_nbatch
for P40/RX 6800/Mi 50. It is also possible to use awarp_size
of 64 rather than 32 but I was not able to get better performance this way; I'm keeping the functionality since it's possible I'm currently ignorant about something and may want to revisit this in the future.Performance changes