-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Flash Attention v3 #36190
base: main
Are you sure you want to change the base?
Flash Attention v3 #36190
Conversation
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. |
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.
Just a preheader to warn/inform you on some stuff regarding the current status of fa3:
- sm80 is supported (A100 etc) (and up)
- (arm64 is supported now I think, not sure if it was before)
- it doesn't seem like dropout will be supported ( Flash attention 3 does not use Dropout_p? Dao-AILab/flash-attention#1377 )
- (barebones) padding is included in hopper ( https://github.com/Dao-AILab/flash-attention/blob/main/hopper/padding.py )
seqused_(q/k) is now forced in the varlen interface ( https://github.com/Dao-AILab/flash-attention/blob/fa445ff6c215026438cca496a97242b8269aa428/hopper/flash_attn_interface.py#L566-L567 ) but tbh not sure if this was unintended ( opened an issue at [newest main shouldnt require it anymoreFA3
] Forced usage ofseqused_(q/k)
in varlen Dao-AILab/flash-attention#1495 )- qkv packed exisits for base fa3 forward (but not the others)
- softcapping should be supported now ( e.g. https://github.com/Dao-AILab/flash-attention/blob/fa445ff6c215026438cca496a97242b8269aa428/hopper/flash_attn_interface.py#L576 )
- fp8 backward doesnt look like it will be added soon ( Is there a plan to support flash_attn_varlen_backward with fp8 Dao-AILab/flash-attention#1420 (comment) )
if torch.version.cuda: | ||
compute_capability = torch.cuda.get_device_capability() | ||
major, _ = compute_capability | ||
if major < 9: |
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.
A100 support has been recently added Dao-AILab/flash-attention#1481 (comment)
cc @bn999 if you're interested about the progress |
@vasqu Yup, I'm following. Good stuff. |
Thanks for the info @vasqu |
What does this PR do?
Replaces #33522 to avoid conflicts and allow those using it to continue while we get it updated for #35235
Initial commit of this PR adds auxiliary code so we can discuss the core FAv3 integration.
cc @ArthurZucker
_flash_attention_forward
/flash_attention_forward
as before or create new functions?FlashAttention2
classes, is refactoring all models to use the new style planned? Integrate FAv3 as before or do the refactor in this PR?Also to check:
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.