Skip to content

qiskit.provider.back_compat.convert_to_target doesn't add control flow instructions to the target #11872

@blakejohnson

Description

@blakejohnson

Environment

  • Qiskit version: 1.0
  • Python version: 3.11.7
  • Operating system: macOS 13.6

What is happening?

convert_to_target doesn't populate the target with control flow instructions.

How can we reproduce the issue?

Example using an IBM backend, but the problem is not due to the qiskit_ibm_runtime.

from qiskit_ibm_runtime import QiskitRuntimeService

# pick any Eagle backend
backend = service.get_backend("ibm_brisbane")

set(instr.name for instr, qargs in backend.target.instructions)

will be missing if_else, for_loop, and switch_case.

Following the chain, you see that backend.target is calling:

convert_to_target(
                configuration=self._configuration,
                properties=self._properties,
                defaults=self._defaults,
            )

What should happen?

The control flow operations should be in the target instructions.

Any suggestions?

The issue seems to be that convert_to_target populates a value all_instructions from configuration.basis_gates. And then iterates over all_instructions to pick up control flow. However, control flow instructions are not in basis gates. Instead, they are found in supported_instructions. Therefore, I think the change that is required is to populate all_instructions from supported_instructions rather than basis_gates.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions