qiskit 1.3.2__cp39-abi3-win32.whl → 1.4.0__cp39-abi3-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qiskit/VERSION.txt +1 -1
- qiskit/__init__.py +1 -0
- qiskit/_accelerate.pyd +0 -0
- qiskit/circuit/__init__.py +5 -2
- qiskit/circuit/bit.py +12 -0
- qiskit/circuit/classicalfunction/__init__.py +13 -1
- qiskit/circuit/classicalfunction/boolean_expression.py +10 -1
- qiskit/circuit/classicalfunction/classicalfunction.py +10 -1
- qiskit/circuit/classicalfunction/exceptions.py +7 -1
- qiskit/circuit/delay.py +5 -0
- qiskit/circuit/library/generalized_gates/mcmt.py +5 -6
- qiskit/circuit/library/phase_oracle.py +24 -17
- qiskit/circuit/library/standard_gates/rz.py +7 -7
- qiskit/circuit/library/standard_gates/xx_minus_yy.py +0 -30
- qiskit/circuit/parametervector.py +25 -5
- qiskit/circuit/quantumcircuit.py +68 -2
- qiskit/circuit/register.py +13 -0
- qiskit/compiler/assembler.py +16 -8
- qiskit/compiler/transpiler.py +1 -1
- qiskit/dagcircuit/dagdependency_v2.py +4 -2
- qiskit/passmanager/passmanager.py +19 -1
- qiskit/primitives/backend_estimator_v2.py +17 -0
- qiskit/primitives/backend_sampler_v2.py +15 -0
- qiskit/providers/backend_compat.py +46 -11
- qiskit/providers/basic_provider/basic_simulator.py +15 -3
- qiskit/providers/exceptions.py +23 -2
- qiskit/providers/models/backendproperties.py +19 -1
- qiskit/providers/models/backendstatus.py +10 -0
- qiskit/providers/models/jobstatus.py +11 -0
- qiskit/pulse/schedule.py +1 -1
- qiskit/quantum_info/operators/channel/transformations.py +15 -0
- qiskit/result/result.py +109 -20
- qiskit/synthesis/evolution/product_formula.py +1 -2
- qiskit/synthesis/evolution/qdrift.py +1 -2
- qiskit/synthesis/evolution/suzuki_trotter.py +1 -2
- qiskit/transpiler/__init__.py +772 -542
- qiskit/transpiler/layout.py +6 -6
- qiskit/transpiler/passes/calibration/rzx_templates.py +7 -0
- qiskit/transpiler/passes/layout/dense_layout.py +12 -0
- qiskit/transpiler/passes/layout/sabre_layout.py +13 -0
- qiskit/transpiler/passes/layout/vf2_layout.py +11 -0
- qiskit/transpiler/passes/layout/vf2_post_layout.py +22 -0
- qiskit/transpiler/passes/optimization/normalize_rx_angle.py +8 -0
- qiskit/transpiler/passes/optimization/remove_identity_equiv.py +2 -3
- qiskit/transpiler/passes/routing/star_prerouting.py +17 -2
- qiskit/transpiler/passes/scheduling/scheduling/alap.py +1 -1
- qiskit/transpiler/passes/scheduling/scheduling/asap.py +1 -1
- qiskit/transpiler/passes/synthesis/unitary_synthesis.py +11 -0
- qiskit/transpiler/passmanager_config.py +11 -0
- qiskit/transpiler/preset_passmanagers/__init__.py +26 -6
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +188 -118
- qiskit/transpiler/preset_passmanagers/common.py +133 -83
- qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +29 -3
- qiskit/transpiler/preset_passmanagers/plugin.py +33 -42
- qiskit/transpiler/target.py +41 -9
- qiskit/visualization/circuit/text.py +3 -2
- qiskit/visualization/gate_map.py +50 -0
- qiskit/visualization/pulse_v2/interface.py +0 -2
- qiskit/visualization/timeline/interface.py +3 -3
- {qiskit-1.3.2.dist-info → qiskit-1.4.0.dist-info}/METADATA +4 -7
- {qiskit-1.3.2.dist-info → qiskit-1.4.0.dist-info}/RECORD +65 -65
- {qiskit-1.3.2.dist-info → qiskit-1.4.0.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.3.2.dist-info → qiskit-1.4.0.dist-info}/WHEEL +0 -0
- {qiskit-1.3.2.dist-info → qiskit-1.4.0.dist-info}/entry_points.txt +0 -0
- {qiskit-1.3.2.dist-info → qiskit-1.4.0.dist-info}/top_level.txt +0 -0
@@ -201,18 +201,25 @@ class BasisTranslatorPassManager(PassManagerStagePlugin):
|
|
201
201
|
"""Plugin class for translation stage with :class:`~.BasisTranslator`"""
|
202
202
|
|
203
203
|
def pass_manager(self, pass_manager_config, optimization_level=None) -> PassManager:
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
204
|
+
with warnings.catch_warnings():
|
205
|
+
warnings.filterwarnings(
|
206
|
+
"ignore",
|
207
|
+
category=DeprecationWarning,
|
208
|
+
message=".*argument ``backend_properties`` is deprecated as of Qiskit 1.4",
|
209
|
+
module="qiskit",
|
210
|
+
)
|
211
|
+
return common.generate_translation_passmanager(
|
212
|
+
pass_manager_config.target,
|
213
|
+
basis_gates=pass_manager_config.basis_gates,
|
214
|
+
method="translator",
|
215
|
+
approximation_degree=pass_manager_config.approximation_degree,
|
216
|
+
coupling_map=pass_manager_config.coupling_map,
|
217
|
+
backend_props=pass_manager_config.backend_properties,
|
218
|
+
unitary_synthesis_method=pass_manager_config.unitary_synthesis_method,
|
219
|
+
unitary_synthesis_plugin_config=pass_manager_config.unitary_synthesis_plugin_config,
|
220
|
+
hls_config=pass_manager_config.hls_config,
|
221
|
+
qubits_initially_zero=pass_manager_config.qubits_initially_zero,
|
222
|
+
)
|
216
223
|
|
217
224
|
|
218
225
|
class UnitarySynthesisPassManager(PassManagerStagePlugin):
|
@@ -457,17 +464,24 @@ class SabreSwapPassManager(PassManagerStagePlugin):
|
|
457
464
|
seed=seed_transpiler,
|
458
465
|
trials=trial_count,
|
459
466
|
)
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
467
|
+
with warnings.catch_warnings():
|
468
|
+
warnings.filterwarnings(
|
469
|
+
"ignore",
|
470
|
+
category=DeprecationWarning,
|
471
|
+
message=".*argument ``backend_properties`` is deprecated as of Qiskit 1.4",
|
472
|
+
module="qiskit",
|
473
|
+
)
|
474
|
+
return common.generate_routing_passmanager(
|
475
|
+
routing_pass,
|
476
|
+
target,
|
477
|
+
coupling_map,
|
478
|
+
vf2_call_limit=vf2_call_limit,
|
479
|
+
vf2_max_trials=vf2_max_trials,
|
480
|
+
backend_properties=backend_properties,
|
481
|
+
seed_transpiler=-1,
|
482
|
+
check_trivial=True,
|
483
|
+
use_barrier_before_measurement=True,
|
484
|
+
)
|
471
485
|
if optimization_level == 2:
|
472
486
|
trial_count = _get_trial_count(20)
|
473
487
|
|
@@ -477,16 +491,23 @@ class SabreSwapPassManager(PassManagerStagePlugin):
|
|
477
491
|
seed=seed_transpiler,
|
478
492
|
trials=trial_count,
|
479
493
|
)
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
494
|
+
with warnings.catch_warnings():
|
495
|
+
warnings.filterwarnings(
|
496
|
+
"ignore",
|
497
|
+
category=DeprecationWarning,
|
498
|
+
message=".*argument ``backend_properties`` is deprecated as of Qiskit 1.4",
|
499
|
+
module="qiskit",
|
500
|
+
)
|
501
|
+
return common.generate_routing_passmanager(
|
502
|
+
routing_pass,
|
503
|
+
target,
|
504
|
+
coupling_map=coupling_map,
|
505
|
+
vf2_call_limit=vf2_call_limit,
|
506
|
+
vf2_max_trials=vf2_max_trials,
|
507
|
+
backend_properties=backend_properties,
|
508
|
+
seed_transpiler=-1,
|
509
|
+
use_barrier_before_measurement=True,
|
510
|
+
)
|
490
511
|
if optimization_level == 3:
|
491
512
|
trial_count = _get_trial_count(20)
|
492
513
|
routing_pass = SabreSwap(
|
@@ -495,16 +516,23 @@ class SabreSwapPassManager(PassManagerStagePlugin):
|
|
495
516
|
seed=seed_transpiler,
|
496
517
|
trials=trial_count,
|
497
518
|
)
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
519
|
+
with warnings.catch_warnings():
|
520
|
+
warnings.filterwarnings(
|
521
|
+
"ignore",
|
522
|
+
category=DeprecationWarning,
|
523
|
+
message=".*argument ``backend_properties`` is deprecated as of Qiskit 1.4",
|
524
|
+
module="qiskit",
|
525
|
+
)
|
526
|
+
return common.generate_routing_passmanager(
|
527
|
+
routing_pass,
|
528
|
+
target,
|
529
|
+
coupling_map=coupling_map,
|
530
|
+
vf2_call_limit=vf2_call_limit,
|
531
|
+
vf2_max_trials=vf2_max_trials,
|
532
|
+
backend_properties=backend_properties,
|
533
|
+
seed_transpiler=-1,
|
534
|
+
use_barrier_before_measurement=True,
|
535
|
+
)
|
508
536
|
raise TranspilerError(f"Invalid optimization level specified: {optimization_level}")
|
509
537
|
|
510
538
|
|
@@ -596,30 +624,37 @@ class OptimizationPassManager(PassManagerStagePlugin):
|
|
596
624
|
]
|
597
625
|
elif optimization_level == 3:
|
598
626
|
# Steps for optimization level 3
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
627
|
+
with warnings.catch_warnings():
|
628
|
+
warnings.filterwarnings(
|
629
|
+
"ignore",
|
630
|
+
category=DeprecationWarning,
|
631
|
+
message=".*argument ``backend_props`` is deprecated as of Qiskit 1.4",
|
632
|
+
module="qiskit",
|
633
|
+
)
|
634
|
+
_opt = [
|
635
|
+
ConsolidateBlocks(
|
636
|
+
basis_gates=pass_manager_config.basis_gates,
|
637
|
+
target=pass_manager_config.target,
|
638
|
+
approximation_degree=pass_manager_config.approximation_degree,
|
639
|
+
),
|
640
|
+
UnitarySynthesis(
|
641
|
+
pass_manager_config.basis_gates,
|
642
|
+
approximation_degree=pass_manager_config.approximation_degree,
|
643
|
+
coupling_map=pass_manager_config.coupling_map,
|
644
|
+
backend_props=pass_manager_config.backend_properties,
|
645
|
+
method=pass_manager_config.unitary_synthesis_method,
|
646
|
+
plugin_config=pass_manager_config.unitary_synthesis_plugin_config,
|
647
|
+
target=pass_manager_config.target,
|
648
|
+
),
|
649
|
+
RemoveIdentityEquivalent(
|
650
|
+
approximation_degree=pass_manager_config.approximation_degree,
|
651
|
+
target=pass_manager_config.target,
|
652
|
+
),
|
653
|
+
Optimize1qGatesDecomposition(
|
654
|
+
basis=pass_manager_config.basis_gates, target=pass_manager_config.target
|
655
|
+
),
|
656
|
+
CommutativeCancellation(target=pass_manager_config.target),
|
657
|
+
]
|
623
658
|
|
624
659
|
def _opt_control(property_set):
|
625
660
|
return not property_set["optimization_loop_minimum_point"]
|
@@ -642,24 +677,31 @@ class OptimizationPassManager(PassManagerStagePlugin):
|
|
642
677
|
if optimization_level == 3:
|
643
678
|
optimization.append(_minimum_point_check)
|
644
679
|
elif optimization_level == 2:
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
680
|
+
with warnings.catch_warnings():
|
681
|
+
warnings.filterwarnings(
|
682
|
+
"ignore",
|
683
|
+
category=DeprecationWarning,
|
684
|
+
message=".*argument ``backend_props`` is deprecated as of Qiskit 1.4",
|
685
|
+
module="qiskit",
|
686
|
+
)
|
687
|
+
optimization.append(
|
688
|
+
[
|
689
|
+
ConsolidateBlocks(
|
690
|
+
basis_gates=pass_manager_config.basis_gates,
|
691
|
+
target=pass_manager_config.target,
|
692
|
+
approximation_degree=pass_manager_config.approximation_degree,
|
693
|
+
),
|
694
|
+
UnitarySynthesis(
|
695
|
+
pass_manager_config.basis_gates,
|
696
|
+
approximation_degree=pass_manager_config.approximation_degree,
|
697
|
+
coupling_map=pass_manager_config.coupling_map,
|
698
|
+
backend_props=pass_manager_config.backend_properties,
|
699
|
+
method=pass_manager_config.unitary_synthesis_method,
|
700
|
+
plugin_config=pass_manager_config.unitary_synthesis_plugin_config,
|
701
|
+
target=pass_manager_config.target,
|
702
|
+
),
|
703
|
+
]
|
704
|
+
)
|
663
705
|
optimization.append(_depth_check + _size_check)
|
664
706
|
else:
|
665
707
|
optimization.append(_depth_check + _size_check)
|
@@ -788,14 +830,21 @@ class DefaultLayoutPassManager(PassManagerStagePlugin):
|
|
788
830
|
condition=_choose_layout_condition,
|
789
831
|
)
|
790
832
|
)
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
833
|
+
with warnings.catch_warnings():
|
834
|
+
warnings.filterwarnings(
|
835
|
+
"ignore",
|
836
|
+
category=DeprecationWarning,
|
837
|
+
message=".*argument ``properties`` is deprecated as of Qiskit 1.4",
|
838
|
+
module="qiskit",
|
839
|
+
)
|
840
|
+
choose_layout_1 = VF2Layout(
|
841
|
+
coupling_map=pass_manager_config.coupling_map,
|
842
|
+
seed=-1,
|
843
|
+
call_limit=int(5e4), # Set call limit to ~100ms with rustworkx 0.10.2
|
844
|
+
properties=pass_manager_config.backend_properties,
|
845
|
+
target=pass_manager_config.target,
|
846
|
+
max_trials=2500, # Limits layout scoring to < 600ms on ~400 qubit devices
|
847
|
+
)
|
799
848
|
layout.append(ConditionalController(choose_layout_1, condition=_layout_not_perfect))
|
800
849
|
|
801
850
|
trial_count = _get_trial_count(5)
|
@@ -821,14 +870,21 @@ class DefaultLayoutPassManager(PassManagerStagePlugin):
|
|
821
870
|
)
|
822
871
|
)
|
823
872
|
elif optimization_level == 2:
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
873
|
+
with warnings.catch_warnings():
|
874
|
+
warnings.filterwarnings(
|
875
|
+
"ignore",
|
876
|
+
category=DeprecationWarning,
|
877
|
+
message=".*argument ``properties`` is deprecated as of Qiskit 1.4",
|
878
|
+
module="qiskit",
|
879
|
+
)
|
880
|
+
choose_layout_0 = VF2Layout(
|
881
|
+
coupling_map=pass_manager_config.coupling_map,
|
882
|
+
seed=-1,
|
883
|
+
call_limit=int(5e6), # Set call limit to ~10s with rustworkx 0.10.2
|
884
|
+
properties=pass_manager_config.backend_properties,
|
885
|
+
target=pass_manager_config.target,
|
886
|
+
max_trials=2500, # Limits layout scoring to < 600ms on ~400 qubit devices
|
887
|
+
)
|
832
888
|
layout.append(
|
833
889
|
ConditionalController(choose_layout_0, condition=_choose_layout_condition)
|
834
890
|
)
|
@@ -856,14 +912,21 @@ class DefaultLayoutPassManager(PassManagerStagePlugin):
|
|
856
912
|
)
|
857
913
|
)
|
858
914
|
elif optimization_level == 3:
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
915
|
+
with warnings.catch_warnings():
|
916
|
+
warnings.filterwarnings(
|
917
|
+
"ignore",
|
918
|
+
category=DeprecationWarning,
|
919
|
+
message=".*argument ``properties`` is deprecated as of Qiskit 1.4",
|
920
|
+
module="qiskit",
|
921
|
+
)
|
922
|
+
choose_layout_0 = VF2Layout(
|
923
|
+
coupling_map=pass_manager_config.coupling_map,
|
924
|
+
seed=-1,
|
925
|
+
call_limit=int(3e7), # Set call limit to ~60s with rustworkx 0.10.2
|
926
|
+
properties=pass_manager_config.backend_properties,
|
927
|
+
target=pass_manager_config.target,
|
928
|
+
max_trials=250000, # Limits layout scoring to < 60s on ~400 qubit devices
|
929
|
+
)
|
867
930
|
layout.append(
|
868
931
|
ConditionalController(choose_layout_0, condition=_choose_layout_condition)
|
869
932
|
)
|
@@ -937,16 +1000,23 @@ class DenseLayoutPassManager(PassManagerStagePlugin):
|
|
937
1000
|
|
938
1001
|
layout = PassManager()
|
939
1002
|
layout.append(_given_layout)
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
1003
|
+
with warnings.catch_warnings():
|
1004
|
+
warnings.filterwarnings(
|
1005
|
+
"ignore",
|
1006
|
+
category=DeprecationWarning,
|
1007
|
+
message=".*argument ``backend_prop`` is deprecated as of Qiskit 1.4",
|
1008
|
+
module="qiskit",
|
1009
|
+
)
|
1010
|
+
layout.append(
|
1011
|
+
ConditionalController(
|
1012
|
+
DenseLayout(
|
1013
|
+
coupling_map=pass_manager_config.coupling_map,
|
1014
|
+
backend_prop=pass_manager_config.backend_properties,
|
1015
|
+
target=pass_manager_config.target,
|
1016
|
+
),
|
1017
|
+
condition=_choose_layout_condition,
|
1018
|
+
)
|
948
1019
|
)
|
949
|
-
)
|
950
1020
|
layout += common.generate_embed_passmanager(coupling_map)
|
951
1021
|
return layout
|
952
1022
|
|
@@ -14,6 +14,7 @@
|
|
14
14
|
"""Common preset passmanager generators."""
|
15
15
|
|
16
16
|
import collections
|
17
|
+
import warnings
|
17
18
|
from typing import Optional
|
18
19
|
|
19
20
|
from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as sel
|
@@ -53,7 +54,7 @@ from qiskit.transpiler.passes.layout.vf2_post_layout import VF2PostLayoutStopRea
|
|
53
54
|
from qiskit.transpiler.exceptions import TranspilerError
|
54
55
|
from qiskit.transpiler.layout import Layout
|
55
56
|
from qiskit.utils.deprecate_pulse import deprecate_pulse_arg
|
56
|
-
|
57
|
+
from qiskit.utils.deprecation import deprecate_arg
|
57
58
|
|
58
59
|
_ControlFlowState = collections.namedtuple("_ControlFlowState", ("working", "not_working"))
|
59
60
|
|
@@ -275,6 +276,16 @@ def _apply_post_layout_condition(property_set):
|
|
275
276
|
)
|
276
277
|
|
277
278
|
|
279
|
+
@deprecate_arg(
|
280
|
+
name="backend_properties",
|
281
|
+
since="1.4",
|
282
|
+
package_name="Qiskit",
|
283
|
+
removal_timeline="in Qiskit 2.0",
|
284
|
+
additional_msg="The BackendProperties data structure has been deprecated and will be "
|
285
|
+
"removed in Qiskit 2.0. The required `target` input argument should be used "
|
286
|
+
"instead. You can use Target.from_configuration() to build the target from the properties "
|
287
|
+
"object, but in 2.0 you will need to generate a target directly.",
|
288
|
+
)
|
278
289
|
def generate_routing_passmanager(
|
279
290
|
routing_pass,
|
280
291
|
target,
|
@@ -352,20 +363,33 @@ def generate_routing_passmanager(
|
|
352
363
|
|
353
364
|
is_vf2_fully_bounded = vf2_call_limit and vf2_max_trials
|
354
365
|
if (target is not None or backend_properties is not None) and is_vf2_fully_bounded:
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
366
|
+
with warnings.catch_warnings():
|
367
|
+
warnings.filterwarnings(
|
368
|
+
"ignore",
|
369
|
+
category=DeprecationWarning,
|
370
|
+
message=".*argument ``properties`` is deprecated as of Qiskit 1.4",
|
371
|
+
module="qiskit",
|
372
|
+
)
|
373
|
+
warnings.filterwarnings(
|
374
|
+
"ignore",
|
375
|
+
category=DeprecationWarning,
|
376
|
+
message=".*argument ``coupling_map`` is deprecated as of Qiskit 1.4",
|
377
|
+
module="qiskit",
|
378
|
+
)
|
379
|
+
routing.append(
|
380
|
+
ConditionalController(
|
381
|
+
VF2PostLayout(
|
382
|
+
target,
|
383
|
+
coupling_map,
|
384
|
+
backend_properties,
|
385
|
+
seed_transpiler,
|
386
|
+
call_limit=vf2_call_limit,
|
387
|
+
max_trials=vf2_max_trials,
|
388
|
+
strict_direction=False,
|
389
|
+
),
|
390
|
+
condition=_run_post_layout_condition,
|
391
|
+
)
|
367
392
|
)
|
368
|
-
)
|
369
393
|
routing.append(ConditionalController(ApplyLayout(), condition=_apply_post_layout_condition))
|
370
394
|
|
371
395
|
def filter_fn(node):
|
@@ -409,6 +433,16 @@ def generate_pre_op_passmanager(target=None, coupling_map=None, remove_reset_in_
|
|
409
433
|
return pre_opt
|
410
434
|
|
411
435
|
|
436
|
+
@deprecate_arg(
|
437
|
+
name="backend_properties",
|
438
|
+
since="1.4",
|
439
|
+
package_name="Qiskit",
|
440
|
+
removal_timeline="in Qiskit 2.0",
|
441
|
+
additional_msg="The BackendProperties data structure has been deprecated and will be "
|
442
|
+
"removed in Qiskit 2.0. The required `target` input argument should be used "
|
443
|
+
"instead. You can use Target.from_configuration() to build the target from the properties "
|
444
|
+
"object, but in 2.0 you will need to generate a target directly.",
|
445
|
+
)
|
412
446
|
def generate_translation_passmanager(
|
413
447
|
target,
|
414
448
|
basis_gates=None,
|
@@ -455,76 +489,92 @@ def generate_translation_passmanager(
|
|
455
489
|
TranspilerError: If the ``method`` kwarg is not a valid value
|
456
490
|
"""
|
457
491
|
if method == "translator":
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
492
|
+
with warnings.catch_warnings():
|
493
|
+
warnings.filterwarnings(
|
494
|
+
"ignore",
|
495
|
+
category=DeprecationWarning,
|
496
|
+
message=".*argument ``backend_props`` is deprecated as of Qiskit 1.4",
|
497
|
+
module="qiskit",
|
498
|
+
)
|
499
|
+
unroll = [
|
500
|
+
# Use unitary synthesis for basis aware decomposition of
|
501
|
+
# UnitaryGates before custom unrolling
|
502
|
+
UnitarySynthesis(
|
503
|
+
basis_gates,
|
504
|
+
approximation_degree=approximation_degree,
|
505
|
+
coupling_map=coupling_map,
|
506
|
+
backend_props=backend_props,
|
507
|
+
plugin_config=unitary_synthesis_plugin_config,
|
508
|
+
method=unitary_synthesis_method,
|
509
|
+
target=target,
|
510
|
+
),
|
511
|
+
HighLevelSynthesis(
|
512
|
+
hls_config=hls_config,
|
513
|
+
coupling_map=coupling_map,
|
514
|
+
target=target,
|
515
|
+
use_qubit_indices=True,
|
516
|
+
equivalence_library=sel,
|
517
|
+
basis_gates=basis_gates,
|
518
|
+
qubits_initially_zero=qubits_initially_zero,
|
519
|
+
),
|
520
|
+
BasisTranslator(sel, basis_gates, target),
|
521
|
+
]
|
481
522
|
elif method == "synthesis":
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
basis_gates=basis_gates,
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
523
|
+
with warnings.catch_warnings():
|
524
|
+
warnings.filterwarnings(
|
525
|
+
"ignore",
|
526
|
+
category=DeprecationWarning,
|
527
|
+
message=".*argument ``backend_props`` is deprecated as of Qiskit 1.4",
|
528
|
+
module="qiskit",
|
529
|
+
)
|
530
|
+
unroll = [
|
531
|
+
# Use unitary synthesis for basis aware decomposition of
|
532
|
+
# UnitaryGates > 2q before collection
|
533
|
+
UnitarySynthesis(
|
534
|
+
basis_gates,
|
535
|
+
approximation_degree=approximation_degree,
|
536
|
+
coupling_map=coupling_map,
|
537
|
+
backend_props=backend_props,
|
538
|
+
plugin_config=unitary_synthesis_plugin_config,
|
539
|
+
method=unitary_synthesis_method,
|
540
|
+
min_qubits=3,
|
541
|
+
target=target,
|
542
|
+
),
|
543
|
+
HighLevelSynthesis(
|
544
|
+
hls_config=hls_config,
|
545
|
+
coupling_map=coupling_map,
|
546
|
+
target=target,
|
547
|
+
use_qubit_indices=True,
|
548
|
+
basis_gates=basis_gates,
|
549
|
+
min_qubits=3,
|
550
|
+
qubits_initially_zero=qubits_initially_zero,
|
551
|
+
),
|
552
|
+
Unroll3qOrMore(target=target, basis_gates=basis_gates),
|
553
|
+
Collect2qBlocks(),
|
554
|
+
Collect1qRuns(),
|
555
|
+
ConsolidateBlocks(
|
556
|
+
basis_gates=basis_gates,
|
557
|
+
target=target,
|
558
|
+
approximation_degree=approximation_degree,
|
559
|
+
),
|
560
|
+
UnitarySynthesis(
|
561
|
+
basis_gates=basis_gates,
|
562
|
+
approximation_degree=approximation_degree,
|
563
|
+
coupling_map=coupling_map,
|
564
|
+
backend_props=backend_props,
|
565
|
+
plugin_config=unitary_synthesis_plugin_config,
|
566
|
+
method=unitary_synthesis_method,
|
567
|
+
target=target,
|
568
|
+
),
|
569
|
+
HighLevelSynthesis(
|
570
|
+
hls_config=hls_config,
|
571
|
+
coupling_map=coupling_map,
|
572
|
+
target=target,
|
573
|
+
use_qubit_indices=True,
|
574
|
+
basis_gates=basis_gates,
|
575
|
+
qubits_initially_zero=qubits_initially_zero,
|
576
|
+
),
|
577
|
+
]
|
528
578
|
else:
|
529
579
|
raise TranspilerError(f"Invalid translation method {method}.")
|
530
580
|
return PassManager(unroll)
|