Skip to content

Commit

Permalink
Restore synthesis pm logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ElePT committed Jan 15, 2025
1 parent ec6a46b commit 7af4e42
Showing 1 changed file with 38 additions and 12 deletions.
50 changes: 38 additions & 12 deletions qiskit/transpiler/preset_passmanagers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def generate_translation_passmanager(
]
elif method == "synthesis":
if target is not None and len(target.operation_names) == 0:
synth_block = [
unroll = [
HighLevelSynthesis(
hls_config=hls_config,
coupling_map=coupling_map,
Expand All @@ -517,12 +517,28 @@ def generate_translation_passmanager(
basis_gates=basis_gates,
min_qubits=3,
qubits_initially_zero=qubits_initially_zero,
)
),
Unroll3qOrMore(target=target, basis_gates=basis_gates),
Collect2qBlocks(),
Collect1qRuns(),
ConsolidateBlocks(
basis_gates=basis_gates,
target=target,
approximation_degree=approximation_degree,
),
HighLevelSynthesis(
hls_config=hls_config,
coupling_map=coupling_map,
target=target,
use_qubit_indices=True,
basis_gates=basis_gates,
qubits_initially_zero=qubits_initially_zero,
),
]
else:
# Use unitary synthesis for basis aware decomposition of
# UnitaryGates > 2q before collection
synth_block = [
unroll = [
# # Use unitary synthesis for basis aware decomposition of
# UnitaryGates > 2q before collection
UnitarySynthesis(
basis_gates,
approximation_degree=approximation_degree,
Expand All @@ -542,11 +558,6 @@ def generate_translation_passmanager(
min_qubits=3,
qubits_initially_zero=qubits_initially_zero,
),
]

unroll = (
synth_block
+ [
Unroll3qOrMore(target=target, basis_gates=basis_gates),
Collect2qBlocks(),
Collect1qRuns(),
Expand All @@ -555,9 +566,24 @@ def generate_translation_passmanager(
target=target,
approximation_degree=approximation_degree,
),
UnitarySynthesis(
basis_gates=basis_gates,
approximation_degree=approximation_degree,
coupling_map=coupling_map,
backend_props=backend_props,
plugin_config=unitary_synthesis_plugin_config,
method=unitary_synthesis_method,
target=target,
),
HighLevelSynthesis(
hls_config=hls_config,
coupling_map=coupling_map,
target=target,
use_qubit_indices=True,
basis_gates=basis_gates,
qubits_initially_zero=qubits_initially_zero,
),
]
+ synth_block
)
else:
raise TranspilerError(f"Invalid translation method {method}.")
return PassManager(unroll)
Expand Down

0 comments on commit 7af4e42

Please sign in to comment.