Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

Home Page:https://www.ibm.com/quantum/qiskit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

passmanager fails when called a second time on different circuit

nonhermitian opened this issue · comments

Environment

  • Qiskit version: 1.0.2
  • Python version:
  • Operating system:

What is happening?

N = 14

qc = QuantumCircuit(N)
qc.h(0)
qc.cx(0, range(1,N))
qc.measure_all()

eagle_pm = generate_preset_pass_manager(3, backend=eagle_backend)
trans_qc = eagle_pm.run(qc)

qc2 = QuantumCircuit(N)
qc2.h(N//2)
qc2.cx(range(N//2, 0, -1), range(N//2-1, -1, -1))
qc2.cx(range(N//2, N-1), range(N//2+1, N))
qc2.measure_all()

trans_qc2 = eagle_pm.run(qc2)

fails on the second call with

TranspilerError: "The 'layout' must be full (with ancilla)."

If I make a new PM instance it works, so I am assuming there is some state being held.

How can we reproduce the issue?

run above

What should happen?

it should work

Any suggestions?

No response

Are you sure you're using Qiskit 1.0.2? I can't reproduce with 1.0.2 nor current main, and I think I already fixed this issue after you raised it before: #11784, #11787.

For what it's worth, here's my complete reproducer script, guessing at your undefined variables, in case they're material:

from qiskit import QuantumCircuit
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit_ibm_runtime import QiskitRuntimeService

prov = QiskitRuntimeService()
eagle_backend = prov.get_backend("ibm_sherbrooke")

N = 14

qc = QuantumCircuit(N)
qc.h(0)
qc.cx(0, range(1,N))
qc.measure_all()

eagle_pm = generate_preset_pass_manager(3, backend=eagle_backend)
trans_qc = eagle_pm.run(qc)

qc2 = QuantumCircuit(N)
qc2.h(N//2)
qc2.cx(range(N//2, 0, -1), range(N//2-1, -1, -1))
qc2.cx(range(N//2, N-1), range(N//2+1, N))
qc2.measure_all()

trans_qc2 = eagle_pm.run(qc2)

Ahh no your right. The AI transpiler install downgraded me to 1.0.0. Thanks!