-
Notifications
You must be signed in to change notification settings - Fork 6.4k
[core] support flash attention through kernels
#12387
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flash Attention is stable. So, we don't have to mark it private like FA3.
HuggingFaceDocBuilderDev
commented
Sep 25, 2025
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
@MekkCyber
MekkCyber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool integration 🔥 ! I just left some nits
@MekkCyber
MekkCyber
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we fetching both kernels here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the way APIs for attention backends are designed and also to support torch.compile
with fullgraph traceability (when possible).
We will let it grow a bit and upon feedback, we can revisit how to better deal with this.
@MekkCyber
MekkCyber
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this related to the kernel or it just needs more time to be integrated ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have models that use varlen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayakpaul qwen image uses varlen. also, native fused qkv+mlp attn requires varlen function.
What does this PR do?
Follow-up of #12236.
Testing code:
Tip
Works with
torch.compile
fullgraph compatibility.I have tested the code on H100 and A100, and it works.