Skip to content

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

Open
mcremon-meta wants to merge 1 commit into
mainfrom
export-D130466673
Open

mcremon-meta wants to merge 1 commit into
mainfrom
export-D130466673

Conversation

@mcremon-meta

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.

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`.

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.

✅ You can merge normally! (1 Unrelated Failure)

As of commit 8647e29 with merge base e0015e1 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

This branch was previously deployed

1 inactive deployment
cadence — 8647e290 Deployed Nov 8, 2026 by mcremon-meta via hifi-op-test / hifi4 #37253
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.

1 participant