Compiler
Two common issues that come up when attempting to run an algorithm on specific hardware platforms include:
Gates inside of theoretical circuits are not directly compatible with the hardware’s native gateset.
Gates or circuits are specified as unitary matrices, rather than specific gate decompositions.
If True-Q™ has access to the configuration of the system, it is possible to solve both of these issues. Our compilation tools take a circuit and rewrite it using only the gates and connections specified in a given device configuration file.
Note
The same circuit can be transpiled for implementation on any number of hardware devices. Below we show an example of this.
How it Works
True-Q™ has a number of compilation tools which rely upon device-specific
configurations. The compilation tools work by applying an ordered list of built-in
and/or user-specified Pass
s to a circuit in
order, see (Compiler
for more details).
To give a feel for what a compiler definition looks like, here is the list of passes
that defines the default compiler which is used when no custom list of
Pass
s is provided:
import trueq as tq
tq.Compiler.HARDWARE_PASSES
(trueq.compilation.two_qubit.Native2Q,
trueq.compilation.common.Merge,
trueq.compilation.one_qubit.Native1Q,
trueq.compilation.common.InvolvingRestrictions,
trueq.compilation.common.RemoveEmptyCycle)
Each item in the list above is one of True-Q™’s built-in
Pass
s. Notice that
RemoveId
is applied twice; this is because the passes
in a compiler are applied sequentially and in the order listed above it is possible that
new identity gates may have appeared between the first application of
RemoveId
and the second.
Each pass takes a circuit, applies an operation, and returns an altered circuit. Details
of how this functions can be found in Compiler
.
Here are the premade Pass
s available for use
with the compiler:
Pass which adds randomly-chosen Pauli gates before all measurements in the circuit. |
|
Pass that searches |
|
A pass which ensures that any |
|
Pass that moves operations forward in time. |
|
Pass that marks cycles which contain multi-qubit gates if none of the existing non-measurement cycles in the circuit have been marked with non-zero values. |
|
Pass that marks cycles which contain multi-qubit gates if none of the existing cycles in the circuit have been marked with non-zero values. |
|
Pass that takes a list of cycles, finds compatabile labels and gates, and merges them to a single gate as much as is possible. |
|
A |
|
An |
|
An |
|
A |
|
An |
|
An |
|
An |
|
An |
|
A pass which decomposes cycles of arbitrary single-qudit gates into alternations of cycles of native gates with diagonal gates. |
|
A |
|
Tracks phase accumulation on each qubit throughout a circuit, and compiles this phase information into parametric gates. |
|
Pass which performs Randomized Compilation (RC) on groups of cycles with matching marker values by adding gates on either side of the cycles, chosen using the provided |
|
Pass which performs Randomized Compilation (RC) on groups of cycles with matching marker values by adding gates on either side of the cycles. |
|
Pass which relabels all the labels and keys in a |
|
Pass that remarks all the marked cycles. |
|
Pass which removes empty cycles from groups of cycles with matching markers. |
|
Pass that removes single qubit identity gates from one |
|
An |
|
Pass which sets all cycle markers to |