Method for development of a compiling process for a quantum circuit on a quantum processor and said method
11669764 · 2023-06-06
Assignee
Inventors
Cpc classification
G06N10/00
PHYSICS
G06F30/398
PHYSICS
G06N5/01
PHYSICS
International classification
G06N10/00
PHYSICS
G06F30/398
PHYSICS
Abstract
A method for the development of a compilation process for a quantum circuit on a quantum processor, includes an implementation step of the compilation method including an iteration loop successively including: a step of simulation of a given implementation of the logical qubits on the physical qubits of the quantum processor; a step of detecting, in the quantum circuit, ineffective quantum gate(s); a step of estimating the number of quantum swap gates to be inserted into the quantum circuit so that all of the quantum gates of the quantum circuit are effective; and a retroaction step, by way of a simulated annealing, involving a new step of simulation, until attaining, whereupon all the quantum gates are effective: either a minimum threshold of the number of estimated quantum value swap gates between two physical qubits, or a maximum threshold of iterations in the loop.
Claims
1. A method for the development of a compilation process for a quantum circuit on a quantum processor, comprising: a selection step: of a quantum circuit, of a quantum processor whereupon to compile the quantum circuit, of a set of executable quantum gates on the selected quantum processor, based on the selected quantum processor, of an optimization metric, of a heuristic or meta-heuristic, an implementation of a compilation method comprising first: a step of division of the selected quantum circuit into quantum sub-circuits, a first step of re-writing of the quantum sub-circuits comprising quantum gates non-executable by the selected quantum processor so that they comprise only quantum gates executable by the selected quantum processor, a second step of re-writing the quantum sub-circuits according to the selected heuristic or meta-heuristic, in order to obtain quantum sub-circuits comprising quantum gates executable by the selected quantum processor, improving the selected optimization metric, a step of regrouping the quantum sub-circuits into a quantum circuit compilable by the selected quantum processor, an implementation step of the compilation method successively comprising: a quantum gate acting only on neighboring physical qubits being an effective quantum gate, a quantum gate acting on at least two non-neighboring physical qubits being an ineffective quantum gate, a step of determining an implementation of logical qubits on physical qubits of the selected quantum processor, by the application of the selected heuristic or meta-heuristic, which reduces a number of ineffective quantum gates and which reduces a number of quantum value swap gates between two physical qubits to be inserted into the selected quantum circuit so that all the quantum gates of the selected quantum circuit are, that is remain or become effective quantum gates.
2. The method for the development of a compilation process for a quantum circuit on a quantum processor according to claim 1, wherein the determination step comprises: an iteration loop successively comprising: a step of simulation of a given implementation of the logical qubits on the physical qubits of the selected quantum processor, a step of detecting, in the selected quantum circuit, at least one ineffective quantum gate, a step of estimating the number of quantum value swap gates between two physical qubits to be inserted into the selected quantum circuit so that all of the quantum gates of the selected quantum circuit are, that is remain or become, effective quantum gates, a retroaction step, by means of the selected heuristic or meta-heuristic, involving a new step of simulation based on the number of quantum value swap gates between two estimated physical qubits, until attaining, whereupon the quantum gates are effective: either a minimum threshold of the number of estimated quantum value swap gates between two physical qubits, or a maximum threshold of iterations in the loop.
3. The method for development of a compilation process for a quantum circuit on a quantum processor according to claim 2 wherein: the maximum threshold of iterations in the loop is predetermined based on at least one selected quantum processor and/or quantum circuit.
4. A method for the compilation of a quantum circuit on a quantum processor, by the use of a set of quantum gates executable on the quantum processor, comprising: first: a step of division of a selected quantum circuit into quantum sub-circuits, a first step of re-writing of the quantum sub-circuits comprising quantum gates non-executable by a selected quantum processor so that they comprise only quantum gates executable by the selected quantum processor, a second step of re-writing of the quantum sub-circuits according to a selected heuristic or meta-heuristic, in order to obtain quantum sub-circuits comprising quantum gates executable by the selected quantum processor, improving a selected metric, a step of regrouping the quantum sub-circuits into a quantum circuit compiled by the selected quantum processor, subsequently: a quantum gate acting only on neighboring physical qubits being an effective quantum gate, a quantum gate acting on at least two non-neighboring physical qubits being an ineffective quantum gate, a step of determining an implementation of logical qubits on physical qubits of the selected quantum processor, by the application of the selected heuristic or meta-heuristic, which reduces a number of ineffective quantum gates and which reduces a number of quantum value swap gates between two physical qubits to be inserted into the selected quantum circuit so that all the quantum gates of the selected quantum circuit are, that is remain or become effective quantum gates.
5. The method for the compilation of a quantum circuit, on a quantum processor, by the use of a set of quantum gates executable on the selected quantum processor according to claim 4, wherein the determination step comprises: an iteration loop successively comprising: a step of simulation of a given implementation of the logical qubits on the physical qubits of the selected quantum processor, a step of detecting, in the selected quantum circuit, at least one ineffective quantum gate, a step of estimating the number of quantum value swap gates between two physical qubits to be inserted into the selected quantum circuit so that all of the quantum gates of the selected quantum circuit are, that is remain or become, effective quantum gates, a retroaction step, by means of the selected heuristic or meta-heuristic, involving a new step of simulation based on the number of quantum value swap gates between two estimated physical qubits, until attaining, whereupon all of the quantum gates are effective: either a minimum threshold of the number of estimated quantum value swap gates between two physical qubits, or a maximum threshold of iterations in the loop.
6. The method for the compilation of a quantum circuit on a quantum processor, by the use of a set of quantum gates executable on the quantum processor according to claim 5, wherein: the maximum iteration threshold in the loop is predetermined.
7. A method for the development of a compilation process for a quantum circuit on a quantum processor, comprising: a selection step: of a quantum circuit, of a quantum processor whereupon to compile the quantum circuit, of a set of executable quantum gates on the selected quantum processor, based on the selected quantum processor, an implementation of a compilation method comprising first: a step of division of the selected quantum circuit into quantum sub-circuits, a first step of re-writing of the quantum sub-circuits comprising quantum gates non-executable by the selected quantum processor so that they comprise only quantum gates executable by the selected quantum processor, a second step of re-writing of the quantum sub-circuits by application of a simulated annealing, so as to obtain quantum sub-circuits comprising quantum gates executable by the selected quantum processor, reducing a number of quantum gates, a step of regrouping the quantum sub-circuits in a quantum circuit compilable by the selected quantum processor, an implementation step of the compilation method successively comprising: a quantum gate acting only on neighboring physical qubits being an effective quantum gate, a quantum gate acting on at least two non-neighboring physical qubits being an ineffective quantum gate, an iteration loop successively comprising: a step of simulation of a given implementation of logical qubits on physical qubits of the selected quantum processor, a step of detecting , in the selected quantum circuit, at least one ineffective quantum gate, a step of estimating a number of quantum value swap gates between two physical qubits to be inserted into the selected quantum circuit so that all of the quantum gates of the selected quantum circuit are, that is remain or become, effective quantum gates, a retroaction step, by means of the simulated annealing, involving a new step of simulation based on the number of quantum value swap gates between two estimated physical qubits, until attained, whereupon all the quantum gates are effective: a either a minimum threshold of the number of estimated quantum value swap gates between two physical qubits, a or a maximum threshold of iterations in the loop.
8. The method for the development of a compilation process for a quantum circuit on a quantum processor according to claim 7, wherein: the maximum threshold of iterations in the loop is predetermined based on at least the selected quantum processor and/or quantum circuit.
9. A method for the compilation of a quantum circuit on a quantum processor, comprising: a quantum gate acting only on neighboring physical qubits being an effective quantum gate, a quantum gate acting on at least two non-neighboring physical qubits being an ineffective quantum gate, an iteration loop successively comprising: a step of simulation of a given implementation of logical qubits on physical qubits of the quantum processor, a step of detecting, in the quantum circuit, at least one ineffective quantum gate, a step of estimating a number of quantum value swap gates between two physical qubits to be inserted into the quantum circuit so that all of the quantum gates of the quantum circuit are, that is remain or become, effective quantum gates, a retroaction step, by means of simulated annealing, involving a new step of simulation based on the number of quantum value swap gates between two estimated physical qubits, until attained, whereupon all the quantum gates are effective: either a minimum threshold of the number of estimated quantum value swap gates between two physical qubits, or a maximum threshold of iterations in the loop.
10. The method for the compilation of a quantum circuit on a quantum processor, by the use of a set of quantum gates executable on the quantum processor according to claim 9, wherein: the maximum threshold of iterations in the loop is predetermined.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1) Other characteristics, details and benefits of the invention will become apparent upon reading the detailed description below, and analysis of the annexed drawings, wherein:
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
DESCRIPTION OF THE EMBODIMENTS
(11) Reference is now made to
(12) To do this, the following problem must be solved:
(13)
(14) Where f is a selectable metric and ˜.sub.R is a binary relationship so that:
C′˜.sub.RC⇔″C′ can be obtained using C by local change [Math. 2]
(15) A transformation.fwdarw..sub.L can additionally be defined, so that:
.fwdarw..sub.L: .fwdarw.
(
) [Math 3]
(16) Being a set of quantum circuits.
(17) The problem can therefore be re-written so that
(18)
(19) The method according to the invention makes it possible to select the desired metric ƒ, and any local changes.fwdarw..sub.L.
(20) More specifically, the local changes make it possible to define rules for the re-writing of the quantum circuit so that it can be compilable on a selected quantum processor. The local changes are, for example, a set of quantum gates executable on the selected quantum processor.
(21) The local changes can further comprise optimization rules, such as the insertion of quantum swap gates, as described below.
(22) The method particularly uses a heuristic or meta-heuristic, depicted by block B1 on
(23) The heuristic or meta-heuristic (hereinafter referred to as meta-heuristic) can also be selected. In particular, the meta-heuristic can be selected from among a gradient descent, a simulated annealing or even a genetic algorithm.
(24) The meta-heuristic receives in input a selected quantum circuit and a global metric as entries, depicted by block B2. The global metric can specifically be selected to decrease the number of quantum gates in the obtained compilable quantum circuit. The meta-heuristic is intended to maximize the selected global metric.
(25) To do this, the meta-heuristic further receives as input quantum sub-circuits provided by a local search, corresponding to block B3.
(26) The local search per se receives as input the selected quantum circuit as an entry. The local search is capable of effecting a separation of the quantum circuit into a plurality of sub-circuits and of determining equivalent quantum sub-circuits.
(27) An equivalent quantum sub-circuit corresponds to a different quantum sub-circuit, which, however, produces the same effects, particularly with regard to quantum operations.
(28) The equivalent sub-circuits are determined based on the authorized local changes, such as modifications of quantum gates that cannot be executed by the selected quantum processor into quantum gates that can be executed by said quantum processor.
(29) More specifically, the local search B3 implements an operation for the local modification of the quantum circuit. More specifically, a quantum sub-circuit is replaced by an equivalent quantum sub-circuit without considering the quantum circuit globally.
(30) Therefore, this modification costs little, given the size of the quantum circuit.
(31) At the end of this modification, a limited number of sub-circuits is returned to the meta-heuristic, since local search B3 only authorizes certain changes on sub-circuits, defined by the selected local changes. Therefore, the local search makes it possible to accelerate the meta-heuristic.
(32) However, these re-writings of the quantum circuit into equivalent quantum sub-circuits may lead to a deterioration of the global metric.
(33) Thus, a local optimization can be implemented by block B4. The local optimization detects the non-optimal quantum sub-circuits. A quantum sub-circuit is non-optimal if there is a strictly better equivalent quantum sub-circuit. The local optimization is intended to replace the non-optimal quantum sub-circuits by the optimal quantum sub-circuits.
(34) The local optimization uses a rated score l. For a quantum sub-circuit, the higher the score, the more optimal the quantum sub-circuit is.
(35) The quantum circuit is to be modified so that it only contains optimal sub-circuits, such as:
∀C.sub.1, C.sub.2∈.sup.2, if C.sub.1.fwdarw..sub.LC.sub.2 and l(C.sub.1)≤l(C.sub.2) then C.sub.1.fwdarw.C.sub.2 [Math 5]
(36) The operator.fwdarw.means to replace the sub-circuits C.sub.1 by C.sub.2 in all sub-circuits found by the local search.
(37) Local optimization makes local changes by decreasing gain. In other words, changes with high gains are made first. The gain is defined as the score difference between a quantum sub-circuit and an equivalent quantum sub-circuit:
gain=score.sub.local(rightmember)−score.sub.local(leftmember) [Math. 6]
(38)
(39) These optimal quantum sub-circuits are then sent to the meta-heuristic (block B2), which re-writes the quantum circuit by replacing quantum sub-circuits by an optimal quantum sub-circuit with the goal of maximizing the global metric. Finally, in block B5, the optimized and compiled quantum circuit is obtained.
(40) At this point, specific reference is made to
(41) A selection step S1 is implemented first. During the selection step S1, several elements are selected: a quantum circuit, a quantum processor whereupon the selected quantum circuit is to be compiled, a set of quantum gates that can be executed on the selected quantum processor, a metric to be maximized and a meta-heuristic.
(42) In the following example of embodiment, the selected meta-heuristic is a simulated annealing.
(43) Furthermore, the metrics target, on the one hand, the reduction of the global number of quantum gates of the compiled circuit and, on the other hand, more specifically, the reduction of the number of quantum swap gates to be inserted in the quantum circuit so that it can be compilable.
(44) A division step S2 of the quantum circuit into quantum sub-circuits is then carried out.
(45) A first re-writing step S3 is implemented on these quantum sub-circuits. More specifically, the quantum sub-circuits comprising quantum gates non-executable by the selected quantum processor are re-written so that they comprise only quantum gates executable by the selected quantum processor.
(46) Thus, the re-written quantum sub-circuits are obtained at the obtaining step S4.
(47) The first step of re-writing of the quantum sub-circuits is implemented by the local search and local optimization depicted by blocks B3 and B4 on
(48) A second re-writing step S5 of the re-written quantum sub-circuits is then carried out. The second re-writing step S5 is carried out by the simulated annealing, and is intended to maximize the global metric, defined herein as a minimization of the number of quantum gates of the quantum circuit.
(49) At the step of regrouping S6, the quantum sub-circuits are regrouped in order to obtain a quantum circuit compilable by the quantum processor, In other words, all of the quantum gates present in this quantum circuit can be executed by the quantum processor.
(50) Then, the simulated annealing determines, at the determination step S7, if the regrouped sub-circuits are optimal, i.e., that the score associated with the quantum circuit obtained at the step S6 attains a pre-determined threshold, or if the maximum number of iterations is obtained.
(51) If this is not the case, the second re-writing step S5 is implemented again in order to further optimize the obtained quantum circuit.
(52)
(53) Additionally, combinations of quantum gates that can be executed by the quantum processor can be defined to replace the quantum gates that cannot be executed.
(54) For example,
(55) Another example of rules is changing the order of the quantum gates, as shown in
(56) Furthermore, in order to comply with the metric intending to reduce the number of quantum gates, other rules are followed. For example, two identical successive quantum gates can be merged in order to become a single quantum gate, as shown in
(57) All of these rules are applied by the local search and the local optimization, the blocks B3 and B4 in order to locally optimize the quantum circuit. However, these re-written sub-circuits are reprocessed by the simulated annealing (block B1), which seeks to optimize the global metric of the circuit, i.e., to reduce the number of quantum gates. Thus, during the iteration of steps S5 to S7, the simulated annealing can choose to re-write a sub-circuit decreasing the local metric of the circuit but maximizing the global metric of the quantum circuit. The use of the simulated annealing is, therefore, particularly advantageous.
(58)
(59) Once this compiled and optimized quantum circuit is obtained, a second optimization can be implemented.
(60) This relates to making it possible for qubits to interact therebetween. In order to do this, it is possible to exchange the value of two qubits in order to draw together the qubits to be made to interact, thus making the interaction possible. Quantum swap gates can therefore be added to the circuit, in order to exchange the value of two qubits.
(61) The metric used can be modified. In this example, the selected metric is intended to obtain a quantum circuit comprising a minimum of quantum swap gates.
(62) In step S8, the local search (block B3) conducts a simulation of the implementation of the logical qubits of the quantum circuit obtained in step S7 on the physical qubits of the selected quantum processor.
(63) In step S9, this same local search detects the ineffective quantum gates in the quantum circuit. An ineffective quantum gate should be understood as a quantum gate that is to interact between two qubits and yet is unable to do so due to the fact that the qubits are not neighbors, or that they are quantum gates that are no longer to be kept.
(64) A local metric can then be defined. Particularly, the local score of an effective quantum gate is defined as depending on the number of quantum swap gates inserted in the quantum circuit. The score can therefore be equal to the number of quantum swap gates present in the quantum circuit. A quantum gate acting on two non-neighboring qubits has a local score equal to at least the infinite or strictly inferior to the score associated with an effective quantum gate.
(65) This local metric makes it possible to have a quantum circuit for which all of the quantum gates act on two neighboring qubits and therefore, for which all of the quantum gates of the quantum circuit are effective.
(66) It is also possible to force the local metric to process the gates in a particular order (the first gates first, for example) by slightly changing the local metric.
(67) Additionally, it is possible to improve the method by observing the impact of the simulation of the simulation step S8 on the following qubits.
(68) The rules of the metric make it possible to define where the quantum swap gates can be inserted into the quantum circuit. The quantum circuit can therefore be transformed in order to move the qubits of one quantum gate closer, i.e., to insert a swap gate into the quantum circuit and renumber the qubits of the quantum circuit since the swap gates change the order of the qubits.
(69) At the insertion step S10, the quantum swap gates are inserted into the quantum circuit so that all of the quantum gates of the circuit are effective. A transformation step S11 of the quantum circuit is then implemented. The simulated annealing effects a global optimization of the circuit in order to comply with the global metric, i.e., to minimize the number of quantum swap gates. In order to do this, sub-parts of the quantum circuit can be re-written, for example, by following the rules for local changes authorized by the quantum processor, in order to delete quantum swap gates.
(70) The quantum swap gates are inserted by the local search and the local optimization, blocks B3 and B4, in order to locally optimize the quantum circuit, by deleting all of the ineffective quantum gates. However, the modified quantum circuit is reprocessed by the simulated annealing which seeks to optimize the global metric of the circuit, i.e., to reduce the number of quantum gates. Thus, during the iteration of steps S8 to S11, the simulated annealing can choose to modify quantum gates from the quantum circuit, which can decrease the local metric of the circuit but maximize the global metric of the quantum circuit. The use of the simulated annealing is, therefore, also particularly advantageous.
(71) Then, at the determination step S12, if a minimum number of quantum swap gates is attained, or if a maximum number of iterations is attained, the quantum circuit is returned. This quantum circuit is compilable by the selected and optimized quantum processor.
(72) If this is not the case, the method is repeated starting from the simulation step S8.
(73)
(74) The table below shows the results of the method according to the invention in the case of the reduction of the number of quantum swap gates in relation to the prior art, for a quantum Fourier transformation application at 10, 13, 16, 20 qubits.
(75) TABLE-US-00001 TABLE 1 Method according to the invention Prior Art Number of swap Number Number gates when the of of process is swap Time swap Time stopped at 10% of Methods gates (s) gates (s) the elapsed time. QFT 10 54 0.103 20 3.52 27 QFT 13 96 0.036 32 7.23 41 QFT 16 186 0.084 62 19.32 82 QFT 20 372 0.102 103 33.46 119
(76) Therefore, it appears that the minimization of the number of swap gates with the method according to the invention is much more effective than the method used in the prior art. Furthermore, since the method according to the invention is an anytime method, the method can be interrupted without losing the optimization already completed on the quantum circuit, an optimization already much more effective than the method of the prior art, even at 10% of the elapsed time.
(77) However, the obtained quantum circuit comprises more quantum gates than the initial circuit. This is particularly due to the insertion of the quantum swap gates. As a result, those noise phenomena are amplified.
(78) One of the sources of noise is the inactivity time of the qubits.
(79) In order to reduce the inactivity of the qubits, it is possible to move certain quantum gates so that they fill the inactivity zones of the qubits.
(80) The simulated annealing seeks therefore to maximize the global metric intending to reduce the inactivity time of the qubits in the quantum circuit. The local changes authorized by the quantum processor are defined. For example, such changes are the replacement of quantum sub-circuits by an equivalent quantum sub-circuit decreasing the inactivity time of the qubits.
(81) A local metric, that the local search and local optimization seek to maximize, is to reduce the number of quantum gates in the quantum circuit.
(82) Thus, the local search and the local optimization re-write quantum sub-circuits in order to locally reduce the number of quantum gates.
(83) The simulated annealing effects a transformation of the quantum circuit obtained using these quantum sub-circuits in order to maximize the global metric.
LIST OF CITED DOCUMENTS
Non-Patent Literature
(84) For all useful purposes, the following non-patent element(s) are cited: nplcit1: Compiling SU(4) Quantum Circuits to IBM QX Architectures; nplcit2: Rule-based optimization of reversible circuits.