Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.02k stars 2.32k forks source link

EchoRZXWeylDecomposition incompatible with GenericBackendV2? #12759

Open 1ucian0 opened 1 month ago

1ucian0 commented 1 month ago

Environment

What is happening?

Why trying to move the tests from Fake27QPulseV1 to GenericBackendV2 (see https://github.com/Qiskit/qiskit/pull/12660), I noticed that EchoRZXWeylDecomposition seems to fail very deeply in because len(cr_tones) == 1 and len(comp_tones) == 2 is not a possible condition in

https://github.com/Qiskit/qiskit/blob/61805c8e166800687aa64ef3bf8d7da7540f5f2f/qiskit/transpiler/passes/calibration/rzx_builder.py#L392__

How can we reproduce the issue?

from qiskit import QuantumRegister, QuantumCircuit
from qiskit.providers.fake_provider import GenericBackendV2
from qiskit.quantum_info import Operator
from qiskit.transpiler.passes import EchoRZXWeylDecomposition

backend = GenericBackendV2(num_qubits=27, calibrate_instructions=True, control_flow=True, seed=42)

qr = QuantumRegister(2, "qr")
circuit = QuantumCircuit(qr)
circuit.cx(qr[0], qr[1])

unitary_circuit = Operator(circuit).data

after = EchoRZXWeylDecomposition(backend.instruction_schedule_map)(circuit)
qiskit.exceptions.QiskitError: 'Schedule((0, Shi [...] is undefined pulse sequence. Check if this is a calibration for cross resonance operation."

Notice that the following works:

from qiskit import QuantumRegister, QuantumCircuit
from qiskit.providers.fake_provider import Fake27QPulseV1
from qiskit.quantum_info import Operator
from qiskit.transpiler.passes import EchoRZXWeylDecomposition

backend = Fake27QPulseV1()
qr = QuantumRegister(2, "qr")
circuit = QuantumCircuit(qr)
circuit.cx(qr[0], qr[1])

unitary_circuit = Operator(circuit).data

after = EchoRZXWeylDecomposition(backend.defaults().instruction_schedule_map)(circuit)

What should happen?

I think GenericBackendV2(num_qubits=27, calibrate_instructions=True, control_flow=True, coupling_map=[[0, 1], [1, 0], [1, 2], [1, 4], [2, 1], [2, 3], [3, 2], [3, 5], [4, 1], [4, 7], [5, 3], [5, 8], [6, 7], [7, 4], [7, 6], [7, 10], [8, 5], [8, 9], [8, 11], [9, 8], [10, 7], [10, 12], [11, 8], [11, 14], [12, 10], [12, 13], [12, 15], [13, 12], [13, 14], [14, 11], [14, 13], [14, 16], [15, 12], [15, 18], [16, 14], [16, 19], [17, 18], [18, 15], [18, 17], [18, 21], [19, 16], [19, 20], [19, 22], [20, 19], [21, 18], [21, 23], [22, 19], [22, 25], [23, 21], [23, 24], [24, 23], [24, 25], [25, 22], [25, 24], [25, 26], [26, 25]], seed=42) should work like Fake27QPulseV1, but maybe I'm setting something wrong.

Any suggestions?

No response

1ucian0 commented 1 month ago

@nkanazawa1989 can you confirm it?

Cryoris commented 3 weeks ago

This looks like it might be related to #12834, as the above works with other BackendV2s (such as qiskit_ibm_runtime.fake_provider.FakeSherbrooke.