We use cookies to improve your experience with our site.

一个基于模式匹配的电路重写框架

A Pattern Matching Based Framework for Quantum Circuit Rewriting

  • 摘要:
    研究背景 量子计算近年来吸引了越来越多的注意,因为它为有效解决一些重要的问题提供了可能性,如整数分解、非结构化搜索和求解线性方程。近年来,随着量子计算的普及,许多公司、大学和机构一直在积极致力于开发量子计算机系统的原型。例如,2019年,谷歌宣布实现量子霸权,开发了53量子比特量子处理器“Sycamore”。2021 年 11 月,IBM 推出了其新的 127 量子比特“Eagle”处理器,其规模使经典计算机无法可靠地模拟,而增加的量子比特数量使用户能够在新的复杂程度上探索问题。2022 年 6 月,Xanadu 展示了其可编程光子处理器的量子计算优势,该处理器在 216 个压缩模式下实现了高斯玻色子采样。这些系统称为嘈杂的中等规模量子系统(NISQ)。
    目的 量子算法的实现依赖于根据量子处理器进行的特定量子编译。然而,在不同的物理环境中实现量子比特并操纵量子比特的方式不同。这些差异导致了不同的通信方法和连接拓扑,每个供应商都实现了自己的一套原始门。因此,量子电路的跨平台编译必须从一个平台移植到另一个平台。此外,由于量子处理器支持的门类型是有限的,因此在量子处理器上执行量子电路之前,当一些高级门被分解为低级门时,量子电路也可能被重写。
    方法 我们提出了一个基于模式匹配的框架来重写量子电路,称为QRewriting。它利用了使用符号序列的量子电路的新表示。与使用有向无环图的传统方法不同,新的表示使我们能够轻松识别非连续出现但可规约的模式电路。然后,将模式匹配问题转化为寻找不同子序列的问题,并提出一种基于多项式时间动态规划的模式匹配和替换算法。
    结果 我们将QRewriting与基于模式匹配的量子电路优化框架PaF进行了比较。相较于PaF,QRewriting优化后的电路在 1-qubit门数量、2-qubit门数量、总门数和深度方面平均减少了5.2%、57.0%、17.4%和26.5%。在时间方面,QRewriting 比 PaF 快约 5 倍。除此之外,我们还在算术和Toffoli基准上进行了重写测试。从实验数据可以看出从门集 GIBM 到门组 GSur 的电路重写,门数最多可减少 52%,深度最多可减少 49%。
    结论 我们引入了一种新的量子电路表示,将电路的模式匹配简化为寻找不同子序列的问题。 为此提出了一种基于动态编程的算法,以匹配目标电路中的图形电路。为了解决替换冲突,我们提出了三种用于生成替换调度器的策略和多项式时间替换算法。量子电路优化是一项很有前景的研究方向与此相关的还有量子电路编译问题。

     

    Abstract: The realization of quantum algorithms relies on specific quantum compilations according to the underlying quantum processors. However, there are various ways to physically implement qubits and manipulate those qubits in different physical devices. These differences lead to different communication methods and connection topologies, with each vendor implementing its own set of primitive gates. Therefore, quantum circuits have to be rewritten or transformed in order to be transplanted from one platform to another. We propose a pattern matching based framework for rewriting quantum circuits, called QRewriting. It takes advantage of a new representation of quantum circuits using symbolic sequences. Unlike the traditional approach using directed acyclic graphs, the new representation allows us to easily identify the patterns that appear non-consecutively but are reducible. Then, we convert the problem of pattern matching into that of finding distinct subsequences and propose a polynomial-time dynamic programming based pattern matching and replacement algorithm. We develop a rule library for basic optimizations and rewrite the arithmetic and Toffoli circuits from a commonly used gate set to the gate set supported by the Surface-17 quantum processor. Compared with a state-of-the-art quantum circuit optimization framework PaF optimized on the BIGD benchmarks, QRewriting further reduces the depth and the gate count by an average of 26.5% and 17.4%, respectively.

     

/

返回文章
返回