Skip to content

Commit 62dccf1

Browse files
authored
Ensure modified flag is returned correctly for RemovePermutesAroundElementwiseOps.
Differential Revision: D88109865 Pull Request resolved: #16047
1 parent 78a73d4 commit 62dccf1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

backends/cadence/aot/remove_ops.py

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

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

572-
graph_module.graph.eliminate_dead_code()
573-
graph_module.recompile()
574+
if modified:
575+
graph_module.graph.eliminate_dead_code()
576+
graph_module.recompile()
577+
return super().call(graph_module)
574578

575-
return super().call(graph_module)
579+
return PassResult(graph_module, False)
576580

577581
def visit(
578582
self,

0 commit comments

Comments
 (0)