Decades of research have gone into classical compiler design, producing sophisticated frameworks that transform high-level programs into efficient machine code. Quantum computing faces the same challenge: translating quantum algorithms into hardware-executable instructions. A classical-first approach extends established compiler frameworks with quantum concepts, treating quantum processors as specialized accelerators within larger computing systems. This article presents multilevel intermediate representation (MLIR) as an effective foundation for this approach and demonstrates its use in the Munich Quantum Software Stack, which connects high-level applications to diverse quantum hardware through a modular, high-performance computing (HPC)-integrated pipeline. MLIR dialects support multiple abstraction levels while providing built-in parsing, transformation, and optimization infrastructure. Quantum programs are represented through complementary dialects: one explicitly encodes the circuit's dataflow graph, while the other mirrors established languages for seamless tool interoperability. The resulting framework, the Munich Quantum Toolkit Compiler Collection, supports compiler passes for both flat circuits and structured control flow. It is available at https://github.com/munich-quantum-toolkit/core.
Decades of research have gone into classical compiler design, producing sophisticated frameworks that transform high-level programs into efficient machine code. Quantum computing faces the same challenge: translating quantum algorithms into hardware-executable instructions. A classical-first approach extends established compiler frameworks with quantum concepts, treating quantum processors as specialized accelerators within larger computing systems. This article presents multilevel intermediate representation (MLIR) as an effective foundation for this approach and demonstrates its use in the Munich Quantum Software Stack, which connects high-level applications to diverse quantum hardware through a modular, high-performance computing (HPC)-integrated pipeline. MLIR dialects support multiple abstraction levels while providing built-in parsing, transformation, and optimization infrastructure. Quantum programs are represented through complementary dialects: one explicitly encodes the circuit's dataflow graph, while the other mirrors established languages for seamless tool interoperability. The resulting framework, the Munich Quantum Toolkit Compiler Collection, supports compiler passes for both flat circuits and structured control flow. It is available at https://github.com/munich-quantum-toolkit/core.
As the capabilities of quantum computing hardware continue to rise, algorithms that exploit them are becoming increasingly complex. These developments increase the need for sophisticated compilation frameworks that translate high-level algorithms into executable code. In the past, most solutions were built with a quantum-first approach and handled mostly pure quantum programs without classical elements such as structured control flow. However, developments in quantum algorithms, error correction, and optimization, as well as the integration into high-performance computing (HPC) environments, depend on such classical elements. As quantum-first approaches increasingly struggle to handle these concepts, classical-first approaches are becoming a promising alternative. In this work, we present the MQT Compiler Collection, a blueprint for a future-proof quantum-classical compilation framework built on the Multi-Level Intermediate Representation (MLIR). After years of experience with the quantum-first approach and its shortcomings, we propose a framework that embraces core MLIR concepts to support the full compilation pipeline from high-level algorithms to hardware-specific instructions. The proposed architecture is designed from the ground up to support complex optimizations beyond, e.g., simple gate cancellation. It is publicly available at https://github.com/munich-quantum-toolkit/core.
Compilers transform code into action. They convert high-level programs into executable hardware instructions - a crucial step in enabling reliable and scalable quantum computation. However, quantum compilation is still in its infancy, and many existing solutions are ad hoc, often developed independently and from scratch. The resulting lack of interoperability leads to significant missed potential, as quantum software tools remain isolated and cannot be seamlessly integrated into cohesive toolchains.
The Multi-Level Intermediate Representation (MLIR) has addressed analogous challenges in the classical domain. It was developed within the LLVM project, which has long powered robust software stacks and enabled compilation across diverse software and hardware components, with particular importance in high-performance computing environments. However, MLIR's steep learning curve poses a significant barrier to entry, particularly in quantum computing, where much of the software stack is still predominantly built by experimentalists out of necessity rather than by experienced software engineers.
This paper provides a practical and hands-on guide for quantum software engineers to overcome this steep learning curve. Through a concrete case study linking Xanadu's PennyLane framework with the Munich Quantum Toolkit (MQT), we outline actionable integration steps, highlight best practices, and share hard-earned insights from real-world development. This work aims to support quantum tool developers in navigating MLIR's complexities and to foster its adoption as a unifying bridge across a rapidly growing ecosystem of quantum software tools, ultimately guiding the development of more modular, interoperable, and integrated quantum software stacks.
The Munich Quantum Software Stack (MQSS) is a compilation and runtime infrastructure designed to bridge the gap between high-performance computing (HPC) and quantum computing (QC). A unified, extensible, and efficient compilation framework becomes important as quantum devices and applications scale. This paper proposes the integration of Multi-Level Intermediate Representation (MLIR) as intermediate representation into the MQSS to address the challenges of optimizing and compiling hybrid classical-quantum applications across diverse quantum devices. Accordingly, the MQSS can separate abstraction layers, enabling high-level optimizations, seamless integration of existing quantum dialects, and targetspecific optimizations for diverse quantum devices.
The Multi-Level Intermediate Representation (MLIR) framework has become a cornerstone for building extensible, domain-specific compilers, with the quantum computing community already leveraging it to model quantum programs and implement basic optimizations. However, computationally intensive tasks in the quantum compilation pipeline, such as quantum circuit mapping, remain underexplored within the MLIR ecosystem. This paper proposes an MLIR-native blueprint for these non-local, quantum-specific optimization routines by reimplementing a well-established, state-of-the-art mapping A* search algorithm for qubit routing and SWAP insertion. Our evaluation demonstrates that this approach not only integrates seamlessly into an MLIR-based quantum compiler collection but also surpasses previous non-MLIR solutions in both solution quality and runtime. The implementation is open-source and publicly available at https://github.com/munich-quantum-toolkit/core.
Programming quantum computers is a complex endeavor that requires highly specialized knowledge. Given the growing momentum of quantum computing, high-level synthesis of quantum circuits from well-known classical languages could significantly benefit the ecosystem, allowing specialists to focus on the parts of an application where quantum computing offers the greatest advantage, while letting the compiler handle the boilerplate code. To bridge this gap, we present a high-level synthesis framework that translates C programs into quantum circuits through a sequence of modular and structured Multi-Level Intermediate Representation (MLIR) dialects. These dialects expose classical control and data flow in a form compatible with quantum constraints, enabling reversible and unitary circuit generation. Our framework maps conditionals, loops, and arithmetic operations, supports configurable bitwidths, and allows retargetability to different quantum backends. Furthermore, we demonstrate a correlation between classical program metrics—such as instruction count and cyclomatic complexity—and the performance characteristics of the resulting quantum circuits. To validate our methodology, we quantify compilation resource usage, showing a linear scaling of memory footprint and a quadratic scaling of CPU time as a function of quantum circuit complexity. Our tool generates circuits in OpenQASM format, facilitating integration with current quantum programming frameworks.
Quantum computing is increasingly integrated into High-Performance Computing (HPC) environments, where quantum processors act as specialized accelerators within hybrid workflows. The Munich Quantum Software Stack (MQSS) - a unified compilation and runtime framework for hybrid quantum–classical computing - provides the foundation for this integration. However, the growing heterogeneity of applications demands more flexible compilation tools. This work introduces an MultiLevel Intermediate Representation (MLIR)-based translation library that extends MQSS by enabling the conversion of CUDA-Quantum (CUDA-Q) (quake) dialects into machine learning–oriented MLIR representations compatible with modern compiler ecosystems. Leveraging MLIR’s dialect-driven design, the library enables hardware-agnostic transformations, device-specific optimizations, and seamless integration with MQSS components. The proposed approach bridges quantum compilation and contemporary machine learning frameworks, facilitating GPU-accelerated circuit simulation, hybrid quantum–classical workflows, and heterogeneous execution, thereby advancing a unified compiler infrastructure for quantum computing.