Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

arXiv:2303.14500

Formalization of Quantum Intermediate Representations for Code Safety

Junjie Luo, Jianjun Zhao

Published Mar 25, 2023• 1 citation
arXivHTMLPDF

Abstract

Quantum Intermediate Representation (QIR) is a Microsoft-developed, LLVM-based intermediate representation for quantum program compilers. QIR aims to provide a general solution for quantum program compilers independent of front-end languages and back-end hardware, thus avoiding duplicate development of intermediate representations and compilers. Since it is still under development, QIR is described in natural language and lacks a formal definition, leading to ambiguity in its interpretation and a lack of rigor in implementing quantum functions. In this paper, we provide formal definitions for the data types and instruction sets of QIR, aiming to provide correctness and security guarantees for operations and intermediate code conversions in QIR. To validate our design, we show some samples of unsafe QIR code where errors can be detected by our formal approach.

DOI
10.48550/arxiv.2303.14500

Related papers

Enhancing Code Safety in Quantum Intermediate Representation

Junjie Luo, Jianjun Zhao

Quantum Intermediate Representation (QIR) is an LLVM-based intermediate representation developed by Microsoft for quantum program compilers. QIR is designed to offer a universal solution for quantum program compilers, decoupled from both front-end languages and back-end hardware, thereby eliminating the need for redundant development of intermediate representations and compilers. However, the lack of a formal definition and reliance on natural language descriptions in the current state of QIR result in interpretational ambiguity and a dearth of rigor in implementing quantum functions. In this paper, we present formal definitions for QIR's data types and instruction sets to establish correctness and safety assurances for operations and intermediate code conversions within QIR. To demonstrate the effectiveness of our approach, we provide examples of unsafe QIR codes where errors can be identified with our method.

IEEE/ACM International Conference on Automated Software Engineering (ASE)•Sep 11, 2023•1 citation

A cross-platform execution engine for the quantum intermediate representation

Elaine Wong, Vicente Leyton‐Ortega, Daniel Claudino +6 more

Hybrid languages like the quantum intermediate representation (QIR) are essential for programming systems that mix quantum and conventional computing models, while execution of these programs is often deferred to a system-specific implementation. Here, we develop the QIR Execution Engine (QIR-EE) for parsing, interpreting, and executing QIR across multiple hardware platforms. QIR-EE uses LLVM to execute hybrid instructions specifying quantum programs and, by design, presents extension points that support customized runtime and hardware environments. We demonstrate an implementation that uses the XACC quantum hardware-accelerator library to dispatch prototypical quantum programs on different commercial quantum platforms and numerical simulators, and we validate execution of QIR-EE on IonQ, Quantinuum, and IBM hardware. Our results highlight the efficiency of hybrid executable architectures for handling mixed instructions, managing mixed data, and integrating with quantum computing frameworks to realize cross-platform execution.

arXiv:2404.14299•The Journal of Supercomputing•Nov 5, 2025•4 citations

A MLIR Dialect for Quantum Assembly Languages

Alexander McCaskey, Thien Nguyen

We demonstrate the utility of the Multi-Level Intermediate Representation (MLIR) for quantum computing. Specifically, we extend MLIR with a new quantum dialect that enables the expression and compilation of common quantum assembly languages. The true utility of this dialect is in its ability to be lowered to the LLVM intermediate representation (IR) in a manner that is adherent to the quantum intermediate representation (QIR) specification recently proposed by Microsoft. We leverage a qcor-enabled implementation of the QIR quantum runtime API to enable a retargetable (quantum hardware agnostic) compiler workflow mapping quantum languages to hybrid quantum-classical binary executables and object code. We evaluate and demonstrate this novel compiler workflow with quantum programs written in OpenQASM 2.0. We provide concrete examples detailing the generation of MLIR from OpenQASM source files, the lowering process from MLIR to LLVM IR, and ultimately the generation of executable binaries targeting available quantum processors.

arXiv:2101.11365•IEEE International Conference on Quantum Computing and Engineering (QCE)•Oct 1, 2021•43 citations

Comparative Analysis of Quantum Intermediate Representation Generation Methods

Kuldeep Vayadande, Yogesh Uttamrao Bodhe, Aditya Dharashivkar +4 more

In this survey, there is a systematic assessment of the existing plans of manufacturing Quantum.Their ability to make Intermediate Representations (QIRs) sell optimization solutions to problems, plasticity in the both hardware and verification.We survey the existent methodologies and identify them in four waves, i.e. language-derived paradigm, multi-level paradigm, classically-quantum and hybrid classicalquantum paradigm and hybrid formally verified and verify their performance in some major parameters, i.e., circuit depth reduction, compilation transversal and cross-operating system portability.We find that the optimal compromise of performance and reliability is realised on hybrid systems that combine classical Compiler with extensions supporting quantum, in which current tools (note that we are not exist and future designs, which implement quantum provide technology at the center of the research significant enhancement of optimization ability and black box testing of the verification suite.Nevertheless, essential there are problems within the development of the new quantum paradigms supporter, temporal optimization and error correction incorporation.An outlook is provided at the end of the paper on the creation of next generation QIR with a special emphasis on the need to have verifiable, quantifiable frameworks that maintain optimization at the various levels transparent.This paper can be used as are source on both the technical community designing quantum compilers in addition to a roadmap that researchers should pursue in this various area of QIR.

Advances in engineering research/Advances in Engineering Research•Jan 1, 2026•0 citations

QIRopt: An Optimization Method for Quantum Intermediate Representation

Junjie Luo, Haoyu Zhang, Jianjun Zhao

This paper proposes a dataflow-based optimization method called Quantum Intermediate Representation Optimization (QIRopt) within the LLVM infrastructure. QIRopt has two main functions: preprocessing QIR code to expose more optimization opportunities to the LLVM optimizer and optimizing QIR code to avoid redundant loading and construction of qubits and qubit arrays. We evaluated QIRopt on the IBM Challenge Dataset, and the results demonstrate its effectiveness in reducing redundant operations in QIR code. A preliminary implementation of QIRopt and a case study on real-world code further confirm that our approach enhances the LLVM optimizer's ability to optimize preprocessed QIR code.

IEEE International Conference on Quantum Computing and Engineering (QCE)•Aug 30, 2025•0 citations

Towards Supporting QIR

Yannick Stade, Lukas Burgholzer, Robert Wille

Intermediate representations (IRs) play a crucial role in the software stack of a quantum computer to facilitate efficient optimizations for executing an application on hardware. One of those IRs is the Quantum Intermediate Representation (QIR), which builds on the classical LLVM compiler infrastructure. In this article, we outline different approaches to how QIR can be adopted. This exploration culminates in a demonstration of what it takes to turn an existing quantum circuit simulator into a QIR runtime and that such a transition is less daunting than it might seem at first. We further show that switching to QIR does not entail any performance deficits compared to the original simulator. On the contrary, the presented steps effortlessly allow adding support for arbitrary classical control flow to any classical simulator. We conclude with an outlook on future directions using QIR. The implemented QIR runtime is available under https://github.com/munich-quantum-toolkit/core.

arXiv:2411.18682•International Conference for High Performance Computing, Networking, Storage and Analysis (SC)•Nov 7, 2025•4 citations
Quantum Intermediate Representation (QIR) is a Microsoft-developed, LLVM-based intermediate representation for quantum program compilers. QIR aims to provide a general solution for quantum program compilers independent of front-end languages and back-end hardware, thus avoiding duplicate development of intermediate representations and compilers. Since it is still under development, QIR is described in natural language and lacks a formal definition, leading to ambiguity in its interpretation and a lack of rigor in implementing quantum functions. In this paper, we provide formal definitions for the data types and instruction sets of QIR, aiming to provide correctness and security guarantees for operations and intermediate code conversions in QIR. To validate our design, we show some samples of unsafe QIR code where errors can be detected by our formal approach.
Quantum Intermediate Representation (QIR) is an LLVM-based intermediate representation developed by Microsoft for quantum program compilers. QIR is designed to offer a universal solution for quantum program compilers, decoupled from both front-end languages and back-end hardware, thereby eliminating the need for redundant development of intermediate representations and compilers. However, the lack of a formal definition and reliance on natural language descriptions in the current state of QIR result in interpretational ambiguity and a dearth of rigor in implementing quantum functions. In this paper, we present formal definitions for QIR's data types and instruction sets to establish correctness and safety assurances for operations and intermediate code conversions within QIR. To demonstrate the effectiveness of our approach, we provide examples of unsafe QIR codes where errors can be identified with our method.
Hybrid languages like the quantum intermediate representation (QIR) are essential for programming systems that mix quantum and conventional computing models, while execution of these programs is often deferred to a system-specific implementation. Here, we develop the QIR Execution Engine (QIR-EE) for parsing, interpreting, and executing QIR across multiple hardware platforms. QIR-EE uses LLVM to execute hybrid instructions specifying quantum programs and, by design, presents extension points that support customized runtime and hardware environments. We demonstrate an implementation that uses the XACC quantum hardware-accelerator library to dispatch prototypical quantum programs on different commercial quantum platforms and numerical simulators, and we validate execution of QIR-EE on IonQ, Quantinuum, and IBM hardware. Our results highlight the efficiency of hybrid executable architectures for handling mixed instructions, managing mixed data, and integrating with quantum computing frameworks to realize cross-platform execution.
We demonstrate the utility of the Multi-Level Intermediate Representation (MLIR) for quantum computing. Specifically, we extend MLIR with a new quantum dialect that enables the expression and compilation of common quantum assembly languages. The true utility of this dialect is in its ability to be lowered to the LLVM intermediate representation (IR) in a manner that is adherent to the quantum intermediate representation (QIR) specification recently proposed by Microsoft. We leverage a qcor-enabled implementation of the QIR quantum runtime API to enable a retargetable (quantum hardware agnostic) compiler workflow mapping quantum languages to hybrid quantum-classical binary executables and object code. We evaluate and demonstrate this novel compiler workflow with quantum programs written in OpenQASM 2.0. We provide concrete examples detailing the generation of MLIR from OpenQASM source files, the lowering process from MLIR to LLVM IR, and ultimately the generation of executable binaries targeting available quantum processors.
In this survey, there is a systematic assessment of the existing plans of manufacturing Quantum.Their ability to make Intermediate Representations (QIRs) sell optimization solutions to problems, plasticity in the both hardware and verification.We survey the existent methodologies and identify them in four waves, i.e. language-derived paradigm, multi-level paradigm, classically-quantum and hybrid classicalquantum paradigm and hybrid formally verified and verify their performance in some major parameters, i.e., circuit depth reduction, compilation transversal and cross-operating system portability.We find that the optimal compromise of performance and reliability is realised on hybrid systems that combine classical Compiler with extensions supporting quantum, in which current tools (note that we are not exist and future designs, which implement quantum provide technology at the center of the research significant enhancement of optimization ability and black box testing of the verification suite.Nevertheless, essential there are problems within the development of the new quantum paradigms supporter, temporal optimization and error correction incorporation.An outlook is provided at the end of the paper on the creation of next generation QIR with a special emphasis on the need to have verifiable, quantifiable frameworks that maintain optimization at the various levels transparent.This paper can be used as are source on both the technical community designing quantum compilers in addition to a roadmap that researchers should pursue in this various area of QIR.
This paper proposes a dataflow-based optimization method called Quantum Intermediate Representation Optimization (QIRopt) within the LLVM infrastructure. QIRopt has two main functions: preprocessing QIR code to expose more optimization opportunities to the LLVM optimizer and optimizing QIR code to avoid redundant loading and construction of qubits and qubit arrays. We evaluated QIRopt on the IBM Challenge Dataset, and the results demonstrate its effectiveness in reducing redundant operations in QIR code. A preliminary implementation of QIRopt and a case study on real-world code further confirm that our approach enhances the LLVM optimizer's ability to optimize preprocessed QIR code.
Intermediate representations (IRs) play a crucial role in the software stack of a quantum computer to facilitate efficient optimizations for executing an application on hardware. One of those IRs is the Quantum Intermediate Representation (QIR), which builds on the classical LLVM compiler infrastructure. In this article, we outline different approaches to how QIR can be adopted. This exploration culminates in a demonstration of what it takes to turn an existing quantum circuit simulator into a QIR runtime and that such a transition is less daunting than it might seem at first. We further show that switching to QIR does not entail any performance deficits compared to the original simulator. On the contrary, the presented steps effortlessly allow adding support for arbitrary classical control flow to any classical simulator. We conclude with an outlook on future directions using QIR. The implemented QIR runtime is available under https://github.com/munich-quantum-toolkit/core.