-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix arguments for RZXCalibrationBuilder and EchoRZXWeylDecomposition (#…
…7331) * Fix arguments for RZXCalibrationBuilder and EchoRZXWeylDecomposition The RZXCalibrationBuilder and EchoRZXWeylDecomposition transpiler passes were previously taking BaseBackend instances as arguments. Besides that being a deprecated class which will be removed soon, it also is incorrect because backend objects are not guaranteed to be pickleable so when a pass manager runs in parallel processes this will cause an error. This was never caught because these passes aren't part of any default pass managers and their tests don't include running them as part of transpile(). To fix this passes typically take the properties of a backend they require. This is being reworked for BackendV2 in #5885 so a target object can be used to encapsulate the model of a backend so we have a single data structure to pass around, but until that is the minimum backend version we need to also support taking the individual components for BackendV1 and BaseBackend. This commit changes the pass constructors to take only use the parameters from the backend object used in the pass internals and stop requiring a backend object be used to construct an instance of either pass. * Deprecate backend for RZXCalibrationBuilder instead of removing
- Loading branch information
Showing
5 changed files
with
99 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
releasenotes/notes/deprecate-backend-rzx-cal-build-8eda1526725d7e7d.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
features: | ||
- | | ||
The constructor of :class:`~qiskit.transpiler.passes.RZXCalibrationBuilder` | ||
has two new kwargs ``instruction_schedule_map`` and ``qubit_channel_mapping`` | ||
which take a :class:`~qiskit.pulse.InstructionScheduleMap` and list of | ||
channel name lists for each qubit respectively. These new arguments are used | ||
to directly specify the information needed from a backend target. They should | ||
be used instead of passing a :class:`~qiskit.providers.BaseBackend` or | ||
:class:`~qiskit.providers.BackendV1` object directly to the pass with the | ||
``backend`` argument. | ||
deprecations: | ||
- | | ||
For the constructor of the | ||
:class:`~qiskit.transpiler.passes.RZXCalibrationBuilder` passing a backend | ||
either as the first positional argument or with the named ``backend`` kwarg | ||
is deprecated and will no longer work in a future release. Instead a | ||
a :class:`~qiskit.pulse.InstructionScheduleMap` should be passed directly to | ||
the ``instruction_schedule_map`` kwarg and a list of channel name lists for | ||
each qubit should be passed directly to ``qubit_channel_mapping``. For example, | ||
if you were calling the pass like:: | ||
from qiskit.transpiler.passes import RZXCalibrationBuilder | ||
from qiskit.test.mock import FakeMumbai | ||
backend = FakeMumbai() | ||
cal_pass = RZXCalibrationBuilder(backend) | ||
instead you should call it like:: | ||
from qiskit.transpiler.passes import RZXCalibrationBuilder | ||
from qiskit.test.mock import FakeMumbai | ||
backend = FakeMumbai() | ||
inst_map = backend.defaults().instruction_schedule_map | ||
channel_map = self.backend.configuration().qubit_channel_mapping | ||
cal_pass = RZXCalibrationBuilder( | ||
instruction_schedule_map=inst_map, | ||
qubit_channel_mapping=channel_map, | ||
) | ||
This change is necessary because as a general rule backend objects are not | ||
pickle serializeable and it would break when it was used with multiple | ||
processes inside of :func:`~qiskit.compiler.transpile` when compliing | ||
multiple circuits at once. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters