Skip to content

backend.basis_gates is not renewed even if the backend is renewed #2280

Open
@t-imamichi

Description

@t-imamichi

Describe the bug

If I update backend.basis_gates by removing a gate, the basis gates persists even if I renewed the backend.

I confirmed that qiskit-ibm-runtime 0.39.0 with use_fractional_gates=False renewed the basis gates, but use_fractional_gates=True or newer versions cause the issue.

Steps to reproduce
I expect the basis gates of backend renewed is same as that of original. But it happens only for 0.39.0 and use_fractional_gates=False.

from qiskit_ibm_runtime import QiskitRuntimeService, __version__

print(f"runtime_version={__version__}")


def test_remove(gate: str, fractional: bool):
    print(f"\nRemove {gate} gate with use_fractional_gates={fractional}")
    service = QiskitRuntimeService(name="demo-premium")
    backend = service.backend("ibm_fez", use_fractional_gates=fractional)
    print("original\t", backend.basis_gates)
    backend.basis_gates.remove(gate)
    print(f"{gate} removed\t", backend.basis_gates)
    backend = service.backend("ibm_fez", use_fractional_gates=fractional)
    print("backend renewed\t", backend.basis_gates)


test_remove("cz", False)
test_remove("cz", True)
runtime_version=0.39.0

Remove cz gate with use_fractional_gates=False
original	 ['cz', 'id', 'rz', 'sx', 'x']
cz removed	 ['id', 'rz', 'sx', 'x']
backend renewed	 ['cz', 'id', 'rz', 'sx', 'x']

Remove cz gate with use_fractional_gates=True
original	 ['cz', 'id', 'rx', 'rz', 'rzz', 'sx', 'x']
cz removed	 ['id', 'rx', 'rz', 'rzz', 'sx', 'x']
backend renewed	 ['id', 'rx', 'rz', 'rzz', 'sx', 'x']
runtime_version=0.40.0

Remove cz gate with use_fractional_gates=False
original	 ['cz', 'id', 'rz', 'sx', 'x']
cz removed	 ['id', 'rz', 'sx', 'x']
backend renewed	 ['id', 'rz', 'sx', 'x']

Remove cz gate with use_fractional_gates=True
original	 ['cz', 'id', 'rx', 'rz', 'rzz', 'sx', 'x']
cz removed	 ['id', 'rx', 'rz', 'rzz', 'sx', 'x']
backend renewed	 ['id', 'rx', 'rz', 'rzz', 'sx', 'x']
runtime_version=0.41.0.dev4+g3a8d49cb

Remove cz gate with use_fractional_gates=False
original	 ['cz', 'id', 'rz', 'sx', 'x']
cz removed	 ['id', 'rz', 'sx', 'x']
backend renewed	 ['id', 'rz', 'sx', 'x']

Remove cz gate with use_fractional_gates=True
original	 ['cz', 'id', 'rx', 'rz', 'rzz', 'sx', 'x']
cz removed	 ['id', 'rx', 'rz', 'rzz', 'sx', 'x']
backend renewed	 ['id', 'rx', 'rz', 'rzz', 'sx', 'x']

Expected behavior

The basis gates should be renewed when the backend is renewed as same as 0.39.0 and use_fractional_gates=False.

Suggested solutions

Additional Information

  • qiskit-ibm-runtime version: 0.39.0, 0.40.0, main g3a8d49cb
  • Python version: 3.12.10
  • Operating system: macOS 15.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions