-
Notifications
You must be signed in to change notification settings - Fork 31.3k
[Quantization] per tensor quantization kernel #42560
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
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Thanks a lot for adding this ! Just a minor comment
| assert len(block_size) == 2 | ||
| block_n, block_k = block_size[0], block_size[1] | ||
|
|
||
| # if we have per-tensor quantization, we use 128x128 block size for tiled matmul multiplication | ||
| if block_n == B.shape[-2] and block_k == B.shape[-1]: | ||
| block_n = 128 | ||
| block_k = 128 | ||
|
|
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.
it doesn't make sense before to set blocks to something else than None when doing per tensor in the FP8Linear. Can we change that so that we fix it here also ?
| """Triton-accelerated function used to perform linear operations (dot | ||
| product) on input tensors `A` and `B` with block-wise quantization, and | ||
| store the result in output tensor `C`. | ||
| """ |
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.
update
What does this PR do?
Adds a simple kernel for per tensor quantization, where the matmul is done per blocks of 128x128, and the weights scales, and activation scales are expected to be scalars