Microsoft

Microsoft taps LLVM for quantum computing

Microsoft has introduced an intermediate representation for quantum programs, called QIR (Quantum Intermediate Representation), to serve as a common interface between programming languages for gate-based quantum computing and target quantum computation platforms.

Introduced September 23 and based on the LLVM intermediate language, QIR specifies rules to represent quantum constructs in LLVM. No extensions or modifications to LLVM are necessary.

QIR supports Microsoft’s open source Q# language for developing quantum algorithms but is not specific to Q#. Any language for gate-based quantum computing can be represented. QIR also is hardware-agnostic, not specifying a quantum instruction or gate set.

One application cited as being enabled by QIR involves using the LLVM-based Clang compiler to compile QIR into executable machine code for a classical target, providing a path to build a simulator in C or C++ by implementing quantum instruction set functions.

Microsoft has made the draft QIR specification available in the new Q# language repository on GitHub. The company has also rolled out a compiler extension that generates QIR from Q#; it can be found in the feature/QIR branch of the Q# compiler repository. Directions for using the extension have been posted, as well.

Microsoft said that as quantum computing capabilities mature, most large-scale quantum applications will take advantage of both classical and quantum resources working together. LLVM offers QIR capabilities for describing rich classical computation integrated with quantum computation. LLVM also supports integration with many classical languages and tools already supported by the LLVM tool chain. 

A common pattern in compilers is to start by compiling the source language into an intermediate representation, typically designed to allow different source languages to be represented. With this intermediate representation, code can be optimized and transformed. Once the actual target execution platform is known, the intermediate representation can be compiled to executable code.

Through an intermediate representation, many source languages can share a common set of optimizers and executable generators. Also, it becomes easy to compile a single source language for many different targets. The intermediate representation provides a common platform to be shared across sources and targets and allows re-use in compiler machinery.

Microsoft anticipates more advances in how classical and quantum computations interact at the hardware level. With QIR, the goal is to provide a single representation that can be used for both current restricted capabilities and more powerful systems in the future. The community will be able to develop optimizations and code transformations.

Related posts

Microsoft’s Playwright simplifies tests for Python web apps

admin

Microsoft Edge browser previews for Linux

admin

What’s new in Microsoft Visual Studio Code 1.49

admin