-
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
Adding comparison for different fp8 matmuls #36
Merged
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
ac31f09
to
f7d68be
Compare
vkuzo
reviewed
Oct 1, 2024
benchmarks/fp8_matmul.py
Outdated
save_path (Optional[str], optional): Path to save the results. Defaults to None. | ||
""" | ||
torch.random.manual_seed(123) | ||
configs = get_configs_varying_k() |
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 curious, any interesting insights from varying M and N in this script?
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.
3836e3c
to
06aaf0b
Compare
06aaf0b
to
ba0b51b
Compare
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Oct 11, 2024
# Summary I started to explore the performance of _scaled_mm against a triton-based persistent TMA kernel for RowWise scaling. There are more details here: drisspg/transformer_nuggets#36 It clearly showed that where was some room for improvement on larger problem sizes compared to triton's performance. Note that the triton kernel only has a 128x128x128 Tile shape, where scaled_mm has a 64, 128, 128 tile shape which we use for smaller problem sizes which may explain some of the perf delta for at smaller shapes. This led to seeing if we can improve our triton codegen lowering for _scaled_mm (I think we should still do this: #137517). In the meantime @Chillee suggested I make sure swizziling is set for the large matmul shapes This PR makes sure that we increase the max_swizzle_size for the large matmuls. ## Performance Note* Red means triton based tma beats _scaled_mm blue means _scaled_mm is faster On Nighlty W/ Triton at (2ef33c6c4c3)  You can see that as M,K,N increase there is a clear win for the Triton Persistent TMA. After this PR:  For example w/ this change(power limited gpu) M=16384 K=16384 N=16384 TFlops Before :`985.49` TFlops After: `1304.69` Pull Request resolved: #137681 Approved by: https://github.com/eqy
jackzhxng
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Oct 16, 2024
# Summary I started to explore the performance of _scaled_mm against a triton-based persistent TMA kernel for RowWise scaling. There are more details here: drisspg/transformer_nuggets#36 It clearly showed that where was some room for improvement on larger problem sizes compared to triton's performance. Note that the triton kernel only has a 128x128x128 Tile shape, where scaled_mm has a 64, 128, 128 tile shape which we use for smaller problem sizes which may explain some of the perf delta for at smaller shapes. This led to seeing if we can improve our triton codegen lowering for _scaled_mm (I think we should still do this: #137517). In the meantime @Chillee suggested I make sure swizziling is set for the large matmul shapes This PR makes sure that we increase the max_swizzle_size for the large matmuls. ## Performance Note* Red means triton based tma beats _scaled_mm blue means _scaled_mm is faster On Nighlty W/ Triton at (2ef33c6c4c3)  You can see that as M,K,N increase there is a clear win for the Triton Persistent TMA. After this PR:  For example w/ this change(power limited gpu) M=16384 K=16384 N=16384 TFlops Before :`985.49` TFlops After: `1304.69` Pull Request resolved: #137681 Approved by: https://github.com/eqy
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
Comparing different PerTensor and PerRow scaling kernels
Eager Results
Max Autotune for scaled-fp8
Traces