Could we use an LLVM-based cross-compiler to build apps for quantum computers? This alliance says yes – The Register

The Linux Foundation has launched a group called the QIR Alliance to make quantum computing applications more portable across hardware architectures and simulators.

The QIR in QIR Alliance stands for Quantum Intermediate Representation, which may not mean much to those unfamiliar with “intermediate representation” in the context of computing.

Within the LLVM compiler framework, an intermediate representation (IR) of classical computer code serves as a platform-independent assembly language. Application source code in C, C++, Rust, Go, and other languages is compiled into this IR by a front-end. From this convenient format, the IR is turned into optimized IR, which is then converted by a back-end into executable code for a target system.

The QIR Alliance aims to provide those programming quantum computers with a Quantum Intermediate Representation that outlines rules for representing quantum programs in LLVM IR.

In essence, QIR will serve as common ground for researchers developing quantum-computing software for various different systems. As documented here by the group, QIR can be used to turn generic quantum programs into operations for specific quantum-computer architectures to perform, or at least that’s the hope.

“A consistent IR of quantum programs will enable interoperability between quantum applications and hardware devices, making quantum computing more usable to researchers and developers,” explained Thien Nguyen, quantum computer science researcher at America’s Oak Ridge National Laboratory, in a statement.

“We look forward to contributing to the QIR specification and the associated compiler toolchain under this partnership.”

Microsoft announced QIR last year, and offered as an example this Q# code for generating a Bell pair…

// Assumes that qb1 and qb2 are already in the |0> state
operation BellPair(qb1 : Qubit, qb2 : Qubit) : Unit
{
    H(qb1);
    CNOT(qb1, qb2);
}

…that looks like this when compiled to QIR:

define void @BellPair__body(%Qubit* %qb1, %Qubit* %qb2) {
entry:
  call void @__quantum__qis__h(%Qubit* %qb1)
  call void @__quantum__qis__cnot(%Qubit* %qb1, %Qubit* %qb2)
  ret void
}

One interesting use-case for QIR, according to the Linux Foundation, involves developing “quantum optimizers that operate on QIR and target it to specific hardware backends or linking it with classical high-performance libraries for quantum simulation.”

This opens up the possibility of cross-compiling quantum-computing applications not only for quantum machines but also for your non-quantum workstation to run within a simulation environment, allowing you to see how the code operates without having to fire up an actual quantum computer.

This will allow the community to experiment with and develop optimizations and code transformations that work in a variety of use cases

“The QIR Alliance will provide a single representation that can be used for both today’s restricted capabilities and the more powerful systems of the future,” said Bettina Heim, principal software engineering manager at Microsoft, in a statement. “This will allow the community to experiment with and develop optimizations and code transformations that work in a variety of use cases.”

In an email to The Register, Heim, who in addition to her role at Microsoft also serves as QIR Alliance chair, pointed to Azure Quantum fullstate simulator, currently in private preview, and to Pacific Northwest National Laboratory’s high-performance GPU-based simulators, DM-sim and SV-sim, as examples of quantum computer simulations on classical systems that implement QIR.

“The idea is to compile quantum programs into QIR, and then use the LLVM toolchain …….

Source: https://www.theregister.com/2021/12/01/qir_alliance_aims/

Posted on

Leave a Reply

Your email address will not be published. Required fields are marked *