qiskit-ibm-runtime icon indicating copy to clipboard operation
qiskit-ibm-runtime copied to clipboard

Runtime transpilation fails for circuit with reset in it

Open nonhermitian opened this issue 1 year ago • 4 comments

Describe the bug Attempting to execute a circuit with a reset in it via the Estimator gives the following transpiler error:

RuntimeJobFailureError: 'Unable to retrieve job result. TRANSPILERERROR: "UNKNOWN OPERATION TYPE FOR DAGOPNODE(OP=INSTRUCTION(NAME='RESET', NUM_QUBITS=1, NUM_CLBITS=0, PARAMS=[]), QARGS=(QUBIT(QUANTUMREGISTER(27, 'Q'), 1),), CARGS=()).'

Steps to reproduce The circuit comes from here: https://quantum-enablement.org/events/skku-2022/Dynamical-decoupling.html#example-wormhole-teleportation

Expected behavior I expect to be able to compute the observable 'ZIIIII' with no issue.

Suggested solutions

Additional Information

  • qiskit-ibm-runtime version: latest
  • Python version:
  • Operating system:

nonhermitian avatar Jul 27 '23 01:07 nonhermitian

I tried to build a small test case similar to yours, using Estimator, with a reset but did not get a failure. I couldn't use your circuit because it doesn't use Estimator as far as I could see (also because it is a huge example :). Can you provide a small example that is failing?

merav-aharoni avatar Jul 31 '23 12:07 merav-aharoni

I see now that it fails when running on a real device. On the simulator it passes. I will investigate further.

merav-aharoni avatar Aug 08 '23 11:08 merav-aharoni

The problem appears to be in qiskit_ibm_primitives. I will open an issue there.

merav-aharoni avatar Aug 08 '23 13:08 merav-aharoni

I'm following up on this issue. I'm not sure this is the same error as reported, but here is a small piece of code that illustrates the same compiler error. Even though FakeAlmadenV2 is a V2 backend, it does not include the reset operation, which causes the transpilation to fail. This could be a problem with the provider as written, or maybe with the BackendV2Converter? The initialize command apparently includes a reset. (Transpilation works with a V1 backend (e.g., FakeAlmaden) and with the GenericBackendV2.)

This is with qiskit 1.0.2, and qiskit-ibm-runtime 0.22.0.

from qiskit import QuantumCircuit, QuantumRegister, transpile from qiskit.providers.fake_provider import GenericBackendV2 from qiskit_ibm_runtime.fake_provider import FakeAlmadenV2 from qiskit.quantum_info import Statevector

sv = Statevector.from_label("001100") qc = QuantumCircuit(6, name='prep') qc.initialize(sv.data, list(range(0,6)))

backend = GenericBackendV2(20) print(f'GenericBackendV2 operations: {backend.operation_names}') tqc = transpile(qc, backend) # this works

backend = FakeAlmadenV2() print(f'FakeAlmadenV2 operations: {backend.operation_names}') tqc = transpile(qc, backend) # this fails because backend has no reset operator

---- OUTPUT GenericBackendV2 operations: ['cx', 'id', 'rz', 'sx', 'x', 'reset', 'delay', 'measure'] FakeAlmadenV2 operations: ['u3', 'measure', 'u2', 'cx', 'id', 'u1', 'delay'] ...transpiler error happens here...

gregbyrd avatar Mar 28 '24 15:03 gregbyrd

I think this was fixed, but someone should test it.

jyu00 avatar May 22 '24 17:05 jyu00

Confirmed this has been fixed

kt474 avatar May 22 '24 18:05 kt474