Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version


class qiskit.transpiler.passes.HighLevelSynthesis(*args, **kwargs)

GitHub(opens in a new tab)

Bases: TransformationPass

Synthesize higher-level objects and unroll custom definitions.

The input to this pass is a DAG that may contain higher-level objects, including abstract mathematical objects (e.g., objects of type LinearFunction), annotated operations (objects of type AnnotatedOperation), and custom gates.

In the most common use-case when either basis_gates or target is specified, all higher-level objects are synthesized, so the output is a DAGCircuit without such objects. More precisely, every gate in the output DAG is either directly supported by the target, or is in equivalence_library.

The abstract mathematical objects are synthesized using synthesis plugins, applying synthesis methods specified in the high-level-synthesis config (refer to the documentation for HLSConfig).

As an example, let us assume that op_a and op_b are names of two higher-level objects, that op_a-objects have two synthesis methods default which does require any additional parameters and other with two optional integer parameters option_1 and option_2, that op_b-objects have a single synthesis method default, and qc is a quantum circuit containing op_a and op_b objects. The following code snippet:

hls_config = HLSConfig(op_b=[("other", {"option_1": 7, "option_2": 4})])
pm = PassManager([HighLevelSynthesis(hls_config=hls_config)])
transpiled_qc =

shows how to run the alternative synthesis method other for op_b-objects, while using the default methods for all other high-level objects, including op_a-objects.

The annotated operations (consisting of a base operation and a list of inverse, control and power modifiers) are synthesizing recursively, first synthesizing the base operation, and then applying synthesis methods for creating inverted, controlled, or powered versions of that).

The custom gates are synthesized by recursively unrolling their definitions, until every gate is either supported by the target or is in the equivalence library.

When neither basis_gates nor target is specified, the pass synthesizes only the top-level abstract mathematical objects and annotated operations, without descending into the gate definitions. This is consistent with the older behavior of the pass, allowing to synthesize some higher-level objects using plugins and leaving the other gates untouched.

HighLevelSynthesis initializer.


  • hls_config – Optional, the high-level-synthesis config that specifies synthesis methods and parameters for various high-level-objects in the circuit. If it is not specified, the default synthesis methods and parameters will be used.
  • coupling_map – Optional, directed graph represented as a coupling map.
  • target – Optional, the backend target to use for this pass. If it is specified, it will be used instead of the coupling map.
  • use_qubit_indices – a flag indicating whether this synthesis pass is running before or after the layout is set, that is, whether the qubit indices of higher-level-objects correspond to qubit indices on the target backend.
  • equivalence_library – The equivalence library used (instructions in this library will not be unrolled by this pass).
  • basis_gates – Optional, target basis names to unroll to, e.g. [‘u3’, ‘cx’]. Ignored if target is also specified.
  • min_qubits – The minimum number of qubits for operations in the input dag to translate.



Check if the pass is an analysis pass.

If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.


Check if the pass is a transformation pass.

If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).



execute(passmanager_ir, state, callback=None)

Execute optimization task for input Qiskit IR.



Optimized Qiskit IR and state of the workflow.

Return type

tuple(opens in a new tab)[Any(opens in a new tab), qiskit.passmanager.compilation_status.PassManagerState]



Name of the pass.

Return type

str(opens in a new tab)



Run the HighLevelSynthesis pass on dag.


dag (DAGCircuit) – input dag.


Output dag with higher-level operations synthesized.


  • TranspilerError – when the transpiler is unable to synthesize the given DAG
  • (for instance, when the specified synthesis method is not available)****.

Return type



update_status(state, run_state)

Update workflow status.


  • state (PassManagerState) – Pass manager state to update.
  • run_state (RunState) – Completion status of current task.


Updated pass manager state.

Return type


Was this page helpful?
Report a bug or request content on GitHub.