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

Optimization

fermionic-level optimization

Layout

fermion-to-qubit layouting

Synthesis

fermion-to-qubit synthesis

Quantum

continued transpilation on the qubit-level

Optimization

This stage of the transpilation pipeline can implement circuit optimizations while preserving the type of circuit to be an instance of FermionicCircuit. 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.

F2QLayout

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 Plugins.

Quantum

At this point in the transpilation process, we have reached QuantumCircuit 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!

Pass Managers

Qiskit’s transpilation process is orchestrated by a PassManager. In particular, a StagedPassManager can be used to orchestrate the transpilation into stages as explained above.

Here, we are dealing with a change of circuit representation converting FermionicCircuit instances to QuantumCircuit ones. As such, this module provides its own interfaces of these transpiler pass managers listed below.

Note

Qiskit is currently working on native support of transpiler pipelines involving more than a single intermediate representation. Once that gets more formalized, the implementation here will be aligned with the resulting interfaces. See also this tracking issue.

FermionicPassManager

A transpiler pass manager converting one FermionicCircuit to another.

FermionicStagedPassManager

The staged fermion-to-qubit transpilation pipeline.

FermionicToQubitConverter

A transpiler pass manager converting a FermionicCircuit to a QuantumCircuit.

Presets

For user convenience, the qiskit_fermions.transpiler.presets module provides a number of functions for quickly building pre-defined transpilation pipelines.