Skip to content

Speed up ConsolidateBlocks pass #8779

@mtreinish

Description

@mtreinish

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:

Screenshot_2022-09-22_07-14-59

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions