Cortex-M backend: Refactor quantized_op_fusion_pass#20179
Cortex-M backend: Refactor quantized_op_fusion_pass#20179AdrianLundell wants to merge 4 commits into
Conversation
Move to use the AtenToCortexMPass instead. Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: I00020beb4248b24f344c47a1728c06925f1b7c7a
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: I9f94f018d95ec58a4a12022679ddd66340344fa0
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20179
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 78 Pending, 4 Unrelated FailuresAs of commit d107ddb with merge base 2b9e9bf ( NEW FAILURE - The following job has failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
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 refactors the Cortex-M backend pass pipeline by removing the standalone QuantizedOpFusionPass and moving its operator replacement/fusion responsibilities into AtenToCortexMPass, simplifying pass management and consolidation of Cortex-M dialect substitutions.
Changes:
- Deleted
quantized_op_fusion_pass.pyand removed it from imports/build rules and the Cortex-M pass list. - Extended
AtenToCortexMPasswith additional dialect substitutions for quantized add/mul/softmax/maxpool/min/max/permute/pad (and quantize/dequantize per-tensor). - Updated BUCK targets and
__init__.pyexports to reflect the refactor.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
backends/cortex_m/passes/quantized_op_fusion_pass.py |
Removed the old ExportPass-based fusion/replacement implementation. |
backends/cortex_m/passes/cortex_m_pass_manager.py |
Dropped QuantizedOpFusionPass from the pass list and imports. |
backends/cortex_m/passes/BUCK |
Removed the deleted file from build sources. |
backends/cortex_m/passes/aten_to_cortex_m_pass.py |
Added/ported substitution logic that previously lived in QuantizedOpFusionPass. |
backends/cortex_m/passes/__init__.py |
Removed export/import of QuantizedOpFusionPass. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| del dialect_pass | ||
| input_tensor = _get_input_tensor_data(node) | ||
| if input_tensor.dtype != torch.int8: | ||
| return None |
rascani
left a comment
There was a problem hiding this comment.
LGTM, just a couple minor nits.
|
|
||
|
|
||
| @AtenToCortexMPass.register_dialect_substitution( | ||
| exir_ops.edge.quantized_decomposed.quantize_per_tensor.default |
There was a problem hiding this comment.
Should we also remove the ReplaceQuantNodePass?
There was a problem hiding this comment.
It is used in aot_arm_compiler so it would be a slightly larger fix and should perhaps be treated as an API which should be deprecated properly, so maybe in another PR?
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: Ibf36386cff49fe0fc16f60b8f582d0d49e061095
Move to use the AtenToCortexMPass instead.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani