Skip to content

Commit

Permalink
Fix fusion CostBasedFusion::aggregate_operations
Browse files Browse the repository at this point in the history
  • Loading branch information
doichanj committed Feb 27, 2024
1 parent 5991cf8 commit 7bed6d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transpile/fusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,8 @@ bool CostBasedFusion::aggregate_operations(oplist_t &ops,
double estimated_cost =
estimate_cost(ops, (uint_t)j,
i) // fusion gate from j-th to i-th, and
+ (j == 0 ? 0.0 : costs[j - 1 - fusion_start]); // cost of (j-1)-th
+ (j <= fusion_start ? 0.0 : costs[j - 1 - fusion_start]);
// cost of (j-1)-th

// update cost
if (estimated_cost <= costs[i - fusion_start]) {
Expand Down

0 comments on commit 7bed6d8

Please sign in to comment.