Quantum computing hardware has progressed rapidly. Simultaneously, there has been a proliferation of programming languages and program optimization tools for quantum computing. Existing quantum compilers use intermediate representations (IRs) where quantum programs are described as circuits. Such IRs fail to leverage existing work on compiler optimizations. In such IRs, it is non-trivial to statically check for physical constraints such as the no-cloning theorem, which states that qubits cannot be copied. We introduce QSSA, a novel quantum IR based on static single assignment (SSA) that enables decades of research in compiler optimizations to be applied to quantum compilation. QSSA models quantum operations as being side-effect-free. The inputs and outputs of the operation are in one-to-one correspondence; qubits cannot be created or destroyed. As a result, our IR supports a static analysis pass that verifies no-cloning at compile-time. The quantum circuit is fully encoded within the def-use chain of the IR, allowing us to leverage existing optimization passes on SSA representations such as redundancy elimination and dead-code elimination. Running our QSSA-based compiler on the QASMBench and IBM Quantum Challenge datasets, we show that our optimizations perform comparably to IBM's Qiskit quantum compiler infrastructure. QSSA allows us to represent, analyze, and transform quantum programs using the robust theory of SSA representations, bringing quantum compilation into the realm of well-understood theory and practice.
翻译:量子计算硬件进展迅速。 同时, 量子计算的程序语言和程序优化工具激增。 现有的量子汇编器使用量子程序称为电路的中间表示法( IRs ) 。 这种IRs 无法利用现有的编译器优化工作。 在这种IRs 中, 无法静态检查物理限制, 如无克隆定理, 这表明无法复制qubits。 我们引入了QSSA, 一个基于静态单一任务( SS) 的新型量子量子IR, 使得数十年的编译器优化研究能够应用到量子汇编中。 QSAA模型量子操作是无副效果的。 操作的投入和输出是一对一的通信; qubits是无法创建或销毁的。 结果, 我们的IRSA支持静态分析通道, 校验在编译时无法复制qubits。 量电路路完全在IRs的解码单一任务( SSA) 链内编码, 使我们能够在现有的SSAQ( ) 上将SAqual realalalalalalal dealalalalalalation) QA( QA) AS), 进行我们的SARmamaqualal Realalalalalalalal 。