Skip to content

Conversation

@AdrianLundell
Copy link
Collaborator

@AdrianLundell AdrianLundell commented Oct 30, 2025

Changes to_edge_and_transform to to_edge which supports the preserver_ops arg of the EdgeCompileConfig to avoid decomposing of the linear op. This significantly simplifies lowering the linear operator as it does not have to be re-fused.

Adds a cortex_m quantizer, with the intention to be general enough to be used for a general MCU. It is implemented as a ComposableQuantizer using multiple instances of a new OperatorConfigQuantizer class. This gives a number of abstraction levels for configuration

  • McuQuantizer
  • ComposableQuantizer
  • OperatorConfig
  • QuantizerConfig
  • QuantizationSpec

The new quantizer also adds a transform_for_annotation pass pipeline which allows to fix scalar + tensor operations.

cc @freddan80 @per @zingo @oscarandersson8218 @digantdesai

Changes to_edge_and_transform to to_edge which supports the
preserver_ops arg of the EdgeCompileConfig to avoid decomposing
of the linear op. This significantly simplifies lowering the linear
operator as it does not have to be re-fused.

Adds a cortex_m quantizer, with the intention to be general enough to be
used for a general MCU. It is implemented as a ComposableQuantizer using
multiple instances of a new OperatorConfigQuantizer class. This gives
a number of abstraction levels for configuration

- McuQuantizer
- ComposableQuantizer
- OperatorConfig
- QuantizerConfig
- QuantizationSpec

The new quantizer also adds a transform_for_annotation pass pipeline
which allows to fix scalar + tensor operations.

Old test_quantize_op_fusion_pass test is removed since it is not
relevant anymore after the add implementation has been redone.

Change-Id: Ic1d5b48623a14d220cb1ba472948db6a1406e0b7
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
@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 Oct 30, 2025
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 30, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit 364159b with merge base a11d555 (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 Oct 30, 2025
@AdrianLundell AdrianLundell requested a review from psiddh October 30, 2025 11:13
# LICENSE file in the root directory of this source tree.


from executorch.backends.arm._passes import ScalarsToAttributePass
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you plan to add "EdgeCompileConfig(preserve_ops...." step in CortexMPassManager to avoid decomposition ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or "Do you plan to implement a CortexMPartitioner with ops_to_not_decompose() method to work with to_edge_transform_and_lower(), similar to how the Cadence backend handles operation preservation?"

_core_aten_ops_exception_list=TO_EDGE_OP_EXCEPTION_LIST
+ (core_aten_exceptions or []),
preserve_ops=TO_EDGE_PRESERVE_OPS,

Copy link
Collaborator Author

@AdrianLundell AdrianLundell Nov 3, 2025

Choose a reason for hiding this comment

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

I am rather neutral towards how the list of ops to not preserve should be implemented, do you have a preference? From what I noticed preserve_ops in EdgeCompileConfig does not do anything in to_edge_transfrom_and_lower however, only in to_edge.

@AdrianLundell AdrianLundell merged commit 6ab8723 into pytorch:main Nov 3, 2025
145 checks passed
abhinaykukkadapu pushed a commit to abhinaykukkadapu/executorch that referenced this pull request Nov 6, 2025
Changes to_edge_and_transform to to_edge which supports the
preserver_ops arg of the EdgeCompileConfig to avoid decomposing of the
linear op. This significantly simplifies lowering the linear operator as
it does not have to be re-fused.

Adds a cortex_m quantizer, with the intention to be general enough to be
used for a general MCU. It is implemented as a ComposableQuantizer using
multiple instances of a new OperatorConfigQuantizer class. This gives a
number of abstraction levels for configuration

- McuQuantizer
- ComposableQuantizer
- OperatorConfig
- QuantizerConfig
- QuantizationSpec

The new quantizer also adds a transform_for_annotation pass pipeline
which allows to fix scalar + tensor operations.

Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
@AdrianLundell AdrianLundell deleted the change-1137032 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