You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is interesting. I don't think we claim anywhere that transpiler with optimization_level=2 should always provide a better result than with optimization_level=1, and Qiskit's behavior did not change between the two Qiskit versions, so technically this is not a bug.
Still, in this specific case under the hood the level-2 transpiler first brings it to the form of level-1, and then applies the two-qubit resynthesis (Collect2qBlocks + ConsolidateBlocks + UnitarySynthesis), which seemingly makes the circuit more complex. I also remember wishing for something similar in the past when seeing two-qubit resynthesis messing up Clifford gates even though all of them were in the basis gates. Though note that the number of 2-qubit gates is the same for levels 1 and 2, and in this sense the two-qubit resynthesis is "optimal".
I am wondering if we could attach the "oroginal definition" to UnitaryGates and return that instead of the resynthesized definition when all of its gates are in basis_gates and it's better (same number of 2-qubit gates but fewer 1-qubit gates).
I'm wondering if the new pass I'm working on in: #13419 will help with this. If we replace the use of the 3 passes for 2 qubit peephole optimization with that new pass it'll hopefully see the synthesis output is less efficient than the original block and not substitute it.
Although it's not a bug technically, this case is trivial as seen as the result of optimization level 1. So, I expect Qiskit can generate the optimal circuit for optimization level 2 and 3. But, of course, it's not urgent.
Environment
What is happening?
Transpilation with optimization level 2 and 3 result in a deeper circuit than that of optimization level 1 for a case with consecutive RZZ gates.
How can we reproduce the issue?
output
What should happen?
It would be nice to generate the circuit of optimization level 1
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: