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

IEEE/ACM International Conference on Automated Software Engineering (ASE)

Enhancing Code Safety in Quantum Intermediate Representation

Junjie Luo, Jianjun Zhao

Published Sep 11, 2023• 1 citation
Publisher

Abstract

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.

DOI
10.1109/ase56229.2023.00195

Related papers

Formalization of Quantum Intermediate Representations for Code Safety

Junjie Luo, Jianjun Zhao

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.

arXiv:2303.14500•Mar 25, 2023•1 citation

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

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

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

Dataflow-Based Optimization for Quantum Intermediate Representation Programs

Luo, Junjie, Haoyu Zhang, Jianjun Zhao

This paper proposes QDFO, a dataflow-based optimization approach to Microsoft QIR. QDFO consists of two main functions: one is to preprocess the QIR code so that the LLVM optimizer can capture more optimization opportunities, and the other is to optimize the QIR code so that duplicate loading and constructing of qubits and qubit arrays can be avoided. We evaluated our work on the IBM Challenge Dataset, the results show that our method effectively reduces redundant operations in the QIR code. We also completed a preliminary implementation of QDFO and conducted a case study on the real-world code. Our observational study indicates that the LLVM optimizer can further optimize the QIR code preprocessed by our algorithm. Both the experiments and the case study demonstrate the effectiveness of our approach.

arXiv:2406.19592•Jun 28, 2024•0 citations
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.
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.
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.
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.
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.
This paper proposes QDFO, a dataflow-based optimization approach to Microsoft QIR. QDFO consists of two main functions: one is to preprocess the QIR code so that the LLVM optimizer can capture more optimization opportunities, and the other is to optimize the QIR code so that duplicate loading and constructing of qubits and qubit arrays can be avoided. We evaluated our work on the IBM Challenge Dataset, the results show that our method effectively reduces redundant operations in the QIR code. We also completed a preliminary implementation of QDFO and conducted a case study on the real-world code. Our observational study indicates that the LLVM optimizer can further optimize the QIR code preprocessed by our algorithm. Both the experiments and the case study demonstrate the effectiveness of our approach.