Skip to content

Commit 7348caf

Browse files
committed
set GPhase complexity to 0 and fix complexity calculation for backtracking
1 parent 7b93aec commit 7348caf

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

mlir/include/mlir/Passes/Decomposition/Helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ template <typename T, int N, int M>
217217
return (numOfQubits - 1) * multiQubitFactor;
218218
}
219219
if (type == qc::GPhase) {
220-
return 2;
220+
return 0;
221221
}
222222
return 1;
223223
}

mlir/lib/Passes/Patterns/GateDecompositionPattern.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ struct GateDecompositionPattern final
464464
auto prependSingleQubitGate = [&](UnitaryOpInterface op) {
465465
inQubits[qubitId] = op.getInputQubit(0);
466466
gates.insert(gates.begin(), {.op = op, .qubitIds = {qubitId}});
467+
complexity += helpers::getComplexity(helpers::getQcType(op), 1);
467468
// outQubits do not need to be updated because the final out qubit is
468469
// already fixed
469470
};

0 commit comments

Comments
 (0)