You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, in #1784, we added ISA checks inside bodies of control flow operations. @ashsaki found an example similar to the one below, where a valid circuit is labeled as invalid by this new ISA check.
The bug seems to occur only for simulators. I was not able to reproduce it on a device.
By the error message, it appears that the bug is related to the qubit mapping here. Apparently qubit indices change inside the control operation blocks. I'm not sure exactly how, @mtreinish can you (or someone else from the qiskit team) elaborate? Can you please refer me to relevant documentation?
File "/mnt/wsl/balagan/saki.py", line 16, in <module>
res = sampler.run([circ]).result()
File "/root/miniforge3/envs/env2/lib/python3.10/site-packages/qiskit_ibm_runtime/sampler.py", line 159, in run
return self._run(coerced_pubs) # type: ignore[arg-type]
File "/root/miniforge3/envs/env2/lib/python3.10/site-packages/qiskit_ibm_runtime/base_primitive.py", line 174, in _run
validate_isa_circuits([pub.circuit], self._backend.target)
File "/root/miniforge3/envs/env2/lib/python3.10/site-packages/qiskit_ibm_runtime/utils/validations.py", line 89, in validate_isa_circuits
raise IBMInputValueError(
qiskit_ibm_runtime.exceptions.IBMInputValueError: 'The instruction cx on qubits (0, 1) is not supported by the target system. Circuits that do not match the target hardware definition are no longer supported after March 4, 2024. See the transpilation documentation (https://docs.quantum.ibm.com/transpile) for instructions to transform circuits and the primitive examples (https://docs.quantum.ibm.com/run/primitives-examples) to see this coupled with operator transformations.'
Expected behavior
Well, don't crash and let the circuit pass the ISA test.
Suggested solutions
Well, debug and fix 😄.
Additional Information
qiskit-ibm-runtime version:
Python version:
Operating system:
The text was updated successfully, but these errors were encountered:
It happens on real backends as well. Switching the backend to ibm_sherbrooke threw me 'The instruction ecr on qubits (0, 1) is not supported by the target system.
Example:
from qiskit import QuantumCircuit, transpile
from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2
from qiskit_ibm_runtime.fake_provider import FakeCairoV2
service = QiskitRuntimeService()
backend = service.backend("ibm_sherbrooke")
sampler = SamplerV2(mode=backend)
circ = QuantumCircuit(5, 1)
circ.x(0)
circ.measure(0, 0)
with circ.if_test((0, 1)):
circ.cx(1, 2)
trans_qc = transpile(circ, backend=backend, optimization_level=1)
res = sampler.run([trans_qc]).result()
Inside the control flow operation, when the ISA check checks cx(1, 2), it wrongly checks cx(0, 1), because of a bug. Since (0, 1) is not connected in Sherbrooke (only (1, 0) is connected - the other direction), the ISA check fails, in spite of (1, 2) being connected and valid.
This bug occurs also on the other way around: in Cusco, (0, 1) is connected but (1, 2) is not connected. Because of the bug, cx(1, 2) wrongly passes the ISA check, and the failure is deferred must later down the stack:
Describe the bug
Recently, in #1784, we added ISA checks inside bodies of control flow operations. @ashsaki found an example similar to the one below, where a valid circuit is labeled as invalid by this new ISA check.
Steps to reproduce
Output is:
Expected behavior
Well, don't crash and let the circuit pass the ISA test.
Suggested solutions
Well, debug and fix 😄.
Additional Information
The text was updated successfully, but these errors were encountered: