Skip to content

Conversation

@AdrianLundell
Copy link
Collaborator

@AdrianLundell AdrianLundell commented Nov 5, 2025

A number of ops only handles shape/meta-data without changing the dynamic range. In these cases, no rescaling needs to be performed and the int8 portable_ops kernel can be used directly.

A new test is added to ensure this behaviour, as well as a test showing how operators which does change the dynamic range (SUB) are not supported.

To support quantization of graphs with no-rescale ops in the beginning/ end of the graph, two new quantizers InputQuantizer and OutputQuantizer are introduced. By explicitly stating the dtpye of the input/output, no-rescale ops inherit dtypes from them as with any other op.

cc @freddan80 @per @zingo @oscarandersson8218 @digantdesai

A number of ops only handles shape/meta-data without changing
the dynamic range. In these cases, no rescaling needs to be performed
and the int8 portable_ops kernel can be used directly.

A new test is added to ensure this behaviour, as well as a test showing
how operators which does change the dynamic range (SUB) are not
supported.

To support quantization of graphs with no-rescale ops in the beginning/
end of the graph, two new quantizers InputQuantizer and OutputQuantizer
are introduced. By explicitly stating the dtpye of the input/output,
no-rescale ops inherit dtypes from them as with any other op.

Signed-off-by: Adrian Lundell <[email protected]>
Change-Id: I8f79b86b633f9ad8d9f183c914754b0ee2f7a87c
@AdrianLundell AdrianLundell requested a review from psiddh November 5, 2025 10:11
@AdrianLundell AdrianLundell added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: none Do not include this in the release notes labels Nov 5, 2025
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 5, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (5 Unrelated Failures)

As of commit 094b370 with merge base 993254c (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was 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 5, 2025
@psiddh
Copy link
Contributor

psiddh commented Nov 6, 2025

Is this the idea in general ?

// Current state:
input(float32) → ops → output(float32)

// Annotate (This PR):
input(float32) 📋"Annotate Q!" → ops → 📋"Annotate DQ!" output(float32)

// What later passes will do:
input(float32) → [Q] → ops(int8) → [DQ] → output(float32)
↑---------------------------------↑
"OK, inserting ------------- ---------"OK, inserting
quantize!" -------------------------- "dequantize!"

@AdrianLundell AdrianLundell merged commit d07a49a into pytorch:main Nov 6, 2025
138 of 146 checks passed
AdrianLundell added a commit to AdrianLundell/executorch that referenced this pull request Nov 6, 2025
Fix a merge issue causing the build to fail + update tests after
merging of pytorch#15590

Signed-off-by: Adrian Lundell <[email protected]>
abhinaykukkadapu pushed a commit to abhinaykukkadapu/executorch that referenced this pull request Nov 6, 2025
…orch#15590)

A number of ops only handles shape/meta-data without changing the
dynamic range. In these cases, no rescaling needs to be performed and
the int8 portable_ops kernel can be used directly.

A new test is added to ensure this behaviour, as well as a test showing
how operators which does change the dynamic range (SUB) are not
supported.

To support quantization of graphs with no-rescale ops in the beginning/
end of the graph, two new quantizers InputQuantizer and OutputQuantizer
are introduced. By explicitly stating the dtpye of the input/output,
no-rescale ops inherit dtypes from them as with any other op.

Signed-off-by: Adrian Lundell <[email protected]>
@AdrianLundell AdrianLundell deleted the change-1140592 branch November 7, 2025 12:24
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. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants