Preprint

A MLIR Dialect for Quantum Assembly Languages

Authors:
Preprints and early-stage research may not have been peer reviewed yet.
To read the file of this research, you can request a copy directly from the authors.

Abstract

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.

No file available

Request Full-text Paper PDF

To read the file of this research,
you can request a copy directly from the authors.

ResearchGate has not been able to resolve any citations for this publication.
Article
Full-text available
We present a quantum chemistry benchmark for noisy intermediate-scale quantum computers that leverages the variational quantum eigensolver, active-space reduction, a reduced unitary coupled cluster ansatz, and reduced density purification as error mitigation. We demonstrate this benchmark using 4 of the available qubits on the 20-qubit IBM Tokyo and 16-qubit Rigetti Aspen processors via the simulation of alkali metal hydrides (NaH, KH, RbH), with accuracy of the computed ground state energy serving as the primary benchmark metric. We further parameterize this benchmark suite on the trial circuit type, the level of symmetry reduction, and error mitigation strategies. Our results demonstrate the characteristically high noise level present in near-term superconducting hardware, but provide a relevant baseline for future improvement of the underlying hardware, and a means for comparison across near-term hardware types. We also demonstrate how to reduce the noise in post processing with specific error mitigation techniques. Particularly, the adaptation of McWeeny purification of noisy density matrices dramatically improves accuracy of quantum computations, which, along with adjustable active space, significantly extends the range of accessible molecular systems. We demonstrate that for specific benchmark settings and a selected range of problems, the accuracy metric can reach chemical accuracy when computing over the cloud on certain quantum computers.
Article
Full-text available
We report a quantum simulation of the deuteron binding energy on quantum processors accessed via cloud servers. We use a Hamiltonian from pionless effective field theory at leading order. We design a low-depth version of the unitary coupled-cluster ansatz, use the variational quantum eigensolver algorithm, and compute the binding energy to within a few percent. Our work is the first step towards scalable nuclear structure computations on a quantum processor via the cloud, and it sheds light on how to map scientific computing applications onto nascent quantum devices.
Article
We present qcor—a language extension to C++ and compiler implementation that enables heterogeneous quantum-classical programming, compilation, and execution in a single-source context. Our work provides a first-of-its-kind C++ compiler enabling high-level quantum kernel (function) expression in a quantum-language agnostic manner, as well as a hardware-agnostic, retargetable compiler workflow targeting a number of physical and virtual quantum computing backends. qcor leverages novel Clang plugin interfaces and builds upon the XACC system-level quantum programming framework to provide a state-of-the-art integration mechanism for quantum-classical compilation that leverages the best from the community at-large. qcor translates quantum kernels ultimately to the XACC intermediate representation, and provides user-extensible hooks for quantum compilation routines like circuit optimization, analysis, and placement. This work details the overall architecture and compiler workflow for qcor, and provides a number of illuminating programming examples demonstrating its utility for near-term variational tasks, quantum algorithm expression, and feed-forward error correction schemes.
Article
In November 2014, the Oak Ridge Leadership Computing Facility (OLCF), a US Department of Energy (DOE) Office of Science User Facility located at Oak Ridge National Laboratory (ORNL), announced plans for an ambitious new chapter in scientific computing: the Summit supercomputer, a machine capable of supplying five to ten times more computing power than current leadership-class systems (see Figure 1). Scientists, in turn, could harness this computational behemoth to address longstanding challenges in science and engineering.
Article
We introduce an abstract machine architecture for classical/quantum computations---including compilation---along with a quantum instruction language called Quil for explicitly writing these computations. With this formalism, we discuss concrete implementations of the machine and non-trivial algorithms targeting them. The introduction of this machine dovetails with ongoing development of quantum computing technology, and makes possible portable descriptions of recent classical/quantum algorithms.
Article
We present ScaffCC, a scalable compilation and analysis framework based on LLVM [1], which can be used for compiling quantum computing applications at the logical level. Drawing upon mature compiler technologies, we discuss similarities and differences between compilation of classical and quantum programs, and adapt our methods to optimizing the compilation time and output for the quantum case. Our work also integrates a reversible-logic synthesis tool in the compiler to facilitate coding of quantum circuits. Lastly, we present some useful quantum program analysis scenarios and discuss their implications, specifically with an elaborate discussion of timing analysis for critical path estimation. Our work focuses on bridging the gap between high-level quantum algorithm specifications and low-level physical implementations, while providing good scalability to larger and more interesting problems.
Article
This paper describes LLVM (Low Level Virtual Machine), a compiler framework designed to support transparent, lifelong program analysis and transformation for arbitrary programs, by providing high-level information to compiler transformations at compile-time, link-time, run-time, and in idle time between runs. LLVM defines a common, low-level code representation in Static Single Assignment (SSA) form, with several novel features: a simple, language-independent type-system that exposes the primitives commonly used to implement high-level language features; an instruction for typed address arithmetic; and a simple mechanism that can be used to implement the exception handling features of high-level languages (and setjmp/longjmp in C) uniformly and efficiently. The LLVM compiler framework and code representation together provide a combination of key capabilities that are important for practical, lifelong analysis and transformation of programs. To our knowledge, no existing compilation approach provides all these capabilities. We describe the design of the LLVM representation and compiler framework, and evaluate the design in three ways: (a) the size and effectiveness of the representation, including the type information it provides; (b) compiler performance for several interprocedural problems; and (c) illustrative examples of the benefits LLVM provides for several challenging compiler problems.
  • Matthew Amy
  • Vlad Gheorghiu
Matthew Amy and Vlad Gheorghiu. staq -A full-stack quantum processing toolkit. arXiv e-prints, page arXiv:1912.06070, December 2019.
  • Andrew W Cross
  • Lev S Bishop
  • John A Smolin
  • Jay M Gambetta
Andrew W. Cross, Lev S. Bishop, John A. Smolin, and Jay M. Gambetta. Open Quantum Assembly Language. arXiv e-prints, page arXiv:1707.03429, Jul 2017.
Really embedding domain-specific languages into c++
  • Hal Finkel
  • Alexander Mccaskey
  • Tobi Popoola
  • Dmitry Lyakh
  • Johannes Doerfert
Hal Finkel, Alexander McCaskey, Tobi Popoola, Dmitry Lyakh, and Johannes Doerfert. Really embedding domain-specific languages into c++, 2020.
Torsten Hoefler, and Tobias Grosser. Domain-specific multi-level ir rewriting for gpu
  • Tobias Gysi
  • Christoph Müller
  • Oleksandr Zinenko
  • Stephan Herhut
  • Eddie Davis
  • Tobias Wicky
  • Oliver Fuhrer
Tobias Gysi, Christoph Müller, Oleksandr Zinenko, Stephan Herhut, Eddie Davis, Tobias Wicky, Oliver Fuhrer, Torsten Hoefler, and Tobias Grosser. Domain-specific multi-level ir rewriting for gpu, 2020.
Compiling onnx neural network models using mlir
  • Tian Jin
  • Gheorghe-Teodor Bercea
  • Tung D Le
  • Tong Chen
  • Gong Su
  • Haruki Imai
  • Yasushi Negishi
  • Anh Leu
  • O' Kevin
  • Kiyokuni Brien
  • Alexandre E Kawachiya
  • Eichenberger
Tian Jin, Gheorghe-Teodor Bercea, Tung D. Le, Tong Chen, Gong Su, Haruki Imai, Yasushi Negishi, Anh Leu, Kevin O'Brien, Kiyokuni Kawachiya, and Alexandre E. Eichenberger. Compiling onnx neural network models using mlir, 2020.
Mlir: A compiler infrastructure for the end of moore's law
  • Chris Lattner
  • Mehdi Amini
  • Uday Bondhugula
  • Albert Cohen
  • Andy Davis
  • Jacques Pienaar
  • River Riddle
  • Tatiana Shpeisman
  • Nicolas Vasilache
  • Oleksandr Zinenko
Chris Lattner, Mehdi Amini, Uday Bondhugula, Albert Cohen, Andy Davis, Jacques Pienaar, River Riddle, Tatiana Shpeisman, Nicolas Vasilache, and Oleksandr Zinenko. Mlir: A compiler infrastructure for the end of moore's law, 2020.
  • C A Benjamin
  • Andrew J Morrison
  • Daniel S Landahl
  • Kenneth M Lobser
  • Antonio E Rudinger
  • Jay W Russo
  • Van Der
  • Peter Wall
  • Maunz
Benjamin C. A. Morrison, Andrew J. Landahl, Daniel S. Lobser, Kenneth M. Rudinger, Antonio E. Russo, Jay W. Van Der Wall, and Peter Maunz. Just another quantum assembly language (Jaqal). arXiv e-prints, page arXiv:2008.08042, August 2020.
Antlr: A predicated-ll(k) parser generator. Software: Practice and Experience
  • T J Parr
  • R W Quong
T. J. Parr and R. W. Quong. Antlr: A predicated-ll(k) parser generator. Software: Practice and Experience, 25(7):789-810, 1995.
Q#: Enabling scalable quantum computing and development with a highlevel dsl
  • Krysta Svore
  • Alan Geller
  • Matthias Troyer
  • John Azariah
  • Christopher Granade
  • Bettina Heim
  • Vadym Kliuchnikov
  • Mariia Mykhailova
  • Andres Paz
  • Martin Roetteler
Krysta Svore, Alan Geller, Matthias Troyer, John Azariah, Christopher Granade, Bettina Heim, Vadym Kliuchnikov, Mariia Mykhailova, Andres Paz, and Martin Roetteler. Q#: Enabling scalable quantum computing and development with a highlevel dsl. In Proceedings of the Real World Domain Specific Languages Workshop 2018, RWDSL2018, New York, NY, USA, 2018. Association for Computing Machinery.