Transpiler¶
Overview¶
Transpilation is the process of rewriting a given input circuit to conform with desired criteria
such as topological and operational constraints of the hardware used to execute the final circuit.
We are not going to explain this in more detail here, and instead refer to Qiskit’s documentation of
the qiskit.transpiler module.
The focus here lies on explaining how we achieve the transpilation of a FermionicCircuit
to a QuantumCircuit.
Stages¶
Conceptually, we split the transpilation process into several stages:
Stage |
Description |
|---|---|
convert to DAG data structure |
|
fermionic-level optimization |
|
fermion-to-qubit layouting |
|
fermion-to-qubit synthesis |
|
continued transpilation on the qubit-level |
|
convert from DAG data structure |
Input¶
The various transpiler passes are implemented to work with FermionicDAGCircuit as the
underlying data structure to store the circuit operations. Such directed acyclic graphs (DAGs)
provide an efficient data model for the traversal and manipulation of circuits.
However, an end-user is more likely to work with a FermionicCircuit as it provides a more
intuitive interface and data model. As such, this input stage simply runs the
FermionicCircuitToDAG transpiler pass.
Optimization¶
This stage of the transpilation pipeline can implement circuit optimizations while preserving the
type of circuit to be an instance of FermionicDAGCircuit. As such, no qubit information is
required (or necessarily available) at this point in the transpilation pipeline.
Layout¶
One global configuration setting for the transpilation process is the fermion-to-qubit “layout”. This must be provided by the user and it must match the provided fermion-to-qubit mapping (in the sense that, if a chosen mapping encodes a fixed number of fermions with a different number of qubits, the configured layout must account for that).
In the general case, fermionic modes are not always encoded with an occupation-basis into the qubit
register. Consequently, we cannot associate a single fermionic mode with a single qubit.
Therefore, the user-provided fermion-to-qubit layout (F2QLayout) associates
FermionicRegister instances with
QuantumRegister ones.
A mapping of fermionic mode registers to quantum registers. |
The way to configure this global setting, is by placing a F2QLayout instance in the
f2q_layout field of the property_set. For more details
refer to Layouting Passes.
Synthesis¶
At its core, the transpilation is handled by the F2QSynthesis transpiler pass. It is
conceptually similar to Qiskit’s HighLevelSynthesis pass, which
uses various plugins for transpiling high-level circuit instructions. For more details, refer to
the documentation of F2QSynthesis directly.
How a given FermionicGate can be synthesized in terms of qubit-based operations will
depend on the particular gate type as well as the user-chosen fermion-to-qubit mapping. For more
details, refer to Transpiler Pass Plugins.
Qubit¶
At this point in the transpilation process, we have reached a
DAGCircuit instance and can continue to use Qiskit’s transpilation
pipeline as one would usually.
Hint
Additional transpiler passes for optimizations on the qubit-level that take into account the
knowledge of a circuit originating from a FermionicCircuit may be added in the future!
Output¶
This stage implements effectively the reverse of Input, by
calling the QuantumDAGToCircuit transpiler pass.
Pass Managers¶
All of the stages above are the default stages by how the presets
orchestrate the various MultiStagePassManager.
The individual stages can be either a single pass (when they change from one internal representation
(IR) to another, such as the Input,
Synthesis, and
Output stages above) or a stage can be a
BasePassManager whose internal passes can be modified.
For the stages operating on fermionic circuits (Optimization
and Layout), the type of passmanager to use is
FermionicPassManager.
|
A transpiler pass manager converting one |
Conversion Passes¶
Some very basic conversion passes are provided directly by this module:
Converts a |
|
Converts a |
|
Converts a |
Presets¶
For user convenience, the qiskit_fermions.transpiler.presets module provides a number of
functions for quickly building pre-defined transpilation pipelines.