Skip to content
Draft
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
12 changes: 7 additions & 5 deletions examples/arm/aot_arm_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,8 @@ def to_edge_no_delegate(
return model_quant, edge


from executorch.backends.xnnpack._passes import XNNPACKPass

def transform_for_cortex_m_backend(edge_program_manager, args):
# Let's make sure we are using optimized Cortex M backend
# NB: If we can't find and replace ops those are expected to be replaced,
Expand All @@ -802,11 +804,11 @@ def transform_for_cortex_m_backend(edge_program_manager, args):
passes += [ConvertToCortexMPass, QuantizedOpFusionPass]
current_edge = edge_program_manager
for pass_cls in passes:
transform_pass = (
pass_cls(current_edge.exported_program())
if pass_cls.__name__ == "QuantizedLinearFusionPass"
else pass_cls()
)
# XNNPACKPass and its subclasses require exported_program
if issubclass(pass_cls, XNNPACKPass):
transform_pass = pass_cls(current_edge.exported_program())
else:
transform_pass = pass_cls()
current_edge = current_edge.transform([transform_pass])
return current_edge

Expand Down
Loading