-
Notifications
You must be signed in to change notification settings - Fork 16
Add Flash Attention forward kernel with MFMA32 register pipeline #133
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
Draft
yanguahe
wants to merge
18
commits into
main
Choose a base branch
from
hyg_mha
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
11b3967
Add simple GEMM kernel with MFMA 16x16x16 and test scripts
yanguahe 7a3d05b
Add waves_per_eu support and switch to mask-based boundary handling i…
yanguahe 5e11342
Fix hardware OOB handling in buffer ops to match Triton implementation
yanguahe 516fe7d
Add unsafe_fp_math and fast_fp_math compiler options for faster GPU math
yanguahe ab58591
Add peng's Flash Attention PR: https://github.com/sunway513/FlyDSL/pu…
yanguahe 9390ffa
Add flash_attention_v4_4_kernel and it's test
yanguahe 9ee814c
Romve flash_attention_v4_4_kernel
yanguahe d41beae
Add flash_attention_v4_4_kernel and it's test
yanguahe 7705b50
Optimize flash_attention_v4_4 with MFMA32 register pipeline
yanguahe b8fc969
[WIP] Opt flash_attention_v4_4_kernel
yanguahe 73f96c7
Refine flash_attention_v4_4 convergence paths with safe defaults.
yanguahe 4e0fff0
Rename flash_attention_v4_4 artifacts to flash_attn_func.
yanguahe 5767f75
Remove legacy flash_attention_v4 variants and simplify flash_attn_fun…
yanguahe 1c49a1c
Remove temp file
yanguahe 5b039e2
Merge origin/main into hyg_mha, resolve conflict in compiler.py
yanguahe c274a87
Update test config
yanguahe ac1d477
Address review: remove unused _apply_waves_per_eu_hint, clarify exp2 …
yanguahe 5401b36
Fix CI: update preshuffle_gemm to use compile(waves_per_eu=) instead …
yanguahe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Oops, something went wrong.
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.
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 change this? use dynamic shapes?
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.
Not related to dynamic shapes. This is a correctness fix for masked buffer loads/stores.
The previous code used
num_records=0xFFFFFFFFwithmask_offset=0x7FFFFFFF. The GPU does unsigned comparisonoffset < num_recordsfor OOB detection, so0x7FFFFFFF < 0xFFFFFFFF = true— the mask never triggers OOB, which is a bug.Changed to match Triton's approach:
MAX_NUM_RECORDS = 0x7FFFFFFEOOB_OFFSET = 0x800000000x80000000 > 0x7FFFFFFE(unsigned), hardware OOB is always triggered when mask=False. ✅