Repository navigation
[LinalgExt] Add affine quantization and dequantization ops - #24901
Merged
Merged
Conversation
ziereis
marked this pull request as ready for review
September 9, 2026 07:00
ziereis
requested review from
AGindinson,
egebeysel,
jschuhmacher and
phemashekar
as code owners
September 9, 2026 07:00
jschuhmacher
reviewed
Sep 9, 2026
ziereis
force-pushed
the
users/ziereis/qdq-linalg-ext-ops
branch
2 times, most recently
from
September 10, 2026 07:16
f3fda4b to
aa350f2
Compare
Signed-off-by: Thomas Ziereis <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
ziereis
force-pushed
the
users/ziereis/qdq-linalg-ext-ops
branch
from
September 10, 2026 07:26
aa350f2 to
b0c4672
Compare
jschuhmacher
approved these changes
Sep 15, 2026
jschuhmacher
left a comment
Contributor
There was a problem hiding this comment.
Thanks! Looks good to me
Manewing
added a commit
that referenced
this pull request
Sep 22, 2026
Rewrites contractions over `iree_linalg_ext.dequantize_affine` operands into integer contractions, integer zero-point corrections, and floating-point scaling. The transformation uses indexing maps and iterator types to handle named and generic contractions, including convolutions. It reduces in integer arithmetic over dimensions where quantization parameters are invariant. For blockwise quantization, it computes integer partial results, applies each block's correction and scales, then accumulates across blocks in floating point. Zero-point correction terms are built as separate computations so constant terms can be evaluated independently. Corrections are applied before conversion to floating point. Scaling and accumulation use at least f32, preserving wider scale or output types and narrowing only the final result. The rewrite requires a plain multiply-add body, zero initialization, and positive static integer reduction extents whose products and corrections fit in signed i32. Unsupported cases retain the original computation. The pass is enabled by default; reassociation changes floating-point rounding. It can be disabled with `--iree-global-opt-enable-qdq-to-integer-math=false`. Builds on the [affine QDQ operations PR #24901](#24901) and implements the contraction rewrite portion of [Linalg(_ext) native QDQ #24862](#24862). --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> --------- Signed-off-by: Thomas Ziereis <[email protected]> Signed-off-by: Florian Walbroel <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Florian Walbroel <[email protected]>
9 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.
Adds
iree_linalg_ext.quantize_affineandiree_linalg_ext.dequantize_affineto represent QDQ directly in LinalgExt, preserving quantization parameters for subsequent compiler transformations.Independent indexing maps for the input, scale, zero point, and output express per-tensor, per-channel, and blockwise quantization. The ops support optional zero points, explicit storage and zero-point signedness, and arithmetic in the scale's element type. Quantization rounds ties to even and clamps to the specified storage range.
Includes operation verification, shape reification, and decomposition into elementwise Linalg generics. Dispatch creation decomposes remaining QDQ ops before fusion, allowing earlier optimizations to consume the explicit quantization representation.
Implements the QDQ operation layer of Linalg(_ext) native QDQ #24862.
Stack created with GitHub Stacks CLI • Give Feedback 💬