Tackling the Qubit Mapping Problem for NISQ-Era Quantum Devices
Total Page:16
File Type:pdf, Size:1020Kb
Tackling the Qubit Mapping Problem for NISQ-Era Quantum Devices Gushu Li Yufei Ding Yuan Xie University of California University of California University of California Santa Barbara, CA Santa Barbara, CA Santa Barbara, CA [email protected] [email protected] [email protected] Abstract 1 Introduction Due to little consideration in the hardware constraints, e.g., Quantum Computing (QC) has been rapidly growing in the limited connections between physical qubits to enable two- last few decades because of its potential in various important qubit gates, most quantum algorithms cannot be directly applications, including integer factorization [47], database executed on the Noisy Intermediate-Scale Quantum (NISQ) search [15], quantum simulation [36], etc. Recently, IBM, devices. Dynamically remapping logical qubits to physical Intel, and Google released their QC devices with 50, 49, and qubits in the compiler is needed to enable the two-qubit 72 qubits respectively [22, 23, 56]. IBM and Rigetti also pro- gates in the algorithm, which introduces additional oper- vide cloud QC services [18, 40], allowing more people to ations and inevitably reduces the fidelity of the algorithm. study real quantum hardware. We are expected to enter the Previous solutions in finding such remapping suffer from Noisy Intermediate-Scale Quantum (NISQ) era in the next high complexity, poor initial mapping quality, and limited few years [39], when QC devices with dozens to hundreds of flexibility and controllability. qubits will be available. Though the number of qubits is insuf- To address these drawbacks mentioned above, this paper ficient for Quantum Error Correction (QEC), .it is expected proposes a SWAP-based BidiREctional heuristic search al- that these devices will be used to solve real-world problems gorithm (SABRE), which is applicable to NISQ devices with beyond the capability of available classical computers [5, 38]. arbitrary connections between qubits. By optimizing every However, there exists a gap between quantum software search attempt, globally optimizing the initial mapping using and hardware due to technology constraints in the NISQ a novel reverse traversal technique, introducing the decay era. When designing a quantum program based on the most effect to enable the trade-off between the depth and thenum- popular circuit model, it is always assumed that qubits and ber of gates of the entire algorithm, SABRE outperforms quantum operations are perfect and any quantum-physics- the best known algorithm with exponential speedup and allowed operations can be applied. But on NISQ hardware, comparable or better results on various benchmarks. the qubits have limited coherence time, and quantum op- erations are not perfect. Furthermore, only a subset of the- CCS Concepts • Computer systems organization → oretically possible quantum operations can be directly im- Quantum computing; • Hardware → Quantum compu- plemented, which calls for a modification in the quantum tation; Emerging languages and compilers. program to fit the target platform. Keywords Quantum Computing; Qubit Mapping; NISQ In this paper, we will focus on the qubit mapping problem caused by limited two-qubit coupling on NISQ devices. Two- ACM Reference Format: qubit gates are one important type of quantum operations Gushu Li, Yufei Ding, and Yuan Xie. 2019. Tackling the Qubit Map- ping Problem for NISQ-Era Quantum Devices. In 2019 Architectural applied on two qubits. They can create quantum entangle- Support for Programming Languages and Operating Systems (ASP- ment, an advantage that does not exist in classical computing. LOS ’19), April 13–17, 2019, Providence, RI, USA. ACM, New York, Two-qubit gates can be applied to arbitrary two logical qubits NY, USA, 14 pages. https://doi.org/10.1145/3297858.3304023 in a quantum algorithm but this assumption does not hold with NISQ devices. When running a quantum program, the Permission to make digital or hard copies of all or part of this work for logical qubits need to be mapped to the physical qubits (an personal or classroom use is granted without fee provided that copies are not analogy in classical computation is register allocation). But made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components for the physical qubits on NISQ devices, one qubit can only of this work owned by others than ACM must be honored. Abstracting with couple with its neighbor qubits directly. So that for a specific credit is permitted. To copy otherwise, or republish, to post on servers or to mapping, two-qubit gates can only be applied to limited log- redistribute to lists, requires prior specific permission and/or a fee. Request ical qubit pairs, whose corresponding physical qubit pairs permissions from [email protected]. support direct coupling. This makes a quantum circuit not ASPLOS ’19, April 13–17, 2019, Providence, RI, USA directly executable on NISQ devices. © 2019 Association for Computing Machinery. ACM ISBN 978-1-4503-6240-5/19/04...$15.00 As a result, circuit transformation is required to make https://doi.org/10.1145/3297858.3304023 the circuit compatible with NISQ device during compilation. ASPLOS ’19, April 13–17, 2019, Providence, RI, USA Li, et al. Based on a given quantum circuit and the coupling informa- additional gates on average with the assistance of the high- tion of the device, we need 1) an initial logical-to-physical quality initial mapping generated by our proposed method. qubit mapping and 2) the intermediate mapping transition In some cases, the best known previous solution cannot which is able to remap the two logical qubits in a two-qubit even finish execution due to exponential execution time and gate to two coupled physical qubits. The qubit mapping prob- memory requirement, while SABRE can still work with short lem has been proved to be NP-Complete [49]. execution time and low memory usage. By tuning the decay Previous solutions to this problem can be classified into parameters in our algorithm, SABRE shows the ability to two types. One type is to formulate this issue into an equiv- control the generated circuit quality with about 8% variation alent mathematical problem and then apply a solver [4, 6, in generated circuit depth by varying the number of gates. 8, 30, 31, 34, 45, 46, 53, 54, 59]. These attempts suffer from The major contributions of this paper can be summarized very long runtime and can only be applied to small size cases. as follows: Moreover, general software solvers can not exploit the intrin- • We perform a comprehensive analysis on the short- sic feature of the quantum mapping problem. Another type comings of previous solutions, and then summarize the of approach is heuristic search [1, 3, 26, 27, 29, 42, 48, 58], objectives and metrics that should be considered when while most of them were developed on ideal 1D/2D lattice designing a heuristic solution for the qubit mapping model and not applicable to NISQ devices with more ir- problem. regular and restricted coupling connections. Some recent • We propose a SWAP-based search scheme which can works [19, 49, 61] targeting IBM chip architecture are able to produce comparable results with exponential speedup handle arbitrary coupling but they suffer from very long run- in the search complexity compared with previous ex- time due to exhaustive mapping search, and their solutions haustive mappingsearch algorithms. This fast search for initial mapping lack the ability of global optimization. scheme ensures the scalability of SABRE to accommo- Moreover, none of them have the ability to control the gener- date larger-size quantum devices in the NISQ era. ated circuit quality among multiple optimization objectives • We present a reverse traversal technique to enable to fit in NISQ devices with different characteristics. global optimization in the initial mapping solution by In this paper, a SWAP-based BidiREctional heuristic sear- leveraging the intrinsic reversibility in qubit mapping ch algorithm, named SABRE, is proposed to solve this qubit problem. Our high-quality initial mapping can signifi- mapping problem and overcome the drawbacks mentioned cantly reduce the overhead in the generated circuit. above. With the observation that many attempts in exhaus- • By introducing a decay effect in the heuristic cost tive search can be redundant and effective mapping transi- function, we are able to generate different hardware- tion needs to start from the qubits in the two-qubit gates that compliant circuits by trading the number of gates need to be executed, we design an optimized SWAP-based in the circuit against the circuit depth. This makes heuristic search scheme in SABRE with significantly reduced SABRE applicable for NISQ devices with different char- search space. Initial mapping has been proved to be very im- acteristics and optimization objectives. portant in this problem since it can significantly affect the final circuit quality [49, 61]. We present a novel reserve tra- The rest of this paper is organized as follows. We introduce versal search technique in SABRE to naturally generate a QC background information in Section2 and then formu- high-quality initial mapping through traversing a reverse late the qubit mapping problem in Section3. Our solution circuit, in which more consideration is given to those gates SABRE is introduced in Section4 and evaluated in Section5. at the beginning of the circuit without completely ignoring Limitations and future research directions are discussed in the rest of the circuit. Moreover, we introduce a decay effect, Section6. Related works are summarized in Section7 and which will slightly increase our heuristic cost function val- we finally conclude this paper in Section8. ues when evaluating overlapped SWAPs, to let SABRE tend to select non-overlapped SWAPs. This optimization enables 2 Background the control of parallelism in the additional SWAPs and can In this section, we will give a brief introduction to QC.