An effort to produce a cross compiler for quantum computers • 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 IT.

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

The QIR Alliance aims to provide those who program quantum computers with a Quantum Intermediate Representation that describes the rules for representing quantum programs in LLVM IR.

Essentially, QIR will serve as a common ground for researchers who are developing quantum computing software for a variety of different systems. As documented here by the group, QIR can be used to turn generic quantum programs into operations for specific quantum computing architectures to run, or at least that’s the hope.

“Coherent IR of quantum programs will enable interoperability between quantum applications and hardware devices, making quantum computing more usable for researchers and developers,” said Thien Nguyen, quantum computing researcher at the U.S. National Laboratory of Oak Ridge, in a statement.

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

Microsoft announced QIR last year, and offered as an example this Q # code 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);

… which 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

An interesting use case for QIR, according to the Linux Foundation, is to develop “quantum optimizers that run on QIR and target it to 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 to run in a simulation environment, allowing you to see how the code works without having to run. a real quantum computer. .

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

“The QIR Alliance will provide a unique representation that can be used both for constrained capabilities today and for more powerful systems of the future,” said Bettina Heim, senior director of software engineering at Microsoft, in a press release. “This will allow the community to experiment 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, is also president of the QIR Alliance, highlighted the Azure Quantum full simulator, currently in private preview, and the high performance GPU simulators at the Pacific Northwest National Laboratory, DM -sim and SV- sim, as examples of quantum computer simulations on classical systems that implement QIR.

“The idea is to compile quantum programs in QIR, then use the LLVM or Clang toolchain to link the QIR to the necessary runtime libraries and a simulator implementation into an executable,” he said. she explains. This executable then runs like any other executable on a CPU, GPU, or other backends supported by LLVM. The simulator itself is simply a library that can be written in any language. which compiles in LLVM. “

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

With QIR, we aim to create a powerful compiler infrastructure capable and flexible enough to target the wide variety of hardware backends.

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

“This allows interoperability between all languages ​​that compile into QIR. Before running QIR on a hardware backend, the QIR is tied to the runtime and to target-specific libraries, further optimized, and then focused on it. backend specific, resulting in a QIR profile. A profile is no longer portable but target specific. This allows the hardware backend to process and support only what makes sense for that particular hardware platform. “

Useful quantum computers will be impossible without error correction. Fortunately these people work there


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

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

IDC said on Monday that it expects the annual global quantum computer market to reach $ 8.6 billion by 2027, a fraction of the $ 161.93 billion forecast for global PC sales in 2021. With commercial quantum workloads still many years away, view the QIR Alliance as a long-term gamble. ®

About Thomas Brown

Check Also

The Witcher 3 characters who could be alive in The Witcher 4

The Witcher 4 is currently in development and should be the start of a new …