Skip to content

Commit 2ea74b9

Browse files
author
eellison
committed
Don't re run CSE on every block
ghstack-source-id: bd25b5c Pull Request resolved: #41479
1 parent 7a0e039 commit 2ea74b9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

torch/csrc/jit/passes/create_autodiff_subgraphs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ class SubgraphSlicer {
8888
}
8989
curNode = prevNode;
9090
}
91-
// Run CSE one more time to eliminate duplicates that may have occurred
92-
// while re-inlining subgraphs.
93-
EliminateCommonSubexpression(graph_);
9491
}
9592

9693
private:
@@ -231,6 +228,9 @@ std::vector<Node*> CreateAutodiffSubgraphs(
231228
size_t threshold) {
232229
std::vector<Node*> diff_nodes;
233230
SubgraphSlicer(graph->block(), graph, threshold).run(diff_nodes);
231+
// Run CSE to eliminate duplicates that may have occurred
232+
// while inlining subgraphs.
233+
EliminateCommonSubexpression(graph);
234234
return diff_nodes;
235235
}
236236
} // namespace jit

0 commit comments

Comments
 (0)