Repository navigation
[Torch] Convert integral float zero points of PT2E and torchao ops - #25136
Merged
roberto-laudani merged 2 commits intoNov 4, 2026
Merged
Conversation
roberto-laudani
force-pushed
the
users/roberto-laudani/qdq-integral-float-zero-points
branch
from
October 28, 2026 12:56
6d73d8d to
b612557
Compare
roberto-laudani
marked this pull request as ready for review
October 28, 2026 13:00
roberto-laudani
requested review from
AGindinson,
rsuderman,
ziereis and
zjgarvey
as code owners
October 28, 2026 13:00
roberto-laudani
force-pushed
the
users/roberto-laudani/qdq-integral-float-zero-points
branch
from
November 2, 2026 10:34
b612557 to
cdbd42a
Compare
roberto-laudani
force-pushed
the
users/roberto-laudani/qdq-integral-float-zero-points
branch
from
November 2, 2026 10:39
cdbd42a to
22597c4
Compare
roberto-laudani
marked this pull request as draft
November 2, 2026 10:56
roberto-laudani
force-pushed
the
users/roberto-laudani/qdq-integral-float-zero-points
branch
from
November 2, 2026 14:26
22597c4 to
51a2aee
Compare
roberto-laudani
marked this pull request as ready for review
November 2, 2026 14:27
roberto-laudani
requested review from
egebeysel and
jschuhmacher
as code owners
November 2, 2026 14:27
roberto-laudani
force-pushed
the
users/roberto-laudani/qdq-integral-float-zero-points
branch
from
November 2, 2026 15:16
51a2aee to
2133964
Compare
Signed-off-by: Roberto Laudani <[email protected]>
roberto-laudani
force-pushed
the
users/roberto-laudani/qdq-integral-float-zero-points
branch
from
November 3, 2026 12:09
2133964 to
b25c88c
Compare
Manewing
approved these changes
Nov 3, 2026
egebeysel
approved these changes
Nov 3, 2026
egebeysel
left a comment
Contributor
There was a problem hiding this comment.
Generally LGTM % a remark on the verifier.
Also, my coding agent found this but not sure if it's 100% relevant for the "common" zero-point values:
The two computations differ in where the subtraction happens. With a float zero point, every PT2E dequantize reference (per-channel, per-channel-group, per-token in PyTorch's _decomposed.py at main) does input - zero_points directly on the integer tensor. PyTorch type promotion makes that a float subtraction in the zero point's dtype, so the quantized value is first rounded to f16 or bf16 and the difference is rounded again. LinalgExt's dequantize_affine lowering subtracts in integers, converts the exact difference to the scale type, and then multiplies.
PT2E (f16 zero point): f16(q) - zp -> rounded in f16 -> * scale
LinalgExt: (q - zp) exact as i32 -> sitofp -> * scale
…fy the float reader Signed-off-by: Roberto Laudani <[email protected]>
roberto-laudani
force-pushed
the
users/roberto-laudani/qdq-integral-float-zero-points
branch
from
November 3, 2026 16:44
ff53898 to
69402ad
Compare
Contributor
Author
|
Hi @egebeysel, good point, but the integer subtraction is exact and matches Inductor's dequantize_per_channel lowering. The difference comes from eager rounding in bf16/f16. |
roberto-laudani
deleted the
users/roberto-laudani/qdq-integral-float-zero-points
branch
November 4, 2026 14:17
8 tasks done
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
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.
Converts integer-valued float zero points of PT2E and torchao ops to i32 so they lower to LinalgExt. The constant zero-point check moves from the
dequantize_affineverifier into the Torch conversion, which declines constant zero points outside the quantization bounds.Part of #24862.
Assisted by: Claude