10 20 30 40 50
10
4
10
5
N Qubits
N Controlled Operations (CX, CRZ)
Manual Compute / Action
Fig. 12: Th e number of co ntrolled o perations (CX and CRZ)
present in the compiled representation of Figure
11 for a given
number of qubits. The Manual plot represents a p rogram that
sequentially lists the instruction for the pattern W = U V U
†
,
while the other plot represents the case w hereby a programmer
expresses this pattern via the compute-action syntax from
our gramm ar extension.
is adhe rent to the QIR specification. We provide quantum
circuit optimization passes at the MLIR level and leverage
existing c la ssical optimization passes pre sent in both MLI R
and LLVM. Our work extends the OpenQASM grammar
with support for C-like constructs a nd the co mpute-action-
uncompute pattern for efficient programming and compile-
time optimizations. Targeting the QIR enables one to swap
runtime library implementatio ns enabling a write once run
anywhere character istic. We have provided a ru ntime library
implementation of the QIR specification that is backed by the
XACC quantum programming framework, thereby enabling
OpenQASM compilation that targets quan tum compute rs from
IBM, Rigetti, H oneywell, IonQ, as well as simulators that scale
from laptops to large-scale heterogeneous high performance
computers, like Summit. Moving f orward, our approach opens
up the possibility of true language integration at the LLVM IR
level. We envision a number of language approaches that map
to the LLVM IR adhe rent to the QIR specifica tion, and via
simple runtime linking, enabling the in tegra tion of quantu m
languag e A with code from quantum language B. As of this
writing, the integration of Q#, qcor C++, and Open QA SM
is now possible. We also envision this work as a n alternative
mechanism for embedded C++ quantu m kernels in qc or,
departing fro m the existing Clang Syntax Handler so urce
preprocessing. Future work will investigate true quantum
languag e integration and compile-time embedding of MLIR-
to-LLVM processing in the qcor C++ language extension.
ACKNOWLEDGMENT
This material is based upon work suppo rted by the U.S.
Departmen t of Energy, Office of Science, National Quantum
Information Scienc e Research Centers. ORNL is managed by
UT-Battelle, LLC, for the US Department o f Energy under
contract no. DE-AC05-00OR22725.
REFERENCES
[1] Circuit synthesis via quantum gate modifiers.
https://qiskit.github.io/openqasm/language/gates.html#quantum-gate-modifiers.
Accessed: 2021-08-30.
[2] Introducing quantum intermediate representation (qir).
https://devblogs.microsoft.com/qsharp/introducing-quantum-intermediate-representation-qir/.
Accessed: 2021-01-15.
[3] Mlir documentation. https://mlir.llvm.org. Accessed: 2021-01-15.
[4] Qcor github. https://github.com/ornl-qci/qcor. Accessed: 2021-01-15.
[5] Quantum intermediate representation (qir) specification.
https://github.com/microsoft/qsharp-language/tree/main/Specifications/QIR.
Accessed: 2021-01-15.
[6] Koen Bertels, J.W. Hogaboam, and Carmen G. Almudever. Quantum
computer architecture: a full-stack overview. Microprocessors and
Microsystems, 66:21–66, 2019.
[7] Benjamin Bichsel, Maximilian Baader, Timon Gehr, and Martin Vechev.
Silq: A high-level quantum language with safe uncomputation and intu-
itive semantics. In Proceedings of the 41st ACM SIGPLAN Conference
on Programming Language Design and Implementation, PLDI 2020,
page 286–300, New York, NY, USA, 2020. Association for Computing
Machinery.
[8] Keith A Britt and Travis S Hum ble. High-performance computing with
quantum processing units. ACM Journal on Em erging Technologies in
Computing Systems (JETC), 13(3):1–13, 2017.
[9] Andrew W. Cross, Ali Javadi-Abhari, Thomas Alexander, Niel de Beau-
drap, Lev S. Bishop, Steven H eidel, Colm A. Ryan, John Smolin, Jay M.
Gambetta, and Blake R. Johnson. Openqasm 3: A broader and deeper
quantum assembly language, 2021.
[10] E. F. Dumitrescu, A. J. McCaskey, G. Hagen, G. R. Jansen, T. D. Morris,
T. Papenbrock, R. C. Pooser, D. J. Dean, and P. Lougovski. Cloud
quantum computing of an atomic nucleus. Phys. Rev. Lett., 120:210501,
May 2018.
[11] Tobias Gysi, Christoph M¨uller, Oleksandr Zinenko, Stephan Herhut,
Eddie Davis, Tobias Wicky, Oliver Fuhrer, Torsten Hoefler, and Tobias
Grosser. Domain-specific multi-level ir rewriting for gpu, 2020.
[12] Kathleen E. Hamilton, Eugene F. Dumitrescu, and Raphael C. Pooser.
Generative model benchmarks for superconducting qubits. Phys. Rev.
A, 99:062323, Jun 2019.
[13] IBM. Openqasm 3.x live specification, 2021.
https://qiskit.github.io/openqasm/.
[14] David Ittah, Thomas H¨aner, Vadym Kliuchnikov, and Torsten Hoefler.
Enabling dataflow optimization for quantum programs, 2021.
[15] Ali JavadiAbhari, Shruti Patil, Daniel Kudrow, Jeff Heckey, Alexey
Lvov, Frederic T. Chong, and Margaret Martonosi. Scaffcc: Scalable
compilation and analysis of quantum programs. Parallel Computing,
45:2 – 17, 2015. Computing Frontiers 2014: Best Papers.
[16] 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.
[17] Chris Lattner, Mehdi Amini, Uday Bondhugula, Albert Cohen, Andy
Davis, Jacques Pienaar, River Riddle, Tatiana Shpeisman, Nicolas Vasi-
lache, and Oleksandr Zinenko. Mlir: A compiler infrastructure for the
end of moore’s law, 2020.
[18] Alexander McCaskey, Eugene Dumitrescu, Dmitry Liakh, and Travis
Humble. Hybrid programming for near-term quantum computing sys-
tems. In 2018 IEEE International Conference on Rebooting Computing
(ICRC), pages 1–12. IEEE, 2018.
[19] Alexander McCaskey and Thien Nguyen. A mlir dialect for quantum
assembly languages, 2021.
[20] Alexander Mccaskey, Thien Nguyen, Anthony Santana, Daniel Claudino,
Tyler Kharazi, and Hal Finkel. Extending c++ for heterogeneous
quantum-classical computing. ACM Transactions on Quantum Com-
puting, 2(2), July 2021.
12