Parallel mapping method and device of quantum circuit
By dividing quantum circuits into sub-circuits and combining sliding windows and heuristic search methods, the problems of long execution time and noise interference in traditional quantum circuit mapping methods are solved, and efficient parallel mapping and routing of quantum circuits are achieved.
Patent Information
- Application Number
- CN202410777052.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-08-30
AI Technical Summary
Traditional quantum circuit mapping methods cannot provide users with convenient and fast circuit mapping functions in actual calculations, and are difficult to meet user needs for minimizing circuit execution time and reducing noise interference.
The quantum circuit to be executed is divided into multiple sub-circuits through the line segmentation method, and a mapping method combining sliding window and heuristic search is used to perform local search. Combined with the inter-mapping routing algorithm, the parallel mapping process of the quantum circuit is optimized.
It reduces the execution time of mapping and routing, improves the execution efficiency of parallel mapping and routing of quantum circuits, reduces the depth of the search line, and achieves faster quantum circuit mapping.
Smart Images

Figure CN118569401A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of quantum information technology, and more specifically, to a parallel mapping method and device for quantum circuits. Background Art
[0002] In a quantum computer, the execution of a quantum algorithm generally requires multiple steps, including program generation, hardware-related program compilation, and actual hardware execution. Before executing a quantum program in a quantum computer, the input logical quantum circuit needs to be mapped to a physical quantum circuit that complies with the connectivity restrictions of the corresponding quantum computer, and the quantum circuits before and after the mapping are functionally the same.
[0003] However, traditional quantum circuit mapping methods cannot provide users with convenient and fast circuit mapping functions in actual calculations, and it is difficult to meet user needs such as minimizing circuit execution time and reducing noise interference. Summary of the invention
[0004] In view of this, the present disclosure provides a parallel mapping method and device for quantum circuits.
[0005] One aspect of the present disclosure provides a parallel mapping method for a quantum circuit, comprising: based on the depth of the quantum circuit to be executed and a preset segmentation depth, segmenting the quantum circuit to be executed to obtain M subcircuits to be executed; for the mth subcircuits to be executed, locally searching the initial mapping result of the mth subcircuits to be executed based on a sliding window to obtain a subcircuit mapping result of the mth subcircuit to be executed, wherein the initial mapping result of the mth subcircuit to be executed represents an execution mode of a plurality of quantum bits included in the initial mapping of the mth subcircuit to be executed, and the initial mapping represents mapping the plurality of quantum bits to initial positions on a quantum chip structure in sequence according to a preset order; routing the subcircuit mapping result of the m-1th subcircuit to be executed and the initial mapping of the mth subcircuit to be executed by using an inter-mapping routing algorithm to obtain an inter-mapping routing result between the m-1th subcircuit to be executed and the mth subcircuit to be executed; and obtaining a mapping result of the quantum circuit to be executed based on the inter-mapping routing results between the M subcircuits to be executed and the subcircuit mapping results of each of the M subcircuits to be executed.
[0006] Another aspect of the present disclosure provides a parallel mapping device for a quantum circuit, comprising: a circuit segmentation module, used to segment the quantum circuit to be executed based on the depth of the quantum circuit to be executed and a preset segmentation depth, to obtain M sub-circuits to be executed; a search module, used to perform a local search on the initial mapping result of the m-th sub-circuit to be executed based on a sliding window for the m-th sub-circuit to be executed, to obtain a sub-circuit mapping result of the m-th sub-circuit to be executed, wherein the initial mapping result of the m-th sub-circuit to be executed represents the execution of multiple quantum bits included in the initial mapping of the m-th sub-circuit to be executed. The initial mapping means mapping the multiple quantum bits to the initial positions on the quantum chip structure in sequence according to a preset order; the routing module is used to use an inter-mapping routing algorithm to route the sub-circuit mapping result of the m-1th sub-circuit to be executed and the initial mapping of the mth sub-circuit to be executed, so as to obtain the inter-mapping routing result between the m-1th sub-circuit to be executed and the mth sub-circuit to be executed; the determination module is used to obtain the mapping result of the quantum circuit to be executed based on the inter-mapping routing result between the M sub-circuits to be executed and the sub-circuit mapping results of each of the M sub-circuits to be executed.
[0007] Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0008] Another aspect of the present disclosure provides a computer-readable storage medium having a computer program or instruction stored thereon, wherein the computer program or instruction implements the steps of the above method when executed by a processor.
[0009] Another aspect of the present disclosure provides a computer program product, including a computer program or instructions, which implement the steps of the above method when executed by a processor.
[0010] According to the embodiments of the present disclosure, a quantum circuit to be executed is segmented by a circuit segmentation method to obtain multiple subcircuits to be executed, so as to realize parallel mapping of multiple subcircuits to be executed, thereby reducing the execution time of mapping and routing. In addition, a mapping method based on a combination of heuristic search and sliding window local search obtains subcircuit mapping results of multiple subcircuits to be executed, and limits the search space of the mapping execution mode in each subcircuit to be executed by the window, while keeping the mapping execution mode obtained by the search as the optimal solution, the circuit depth of the search can also be reduced, thereby improving the execution efficiency of parallel mapping and routing of quantum circuits. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0012] Figure 1 The exemplary system architecture of the parallel mapping method and device to which quantum circuits can be applied according to the embodiments of the present disclosure is schematically shown;
[0013] Figure 2 A flowchart of a parallel mapping method of a quantum circuit according to an embodiment of the present disclosure is schematically shown;
[0014] Figure 3 A flowchart of a parallel mapping method of a quantum circuit according to an embodiment of the present disclosure is schematically shown;
[0015] Figure 4 A flowchart of a method for adaptively adjusting the depth of a sliding window according to an embodiment of the present disclosure is schematically shown;
[0016] Figure 5 A schematic diagram schematically shows the test effect of the greedy method according to a specific embodiment of the present disclosure;
[0017] Figure 6 A schematic diagram schematically shows the parallel mapping effect of a quantum circuit according to a specific embodiment of the present disclosure;
[0018] Figure 7 A block diagram schematically shows a parallel mapping device for a quantum circuit according to an embodiment of the present disclosure; and
[0019] Figure 8 A block diagram of an electronic device suitable for implementing a parallel mapping method for quantum circuits according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0020] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0021] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0022] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0023] Quantum computers are physical devices that follow the laws of quantum mechanics to perform high-speed mathematical and logical operations, store and process quantum information. In a quantum computer, the execution of a quantum algorithm generally requires multiple steps, including program generation, hardware-related program compilation, and actual hardware execution. Among them, quantum program generation starts from the quantum algorithm and converts the calculation process in the algorithm into a quantum program circuit. The implementation of any quantum algorithm requires first designing the corresponding quantum functions and quantum circuits, and using appropriate quantum gates and quantum functions to solve the target problem.
[0024] Hardware-related program compilation is to map the quantum program circuit generated in the previous step to the target hardware for execution. The primary goal of program compilation is to solve the problem that the program circuit may not be directly executed on the target hardware during execution. Since the physical quantum bits in the quantum computer have direct connectivity restrictions, two-qubit quantum operations can only be performed between specific physical quantum bit pairs. Therefore, before executing the quantum program in the quantum computer, the input logical quantum circuit needs to be mapped to a physical quantum circuit that meets the connectivity restrictions of the corresponding quantum computer, and the quantum circuits before and after the mapping are functionally the same.
[0025] However, traditional quantum circuit mapping methods cannot provide users with convenient and fast circuit mapping functions in actual calculations, and it is difficult to meet user needs such as minimizing circuit execution time and reducing noise interference.
[0026] In view of this, the embodiment of the present disclosure divides the quantum circuit to be executed by a circuit segmentation method to obtain multiple sub-circuits to be executed, so as to realize parallel mapping of multiple sub-circuits to be executed, thereby reducing the execution time of mapping and routing. In addition, a mapping method based on a combination of heuristic search and sliding window local search obtains sub-circuit mapping results of multiple sub-circuits to be executed, and limits the search space of the mapping execution mode in each sub-circuit to be executed by sliding window. While keeping the mapping execution mode obtained by the search as the optimal solution, the circuit depth of the search can also be reduced, thereby improving the execution efficiency of parallel mapping and routing of quantum circuits.
[0027] Specifically, the embodiments of the present disclosure provide a method and device for parallel mapping of quantum circuits. The method includes segmenting the quantum circuit to be executed based on the depth of the quantum circuit to be executed and the preset segmentation depth to obtain M subcircuits to be executed; for the mth subcircuits to be executed, the initial mapping result of the mth subcircuits to be executed is locally searched based on the sliding window to obtain the subcircuit mapping result of the mth subcircuit to be executed, wherein the initial mapping result of the mth subcircuit to be executed represents the execution mode of multiple quantum bits included in the initial mapping of the mth subcircuit to be executed, and the initial mapping represents mapping multiple quantum bits to the initial positions on the quantum chip structure in sequence according to a preset order; using the inter-mapping routing algorithm, the subcircuit mapping result of the m-1th subcircuit to be executed and the initial mapping of the mth subcircuit to be executed are routed to obtain the inter-mapping routing result between the m-1th subcircuit to be executed and the mth subcircuit to be executed; based on the inter-mapping routing result between the M subcircuit to be executed and the subcircuit mapping results of each of the M subcircuit to be executed, the mapping result of the quantum circuit to be executed is obtained.
[0028] It should be noted that the parallel mapping method and device of quantum circuits determined in the embodiments of the present disclosure can be used in the field of quantum information technology, such as the field of quantum circuit mapping technology and the field of quantum computing technology. The parallel mapping method and device of quantum circuits determined in the embodiments of the present disclosure can also be used in any field other than the field of quantum information technology, and the application field of the parallel mapping method and device of quantum circuits determined in the embodiments of the present disclosure is not limited.
[0029] Figure 1 The exemplary system architecture of the parallel mapping method and device of quantum circuits according to the embodiment of the present disclosure is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0030] like Figure 1 As shown, the system architecture according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 includes but is not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof, and the network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0031] The user can use the first terminal device 101 , the second terminal device 102 , and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc.
[0032] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0033] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0034] It should be noted that the parallel mapping method of the quantum circuit provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the parallel mapping device of the quantum circuit provided in the embodiment of the present disclosure can generally be set in the server 105. The parallel mapping method of the quantum circuit provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the parallel mapping device of the quantum circuit provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Alternatively, the parallel mapping method of the quantum circuit provided in the embodiment of the present disclosure can also be executed by the first terminal device 101, the second terminal device 102, and the third terminal device 103, or can also be executed by other terminal devices different from the first terminal device 101, the second terminal device 102, and the third terminal device 103. Correspondingly, the parallel mapping device of the quantum circuit provided in the embodiment of the present disclosure can also be set in the first terminal device 101, the second terminal device 102, the third terminal device 103, or in other terminal devices different from the first terminal device 101, the second terminal device 102, the third terminal device 103.
[0035] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0036] According to the embodiments of the present disclosure, a quantum program can be composed of a quantum circuit, a measurement operation on a quantum bit in the quantum circuit, a register for storing the measurement result, and a control flow node. A quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution process of a quantum program is the process of executing all quantum logic gates in a certain time sequence. Among them, the time sequence can represent the time order in which a single quantum logic gate is executed, and each quantum logic gate corresponds to a linear mapping.
[0037] According to the embodiments of the present disclosure, the most basic unit in quantum computing is the bit, and the most basic control mode is the logic gate, which can achieve the purpose of controlling the circuit by combining logic gates. Similarly, the way to process quantum bits is quantum logic gates. Quantum logic gates are the basis of quantum circuits. Quantum logic gates include single-bit quantum logic gates and multi-bit quantum logic gates, among which single-bit quantum logic gates can include Pauli gates, Hadamard gates, rotation gates, etc. Multi-bit quantum logic gates can include control NOT gates, control phase gates, etc.
[0038] According to an embodiment of the present disclosure, the numbering of quantum bits can be represented by digital subscripts in quantum algorithms or quantum programs. For example, a group of quantum bits is q0, q1, and q2, which can represent the 0th, 1st, and 2nd quantum bits respectively.
[0039] Figure 2 The flowchart of the parallel mapping method of quantum circuits according to an embodiment of the present disclosure is schematically shown.
[0040] like Figure 2 As shown, the method includes operations S210 to S240.
[0041] In operation S210, based on the depth of the quantum circuit to be executed and a preset segmentation depth, the quantum circuit to be executed is segmented to obtain M sub-circuits to be executed.
[0042] According to an embodiment of the present disclosure, before the quantum circuit to be executed is segmented, the quantum circuit to be executed and the structure of the quantum chip to be executed can be obtained, wherein the quantum chip to be executed can be used to characterize a quantum chip that can be adapted to run with the quantum circuit to be executed. The quantum chip to be executed may include a topological structure and calibration information of quantum bits, wherein the number of physical quantum bits contained in the topological structure of the quantum chip to be executed is greater than or equal to the number of logical quantum bits in the quantum circuit to be executed.
[0043] According to the embodiments of the present disclosure, for the sake of distinction, the quantum bit structure in the quantum chip is generally referred to as a physical quantum bit, and the object bit operated in the quantum circuit is referred to as a logical quantum bit. The mapping relationship between the logical quantum bit and the physical quantum bit refers to the "corresponding" relationship between the logical quantum bit and the physical quantum bit. The quantum swap gate (SWAP) gate can be used to exchange information on two quantum bits.
[0044] According to an embodiment of the present disclosure, the depth of a quantum circuit can be used to characterize the total time required for a quantum circuit consisting of a series of continuous quantum gate operations, that is, the total number of time steps of quantum gate operations in the quantum circuit. A quantum gate operation usually includes two parts: a rotation operation and a control operation. The rotation operation is used to apply a specific unitary transformation to a quantum bit, and the control operation can use the interaction between one or more quantum bits as part of the operation. The depth of a quantum circuit can be used to reflect the complexity of operations and the resources consumed in quantum computing.
[0045] According to an embodiment of the present disclosure, based on the depth of the quantum circuit to be executed, a circuit segmentation method can be used to segment the quantum circuit to be executed. Specifically, based on the depth of the quantum circuit to be executed, the quantum circuit to be executed is segmented into M sub-circuits to be executed according to a preset segmentation depth. Where M≥1. For example, the quantum circuit to be executed is segmented according to the preset segmentation depth, and the expression of the obtained sub-circuits to be executed is as follows:
[0046] (1);
[0047] In the formula, m represents the number of sub-circuits to be executed, D P represents the circuit depth of the quantum circuit to be executed, Indicates the preset segmentation depth.
[0048] In operation S220, for the mth sub-circuit to be executed, a local search is performed on the initial mapping result of the mth sub-circuit to be executed based on the sliding window to obtain a sub-circuit mapping result of the mth sub-circuit to be executed.
[0049] According to an embodiment of the present disclosure, for each subcircuit to be executed, an initial mapping is given, and the initial mapping result from the logical quantum bit to the physical quantum bit is determined. Among them, the initial mapping can be used to characterize the initial position of multiple quantum bits mapped to the quantum chip structure in sequence according to a preset order, and the initial mapping result can be used to characterize the subcircuit execution mode included on the basis of mapping one or more quantum bits to the physical quantum bits of the quantum chip structure to be executed in sequence according to a preset order. The subcircuit execution mode may include the execution mode in which multiple quantum bits are executed in sequence according to a preset order and a newly added quantum exchange gate. Compared with the input initial circuit, the operation of the quantum exchange gate is added. Among them, the preset order may include the arrangement order and numbering order of the logical quantum bits. According to an embodiment of the present disclosure, a heuristic search method and / or a local search method can be used to traverse and optimize the initial mapping result of each subcircuit to be executed, and the optimal solution of the mapping mode of each subcircuit to be executed can be obtained.
[0050] According to an embodiment of the present disclosure, given an initial mapping, a sliding window is used to perform a local search on multiple execution modes of each sub-circuit to be executed to obtain a sub-circuit mapping result for each sub-circuit to be executed. The sub-circuit mapping result can be used to characterize the execution mode with the shallowest depth among the multiple execution modes.
[0051] According to an embodiment of the present disclosure, a sliding window can be used to perform a local search on the initial mapping result of each sub-circuit to be executed. The window can be set according to the total number of time steps of the actual sub-circuit to be executed. For example, a window with a depth of 5 is subdivided into 5 windows, each with a depth of 1. If the starting depth and the ending depth of the current window are set to [0, 1], the window can slide in a depth interval of 0-5 to change the sampling interval.
[0052] In operation S230, the subcircuit mapping result of the m-1th to-be-executed subcircuit and the initial mapping of the mth to-be-executed subcircuit are routed using an inter-mapping routing algorithm to obtain an inter-mapping routing result between the m-1th to-be-executed subcircuit and the mth to-be-executed subcircuit.
[0053] According to an embodiment of the present disclosure, after obtaining the sub-circuit mapping results of multiple sub-circuits to be executed, an inter-mapping routing method is adopted to route the final mapping of the sub-circuit mapping result of the m-1th sub-circuit to be executed to the initial mapping of the mth sub-circuit to be executed, so as to obtain the inter-mapping routing result of each sub-circuit to be executed.
[0054] In operation S240, a mapping result of the quantum circuit to be executed is obtained based on the inter-mapping routing results between the M sub-circuits to be executed and the sub-circuit mapping results of each of the M sub-circuits to be executed.
[0055] According to an embodiment of the present disclosure, the inter-mapping routing results between M subcircuits to be executed and the respective subcircuit mapping results are concatenated to obtain the target mapping result of the quantum circuit to be executed.
[0056] The embodiment of the present disclosure divides the quantum circuit to be executed by a circuit segmentation method to obtain multiple sub-circuits to be executed, so as to realize parallel mapping of multiple sub-circuits to be executed, thereby reducing the execution time of mapping and routing. In addition, a mapping method based on a combination of heuristic search and sliding window local search obtains sub-circuit mapping results of multiple sub-circuits to be executed, and limits the search space of the mapping execution mode in each sub-circuit to be executed by sliding window, while keeping the mapping execution mode obtained by the search as the optimal solution, the circuit depth of the search can also be reduced, thereby improving the execution efficiency of parallel mapping and routing of quantum circuits.
[0057] According to an embodiment of the present disclosure, for the mth sub-circuit to be executed, a local search is performed on the initial mapping result of the mth sub-circuit to be executed based on a sliding window to obtain a sub-circuit mapping result of the mth sub-circuit to be executed, including: using multiple windows with a depth of k and a step size of 1, a local search is performed on the sub-circuit execution mode within n windows included in the initial mapping result of the mth sub-circuit to be executed to obtain the mapping results within the n windows; based on the mapping results within the n windows, the sub-circuit mapping result of the mth sub-circuit to be executed is obtained.
[0058] According to an embodiment of the present disclosure, the window size can be set by parameters such as depth and step size according to the number of quantum gate operations actually to be executed in the subcircuit.
[0059] Specifically, in the embodiment of the present disclosure, multiple windows with a depth of k and a step size of 1 can be used to perform a local search on the sub-circuit execution modes in the n windows included in the initial mapping results of the m-th sub-circuit to be executed under a given initial mapping condition, and obtain the mapping results in the n windows. Based on the mapping results in the n windows, the sub-circuit mapping result of the m-th sub-circuit to be executed is obtained. Wherein, k and n are both positive integers.
[0060] According to an embodiment of the present disclosure, a local search is performed on the subcircuit execution mode in n windows included in the initial mapping result of the mth subcircuit to be executed using multiple windows with a depth of k and a step size of 1, and the mapping results in n windows are obtained, including: for the i-th window, based on the search cost threshold, a breadth-first search algorithm is used to traverse and search the executable modes of the quantum gates respectively included in the windows with a depth of k, to obtain multiple subcircuit candidate mapping results; based on the multiple subcircuit candidate mapping results, a submapping result corresponding to the i-th window is obtained; based on the in-window mapping results corresponding to each window, n in-window mapping results are obtained.
[0061] According to an embodiment of the present disclosure, based on the sliding position of the i-th window with a depth of k and a step size of 1 at the current moment, a mapping of the i-1th window result is obtained as an initial mapping within the i-th window.
[0062] According to an embodiment of the present disclosure, the search cost can be used to characterize the path consumption required to traverse all search nodes using a breadth-first search algorithm. The search cost threshold can be set according to the number of multiple mapping execution modes of the quantum gate included in each window in the subcircuit to be executed. According to an embodiment of the present disclosure, based on the search cost threshold, the breadth-first search algorithm is used to traverse and search the executable modes of the quantum gate included in the window with a depth of k, and multiple subcircuit candidate mapping results in the i-th window are obtained.
[0063] According to an embodiment of the present disclosure, the plurality of subcircuit candidate mapping results include an executable mode with the fastest execution speed among the executable modes of all quantum gates in the i-th window.
[0064] According to an embodiment of the present disclosure, based on multiple sub-line candidate mapping results under the current window, the in-window mapping result corresponding to the i-th window is determined, and based on the in-window mapping results corresponding to each window, the n in-window mapping results of the m-th sub-line to be executed are obtained.
[0065] According to an embodiment of the present disclosure, when the i-th window is the first n-k' window, i.e., i∈[1, n-k'], the first layer of the execution scheme of the mapping result with the smallest depth among the multiple sub-line candidate mapping results in the current window can be used as the mapping result in the window corresponding to the current window. Wherein, k' represents the depth of the sub-line mapping result with a sub-line end depth of k.
[0066] For example, for a window with a depth of 5 and a step size of 1, and the final result depth of the sub-line to be executed is 10, it means that 6 windows can be included in the interval of n∈[1,10], or it can be said that a sliding window can slide n-k'=5 times in the interval of n∈[1,10]. In the case of i∈[1,5], for any of the first 5 windows, the first layer of the execution scheme of the mapping result with the smallest depth in the sub-line candidate mapping result in the current window can be used as the mapping result in the window corresponding to the current window.
[0067] According to an embodiment of the present disclosure, when the i-th window is the n-k'+1-th window, ie, i=n-k'+1, the sub-mapping result corresponding to the i-th window is represented as the entire result (all layers) of the execution scheme.
[0068] Specifically, when the original depth of the line is k, that is, the original depth of the end is k and the result depth is k', only one mapping result can be obtained, that is, the mapping result in one window. When the original depth of the line is less than k, it can be executed only once, that is, n=1; when the original depth of the line is greater than k, the number of executions n is the line result depth n+k'-1 minus the mapping result k' of the sub-line with the original depth k at the end plus 1 (the last window is executed once), that is, n = n+k'-1 - k' + 1.
[0069] For example, for a window with a depth of 5 and a step size of 1, and the final result depth of the sub-circuit to be executed is 10, it means that 6 windows can be included in the interval of n∈[1,10], or it can mean that a sliding window can slide nk=5 times in the interval of n∈[1,10]. In the case of i=6, for the 6th sliding window, all layers of the mapping result in the current window can be used as the mapping result in the window corresponding to the current window.
[0070] According to an embodiment of the present disclosure, the in-window mapping result corresponding to each window is recorded, and n in-window mapping results are generated based on the in-window mapping result corresponding to each window.
[0071] Reference below Figure 3 , the method for generating the sub-mapping result is further explained in conjunction with a specific embodiment.
[0072] Figure 3 The flowchart of the parallel mapping method of quantum circuits according to an embodiment of the present disclosure is schematically shown.
[0073] like Figure 3 As shown, the subcircuit P to be executed includes n layers, and a window with a depth of 3 can be used as an initial window to perform local search on layers 1 to 3, layers 2 to 4, ..., n-2 to n included in the subcircuit P to be executed.
[0074] For example, a local search is performed on the executable mode of each quantum gate in the original circuit of layers 1 to 3 in the first window, and the obtained subcircuit candidate mapping result can be expressed as ,in, represents a given initial mapping, represents the mapping result in the first window, and C represents the quantum chip structure to be executed. The sub-circuit mapping results corresponding to the first to third windows can be expressed as follows (assuming that the mapping results have only three layers):
[0075] (2);
[0076] In the formula, , , They respectively represent the corresponding sub-line mapping results in the first window.
[0077] The first layer of the sub-line candidate mapping result under the first window As the in-window mapping result p1 corresponding to the first window, after saving the in-window mapping result p1 corresponding to the first window, the executed quantum gate corresponding to the in-window mapping result of the first layer is deleted from the sub-circuit to be executed P, and the remaining sub-circuit to be executed is saved.
[0078] Based on the remaining sub-circuits to be executed, a local search is performed on the first three layers of executable modes of the remaining sub-circuits to be executed P in the second window, and the sub-circuit mapping result can be expressed as ,in, Indicates the mapping after p0 is executed. Indicates the mapping result within the window under the second window. Among them, the sub-line mapping result corresponding to the second window line can be expressed as follows (assuming that the mapping result has only three layers):
[0079] (3);
[0080] In the formula, , , They respectively represent the sub-line mapping results corresponding to the second window line.
[0081] Map the first layer of the sub-line mapping result under the second window As the in-window mapping result p2 corresponding to the second window, after saving the in-window mapping result p2 corresponding to the second window, the executed quantum gate corresponding to the in-window mapping result of the second layer is deleted from the sub-circuit P to be executed, and the remaining sub-circuit P to be executed is saved.
[0082] For the remaining sub-circuits P to be executed, continue to iterate the above process until the last three layers of circuits, that is, the n-2th to nth layers of circuits, remain in the sub-circuit P to be executed.
[0083] For the n-2th to nth layer lines, all the mapping results in the n-2th window need to be saved.
[0084] Specifically, a local search is performed on the executable modes included in the n-2~n layers of the circuit in the n-2th window, and the sub-circuit mapping result can be expressed as ,in, Indicates the mapping status after the mapping results in the previous n-1 windows are executed. Indicates the sub-line mapping result under the n-2th window. Among them, the sub-line mapping result corresponding to the n-2~n-layer line can be expressed as follows (assuming that the mapping result has only three layers):
[0085] (4);
[0086] In the formula, , , They respectively represent the sub-circuit mapping results corresponding to the n-2~n layer circuits.
[0087] The sub-line mapping result under the n-2th window is used as the mapping result p in the window n-2 . Save the mapping result p in the window corresponding to the n-2th window n-2 After that, the mapping result within each window can be expressed as , assuming that the mapping result has only n layers, where the mapping result within the window corresponding to each window It can be expressed as:
[0088] (5);
[0089] In the formula, Represents the in-window mapping result corresponding to each window.
[0090] The embodiment of the present disclosure obtains the mapping result in the window of each subcircuit to be executed based on a mapping method combining heuristic search and sliding window local search. The search space of the mapping execution mode in each subcircuit to be executed is limited by the window. While keeping the mapping execution mode obtained by the search as the optimal solution, the circuit depth of the search can be reduced, thereby improving the execution efficiency of parallel mapping and routing of quantum circuits.
[0091] According to an embodiment of the present disclosure, for the mth sub-circuit to be executed, a local search is performed on the initial mapping result of the mth sub-circuit to be executed based on the window to obtain the sub-circuit mapping result of the mth sub-circuit to be executed, including: using multiple windows with a step size of 1, a local search is performed on the sub-circuit execution mode within the window included in the initial mapping result of the mth sub-circuit to be executed, and the mapping results within n windows are obtained, wherein, for the ith window, the depth of the ith window is determined based on the depth of the current window, the search cost threshold and the search cost under the i-1th window; based on the mapping results within the n windows, the sub-circuit mapping result of the mth sub-circuit to be executed is obtained.
[0092] According to an embodiment of the present disclosure, in the process of mapping and routing quantum circuits to be executed, a heuristic search algorithm can be used to adaptively adjust the depth of the window based on the search cost under the current window to improve the computational efficiency of the heuristic search algorithm.
[0093] Specifically, in the embodiment of the present disclosure, multiple windows with a step size of 1 and adaptive depth adjustment can be used to perform local search on the mapping results in n windows included in the sub-line mapping result of the m-th sub-line to be executed, obtain the mapping results in n windows, and obtain the sub-line mapping result of the m-th sub-line to be executed based on the mapping results in n windows. The depth of the i-th window is determined based on the depth of the current window, the search cost threshold, and the search cost under the i-1-th window.
[0094] According to an embodiment of the present disclosure, the search cost under a window can be used to characterize the path consumption required for the mapping execution mode of traversing all quantum gates in the window using a breadth-first search algorithm. The search cost threshold can be set according to the number of multiple mapping execution modes of the quantum gates included in each window in the mth subcircuit to be executed. For example, the number of mapping execution modes of the quantum gates included in the first window is 2000, and the search cost threshold can be set to 2000.
[0095] According to an embodiment of the present disclosure, the depth of the i-th window is determined based on the depth of the current window, the search cost threshold and the search cost under the i-1th window, including: when the depth of the current window is greater than 1, if the search cost under the i-1th window is greater than the first search cost threshold, the depth of the i-1th window is adjusted downward to obtain the depth of the i-th window; if the search cost under the i-1th window is less than the second search cost threshold, the depth of the i-1th window is adjusted upward to obtain the depth of the i-th window.
[0096] According to an embodiment of the present disclosure, the depth of the current window being greater than 1 may indicate that the mth sub-circuit to be executed includes multiple layers of circuits.
[0097] According to an embodiment of the present disclosure, a first search cost threshold and a second search cost threshold are set based on the number of multiple execution modes of the quantum gates included in each window of the multi-layer circuit included in the mth sub-circuit to be executed. The first search cost threshold can be used to characterize the maximum value of the search cost threshold, and the second search cost threshold can be used to characterize the minimum value of the search cost threshold.
[0098] According to an embodiment of the present disclosure, when the depth of the current window is greater than 1, the search cost, the first search cost threshold and the second search cost threshold under the (i-1)th window are obtained.
[0099] According to an embodiment of the present disclosure, the search cost under the i-1th window is compared with the first search cost threshold to obtain a first comparison result, and the search cost under the i-1th window is compared with the second search cost threshold to obtain a second comparison result.
[0100] According to an embodiment of the present disclosure, the depth of the i-1th window is adjusted based on the first comparison result and the second comparison result, so as to obtain the depth of the i-th window.
[0101] According to an embodiment of the present disclosure, when the first comparison result indicates that the search cost under the i-1th window is greater than the first search cost threshold, the depth of the i-1th window may be adjusted downward to obtain the depth of the i-th window. When the first comparison result indicates that the search cost under the i-1th window is less than or equal to the first search cost threshold, the depth of the i-1th window may not be adjusted.
[0102] For example, if the first search cost threshold is configured as 2000, and the search cost under the first window is 3000, it means that the search cost under the first window is greater than the first search cost threshold. In this case, the depth of the first window can be reduced by 1 depth based on the current depth to obtain the depth of the second window. If the first search cost threshold is configured as 2000, and the search cost under the first window is 1000, it means that the search cost under the first window is less than the first search cost threshold. In this case, the depth of the first window can be left unchanged and the depth of the first window can be used as the depth of the second window.
[0103] According to an embodiment of the present disclosure, when the second comparison result indicates that the search cost under the i-1th window is less than the second search cost threshold, the depth of the i-1th window may be adjusted upward to obtain the depth of the i-th window. When the second comparison result indicates that the search cost under the i-1th window is greater than or equal to the second search cost threshold, the depth of the i-1th window may not be adjusted.
[0104] For example, if the second search cost threshold is configured as 2000, and the search cost under the first window is 1000, it means that the search cost under the first window is less than the second search cost threshold. In this case, the depth of the first window can be increased by 1 depth based on the current depth to obtain the depth of the second window. If the second search cost threshold is configured as 2000, and the search cost under the first window is 3000, it means that the search cost under the first window is greater than the second search cost threshold. In this case, the depth of the first window can be left unchanged, and the depth of the first window can be used as the depth of the second window.
[0105] According to another embodiment of the present disclosure, when the first comparison result indicates that the search cost under the i-1th window is less than or equal to the first search cost threshold, the depth of the i-1th window may not be adjusted, and the search cost under the i-1th window may be compared with the second search cost threshold to obtain a third comparison result. If the third comparison result indicates that the search cost under the i-1th window is greater than or equal to the second search cost threshold and less than or equal to the first search cost threshold, the depth of the i-1th window may not be adjusted, and the depth of the i-1th window may be used as the depth of the i-th window. For example, the depth of the first window may not be adjusted, and the depth of the first window may be used as the depth of the second window.
[0106] According to another embodiment of the present disclosure, when the second comparison result indicates that the search cost under the i-1th window is greater than or equal to the second search cost threshold, the depth of the i-1th window may not be adjusted, and the search cost under the i-1th window may be compared with the first search cost threshold to obtain a fourth comparison result. If the fourth comparison result indicates that the search cost under the i-1th window is greater than or equal to the second search cost threshold and less than or equal to the first search cost threshold, the depth of the i-1th window may not be adjusted, and the depth of the 1st window may be used as the depth of the i-th window.
[0107] In an embodiment of the present disclosure, when the depth of the subcircuit to be executed is greater than 1, the depth of the next window is adaptively adjusted based on the search cost and the search cost threshold in the current window to improve the search efficiency of the mapping execution mode of the quantum gates included in each window.
[0108] According to an embodiment of the present disclosure, the method further includes: for the mth sub-line to be executed, when the depth of the current window is equal to 1, using a greedy algorithm to determine the intra-window mapping result of the current window.
[0109] According to an embodiment of the present disclosure, when the depth of the current window is equal to 1, a greedy algorithm may be used to determine the intra-window mapping result of the current window.
[0110] According to an embodiment of the present disclosure, a greedy algorithm can be used to obtain a local optimal solution based on a current situation and a certain optimization measure without considering possible overall situations, thereby reducing a large amount of time spent on finding the optimal solution.
[0111] According to an embodiment of the present disclosure, determining the intra-window mapping result in the window by using a greedy algorithm includes: performing a local search on any quantum gate included in the current window to obtain the intra-window mapping result of the current window.
[0112] Specifically, when the depth of the current window is equal to 1, any quantum gate included in the current window is selected for local search to obtain the optimal solution of the mapping execution method corresponding to the quantum gate, and the optimal solution of the mapping execution method corresponding to the quantum gate is used as the sub-circuit mapping result of the current window.
[0113] According to an embodiment of the present disclosure, determining the subcircuit mapping result of the current window using a greedy algorithm further includes: using a direct execution mode of multiple currently executable quantum gates included in the current window as the subcircuit mapping result of the current window.
[0114] Specifically, when the depth of the current window is equal to 1, all executable quantum gates in the mth subcircuit to be executed can be directly executed without considering enumerating all possible execution modes, and the direct execution mode of all executable quantum gates in the mth subcircuit to be executed is used as the subcircuit mapping result of the mth subcircuit to be executed.
[0115] Reference below Figure 4 , the depth adaptive adjustment method of the window is further explained in combination with a specific embodiment.
[0116] Figure 4 The flowchart of the method for adaptively adjusting the depth of a window according to an embodiment of the present disclosure is schematically shown.
[0117] like Figure 4 As shown, the method for adaptively adjusting the depth of a window includes operations S401 to S409.
[0118] In operation S401, the circuit depth of the mth subcircuit to be executed is obtained, and operation S402 is performed to determine whether the circuit depth of the mth subcircuit to be executed is greater than 1. If not, operation S403 is performed to determine the subcircuit mapping result of the mth subcircuit to be executed using a greedy algorithm. If yes, operation S404 is performed.
[0119] In operation S404, the search cost, the first search cost threshold and the second search cost threshold under the i-1th window are obtained, and operation S405 is performed to determine whether the search cost under the i-1th window is greater than the first search cost threshold. If yes, operation S406 is performed to adjust the depth of the i-1th window downward and re-execute operation S404. If no, operation S407 is performed.
[0120] In operation S407, it is determined whether the search cost of the i-1th window is less than the second search cost threshold, if yes, operation S408 is performed to adjust the depth of the i-1th window upward and re-perform operation S404. If no, operation S409 is performed.
[0121] In operation S409, the depth of the (i-1)th window is determined as the depth of the i-th window.
[0122] In the embodiment of the present disclosure, a greedy method is introduced to obtain the subcircuit mapping result of the subcircuit to be executed when the depth of the current window is equal to 1, thereby improving the execution efficiency of the quantum gate for mapping execution when the current search cost is too high.
[0123] According to an embodiment of the present disclosure, a subcircuit mapping result of an m-1th subcircuit to be executed and an initial mapping of an m-th subcircuit to be executed are routed by using an inter-mapping routing algorithm to obtain an inter-mapping routing result of the m-1th subcircuit to be executed and an m-th subcircuit to be executed, including: determining, based on the subcircuit mapping result of the m-1th subcircuit to be executed, a first position of each quantum bit included in the final mapping of the subcircuit mapping result of the m-1th subcircuit to be executed on the quantum chip structure; based on the initial mapping of the m-th subcircuit to be executed, determining a second position of each quantum bit included in the initial mapping of the m-th subcircuit to be executed on the quantum chip structure; based on the first position and the second position, using the inter-mapping routing algorithm, obtaining an inter-mapping routing result of the m-1th subcircuit to be executed and the m-th subcircuit to be executed, wherein the inter-mapping routing result represents an executable way to move the first position to the second position.
[0124] According to an embodiment of the present disclosure, based on the sub-circuit mapping results of multiple sub-circuits to be executed, an inter-mapping routing method can be used to route the final mapping of the sub-circuit mapping result of the m-1th sub-circuit to be executed to the initial mapping of the mth sub-circuit to be executed, so as to obtain the inter-mapping routing result of each sub-circuit to be executed.
[0125] According to an embodiment of the present disclosure, the first position may be used to characterize the position of each quantum bit included in the final mapping of the subcircuit mapping result of the (m-1)th subcircuit to be executed on the quantum chip structure to be executed.
[0126] According to an embodiment of the present disclosure, the second position can be used to characterize the position of each quantum bit included in the initial mapping of the mth subcircuit to be executed on the quantum chip structure. In the process of circuit mapping, each subcircuit to be executed is set to the same initial mapping.
[0127] According to an embodiment of the present disclosure, based on the final mapping of the sub-circuit mapping results of multiple sub-circuits to be executed, a mapping-inter-routing method can be used to route the sub-circuit mapping result of the m-1th sub-circuit to be executed to the initial mapping of the mth sub-circuit to be executed, so as to obtain an executable method for moving the first position to the second position.
[0128] According to an embodiment of the present disclosure, the first position and the second position can be determined based on the sum of the distances between the final mapping of the subcircuit mapping result of the m-1th subcircuit to be executed and the initial mapping of the mth subcircuit to be executed on the quantum chip to be executed. Specifically, the heuristic function of the sum of the distances between the final mapping of the subcircuit mapping result of the m-1th subcircuit to be executed and the initial mapping of the mth subcircuit to be executed on the quantum chip to be executed is expressed as follows:
[0129] (6);
[0130] In the formula, The heuristic function representing the sum of the distances of each quantum bit on the quantum chip to be executed between the final mapping of the subcircuit mapping result of the m-1th subcircuit to be executed and the initial mapping of the mth subcircuit to be executed, represents the end mapping of the subcircuit mapping results of the m-1th subcircuit to be executed, j represents the number of the quantum bit, represents the location of the quantum bits included in the initial mapping of the mth subcircuit to be executed, represents the location of the quantum bit included in the subcircuit mapping result of the m-1th subcircuit to be executed, represents the distance between the initial position and the target position of the jth quantum bit.
[0131] According to an embodiment of the present disclosure, a routing mapping result is determined by using an inter-mapping routing method to move the first position of the end mapping included in the sub-line mapping result of the m-1th to-be-executed sub-line to the second position of the initial mapping included in the initial mapping of the m-th to-be-executed sub-line, and the final mapping of the routing mapping result between the m-1th to-be-executed sub-line and the m-th to-be-executed sub-line is recorded as . Map the sub-circuits of the M sub-circuits to be executed to their respective sub-circuits and the mapping routing result based on M sub-routes to be executed By performing route splicing, the mapping result of the quantum circuit to be executed can be obtained. The mapping result of the quantum circuit to be executed can be expressed as:
[0132] (7);
[0133] In the formula, represents the mapping result of the quantum circuit to be executed, Indicates the sub-circuit mapping results of the mth sub-circuit to be executed, Indicates the mapping inter-routing result between the m-1th and mth sub-circuits to be executed.
[0134] Reference below Figure 5 and Figure 6 , the parallel mapping of quantum circuits is further explained in conjunction with specific embodiments.
[0135] Figure 5 The figure schematically shows the test effect of the greedy method according to a specific embodiment of the present disclosure.
[0136] Figure 6 A schematic diagram schematically illustrates the parallel mapping effect of a quantum circuit according to a specific embodiment of the present disclosure.
[0137] In a specific embodiment, a small-scale circuit with no more than 5 qubits, a medium-scale circuit with 6 to 16 qubits, and a large-scale circuit with more than 16 qubits can be selected as the quantum circuit to be executed. The quantum chip to be executed can also be selected from three types of IBM quito, IBM guadalupe, and Zu Chongzhihao according to the circuit scale.
[0138] like Figure 5 and Figure 6 As shown in the figure, 29 quantum circuits of different sizes were selected and tested. Taking a small-scale quantum circuit with no more than 5 qubits as an example, this circuit can be realized without circuit segmentation.
[0139] Specifically, the depth P of the small-scale quantum circuit is obtained, and the structural information of the quantum chip IBM quito to be executed is obtained.
[0140] Set an initial mapping M from logical qubits to physical qubits, which can map logical bits to physical bits in order of number. For example, M: 0→0, 1→1, 2→2, 3→3, 4→4.
[0141] The window depth of the initial window for small-scale quantum circuits is set to 8, the window depth of the initial window for medium-scale and large-scale circuits can be set to 5, and the search cost threshold is 1000.
[0142] Let the first 5 layers of the small-scale quantum circuit be P0, and M be the initial mapping. Through the local search method based on sliding window proposed in this disclosure, find the circuit mapping result {M, P0 T , C}, and save P0 T The first layer p0 and the result M of the logical quantum bit to physical quantum bit after this layer 0 . And P0 T The quantum gates executed in the first layer are deleted from P.
[0143] Let the first 5 layers of the small-scale quantum circuit be P1, and M 0 For the initial mapping, find the line mapping result of P1 { M0 ,P1 T , C}. Record the first layer p1 in P1 and delete the quantum gates executed in the circuit. After multiple rounds of iterations, there are only 5 layers left in the entire quantum circuit.
[0144] For the last 5 layers of the small-scale quantum circuit, save all mapping results p n , and returns the final result of line mapping and routing {M, P T , C}, where P T ={p0, p1, …, p n} (Assume that there are n layers of line execution results in total).
[0145] By using existing quantum circuit mapping methods such as the IBM qiskit method and the TOQM method to test quantum circuits and quantum chips of the same scale, the circuit depth is used as the basic evaluation indicator. Figure 5 As shown, the results obtained by testing 29 quantum circuits using the greedy method proposed in the present disclosure reduce the quantum circuit depth by 16% on average compared with the existing method.
[0146] like Figure 6 As shown, the results obtained by testing 29 quantum circuits using the parallel mapping method of quantum circuits proposed in the present disclosure can achieve a maximum execution speed of 3.78 times faster and an average execution speed of 2.62 times faster than the existing method, and only requires an additional circuit depth cost of about 11%.
[0147] It should be noted that, unless it is explicitly stated that there is a sequence of execution between different operations shown in the flowchart in the embodiments of the present disclosure, or there is a sequence of execution between different operations in technical implementation, otherwise, the execution order of multiple operations may not be prioritized, and multiple operations may also be executed simultaneously.
[0148] Figure 7 A block diagram of a parallel mapping device for a quantum circuit according to an embodiment of the present disclosure is schematically shown.
[0149] like Figure 7 As shown, the parallel mapping device 700 of quantum circuits includes a circuit segmentation module 710 , a search module 720 , a routing module 730 and a determination module 740 .
[0150] The segmentation module 710 is used to segment the quantum circuit to be executed based on the depth of the quantum circuit to be executed and a preset segmentation depth to obtain M sub-circuits to be executed.
[0151] The search module 720 is used to perform a local search on the initial mapping result of the mth sub-circuit to be executed based on the sliding window for the mth sub-circuit to be executed, so as to obtain the sub-circuit mapping result of the mth sub-circuit to be executed.
[0152] The routing module 730 is used to use the inter-mapping routing algorithm to route the sub-circuit mapping result of the m-1th sub-circuit to be executed and the initial mapping of the mth sub-circuit to be executed, and obtain the inter-mapping routing result between the m-1th sub-circuit to be executed and the mth sub-circuit to be executed.
[0153] The determination module 740 is used to obtain the mapping result of the quantum circuit to be executed based on the mapping inter-routing results between the M sub-circuits to be executed and the sub-circuit mapping results of each of the M sub-circuits to be executed.
[0154] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging circuits, or can be implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0155] For example, any multiple of the line segmentation module 710, the search module 720, the routing module 730 and the determination module 740 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the line segmentation module 710, the search module 720, the routing module 730 and the determination module 740 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in a suitable combination of any of them. Alternatively, at least one of the line segmentation module 710 , the search module 720 , the routing module 730 , and the determination module 740 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be performed.
[0156] It should be noted that the parallel mapping device part of the quantum circuit in the embodiment of the present disclosure corresponds to the parallel mapping method part of the quantum circuit in the embodiment of the present disclosure. The description of the parallel mapping device part of the quantum circuit specifically refers to the parallel mapping method part of the quantum circuit, which will not be repeated here.
[0157] Figure 8 A block diagram of an electronic device suitable for implementing a parallel mapping method for quantum circuits according to an embodiment of the present disclosure is schematically shown. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0158] like Figure 8 As shown, the computer electronic device according to the embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory ROM 802 or the program loaded from the storage part 808 to the random access memory RAM 803. The processor 801 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an on-board memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0159] In RAM 803, various programs and data required for the operation of the electronic device are stored. The processor 801, ROM 802, and RAM 803 are connected to each other via a bus 804. The processor 801 performs various operations of the method flow according to the embodiment of the present disclosure by executing the programs in ROM 802 and / or RAM 803. It should be noted that the program may also be stored in one or more memories other than ROM 802 and RAM 803. The processor 801 may also perform various operations of the method flow according to the embodiment of the present disclosure by executing the programs stored in the one or more memories.
[0160] According to an embodiment of the present disclosure, the electronic device may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device may further include one or more of the following components connected to the input / output (I / O) interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 809 including a network interface card such as a LAN card, a modem, etc. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output (I / O) interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage portion 808 as needed.
[0161] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0162] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0163] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0164] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 802 and / or the RAM 803 described above and / or one or more memories other than the ROM 802 and the RAM 803 .
[0165] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the parallel mapping method of quantum circuits provided by the embodiment of the present disclosure.
[0166] When the computer program is executed by the processor 801, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0167] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 809, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0168] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0169] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs a specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments of the present disclosure can be combined and / or combined in various ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features recorded in the various embodiments of the present disclosure can be combined and / or combined in various ways. All these combinations and / or combinations fall within the scope of the present disclosure.
[0170] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A parallel mapping method for quantum circuits, wherein: The method comprises: Based on the depth of the quantum circuit to be executed and the preset segmentation depth, the quantum circuit to be executed is segmented to obtain M sub-circuits to be executed; For the mth subcircuit to be executed, a local search is performed on the initial mapping result of the mth subcircuit to be executed based on the sliding window to obtain a subcircuit mapping result of the mth subcircuit to be executed, wherein the initial mapping result of the mth subcircuit to be executed represents an execution mode of multiple quantum bits included in the initial mapping of the mth subcircuit to be executed, and the initial mapping represents mapping the multiple quantum bits to initial positions on the quantum chip structure in sequence according to a preset order; Using an inter-mapping routing algorithm, routing the sub-circuit mapping result of the m-1th sub-circuit to be executed and the initial mapping of the mth sub-circuit to be executed, to obtain an inter-mapping routing result between the m-1th sub-circuit to be executed and the mth sub-circuit to be executed; Based on the mapping inter-routing results between the M sub-circuits to be executed and the sub-circuit mapping results of each of the M sub-circuits to be executed, the mapping result of the quantum circuit to be executed is obtained.
2. The method according to claim 1, wherein: For the mth sub-circuit to be executed, performing a local search on the initial mapping result of the mth sub-circuit to be executed based on the sliding window to obtain the sub-circuit mapping result of the mth sub-circuit to be executed includes: Using multiple windows with a depth of k and a step size of 1, locally search the sub-circuit execution modes within the n windows included in the initial mapping results of the m-th sub-circuit to be executed, and obtain the mapping results within the n windows; Based on the mapping results in the n windows, the sub-circuit mapping result of the m-th sub-circuit to be executed is obtained, wherein k and n are both positive integers.
3. The method according to claim 2, wherein: The method uses multiple windows with a depth of k and a step size of 1 to perform a local search on the sub-circuit execution modes in the n windows included in the initial mapping result of the m-th sub-circuit to be executed, and obtains the mapping results in the n windows including: For the i-th window, based on the search cost threshold, a breadth-first search algorithm is used to traverse and search the executable modes of the quantum gates respectively included in the window with a depth of k, to obtain multiple subcircuit candidate mapping results; Based on the multiple sub-line candidate mapping results, a sub-mapping result corresponding to the ith window is obtained, wherein, when the ith window is the n-k'+1th sliding window, the mapping result in the window corresponding to the ith window is represented as the multiple sub-line candidate mapping results, and when the ith window is the first n-k' window, the sub-mapping result corresponding to the ith window is represented as the sub-line candidate mapping result with the smallest depth among the multiple sub-line candidate mapping results, and k' represents the depth of the sub-line mapping result with a sub-line end depth of k; Based on the in-window mapping result corresponding to each window, the n in-window mapping results are obtained.
4. The method according to claim 1, wherein: For the mth sub-circuit to be executed, performing a local search on the initial mapping result of the mth sub-circuit to be executed based on the sliding window to obtain the sub-circuit mapping result of the mth sub-circuit to be executed includes: Using multiple windows with a step size of 1, locally search the sub-circuit execution modes in n windows included in the initial mapping result of the m-th sub-circuit to be executed, and obtain mapping results in n windows, wherein for the i-th window, the depth of the i-th window is determined based on the depth of the current window, the search cost threshold, and the search cost under the i-1-th window; Based on the mapping results in the n windows, a sub-circuit mapping result of the m-th sub-circuit to be executed is obtained.
5. The method according to claim 4, wherein: The depth of the i-th window is determined based on the current window, the search cost threshold and the search cost under the i-1-th window, including: When the depth of the current window is greater than 1, if the search cost under the i-1th window is greater than the first search cost threshold, the depth of the i-1th window is adjusted downward to obtain the depth of the i-th window; If the search cost under the i-1th window is less than the second search cost threshold, the depth of the i-1th window is adjusted upward to obtain the depth of the i-th window.
6. The method according to claim 4, wherein: The method further comprises: For the mth sub-line to be executed, when the depth of the current window is equal to 1, a greedy algorithm is used to determine the intra-window mapping result of the current window.
7. The method according to claim 6, wherein: The step of using a greedy algorithm to determine the mapping result within the window of the current window includes: Perform a local search on any quantum gate included in the current window to obtain an intra-window mapping result of the current window.
8. The method according to claim 6, wherein: The step of using a greedy algorithm to determine the mapping result within the window of the current window further includes: The executable modes of the multiple quantum gates included in the current window are used as the in-window mapping result of the current window.
9. The method according to claim 1, wherein: Using an inter-mapping routing algorithm, routing the sub-circuit mapping result of the m-1th sub-circuit to be executed and the initial mapping of the m-th sub-circuit to be executed, to obtain an inter-mapping routing result of the m-1th sub-circuit to be executed and the m-th sub-circuit to be executed, including: Based on the subcircuit mapping result of the m-1th subcircuit to be executed, determining a first position on the quantum chip structure of each quantum bit included in the final mapping of the subcircuit mapping result of the m-1th subcircuit to be executed; Based on the initial mapping of the mth subcircuit to be executed, determining a second position on the quantum chip structure of each quantum bit included in the initial mapping of the mth subcircuit to be executed; Based on the first position and the second position, an inter-mapping routing algorithm is used to obtain an inter-mapping routing result of the m-1th to-be-executed sub-circuit and the mth to-be-executed sub-circuit, wherein the inter-mapping routing result represents an executable method of moving the first position to the second position.
10. A parallel mapping device for quantum circuits, comprising: A circuit segmentation module, used to segment the quantum circuit to be executed based on the depth of the quantum circuit to be executed and a preset segmentation depth, to obtain M sub-circuits to be executed; A search module, for performing a local search on an initial mapping result of the mth subcircuit to be executed based on a sliding window for the mth subcircuit to be executed, to obtain a subcircuit mapping result of the mth subcircuit to be executed, wherein the initial mapping result of the mth subcircuit to be executed represents an execution mode of a plurality of quantum bits included in the initial mapping of the mth subcircuit to be executed, and the initial mapping represents mapping the plurality of quantum bits to initial positions on the quantum chip structure in sequence according to a preset order; A routing module, used to route the sub-circuit mapping result of the m-1th sub-circuit to be executed and the initial mapping of the m-th sub-circuit to be executed by using an inter-mapping routing algorithm, and obtain an inter-mapping routing result between the m-1th sub-circuit to be executed and the m-th sub-circuit to be executed; The determination module is used to obtain the mapping result of the quantum circuit to be executed based on the mapping inter-routing results between the M sub-circuits to be executed and the sub-circuit mapping results of each of the M sub-circuits to be executed.
