We demonstrate the utility of the Multi-Level Intermediate Representation (MLIR) for quantum computing. Specifically, we extend MLIR with a new quantum dialect that enables the expression and compilation of common quantum assembly languages. The true utility of this dialect is in its ability to be lowered to the LLVM intermediate representation (IR) in a manner that is adherent to the quantum intermediate representation (QIR) specification recently proposed by Microsoft. We leverage a qcor-enabled implementation of the QIR quantum runtime API to enable a retargetable (quantum hardware agnostic) compiler workflow mapping quantum languages to hybrid quantum-classical binary executables and object code. We evaluate and demonstrate this novel compiler workflow with quantum programs written in OpenQASM 2.0. We provide concrete examples detailing the generation of MLIR from OpenQASM source files, the lowering process from MLIR to LLVM IR, and ultimately the generation of executable binaries targeting available quantum processors.
翻译:我们展示了多级中间代表(MLIR)对量子计算的作用。 具体地说, 我们用一种新的量子方言扩展MLIR, 使得能够表达和汇编通用量子组语言。 这个方言的真正效用在于它能够以符合微软最近提议的量子中间代表(QIR)规格的方式, 降低到LLVM中间代表(IR) 。 我们利用QIR 量子运行时间 API 的qcor驱动实施QIR 量子量子量子运行时间 API, 使可重新瞄准( Quantum 硬件不可知性) 汇编者工作流程绘图量子语言, 以混合量子级二进制可执行器和对象代码。 我们用OpenQASM 2. 0 的量子程序来评估和演示这个新型的量子进程。 我们提供了具体的例子,详细说明了从 OpenQASM 源文档生成的MLIR 、 从 MLIR 到 LLVM IR 最终生成的可执行的量子处理器。