Closed blakejohnson closed 4 months ago
Describe the bug
Target construction in backend_converter.py erroneously creates a Target that reports default gates as being user-provided
Target
backend_converter.py
Steps to reproduce
from qiskit_ibm_runtime import QiskitRuntimeService service = QiskitRuntimeService() backend = service.get_backend("ibm_kyiv") print(backend.target["x"][(0,)]._calibration.user_provided)
returns True, but it should return False.
True
False
Suggested solutions
To quote @mtreinish, the issue is roughly here: https://github.com/Qiskit/qiskit-ibm-runtime/blob/33f296abd7c6f07a383d0ad5bae7415910ea4f86/qiskit_ibm_runtime/utils/backend_converter.py#L259
Which is directly setting a pulse Schedule which tells the target it's a user manually setting a calibration since it was updated after the properties object's instantiation (see: https://docs.quantum.ibm.com/api/qiskit/qiskit.transpiler.InstructionProperties#calibration). Also, doing so using a private method from the InstructionScheduleMap for some reason. This code used to be like this: https://github.com/Qiskit/qiskit-ibm-provider/blob/main/qiskit_ibm_provider/utils/json_decoder.py#L248-L251 in the old provider which is when @nkanazawa1989 fixed this originally in https://github.com/Qiskit/qiskit-ibm-provider/pull/413. The easiest fix here would be to change https://github.com/Qiskit/qiskit-ibm-runtime/blob/33f296abd7c6f07a383d0ad5bae7415910ea4f86/qiskit_ibm_runtime/utils/backend_converter.py#L262 to mirror the logic that was in the old provider. That also has the advantage of not creating instruction schedule maps eagerly either so backends and targets load more quickly.
Which is directly setting a pulse Schedule which tells the target it's a user manually setting a calibration since it was updated after the properties object's instantiation (see: https://docs.quantum.ibm.com/api/qiskit/qiskit.transpiler.InstructionProperties#calibration). Also, doing so using a private method from the InstructionScheduleMap for some reason.
Schedule
This code used to be like this: https://github.com/Qiskit/qiskit-ibm-provider/blob/main/qiskit_ibm_provider/utils/json_decoder.py#L248-L251 in the old provider which is when @nkanazawa1989 fixed this originally in https://github.com/Qiskit/qiskit-ibm-provider/pull/413.
The easiest fix here would be to change https://github.com/Qiskit/qiskit-ibm-runtime/blob/33f296abd7c6f07a383d0ad5bae7415910ea4f86/qiskit_ibm_runtime/utils/backend_converter.py#L262 to mirror the logic that was in the old provider. That also has the advantage of not creating instruction schedule maps eagerly either so backends and targets load more quickly.
Additional Information
This is fixed in https://github.com/Qiskit/qiskit-ibm-runtime/pull/1600, aiming for a release tomorrow
Fixed in latest release, 0.24.0
0.24.0
Describe the bug
Target
construction inbackend_converter.py
erroneously creates aTarget
that reports default gates as being user-providedSteps to reproduce
returns
True
, but it should returnFalse
.Suggested solutions
To quote @mtreinish, the issue is roughly here: https://github.com/Qiskit/qiskit-ibm-runtime/blob/33f296abd7c6f07a383d0ad5bae7415910ea4f86/qiskit_ibm_runtime/utils/backend_converter.py#L259
Additional Information