Repository navigation
[GlobalOptimization] Propagate affine QDQ through tensor operations - #24906
Merged
Merged
Conversation
ziereis
force-pushed
the
users/ziereis/qdq-drop-zero-zp
branch
from
September 11, 2026 06:37
f6ef8a2 to
abdb4d4
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 11, 2026 06:37
c8b49c2 to
6b7fe06
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
2 times, most recently
from
September 11, 2026 07:27
f5477f8 to
2bcf3a1
Compare
Manewing
force-pushed
the
users/ziereis/qdq-drop-zero-zp
branch
from
September 15, 2026 08:38
abdb4d4 to
9290c37
Compare
Manewing
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 15, 2026 08:38
2bcf3a1 to
719cc19
Compare
Manewing
force-pushed
the
users/ziereis/qdq-drop-zero-zp
branch
from
September 22, 2026 13:43
9290c37 to
926c874
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 29, 2026 09:40
719cc19 to
8c34330
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 30, 2026 12:21
2992dd3 to
c9a05a3
Compare
ziereis
changed the base branch from
main
to
users/ziereis/qdq-transpose-pattern-refactor
September 30, 2026 12:23
ziereis
force-pushed
the
users/ziereis/qdq-transpose-pattern-refactor
branch
from
September 30, 2026 13:58
b858147 to
528f5c6
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 30, 2026 13:58
c9a05a3 to
41c764e
Compare
ziereis
force-pushed
the
users/ziereis/qdq-transpose-pattern-refactor
branch
from
September 30, 2026 15:16
528f5c6 to
d98e118
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 30, 2026 15:16
41c764e to
d98e118
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 30, 2026 15:25
d98e118 to
26f9b99
Compare
ziereis
force-pushed
the
users/ziereis/qdq-transpose-pattern-refactor
branch
from
September 30, 2026 15:25
5f74093 to
8e2cdbf
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 30, 2026 15:31
26f9b99 to
f516972
Compare
ziereis
force-pushed
the
users/ziereis/qdq-transpose-pattern-refactor
branch
from
September 30, 2026 15:32
8e2cdbf to
6854dae
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
2 times, most recently
from
September 30, 2026 15:53
7fe8848 to
8b0febd
Compare
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
3 times, most recently
from
September 30, 2026 16:22
2cead15 to
70fc572
Compare
ziereis
marked this pull request as ready for review
September 30, 2026 16:28
ziereis
requested review from
AGindinson,
Manewing,
egebeysel,
jschuhmacher and
phemashekar
as code owners
September 30, 2026 16:28
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
September 30, 2026 16:29
70fc572 to
7882973
Compare
devtbi
pushed a commit
that referenced
this pull request
Oct 1, 2026
…24978) I ran into multiple scenarios in the past (and now again for #24906) where i had to reimplement some form of transpose propagation. To improve this, this PR refactors the transpose propagation pass into reusable patterns. This PR should not cause any functional changes and should be a pure refactor. Assisted by: Claude Signed-off-by: Thomas Ziereis <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Base automatically changed from
users/ziereis/qdq-transpose-pattern-refactor
to
main
October 1, 2026 08:51
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
October 6, 2026 08:33
7882973 to
894488e
Compare
Manewing
reviewed
Oct 7, 2026
Manewing
left a comment
Contributor
There was a problem hiding this comment.
Few things otherwise looks good to me :)
Contributor
Author
|
@Manewing Thanks for the review, comments should be addressed. I made one more change to the PR beyond this, which is allowing pads to propagate even if the dequantize op is not single use. I have some experimental evidence that this would block some integer rewrites in real models and generally looks profitable to do from the data i have now. However this might need some better heuristic in the future. |
Manewing
approved these changes
Oct 9, 2026
Move affine quantization through supported reshapes and padding, fuse consuming transposes into dequantize, and run propagation before integer QDQ rewriting so contractions consume dequantize results directly. Add a pattern that fuses a transpose into its single-use dequantize by permuting the dequantize's output map, the same map update the generic producer fusion applies. The integer contraction rewrite already reads through permuted dequantize maps, so no transpose is materialized on either side. The QDQ propagation pass uses it together with generic transpose specialization, restricted to transposes of dequantized values. The general transpose propagation pass also runs it while bubbling. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Thomas Ziereis <[email protected]>
- Keep the static result type of the original pad when moving it onto the quantized side instead of inferring it from the source. - Replace operands by position when cloning an op with dropped unit dims: the same value can appear as several operands that need different replacements. - Name the actual reason a per-channel zero point cannot pad the quantized side: tensor.pad tiling only supports a padding value defined outside the pad. - Say collapse_shape or expand_shape instead of reshape where a specific op is meant, and drop a redundant CHECK-NOT. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Thomas Ziereis <[email protected]>
BubblePadThroughDequantize required the dequantize to have the pad as its only user. A dequantized activation that feeds both a padded convolution and another consumer, such as a residual add or concat, kept its pad on the real-valued side, so the convolution never saw a dequantize producer and stayed in floating point. Moving the pad does not need exclusive ownership: the padded positions get their own dequantize of the padded quantized value, while the other users keep reading the original dequantize. Drop the restriction. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Thomas Ziereis <[email protected]>
The IREE dialects moved to strict properties in #24983, so the parser no longer accepts the inherent attributes of quantize_affine and dequantize_affine in an attribute dictionary. Rewrite the test inputs and CHECK patterns to the <...> property syntax. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Thomas Ziereis <[email protected]>
ziereis
force-pushed
the
users/ziereis/qdq-reshape-propagation
branch
from
October 12, 2026 08:42
7478472 to
b975dde
Compare
ziereis
enabled auto-merge (squash)
October 12, 2026 09:43
7 of 8 tasks
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.
The integer contraction rewrite from #24902 needs dequantize_affine to be the direct producer of a contraction operand. This PR adds PropagateAffineQuantization, which moves the tensor ops in between onto the quantized side, where they also operate on narrower data. It runs right before each integer QDQ rewrite.
It perform the following transformations:
Part of #24862
Assisted By: Claude Code