Skip to content
Open
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
15 changes: 12 additions & 3 deletions backends/arm/_passes/arm_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ def _is_quantized_meta(self, meta: NodeMetadata | dict[str, Any]) -> bool:
output_qparams = meta_dict.get("output_qparams", {})
return bool(input_qparams) and bool(output_qparams)

def should_fast_copy_node(self, target: torch.fx.node.Target) -> bool:
ops_without_quantized_fake_kernel = {
exir_ops.edge.aten.bmm.default,
exir_ops.edge.aten.leaky_relu.default,
}
if any(target is op for op in ops_without_quantized_fake_kernel):
return False
return super().should_fast_copy_node(target)

@property
@abstractmethod
def _passes_required_after(self) -> Set[Type[ExportPass]]:
Expand Down Expand Up @@ -142,11 +151,11 @@ def call_submodule(
self, graph_module: GraphModule, inputs: tuple[Any, ...]
) -> PassResult:
self.submodule_depth += 1
if self.submodule_depth == 1:
if self.submodule_depth == 1 or self.should_run_pass(graph_module):
result = super().call_submodule(graph_module, inputs)
else:
# When we trace a submodule, we don't want to apply the calling pass.
# Temporarily replace call_operator to avoid this.
# Nested submodules that do not need this pass still need normal replay.
# Temporarily replace call_operator to avoid applying subclass rewrites.
_call_operator_fn = self.call_operator
self.call_operator = super().call_operator # type: ignore
result = super().call_submodule(graph_module, inputs)
Expand Down
Loading
Loading