Fix FA3 ring attention signature compatibility#2399
Draft
Conversation
S1ro1
reviewed
May 3, 2026
| @@ -0,0 +1,196 @@ | |||
| import sys | |||
Collaborator
There was a problem hiding this comment.
Delete this pls, seems useless
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fix FlashAttention 3 ring-attention calls so they match the installed FA3 low-level function signature.
The pinned
flash-attn-3package exposes_flash_attn_forward/_flash_attn_backwardwithcausaland tuplewindow_sizeparameters, while the PrimeRL ring-attention wrapper was always passingis_causal,window_size_left, andwindow_size_right. CP + FA3 model paths therefore failed before reaching the kernel.This change keeps compatibility with both observed signature shapes:
causal+window_sizeis_causal+window_size_left/window_size_rightRepro
On current
main, this hits the bug through the PrimeRL FA3 ring-attention wrapper:Before this patch, the installed pinned FA3 wrapper rejects the unexpected
is_causalkeyword.After this patch, the same path passes
causal=Trueandwindow_size=(3, 0)to the installed FA3 wrapper.Tests
Note
Low Risk
Low risk: small, localized keyword-arg plumbing change for FlashAttention-3 wrappers plus targeted unit tests; behavior only differs in how
causal/window_sizekwargs are passed into the FA3 kernel entrypoints.Overview
Fixes FlashAttention-3 ring-attention varlen wrapper calls to handle both observed low-level FA3 signatures by setting either
causal+window_sizeoris_causal+window_size_left/rightbased on the target function’s default-arg keys.Adds unit tests that monkeypatch
flash_attn_interfaceto validate the forward/backward wrappers pass the correct causal/window parameters for each signature variant.Reviewed by Cursor Bugbot for commit 573efcf. Bugbot is set up for automated code reviews on this repo. Configure here.