Skip to content
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

Revert "[CINN] Align initial subgraph order with block.ops (#70719)" #70776

Merged
merged 1 commit into from
Jan 11, 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
7 changes: 3 additions & 4 deletions paddle/fluid/pir/transforms/sub_graph_detector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,13 @@ void SubgraphDetector::MergeSource2Target(const SubGraphPtr& source,

SubgraphDetector::SubgraphDetector(pir::Block* block,
const OpClassifier& classifier) {
// init sort_ops_ in reverse topo order and op2index_ in topo order
// init sort_ops_ in reverse topo order
sort_ops_ = InverselyTopologicalSort(block);
// init op2index_ in topo order
int index = 0;
for (auto& op : *block) {
sort_ops_.push_back(&op);
op2index_[&op] = index++;
}
std::reverse(sort_ops_.begin(), sort_ops_.end());

// construct subgraphs and upstream/downstream relation
std::vector<SubGraphPtr> subgraph_list;
for (const auto& op : sort_ops_) {
Expand Down
Loading