Introducing Quantum Intermediate Representation (QIR)

Points to note…

+  QIR is a new Microsoft-developed intermediate representation for quantum programs. It is based on the popular open-source LLVM intermediate language. QIR specifies a set of rules for representing quantum constructs in LLVM. It does not require any extensions or modifications to LLVM.

QIR is intended to serve as a common interface between many languages and target quantum computation platforms. Thus, while it supports Q#, QIR is not specific to Q#: any programming language for gate-based quantum computing can be represented in QIR. Similarly, QIR is hardware-agnostic: it does not specify a quantum instruction or gate set, leaving that to the target computing environment.


+  As quantum computing capabilities mature, we expect most large-scale quantum applications will take full advantage of both classical and quantum computing resources working together. LLVM provides QIR with full capabilities for describing rich classical computation fully integrated with quantum computation. Using LLVM also facilitates integration with the many classical languages and tools which are already supported by the LLVM tool chain. It also promotes the development of common language- and backend-independent optimizations and code transformations, based on a well-known and robust open-source framework.

+  Another application is to use the standard LLVM “pass” infrastructure to write quantum optimizers that operate on QIR. The source- and target-independent approach of QIR allows optimizations to be used with many different computation languages and computing platforms.

+  QIR has been shared with some partners already to get early feedback. For instance, Oak Ridge National Laboratory’s Quantum Computer Scientist and XACC Project Alex McCaskey says “ORNL is working closely with the Microsoft quantum compiler team to enable compilation of high-level Q# programs to the diverse set of OLCF quantum hardware platforms via integration with the XACC quantum programming framework.”

Source:  Microsoft Q# blog.  Alan Geller,  Introducing Quantum Intermediate Representation (QIR)…

Content may have been edited for style and clarity. The “+” to the left of paragraphs or other statements indicates quoted material from “Source:” document. Boldface title is original title from “Source:” Italicized statements are directly quoted from “Source:” document. Image sources are indicated as applicable.