Skip to content

Commit

Permalink
[DRR] Fix bug of matching source pattern in DRR (PaddlePaddle#58673)
Browse files Browse the repository at this point in the history
* fix bug of drr

* fix bug
  • Loading branch information
zyfncg authored Nov 6, 2023
1 parent 4b0abdb commit ee24bff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion paddle/fluid/pir/drr/drr_rewrite_pattern.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,19 @@ bool DrrRewritePattern::MatchFromOutputToInput(
break;
}
// bfs producer_op of current_op
if (!drr_visited.count(drr_producer_op)) {
if (drr_visited.count(drr_producer_op) &&
ir_visited.count(ir_producer_op)) {
continue;
}
if (!drr_visited.count(drr_producer_op) &&
!ir_visited.count(ir_producer_op)) {
drr_q.push(drr_producer_op);
ir_q.push(ir_producer_op);
drr_visited.insert(drr_producer_op);
ir_visited.insert(ir_producer_op);
} else {
matched = false;
break;
}
}
// binding output tensor of current_op
Expand Down

0 comments on commit ee24bff

Please sign in to comment.