5.1 Greedy Approach
Qubit re-allocation (QURE) [19] is an algorithm that is performed after qubit mapping to improve the fidelity. QURE
is applied to quantum circuits that can be executed directly on target quantum hardware
after applying any DOQA algorithm. $\textit{QURE}$ takes the quantum circuit from
DOQA as an input and provides two algorithms: a greedy approach and a subgraph search.
$\textit{QURE}$’s greedy approach ranks all physical qubits in a coupling graph
in descending order based on the average two-qubit gate fidelities of individual qubits.
Furthermore, $\textit{QURE}$ ranks the physical qubits by the highest-fidelity score
fetched from the quantum hardware. As shown in Fig. 9, it is assumed that a physical qubits are ranked as follows: $Q_{5}$, $Q_{0}$, $Q_{3}$,
$Q_{7}$, $Q_{8}$, $Q_{4}$, $Q_{1}$, $Q_{6}$, and $Q_{2}$ ($Q_{5}$ is the optimal qubit
with highest fidelity). In logical qubits, it ranks all qubits in descending order
based on how many times the two-qubit gate is applied to that qubit. Thus, the ranking
list is $q_{2}$, $q_{1}$, $q_{3}$, and $q_{0}$. After ranking the best qubits, $\textit{QURE}$
starts to select the best physical qubit ($Q_{5}$) and logical qubit ($q_{2}$) and
then assigns (maps) $q_{2}$${\rightarrow}$$Q_{5}$.
Next, $\textit{QURE}$ looks around at the neighbors of $Q_{5}$ ($Q_{8}$, $Q_{4}$,
and $Q_{2}$) and selects the optimal one among them. The same occurs for the logical
qubits, among which the neighbors of $q_{2}$ are $q_{1}$ and $q_{0}$, and then $q_{1}$
is selected as an optimal one. In this step, $q_{1}$ is mapped to $Q_{5}$. The selected
logical and physical qubits will not be chosen anymore. $\textit{QURE}$ continues
looking and assigning until all logical qubits are mapped. Consequently, $\textit{QURE}$
obtains the optimal qubit mapping, as shown in Fig. 9.
Another method from $\textit{QURE}$ is subgraph search, which finds a quantum
circuit’s isomorphic subgraph from the coupling graph. This method also performs after
logical qubits of the circuit are allocated, but it will be re-allocated to increase
fidelity. Accordingly, $\textit{QURE}$ extracts an arbitrary subgraph from the coupling
graph (physical qubits) for logical qubits to map, as indicated by the dotted box
in Fig. 9. Next, $\textit{QURE}$ computes this mapping with a physical qubit to obtain a fidelity
score based on the gate error of each qubit.
As shown in Fig. 9, if the dotted box moves to the left, there is another possible mapping. Moreover,
the other two possible mappings are in the dotted box rotated by 90$^{\circ}$. There
are four possible mappings in Fig. 9. However, each mapping, such as the vertical ($V$) mapping, can be computed by flipping
horizontal ($V_{2}$), flipping vertical ($V_{4}$), and rotating 180$^{\circ}$ ($V_{3}$).
The same occurs for horizontal mapping. More formally, all possible mapping $A$
can be formulated as in Eq. (4). $Q_{v}$ and $q_{v}$ are many physical and logical qubits for vertical mapping, respectively.
$Q_{H}$ and $q_{H}$ are for horizontal mapping. Therefore, Fig. 9 shows that there will be $4\times \left(16-2+1\right)\times \left(16-2+1\right)$
or 900 possible mappings. $\textit{QURE}$’s subgraph search will compute all these
possible mappings and then select the optimal mapping (high fidelity).
Fig. 9. QURE - Greedy approach.
Fig. 10. Label logical qubit edge.
5.2 Optimization
A hardware-aware heuristic ($\textit{HA}$) mapping algorithm [16] inspired by $\textit{sabre}$ efficiently reduces additional gates by 28% and improves
fidelity as well. $\textit{HA}$ performs both swap and bridge gates for mapping. Like
$\textit{sabre}$, $\textit{HA}$ also constructs a quantum circuit to DAG and layers,
as shown in Fig. 5. $\textit{HA}$ follows the $\textit{sabre}$ heuristic search algorithm but simply
modifies the cost function $H$.
$\textit{HA}$ introduces three matrices to estimate the cost of a swap: a swap
matrix (number of swaps) $S$, a swap error matrix $E$, and a swap execution time matrix
$T$. Along with these three matrices, there are three weights ($\alpha _{1},\alpha
_{2},\alpha _{3}$) that can be tuned. More precisely, $S$, $E$, and $T$ are computed
using the Floyd-Warshall algorithm that finds the shortest paths of all pairs in a
directed graph. Computing the Floyd-Warshall algorithm requires using other weights
for each matrix ($W_{E}$,$W_{T}$,$W_{S}$). $W_{E}$ is computed using $e$, an error
rate given in the calibration data.
For example, $e\left(Q_{0},Q_{1}\right)=5$ indicates that the minimum error rate
between the logical qubits corresponding to $Q_{0}$ moving to $Q_{1}$ is 5. As shown
in equation (5), $e_{ij}$ and $e_{ji}$ refer to the error rates of $Q_{i},Q_{j}$ and $Q_{j},Q_{i}$
, respectively.
The execution time cost $W_{T}$ based on the $t$ which is also extracted from
hardware and indicates the execution time between $Q_{i}$ to $Q_{j}$ and vice versa.
The last width is $W_{S}$. It is calculated by 1 cost for 1 Swap. For instance,
it requires a minimum of 1 swap gate to move the state of $Q_{0}$ to $Q_{3}$ in Fig. 2(b). After computing the Floyd-Warshall algorithm, $\textit{HA}$ calculates the sum of
three matrices $E$, $S$, and $T$, which is referred to as the $\textit{distance matrix}$
$D$ in Eq. (7).
Another component is used to find the optimal solution between the bridge and
swap gates. Thus, to choose the optimal solution, $\textit{HA}$ computes the $\textit{Effect}$
function, as shown in Eq. (8), where the distance matrix of a bridge ($D_{$\textit{bridge}$}$) is subtracted from
$D_{swap}$.
Recently, Zhu et al. introduced two core algorithms: an expansion-from-center
scheme ($\textbf{EFC}$) and the maximum consecutive positive effect ($\textbf{MCPE}$)
of a swap gate as the heuristic cost function [27]. The $\textit{EFC}$ scheme is used in the initial mapping process. In the first $\textit{EFC}$
stage, the gate index is labeled at the edge of the logical qubit graph depending
on the first applied gate.
As illustrated in Fig. 10, the gate $g_{0}$ firstly acts on $q_{0}$ and $q_{2}$, so these qubits’ edge is the
index of $g_{0}$ or 0. These labels are used as weights in the breadth-first search
to arrange all logical qubits in a queue starting from the center logical qubit in
the graph topology. This center logical qubit is then mapped to the center physical
one, and each logical qubit in the queue is mapped to the physical qubits one by one
with the closest physical qubit.
In preparatory work for the swap-based heuristic algorithm, the dependency list
is generated by counting the dependency gates of each logical qubit, the so-called
DAG. Next, the cost distance matrix is computed as a 2D array like $W_{S}$ in $\textit{HA}$
(the number of Swaps from $Q_{i}$ to $Q_{j}$). The core algorithm is used to compute
the difference of distance of a gate applied to ($Q_{i},~ Q_{j}$) before and after
applying swaps, the so-called $\textit{Effect}$ in Eq. (9). The $dist$ function is obtained from the cost distance matrix.
Assume that the circuit in Fig. 5(a) is mapped to the coupling graph in Fig. 2(b) by initializing mapping from qubit index 0 to 5. For gate $g_{1}$, the distance neighbor
from $q_{1}$ to $q_{2}$ in the coupling graph is 1, but after applying SWAP ($q_{0},q_{1}$),
the distance is 0. Thus, the effect of this swap operation is 1 minus 0 or 1:
The $\textit{mcpe}$ function computes the sum of the cost effect of every gate
on qubits to which the swap operation is applied until $\textit{effect}(g_{i}$) is
negative. The range from the first gate to the gate with a negative effect is called
the $\textit{window}$. For instance, for the $\textit{mcpe}$ of SWAP($q_{2},q_{0}$)
on $q_{2}$, there are three gates: $g_{1}$, $g_{4}$, and $g_{5}$. The effect on $g_{1}$
is 1 (positive), and that on $g_{4}$ is -1 (negative). Thus, in $\textit{window}$,
the list contains only $g_{1}$. If there is no positive effective gate, the value
of $\textit{mcpe}$ is 0 by default.
A dynamic look-ahead algorithm is introduced as the $\textit{MCPE}$ cost function.
$\textit{MCPE}$ illustrates how much SWAP ($Q_{i}$, $Q_{j}$) can affect all the gates
on $Q_{i}$ and $Q_{j}$.
As an example, we consider the same previous assumption of using the heuristic
search algorithm to solve gate $g_{1}$. There are four solutions: SWAP($q_{0},q_{1}$),
SWAP($q_{2},q_{0}$), SWAP($q_{2},$ $q_{3}$), and SWAP($q_{1}$,$q_{3}$). First, we
consider the cost function MCPE of SWAP($q_{0},q_{1}$), which corresponds to $Q_{0}$
and $Q_{1}$.
For $mcpe$(SWAP,$q_{0}$), two gates are applied to $q_{0}$: gates $g_{3}$ and
$g_{8}$. The nearest-distance qubit in $g_{3}$ before swapping is 0 (nearby), and
after applying SWAP($q_{0}$, $q_{1}$), it is 0, so the effect on $g_{3}$ is still
0 in Eq. (9). The distance of $g_{8}$ is 1, and after swapping, it is 0; thus, the effect cost
is 1. Therefore, $\textit{mcpe}$(SWAP, $q_{0}$) is 1 in Eq. (10). For $mcpe$(SWAP,$q_{1}$), the cost effect is 2 with three CNOT gates ($g_{1},g_{3},g_{5}$).
Therefore, $\textit{MCPE}$(SWAP ($q_{0},q_{1}$)) is 2 + 1 or 3. Both $\textit{MCPEs}$
of SWAP($q_{2},q_{0}$) and SWAP($q_{1},q_{3}$) are 1, and that of SWAP($q_{2},q_{3}$)
is 2. Consequently, SWAP ($q_{0},q_{1}$) is selected to be inserted before $g_{1}$.
Table 1. Summary of qubit allocation algorithms.
Scheme
|
Type
|
Quantum Architecture
|
Speed-up
|
Algorithm Details
|
JKU
(2018)
|
DOQA
|
IBM QX3
|
Reduce the number of gates by 23% compared with baseline from IBM's solution.
|
- Partition the circuit into layers.
- Search the optimal solution by the A* algorithm.
- Searching space is $\mathrm{O }\left(\exp \left(N\right)\right).$
|
Sabre
(2019)
|
IBM Q20 Tokyo
|
Small size reduces 98.7% and large size reduces 10% compared with JKU.
|
- Compute All-Pairs Shortest Path with $\mathrm{O }\left(N^{3}\right)$ time.
- Initial mapping by reverse traversal technique.
- Swap-based search space with $\mathrm{O }\left(N\right)$ time.
- Time complexity is $\mathrm{O }\left(N^{2.5}\cdot g\right)$.
|
BMT
(2019)
|
Reduce the number of gates by 16% and 35% for depth, compared with Sabre
|
- Partition circuit using subgraph isomorphism.
- Combine mapping using Token Swapping,
- Compute 4-approximate algorithm.
|
QURE
(2019)
|
VAQ
|
IBM QX4
|
Improve fidelity 1.54x times than the baseline from Revlib.
|
- Greedy approach: rank optimal fidelity of qubits, then map qubits focus on the highest
fidelity qubits.
- Sub-graph search: compute all possible isomorphic subgraph.
|
MCPE/EFC
(2020)
|
DOQA
VAQ
|
IBM Q20 Tokyo
|
Reduce the number of gates by 22.92% compared with Sabre.
|
- Use expansion-from-center scheme to determine the initial mapping.
- Compute dynamic look-ahead cost function.
- Time complexity is $\mathrm{O }\left(N^{1.5}\cdot ~ g\right).$
|
HA
(2020)
|
IBM Q Valencia
|
8%, 19% and 38% are superior to Sabre in terms of improved fidelity, reduced execution
time and number of gates
|
- Follow heuristic search of Sabre
- Allow swap and bridge for mapping
- Compute cost function with three matrices: number of swap matrix, swap error matrix,
and execution time matrix, using Floyd-Warshall algorithm.
- Mapping requires $\mathrm{O }\left(N^{2.5}\cdot ~ g\right)$ time.
|
IBM Q Almaden
|
Reduce the number of gates by 28% against Sabre.
|