An attempt to produce cross-compilers for quantum computers • The Register

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

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

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

The QIR Alliance aims to provide these programming quantum computers with a Quantum Intermediate Representation that outlines rules for the representation of quantum programs in LLVM IR.

In essence, QIR will serve as a common ground for researchers developing quantum computer software for different systems. As documented here by the group, QIR can be used to convert generic quantum programs into operations that can be performed by certain quantum computer architectures, or at least so is the hope.

“Consistent IR of quantum programs will enable interoperability between quantum applications and hardware devices and make quantum computing more usable for researchers and developers,” said Thien Nguyen, quantum computer scientist at Oak Ridge National Laboratory, in a statement.

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

Microsoft announced QIR last year and offered this Q # code as an example to generate a Bell pair …

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

… it looks like this when compiled in QIR:

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

According to the Linux Foundation, an interesting use case for QIR is the development of “quantum optimizers that work on QIR and target it at specific hardware backends or link it to classic high-performance libraries for quantum simulation”.

This opens up the possibility of compiling quantum computing applications not only for quantum machines but also for your non-quantum workstation in a simulation environment so that you can see how the code works without having to start a real quantum computer.

This allows the community to experiment with and develop tweaks and code transformations that work in a variety of use cases

“The QIR Alliance will provide a single agency that can be used for both today’s limited 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 optimizations and code transformations and develop them that work in a wide variety of use cases.”

In an email to The registry, Heim, who chairs the QIR Alliance in addition to her role at Microsoft, pointed out the Azure Quantum Fullstate Simulator, which is currently in private preview, and the powerful GPU-based simulators from the Pacific Northwest National Laboratory, DM -sim and SV- out. sim, as examples of quantum computer simulations on classical systems that implement QIR.

“The idea is to compile quantum programs in QIR and then use the LLVM toolchain or Clang to link the QIR with the required runtime libraries and a simulator implementation into an executable,” she explained. “This executable then runs like any other executable on a CPU or GPU or other backend that supports LLVM. The simulator itself is simply a library that can be written in any language that is compiled into LLVM.”

Heim said the QIR specification is portable and allows interoperability between programming languages, citing the example of QCOR, which was developed by the Oak Ridge National Laboratory.

With QIR, we want to build a powerful compiler infrastructure that is capable and flexible enough to target a wide variety of hardware backends

“With QIR, we want to build a powerful compiler infrastructure that is capable and flexible enough to target a wide variety of hardware backends,” she said. “The idea is that language-specific front-end compilers compile source code in QIR-compliant manner with the specification. This format is portable and not specific to any particular hardware backend.

“This enables interoperability between all languages ​​that compile to QIR. Before QIR is executed on a hardware backend, the QIR is linked with runtime and target-specific libraries, further optimized and then aligned to this specific backend, which leads to a QIR profile. A profile is no longer portable, but target-specific. As a result, the hardware backend can only process and support what makes sense for the respective hardware platform. “

Useful quantum computers will be impossible without error correction. It’s good that these people are working on it


Founding members of the QIR Alliance include Honeywell, Microsoft, Oak Ridge National Laboratory, Quantum Circuits Inc. and Rigetti Computing under the auspices of the Linux Foundation’s Joint Development Foundation. It’s interesting to see Microsoft emerge with the Linux Foundation, embracing and expanding something like LLVM’s IR.

Noticeably absent from the alliance are D-Wave, Google and IBM, all of whom regularly make noise about qubits and the like.

IDC said Monday it expects the annual global quantum computer market to grow to $ 8.6 billion by 2027, with commercial quantum workloads many years away, consider the QIR Alliance as a long-term bet. ®

About Willie Ash

Check Also

The newly found Lightning Framework offers a wealth of Linux hacking capabilities

The software framework has become indispensable for the development of almost all complex software nowadays. …