Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backends/cortex_m/passes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2025 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

from .quantized_linear_fusion_pass import QuantizedLinearFusionPass # noqa
from .quantized_op_fusion_pass import QuantizedOpFusionPass # noqa
from .replace_quant_nodes_pass import ReplaceQuantNodesPass # noqa
from .cortex_m_pass_manager import CortexMPassManager # noqa # usort: skip
25 changes: 25 additions & 0 deletions backends/cortex_m/passes/cortex_m_pass_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2025 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.


from executorch.backends.cortex_m.passes import (
QuantizedLinearFusionPass,
QuantizedOpFusionPass,
ReplaceQuantNodesPass,
)
from executorch.backends.xnnpack._passes import XNNPACKPassManager
from executorch.exir.pass_base import ExportPass


class CortexMPassManager(XNNPACKPassManager):

pass_list: list[ExportPass] = [
ReplaceQuantNodesPass,
QuantizedOpFusionPass,
QuantizedLinearFusionPass,
]

def __init__(self, exported_program, passes=None):
super().__init__(exported_program, passes or self.pass_list)
20 changes: 3 additions & 17 deletions backends/cortex_m/test/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@
import torch
from executorch.backends.arm.test.common import get_u55_compile_spec
from executorch.backends.arm.test.tester.arm_tester import Serialize
from executorch.backends.cortex_m.passes.quantized_linear_fusion_pass import (
QuantizedLinearFusionPass,
)
from executorch.backends.cortex_m.passes.quantized_op_fusion_pass import (
QuantizedOpFusionPass,
)

from executorch.backends.cortex_m.passes.replace_quant_nodes_pass import (
ReplaceQuantNodesPass,
)
from executorch.backends.cortex_m.passes.cortex_m_pass_manager import CortexMPassManager
from executorch.backends.test.harness import Tester as TesterBase
from executorch.backends.test.harness.stages import (
Export,
Expand All @@ -29,7 +20,6 @@
ToEdgeTransformAndLower,
ToExecutorch,
)
from executorch.backends.xnnpack._passes import XNNPACKPassManager

from executorch.backends.xnnpack.quantizer.xnnpack_quantizer import (
get_symmetric_quantization_config,
Expand All @@ -47,12 +37,8 @@ def __init__(self):
class CortexMRunPasses(RunPasses):
def __init__(self):
super().__init__(
XNNPACKPassManager,
pass_list=[
ReplaceQuantNodesPass,
QuantizedLinearFusionPass,
QuantizedOpFusionPass,
],
CortexMPassManager,
CortexMPassManager.pass_list,
)


Expand Down
Loading