Map top-left map to bottom-right for self-attn#3939
Open
Micky774 wants to merge 1 commit into
Open
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the FMHA v3 backward ASM kernel selection to handle gfx1250’s limited causal-mask kernel availability by remapping an equivalent causal mask in the self-attention (square) case, aligning with an existing symmetry already used for gfx942.
Changes:
- For
arch_id == "gfx1250", remapmask_typefrom top-left (1) to bottom-right (2) whenseqlen_q == seqlen_kso existing gfx1250 causal BWD kernels can be selected. - Keep the existing gfx942 square-seqlen remap logic (2 → 1) and apply the analogous inverse remap for gfx1250.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Motivation
gfx1250 only has kernels which support bottom-right masking. In the case of
s_q=s_kvwe have that bottom-right = top-left masking. This mirrors a similar symmetry already in place for gfx942.Technical Details
Test Plan
Tested by building w/ TE and applying to E2E models.
Test Result
The E2E model succeeds.
Submission Checklist