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
7 changes: 6 additions & 1 deletion backends/cadence/aot/pass_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from executorch.backends.cadence.aot.utils import get_edge_overload_packet

from executorch.exir.dialects.edge._ops import EdgeOpOverload, EdgeOpOverloadPacket
from executorch.exir.pass_base import PassBase
from executorch.exir.pass_base import PassBase, PassResult

from torch._ops import OpOverloadPacket

Expand Down Expand Up @@ -224,3 +224,8 @@ def set_arg(
node.update_arg(idx, value)
else:
node.update_kwarg(kwarg_name, value)


def none_throws(x: Optional[PassResult]) -> PassResult:
assert x is not None
return x
5 changes: 3 additions & 2 deletions backends/cadence/aot/replace_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
)
from executorch.backends.cadence.aot.pass_utils import (
CadencePassAttribute,
none_throws,
register_cadence_pass,
)
from executorch.backends.cadence.aot.remove_ops import RemoveNopSelectOpPass
Expand Down Expand Up @@ -1661,8 +1662,8 @@ def call_operator(self, op, args, kwargs, meta):

def call(self, graph_module: torch.fx.GraphModule) -> PassResult:
result = super().call(graph_module)
result = FuseCascadedViewOps()(result.graph_module)
assert result is not None
fuse_cascaded_result = none_throws(FuseCascadedViewOps()(result.graph_module))
result = none_throws(ExportPass()(fuse_cascaded_result.graph_module))
return result


Expand Down
Loading