Skip to content

Commit 0d5192c

Browse files
Cortex-M backend: Refactor ConvertToCortexMPass (pytorch#20070)
Change to use the general AtenToDialectPass structure, quantized_op_fusion_pass to be changed similarly in an upcoming PR. Removes the 1-1 ensure check as it was to restrictive, cortex-m backend needs to both insert scratch nodes and for BMM an additional transpose at the time of dialect replacement. Bonus small fix: Moves yolo import into test to avoid download at test collection time --------- Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
1 parent ff2bf9c commit 0d5192c

8 files changed

Lines changed: 634 additions & 628 deletions

File tree

backends/cortex_m/passes/BUCK

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fbcode_target(_kind = runtime.python_library,
2929
name="cortex_passes",
3030
srcs=[
3131
"activation_fusion_pass.py",
32+
"aten_to_cortex_m_pass.py",
3233
"clamp_hardswish_pass.py",
33-
"convert_to_cortex_m_pass.py",
3434
"cortex_m_pass.py",
3535
"cortex_m_pass_manager.py",
3636
"decompose_hardswish_pass.py",
@@ -45,8 +45,10 @@ fbcode_target(_kind = runtime.python_library,
4545
"//executorch/backends/cortex_m/ops:ops",
4646
"//executorch/backends/cortex_m/passes:passes_utils",
4747
"//executorch/backends/cortex_m/passes:replace_quant_nodes_pass",
48+
"//executorch/backends/transforms:aten_to_dialect_pass",
4849
"//executorch/backends/transforms:remove_getitem_op",
4950
"//executorch/backends/transforms:replace_scalar_with_tensor",
51+
"//executorch/backends/transforms:utils",
5052
"//executorch/exir:lib",
5153
"//executorch/exir:pass_base",
5254
"//executorch/exir:pass_manager",

backends/cortex_m/passes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def _ensure_cortex_m_dependencies() -> None:
3535

3636
from .cortex_m_pass import CortexMPass # noqa # usort: skip
3737
from .activation_fusion_pass import ActivationFusionPass # noqa
38+
from .aten_to_cortex_m_pass import AtenToCortexMPass # noqa
3839
from .clamp_hardswish_pass import ClampHardswishPass # noqa
39-
from .convert_to_cortex_m_pass import ConvertToCortexMPass # noqa
4040
from .cortex_m_pass import CortexMPass # noqa
4141
from .decompose_hardswish_pass import DecomposeHardswishPass # noqa
4242
from .decompose_mean_pass import DecomposeMeanPass # noqa

0 commit comments

Comments
 (0)