Skip to content

ToOutVarPass skips inplace ops #10921

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

Merged
merged 1 commit into from
May 19, 2025
Merged
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
5 changes: 4 additions & 1 deletion exir/passes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from executorch.exir.dynamic_shape import DynamicMemoryPlanningMode
from executorch.exir.error import InternalError
from executorch.exir.operator.convert import (
_get_overload_schema,
get_out_args_from_opoverload,
is_out_variant,
to_out_variant,
Expand Down Expand Up @@ -63,6 +64,7 @@
from torch._subclasses import FakeTensor
from torch.fx.passes.infra.pass_base import PassBase, PassResult
from torch.fx.passes.shape_prop import TensorMetadata
from torchgen.model import SchemaKind

__all__ = [
"ExportPass",
Expand Down Expand Up @@ -257,7 +259,6 @@ def callWithLoggerEnabled(self, graph_module: torch.fx.GraphModule) -> None:
memory.alloc,
memory.view,
executorch_call_delegate,
torch.ops.aten.copy_.default,
}
to_out_var_skiplist.update(_EXECUTORCH_SYM_OPS)

Expand Down Expand Up @@ -347,6 +348,8 @@ def get_submodule(node: torch.fx.Node) -> torch.fx.GraphModule:
continue
elif target in to_out_var_skiplist:
continue
elif _get_overload_schema(target).kind() == SchemaKind.inplace:
continue
if not isinstance(
target, (torch._ops.OpOverload, EdgeOpOverload, BackendOpOverload)
):
Expand Down
Loading