Skip to content

Revert "Arm backend: Add FuseViewCopyTransform and FuseConstantsPass in arm_pass_manager" #9070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
11 changes: 2 additions & 9 deletions backends/arm/_passes/arm_pass_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
RetraceFoldedDtypesPass,
)
from executorch.backends.arm._passes.fuse_batchnorm2d_pass import FuseBatchnorm2DPass
from executorch.backends.arm._passes.fuse_constant_ops_pass import FuseConstantOpsPass
from executorch.backends.arm._passes.fuse_quantized_activation_pass import ( # type: ignore[import-not-found]
FuseQuantizedActivationPass,
)
Expand Down Expand Up @@ -79,7 +78,6 @@
UnsqueezeScalarPlaceholdersPass,
)
from executorch.backends.arm.tosa_specification import TosaSpecification
from executorch.backends.transforms.fuse_view_copy import FuseViewCopyTransform

from executorch.backends.transforms.replace_scalar_with_tensor import (
ReplaceScalarWithTensorArgPass,
Expand Down Expand Up @@ -116,6 +114,7 @@ def _tosa_080_BI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
self.add_pass(QuantizeOperatorArguments())
self.add_pass(FoldAndAnnotateQParamsPass()) # type: ignore[call-arg]
self.add_pass(RetraceFoldedDtypesPass())
self.add_pass(InsertTableOpsPass(exported_program))

self.add_pass(RemoveClonePass())
self.add_pass(SizeAdjustConv2DPass())
Expand All @@ -129,12 +128,8 @@ def _tosa_080_BI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
self.add_pass(DecomposeSelectPass())
self.add_pass(ConvertSqueezesToViewPass())

self.add_pass(FuseViewCopyTransform())
self.add_pass(FuseConstantOpsPass(exported_program))
self.add_pass(InsertTableOpsPass(exported_program))
self.add_pass(AnnotateChannelsLastDimOrder())
self.add_pass(InsertRescalePass())

return self._transform(exported_program.graph_module)

def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModule:
Expand All @@ -160,6 +155,7 @@ def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
self.add_pass(QuantizeOperatorArguments())
self.add_pass(FoldAndAnnotateQParamsPass()) # type: ignore[call-arg]
self.add_pass(RetraceFoldedDtypesPass())
self.add_pass(InsertTableOpsPass(exported_program))

self.add_pass(RemoveClonePass())
self.add_pass(SizeAdjustConv2DPass())
Expand All @@ -173,9 +169,6 @@ def _tosa_080_MI_pipeline(self, exported_program: ExportedProgram) -> GraphModul
self.add_pass(DecomposeSelectPass())
self.add_pass(ConvertSqueezesToViewPass())

self.add_pass(FuseViewCopyTransform())
self.add_pass(FuseConstantOpsPass(exported_program))
self.add_pass(InsertTableOpsPass(exported_program))
self.add_pass(AnnotateChannelsLastDimOrder())
self.add_pass(InsertRescalePass())

Expand Down
25 changes: 0 additions & 25 deletions backends/arm/_passes/arm_pass_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
)
from torch._ops import OpOverload
from torch._subclasses.fake_tensor import FakeTensor
from torch.export.graph_signature import InputKind


def is_get_attr_node(node: torch.fx.Node) -> bool:
Expand All @@ -45,30 +44,6 @@ def is_param_node(exp_prog: ExportedProgram, node: torch.fx.Node) -> bool:
)


def get_constant_placeholder_kind(
exp_prog: ExportedProgram, node: torch.fx.Node
) -> InputKind:
if is_param(exp_prog, node):
return InputKind.PARAMETER
if is_buffer(exp_prog, node):
return InputKind.BUFFER
if is_lifted_tensor_constant(exp_prog, node):
return InputKind.CONSTANT_TENSOR

raise RuntimeError("Node is neither PARAMETER, BUFFER nor CONSTANT_TENSOR")


def is_persistent_buffer(exp_prog: ExportedProgram, node: torch.fx.Node) -> bool | None:
if is_buffer(exp_prog, node):
buffer_name = exp_prog.graph_signature.inputs_to_buffers[node.name]
if buffer_name in exp_prog.graph_signature.non_persistent_buffers:
return False
else:
return True

return None


def get_param_tensor(
exp_prog: ExportedProgram, node: torch.fx.Node
) -> Optional[torch.Tensor]:
Expand Down
170 changes: 0 additions & 170 deletions backends/arm/_passes/fuse_constant_ops_pass.py

This file was deleted.

115 changes: 0 additions & 115 deletions backends/arm/test/passes/test_fuse_constant_ops_pass.py

This file was deleted.

Loading