-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add FP32 and Bias to fulfill the functionalities required by torch.nn.attention.SDPBackend.EFFICIENT_ATTENTION
#22
Merged
Conversation
This file contains 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
GPU reference code path causes segfaults.
This allows users to select device to compute reference results without modifying the source file.
Example usage: ``` DB=v2python/rules/tuning_database.sqlite3 python -m v2python.table_tool -k '' --action dumpcsv \ -f $DB --table_name 'FLASH$attn_fwd' \ --table_file 'attn_fwd.fp32mi300.csv' \ --select_where 'inputs$Q_dtype = "torch.float32"' git checkout another_branch -- $DB python -m v2python.table_tool -k '' --action loadcsv \ -f $DB --table_name 'FLASH$attn_fwd' \ --table_file attn_fwd.fp32mi300.csv \ --ignore_id ``` Note: --ignored_id does not support cases that 'id' is not the first column of the CSV file, for simplicity.
If .expand() is called upon a tensor, the result tensor may have one or more zeros in its stride()
Otherwise the dk result is incorrect for fp32
1. Computed gradients were not stored for future use, which basically means the gradients were not tested at all. 2. bias should be created as a Rank 2 tensor and then expand to Rank 4.
groenenboomj
reviewed
May 2, 2024
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.
What are the perf impacts of these changes?
groenenboomj
approved these changes
May 2, 2024
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.
This PR includes the following major changes
fp32
datatype support, and the corresponding tuning database informationtable_tool.py
to partially dump/load.csv
file, allowing database mergingKnown limitations:
.expand()
-ed ones are unlikely to work) for backward direction. No checking is performed on this requisite and failure may be silenttest_forward.py
is still using the old method to estimate ATOL/RTOL