Skip to content

Commit 5390611

Browse files
eigen-kfacebook-github-bot
authored andcommitted
Ensure modified flag is returned correctly for RemovePermutesAroundElementwiseOps. (pytorch#16047)
Summary: Pull Request resolved: pytorch#16047 Differential Revision: D88109865
1 parent dc8f2b9 commit 5390611

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

backends/cadence/aot/remove_ops.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,18 @@ def call(self, graph_module: torch.fx.GraphModule) -> PassResult:
566566
for node in subgraph.nodes:
567567
processed_nodes.add(node)
568568

569+
changed = False
569570
for subgraph in subgraphs_found:
570571
self.permute_subgraph(subgraph)
572+
changed = True
571573

572-
graph_module.graph.eliminate_dead_code()
573-
graph_module.recompile()
574574

575-
return super().call(graph_module)
575+
if changed:
576+
graph_module.graph.eliminate_dead_code()
577+
graph_module.recompile()
578+
return super().call(graph_module)
579+
580+
return PassResult(graph_module, False)
576581

577582
def visit(
578583
self,

0 commit comments

Comments
 (0)