-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
What should we add?
When running a large transpile()
(with 1k circuit qubits) with optimization level 3 a substantial amount of time, ~32%, of the compilation is spent in the ConsolidateBlocks
pass. For something that's supposed to take a block of gates on 2 qubit and replace it with an equivalent UnitaryGate
this is a larger portion of time than would normally be expected. Looking at the profile:
Most of the time seems to be spent in the Operator
object creation. We had similar performance issues around the use of Operator
to compute unitaries in Optimize1qGatesDecomposition
and we moved to computing the matrix directly (which is admittedly easier to do for 1q) and sped up the pass significantly (see #5909). We should look at doing a similar optimization in ConsolidateBlocks
and fall back to using Operator
if there are gates in the block we can't work directly with a matrix on.