Skip to content

Make QuantAbsorption's input-side absorption opt-in (#24780) - #24780

Merged
meta-codesync[bot] merged 1 commit into
mainfrom
export-D130466673
Nov 9, 2026
Merged

meta-codesync[bot] merged 1 commit into
mainfrom
export-D130466673

Conversation

@mcremon-meta

@mcremon-meta mcremon-meta commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

This should have been part of
#24720, which added
QuantAbsorptionPass with the other fused_quant graph passes. It was left out
of that PR by mistake.

By default, QuantAbsorptionPass now only runs the rewrite that is never less
accurate. The docstring explains why the other two modes are opt-in.

  • Output side (unchanged, always on): the producer writes its output directly
    in the downstream quantize's qparams. The value still ends up on that grid,
    rounded once instead of twice, so each element is at least as close to the
    float result. It isn't bit-exact with the q/dq graph, though.
  • Input side (now opt-in, absorb_into_inputs): the consumer reads values on
    the dequantize's grid instead of the quantize's. Dropping the second rounding
    is more accurate on average, but not for every value.
  • Forked dequantize (already opt-in, absorb_with_fork): its float users see
    values on the quantize's grid instead of the producer's, which can be
    coarser. Only the docstring changes.

With input-side absorption off, a pair that only the input side would remove
is left to ReplaceDequantQuantWithRequantize, which turns it into a
fused_quant.requantize.

Reviewed By: DrJessop

Differential Revision: D130466673

@pytorch-bot

pytorch-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24780

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 4201e88 with merge base ebdb936 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 7, 2026
@meta-codesync

meta-codesync Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

@mcremon-meta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D130466673.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

meta-codesync Bot pushed a commit that referenced this pull request Nov 8, 2026
Summary:

This should have been part of
#24720, which added
`QuantAbsorptionPass` with the other fused_quant graph passes. It was left out
of that PR by mistake.

By default, `QuantAbsorptionPass` now only runs the rewrite that is never less
accurate. The docstring explains why the other two modes are opt-in.

- Output side (unchanged, always on): the producer writes its output directly
  in the downstream quantize's qparams. The value still ends up on that grid,
  rounded once instead of twice, so each element is at least as close to the
  float result. It isn't bit-exact with the q/dq graph, though.
- Input side (now opt-in, `absorb_into_inputs`): the consumer reads values on
  the dequantize's grid instead of the quantize's. Dropping the second rounding
  is more accurate on average, but not for every value.
- Forked dequantize (already opt-in, `absorb_with_fork`): its float users see
  values on the quantize's grid instead of the producer's, which can be
  coarser. Only the docstring changes.

With input-side absorption off, a pair that only the input side would remove
is left to `ReplaceDequantQuantWithRequantize`, which turns it into a
`fused_quant.requantize`.

Differential Revision: D130466673
@meta-codesync meta-codesync Bot changed the title Make QuantAbsorption's input-side absorption opt-in Make QuantAbsorption's input-side absorption opt-in (#24780) Nov 9, 2026
meta-codesync Bot pushed a commit that referenced this pull request Nov 9, 2026
Summary:

This should have been part of
#24720, which added
`QuantAbsorptionPass` with the other fused_quant graph passes. It was left out
of that PR by mistake.

By default, `QuantAbsorptionPass` now only runs the rewrite that is never less
accurate. The docstring explains why the other two modes are opt-in.

- Output side (unchanged, always on): the producer writes its output directly
  in the downstream quantize's qparams. The value still ends up on that grid,
  rounded once instead of twice, so each element is at least as close to the
  float result. It isn't bit-exact with the q/dq graph, though.
- Input side (now opt-in, `absorb_into_inputs`): the consumer reads values on
  the dequantize's grid instead of the quantize's. Dropping the second rounding
  is more accurate on average, but not for every value.
- Forked dequantize (already opt-in, `absorb_with_fork`): its float users see
  values on the quantize's grid instead of the producer's, which can be
  coarser. Only the docstring changes.

With input-side absorption off, a pair that only the input side would remove
is left to `ReplaceDequantQuantWithRequantize`, which turns it into a
`fused_quant.requantize`.

Reviewed By: DrJessop

Differential Revision: D130466673
Summary:

This should have been part of
#24720, which added
`QuantAbsorptionPass` with the other fused_quant graph passes. It was left out
of that PR by mistake.

By default, `QuantAbsorptionPass` now only runs the rewrite that is never less
accurate. The docstring explains why the other two modes are opt-in.

- Output side (unchanged, always on): the producer writes its output directly
  in the downstream quantize's qparams. The value still ends up on that grid,
  rounded once instead of twice, so each element is at least as close to the
  float result. It isn't bit-exact with the q/dq graph, though.
- Input side (now opt-in, `absorb_into_inputs`): the consumer reads values on
  the dequantize's grid instead of the quantize's. Dropping the second rounding
  is more accurate on average, but not for every value.
- Forked dequantize (already opt-in, `absorb_with_fork`): its float users see
  values on the quantize's grid instead of the producer's, which can be
  coarser. Only the docstring changes.

With input-side absorption off, a pair that only the input side would remove
is left to `ReplaceDequantQuantWithRequantize`, which turns it into a
`fused_quant.requantize`.

Reviewed By: DrJessop

Differential Revision: D130466673
@meta-codesync
meta-codesync Bot merged commit 08ae0c4 into main Nov 9, 2026
218 of 219 checks passed
@meta-codesync
meta-codesync Bot deleted the export-D130466673 branch November 9, 2026 22:25

This branch was previously deployed

1 inactive deployment
cadence — 4201e88b Deployed Nov 9, 2026 by meta-codesync[bot] via hifi5s-op-test / hifi5s #37432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants