Skip to content

Commit

Permalink
Deprecate use of BackendProperties (BackendV1) in transpilation pip…
Browse files Browse the repository at this point in the history
…eline (#13719)

* Add deprecation decorators and adapt unit tests

* Add reno

* Update deprecation messages to add more context. Extend reno to emphasize safeness of removal.

* Apply suggestions from Jake's code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Include deprecation of coupling_map in VF2PostLayout

---------

Co-authored-by: Jake Lishman <jake@binhbar.com>
  • Loading branch information
ElePT and jakelishman authored Feb 19, 2025
1 parent fa84cbc commit f0a80a1
Show file tree
Hide file tree
Showing 15 changed files with 786 additions and 402 deletions.
12 changes: 12 additions & 0 deletions qiskit/transpiler/passes/layout/dense_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from qiskit.transpiler.exceptions import TranspilerError
from qiskit.transpiler.passes.layout import disjoint_utils

from qiskit.utils import deprecate_arg

from qiskit._accelerate.dense_layout import best_subset


Expand All @@ -36,6 +38,16 @@ class DenseLayout(AnalysisPass):
by being set in ``property_set``.
"""

@deprecate_arg(
name="backend_prop",
since="1.4",
package_name="Qiskit",
removal_timeline="in Qiskit 2.0",
additional_msg="The BackendProperties data structure has been deprecated and will be "
"removed in Qiskit 2.0. The `target` input argument should be used instead. "
"You can use Target.from_configuration() to build the target from the properties "
"object, but in 2.0 you will need to generate a target directly.",
)
def __init__(self, coupling_map=None, backend_prop=None, target=None):
"""DenseLayout initializer.
Expand Down
11 changes: 11 additions & 0 deletions qiskit/transpiler/passes/layout/vf2_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from qiskit.transpiler.exceptions import TranspilerError
from qiskit.transpiler.passes.layout import vf2_utils

from qiskit.utils import deprecate_arg

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -73,6 +74,16 @@ class VF2Layout(AnalysisPass):
``vf2_avg_error_map`` key in the property set when :class:`~.VF2Layout` is run.
"""

@deprecate_arg(
name="properties",
since="1.4",
package_name="Qiskit",
removal_timeline="in Qiskit 2.0",
additional_msg="The BackendProperties data structure has been deprecated and will be "
"removed in Qiskit 2.0. The `target` input argument should be used instead. "
"You can use Target.from_configuration() to build the target from the properties "
"object, but in 2.0 you will need to generate a target directly.",
)
def __init__(
self,
coupling_map=None,
Expand Down
22 changes: 22 additions & 0 deletions qiskit/transpiler/passes/layout/vf2_post_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from qiskit.providers.exceptions import BackendPropertyError
from qiskit.transpiler.passes.layout import vf2_utils

from qiskit.utils import deprecate_arg

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -99,6 +100,27 @@ class VF2PostLayout(AnalysisPass):
is run.
"""

@deprecate_arg(
name="properties",
since="1.4",
package_name="Qiskit",
removal_timeline="in Qiskit 2.0",
additional_msg="The BackendProperties data structure has been deprecated and will be "
"removed in Qiskit 2.0. The `target` input argument should be used instead. "
"You can use Target.from_configuration() to build the target from the properties "
"object, but in 2.0 you will need to generate a target directly.",
)
@deprecate_arg(
name="coupling_map",
since="1.4",
package_name="Qiskit",
removal_timeline="in Qiskit 2.0",
additional_msg="This argument was only used with `properties`, which relied on "
"the deprecated BackendProperties data structure. The `target` input argument "
"should be used instead. "
"You can use Target.from_configuration() to build the target from coupling "
"map + properties, but in 2.0 you will need to generate a target directly.",
)
def __init__(
self,
target=None,
Expand Down
11 changes: 11 additions & 0 deletions qiskit/transpiler/passes/synthesis/unitary_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
from qiskit.transpiler.passes.synthesis import plugin
from qiskit.transpiler.target import Target

from qiskit.utils.deprecation import deprecate_arg
from qiskit._accelerate.unitary_synthesis import run_default_main_loop

GATE_NAME_MAP = {
Expand Down Expand Up @@ -315,6 +316,16 @@ def _preferred_direction(
class UnitarySynthesis(TransformationPass):
"""Synthesize gates according to their basis gates."""

@deprecate_arg(
name="backend_props",
since="1.4",
package_name="Qiskit",
removal_timeline="in Qiskit 2.0",
additional_msg="The BackendProperties data structure has been deprecated and will be "
"removed in Qiskit 2.0. The `target` input argument should be used instead. "
"You can use Target.from_configuration() to build the target from the properties "
"object, but in 2.0 you will need to generate a target directly.",
)
def __init__(
self,
basis_gates: list[str] = None,
Expand Down
11 changes: 11 additions & 0 deletions qiskit/transpiler/passmanager_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,22 @@
from qiskit.transpiler.coupling import CouplingMap
from qiskit.transpiler.instruction_durations import InstructionDurations
from qiskit.utils.deprecate_pulse import deprecate_pulse_arg
from qiskit.utils.deprecation import deprecate_arg


class PassManagerConfig:
"""Pass Manager Configuration."""

@deprecate_arg(
name="backend_properties",
since="1.4",
package_name="Qiskit",
removal_timeline="in Qiskit 2.0",
additional_msg="The BackendProperties data structure has been deprecated and will be "
"removed in Qiskit 2.0. The `target` input argument should be used instead. "
"You can use Target.from_configuration() to build the target from the properties "
"object, but in 2.0 you will need to generate a target directly.",
)
@deprecate_pulse_arg("inst_map", predicate=lambda inst_map: inst_map is not None)
def __init__(
self,
Expand Down
Loading

0 comments on commit f0a80a1

Please # to comment.