Skip to content

Unreasonable time taken on optimization level 3 transpilation #14855

@adamglos92

Description

@adamglos92

if a combination of these 3 arguments is provided (backed, initial layout, optimization level 3), the transpilation process with VF2PostLayout is added to pass manager with no time limit. Because of this, especially for simple circuits the pass takes unreasonable time.

To reproduce:

from time import perf_counter

from qiskit import QuantumCircuit, transpile
from qiskit_ibm_runtime.fake_provider.fake_provider import FakeGuadalupeV2

backend = FakeGuadalupeV2()
for q in range(16):
    qc = QuantumCircuit(q)
    qc.measure_all()
    t = perf_counter()
    qc = transpile(qc, backend, optimization_level=3, initial_layout=list(range(q)))
    print(f"{perf_counter() - t} seconds for {q} qubits.")

gives

2.134571125999855 seconds for 1 qubits.
0.006853208000165978 seconds for 2 qubits.
0.034131333000004815 seconds for 3 qubits.
0.6500858340000377 seconds for 4 qubits.
6.656475377999982 seconds for 5 qubits.
73.66349649099993 seconds for 6 qubits.

I was not able to get the next time measure in reasonable time.

Probably the origin of the problem is in OptimizationPassManager.

I'm using qiskit 2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions