-
Notifications
You must be signed in to change notification settings - Fork 17
Add FP/INT triton kernels and unit tests, also update QAT example #58
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
Merged
chichun-charlie-liu
merged 8 commits into
foundation-model-stack:main
from
chichun-charlie-liu:triton-kernel
Jan 30, 2025
Merged
Add FP/INT triton kernels and unit tests, also update QAT example #58
chichun-charlie-liu
merged 8 commits into
foundation-model-stack:main
from
chichun-charlie-liu:triton-kernel
Jan 30, 2025
Conversation
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
Signed-off-by: cliu-us <[email protected]>
Signed-off-by: cliu-us <[email protected]>
Signed-off-by: cliu-us <[email protected]>
Signed-off-by: cliu-us <[email protected]>
Signed-off-by: chichun-charlie-liu <[email protected]>
Signed-off-by: cliu-us <[email protected]>
Signed-off-by: cliu-us <[email protected]>
Signed-off-by: cliu-us <[email protected]>
tharapalanivel
approved these changes
Jan 30, 2025
Collaborator
tharapalanivel
left a comment
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.
LGTM, thanks @chichun-charlie-liu!
9301123
into
foundation-model-stack:main
11 checks passed
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.
Description of the change
In addition to CUTLASS kernel, we added a new Triton matmul kernel that supports FP32, FP16, BF16, FP8, and INT8. Triton kernel is more flexible and easier hackable than CUTLASS. Although the INT8 performance of this triton kernel is only on par with FP16
torch.matmul(CUTLASS is ~2x faster), triton provides a valuable path to study HW behaviors and detailed simulations. For example, we can apply truncation on accumulator in a more efficient way than serialtorch.matmuland much cleaner codes compared to writing in CUTLASS.Related issue number
There is a compatibility issue with our existing CUTLASS kernel and
torch.compile(..., mode=reduced-overhead), which is blocking us from advancing fromPyTorch 2.3toPyTorch 2.4. With the addition of the new Triton kernel, at least there is an alternative run path for the entire INT8 QAT example (including the lowering part) when usingPyTorch 2.4.How to verify the PR
INT8 QAT example has a lowering option which previously only supported CUTLASS. With the newly added Triton kernel, we have a second option to run quantized model using real INT engine now.
Note that in this model lowering experiment, quantized model will pass real INT8 tensor to matmul operator. Therefore, the kernel needs to be able to:
Was the PR tested