HLSConfig
class qiskit.transpiler.passes.HLSConfig(use_default_on_unspecified=True, **kwargs)
Bases: object
The high-level-synthesis config allows to specify a list of “methods” used by HighLevelSynthesis
transformation pass to synthesize different types of higher-level objects.
A higher-level object is an object of type Operation
(e.g., Clifford
or LinearFunction
). Each object is referred to by its name
field (e.g., "clifford"
for Clifford
objects), and the applicable synthesis methods are tied to this name.
In the config, each method is specified in one of several ways:
- a tuple consisting of the name of a known synthesis plugin and a dictionary providing additional arguments for the algorithm.
- a tuple consisting of an instance of
HighLevelSynthesisPlugin
and additional arguments for the algorithm. - a single string of a known synthesis plugin
- a single instance of
HighLevelSynthesisPlugin
.
The following example illustrates different ways how a config file can be created:
from qiskit.transpiler.passes.synthesis.high_level_synthesis import HLSConfig
from qiskit.transpiler.passes.synthesis.high_level_synthesis import ACGSynthesisPermutation
# All the ways to specify hls_config are equivalent
hls_config = HLSConfig(permutation=[("acg", {})])
hls_config = HLSConfig(permutation=["acg"])
hls_config = HLSConfig(permutation=[(ACGSynthesisPermutation(), {})])
hls_config = HLSConfig(permutation=[ACGSynthesisPermutation()])
The names of the synthesis plugins should be declared in entry-points
table for qiskit.synthesis
in pyproject.toml
, in the form <higher-level-object-name>.<synthesis-method-name>.
The standard higher-level-objects are recommended to have a synthesis method called “default”, which would be called automatically when synthesizing these objects, without having to explicitly set these methods in the config.
To avoid synthesizing a given higher-level-object, one can give it an empty list of methods.
For an explicit example of using such config files, refer to the documentation for HighLevelSynthesis
.
For an overview of the complete process of using high-level synthesis, see High-level Synthesis Plugins.
Creates a high-level-synthesis config.
Parameters
- use_default_on_unspecified (bool) – if True, every higher-level-object without an explicitly specified list of methods will be synthesized using the “default” algorithm if it exists.
- kwargs – a dictionary mapping higher-level-objects to lists of synthesis methods.
Methods
set_methods
set_methods(hls_name, hls_methods)
Sets the list of synthesis methods for a given higher-level-object. This overwrites the lists of methods if also set previously.