Skip to content

Arm backend: Make composable_quantizer default#19758

Open
AdrianLundell wants to merge 1 commit into
pytorch:mainfrom
AdrianLundell:change-1253855
Open

Arm backend: Make composable_quantizer default#19758
AdrianLundell wants to merge 1 commit into
pytorch:mainfrom
AdrianLundell:change-1253855

Conversation

@AdrianLundell
Copy link
Copy Markdown
Collaborator

@AdrianLundell AdrianLundell commented May 25, 2026

A few fixes needed:

  • Add new ops added since initial upstream of composable_quantizer
  • Add while-op quantize fix from 3be4546 to TosaQuantizerV2
  • Add fixed_qparams fix from fb90480 to TosaQuantizerV2
  • Update some tests to mirror new behaviours
  • Update quanitzer_tutorial to not be WIP
  • Remove hardswish from FUSED_ACTIVATION_OPS
  • Explicitly check that weights and biases are input args to conv/ linear ops. The assumption that wights and biases are the only parameters of networks does not hold for real models.

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

A few fixes needed:
- Add new ops added since initial upstream of composable_quantizer
- Add while-op quantize fix from 3be4546 to TosaQuantizerV2
- Add fixed_qparams fix from fb90480 to TosaQuantizerV2
- Update some tests to mirror new behaviours
- Update quanitzer_tutorial to not be WIP
- Remove hardswish from FUSED_ACTIVATION_OPS
- Explicitly check that weights and biases are input args to
  conv/ linear ops. The assumption that wights and biases are
  the only parameters of networks does not hold for real models.

Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Change-Id: Ifa127a73d4db45cd2d3461101f97c0cf852bf7bf
@AdrianLundell AdrianLundell requested review from 3l1 and Copilot May 25, 2026 15:05
@AdrianLundell AdrianLundell added help wanted Extra attention is needed partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk release notes: arm Changes to the ARM backend delegate labels May 25, 2026
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 25, 2026

🔗 Helpful Links

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

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

❌ 6 New Failures, 4 Unrelated Failures

As of commit 4595733 with merge base b73df0b (image):

NEW FAILURES - The following jobs have failed:

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 May 25, 2026
@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

@github-actions github-actions Bot added the module: arm Issues related to arm backend label May 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR switches the Arm backend’s TOSAQuantizer to use the composable quantizer implementation by default, and updates Arm quantization annotation/support logic plus tests/tutorial materials to match the new behaviors (including while-loop and fixed-qparams handling).

Changes:

  • Make TOSAQuantizer default to use_composable_quantizer=True.
  • Extend/update quantizer support + annotation behavior (e.g., while-loop shared-qspec handling, fixed-qparams input qspecs for trig ops, additional supported ops).
  • Update Arm backend tests and the Arm quantizer tutorial notebook to reflect the new defaults/behaviors.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
examples/arm/quantizer_tutorial.ipynb Removes WIP framing in the composable quantizer tutorial intro.
backends/arm/test/ops/test_while.py Adds an INT while-loop test path forcing composable quantizer usage.
backends/arm/test/ops/test_transpose_conv2d.py Updates tests to use TOSAQuantizationConfig for global config setup.
backends/arm/test/ops/test_to_copy.py Simplifies redundant-cast xfail configuration shared between FP/INT.
backends/arm/test/misc/test_shared_qspecs.py Updates golden expectations for shared-qspec annotation counts/qparams.
backends/arm/test/misc/test_quant_custom_meta.py Adjusts test quantizer config (including set_io(None)) to match new behavior.
backends/arm/quantizer/quantizer_support.py Updates supported/fused patterns (and adds more supported ops).
backends/arm/quantizer/quantization_config.py Adds fixed-qparams input spec generation for specific trig ops under composable flow.
backends/arm/quantizer/arm_quantizer.py Makes composable quantizer the default for TOSAQuantizer.
backends/arm/quantizer/arm_quantizer_utils.py Tightens weight/bias identification and adds while-loop shared-qspec special-casing; extends shared-qspec op list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 478 to 483
def __init__(
self,
compile_spec_or_tosa_spec,
use_composable_quantizer: bool = False,
use_composable_quantizer: bool = True,
) -> None:
"""Create a TOSA quantizer from a TOSA spec or Arm compile spec.
Comment on lines 69 to 82
ACTIVATION_FUNCTION_PATTERNS = [
(torch.ops.aten.hardswish.default,),
(torch.ops.aten.hardswish_.default,),
]

LINEAR_OPS = [torch.ops.aten.linear.default]
FUSED_ACTIVATION_OPS = [
torch.ops.aten.relu.default,
torch.ops.aten.relu_.default,
torch.ops.aten.hardtanh.default,
torch.ops.aten.hardtanh_.default,
torch.ops.aten.hardsigmoid.default,
torch.ops.aten.hardsigmoid_.default,
torch.ops.aten.clamp.default,
torch.ops.aten.clamp_.default,
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. help wanted Extra attention is needed module: arm Issues related to arm backend partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants