Skip to content

Commit

Permalink
Fix loop error
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahy0825 committed Jun 13, 2023
1 parent 5fa2c7d commit bc7d3ad
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions cinn/hlir/pass/general_fusion_merge_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -875,16 +875,12 @@ class FusionMergePassHelper : public FusionHelperBase {
}
return ret;
};
bool update = false;
while (true) {
const auto& groups = GetFusableConsumerGroupList();
if (groups.size() <= 1) {
break;
}
HorizontalFuse(groups);
update = true;
const auto& groups = GetFusableConsumerGroupList();
if (groups.size() <= 1) {
return false;
}
return update;
HorizontalFuse(groups);
return true;
}

bool HorizontalFusion(GroupPtr producer, const std::unordered_set<GroupPtr>& consumers) {
Expand Down Expand Up @@ -1675,12 +1671,11 @@ class FusionMergePassHelper : public FusionHelperBase {
continue;
}
// do input fusion.
auto st = CallGeneralInputFusePass(input_consumers.second);
if (st) {
while (CallGeneralInputFusePass(input_consumers.second)) {
// fused consumers, update
UpdateInputToConsumers();
updated = true;
}
updated |= st;
}

return updated;
Expand Down

0 comments on commit bc7d3ad

Please sign in to comment.