Arm backend: Make composable_quantizer default#19758
Conversation
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
🔗 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 FailuresAs of commit 4595733 with merge base b73df0b ( 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. |
|
There was a problem hiding this comment.
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
TOSAQuantizerdefault touse_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.
| 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. |
| 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, | ||
| ] |
A few fixes needed:
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani