发表机构
The University of British Columbia(不列颠哥伦比亚大学)
机构由 AI 辅助整理,请以论文原文为准。AI 中文总结
该研究针对量子编译器 passes 提出了基于 Retromorphic 测试和 Hadamard 测试原理的自动化验证方法,在 RetroQ 框架中实现后,成功重现并发现了量子编译器 passes 的多个缺陷,凸显了专用测试方法对提升量子软件栈可靠性的重要性。
AI 中文摘要
量子编译器在将高级量子程序转换为优化的、与硬件兼容的电路中发挥着关键作用。然而,验证编译器 passes 的正确性仍然具有挑战性,因为确定大型、深度纠缠量子电路的预期输出在计算上是难以处理的。当编译器 passes 修改已经复杂的电路结构时,这一挑战会进一步加剧,使得手动验证转换后的电路不切实际。在这项工作中,我们对四个量子编程框架(PennyLane、Qiskit、Cirq 和 pytket)中量子编译器 passes 的单元测试进行了系统分析。我们的发现表明,验证主要由程序内容和程序度量断言主导,且测试电路通常规模小、深度浅。受这些观察的启发,我们引入了一种基于 Retromorphic 测试和 Hadamard 测试原理的量子编译器 passes 自动化验证测试方法。该方法分析编译器 passes、测试电路和预期的 passes 行为,以验证语义保留和预期的结构修改。我们在框架 RetroQ 中实现了我们的方法,并将其应用于 PennyLane 和 Qiskit 中的编译器 passes。实验评估重现了几个现有 bug,还发现了之前未检测到的缺陷,例如符号参数处理有缺陷、对易逻辑不正确、无法识别门的自伴随性以及运行时崩溃。这些发现凸显了针对编译器 passes 的特定测试方法的需求,以改进不断发展的量子软件栈的可靠性。
英文摘要
Quantum compilers play a critical role in transforming high-level quantum programs into optimized, hardware-compatible circuits. However, verifying the correctness of compiler passes remains challenging, as determining the expected output of large, deeply entangled quantum circuits is computationally intractable. This challenge is further amplified when compiler passes modify already complex circuit structures, making manual validation of transformed circuits impractical. In this work, we perform a systematic analysis of unit tests for quantum compiler passes in four quantum programming frameworks (PennyLane, Qiskit, Cirq, and pytket). Our findings indicate validation is dominated by program-content and program-metric assertions, and test circuits are generally small and shallow. Motivated by these observations, we introduce a testing methodology for automated validation of quantum compiler passes based on retromorphic testing and principles from the Hadamard test. This methodology analyzes a compiler pass, test circuit, and expected pass behavior to verify semantic preservation and intended structural modifications. We implement our methods in a framework, RetroQ, and apply it to compiler passes in PennyLane and Qiskit. Experimental evaluation reproduced several existing bugs as well as uncovered previously undetected defects, such as flawed symbolic parameter handling, incorrect commutation logic, failure to recognize self-adjointness of gates, and runtime crashes. These findings highlight the need for compiler-pass-specific testing methodologies to improve the reliability of the evolving quantum software stack.