- The paper presents a novel modular quantum-classical compilation framework that integrates MLIR to support both high-level algorithm representation and hardware-specific mapping.
- It introduces dual dialects (QC for imperative operations and QCO for functional optimizations) to enable comprehensive optimization and interoperability.
- The framework demonstrates enhanced integration of classical control flow with quantum logic, paving the way for scalable and future-proof hybrid computational models.
The MQT Compiler Collection: Towards a Modular Quantum-Classical Compilation Blueprint
Introduction
The MQT Compiler Collection (mqt-cc) proposes a comprehensive quantum-classical compilation framework, decisively moving beyond the limitations of quantum-first compilation and firmly embedding quantum compilation into a classical-first, MLIR-based infrastructure. This architectural reorientation is motivated by the increasing integration of quantum computing into heterogeneous high-performance computing (HPC) environments and the growing complexity of quantum applications that interleave quantum and classical computation. By leveraging MLIR as its backbone, mqt-cc positions itself as both an implementation blueprint and a practical toolkit for modular, extensible, and future-proof quantum-classical program compilation.
Figure 1: mqt-cc combines quantum and classical concepts to create a future-proof modular compilation framework.
Background: Compilation Paradigms and MLIR as Infrastructure
Historically, quantum compilation infrastructure has been dominated by quantum-first approaches, which either neglect or insufficiently support structured control flow and classical logic. Early IRs such as OpenQASM 2.0 failed to adequately represent mixed quantum-classical programs, while ad-hoc extensions and tooling resulted in a fragmented ecosystem limited in extensibility. Although more recent standards (e.g., OpenQASM 3.0) attempt to address these deficiencies, they are often hamstrung by legacy architectures and the need to maintain compatibility with existing toolchains.
Classical-first designs, viewing quantum processors as specialized accelerators akin to GPUs, exploit decades of progress in classical compilation research. LLVM's introduction of QIR marked a pivotal shift towards realistic hybrid program representations. MLIR extends this philosophy, enabling highly modular composition via custom dialects, shared optimizations, and seamless integration of quantum and classical compilation passes at multiple abstraction levels.
Core Principles and Architecture
The mqt-cc framework is underpinned by several design tenets:
Technical Details
QC Dialect: Imperative Entry Point and Hardware Mapping
The QC dialect reflects standard quantum languages by providing reference-based (imperative) semantics, supporting familiar constructs such as in-place qubit allocation, mutation, measurement, and resource management. All unitary operations implement a common UnitaryOpInterface, enabling introspection and manipulation at the IR level.
Figure 3: Abbreviated TableGen definition for UnitaryOpInterface, the central interface for all QC dialect unitary operations.
This abstraction facilitates seamless import/export from/to languages like OpenQASM and Python-based frameworks (e.g., Qiskit), and supports non-unitary modifiers (controlled, inverse, power) as first-class primitives. The imperative nature is particularly advantageous for mapping to backend-specific instruction sets and hardware interaction, but by design complicates dataflow analysis and non-local optimization.
QCO Dialect: Functional Optimization Layer
Optimizations in mqt-cc are predominantly performed within the QCO dialect, which implements value semantics akin to linear type systems. Every operation consumes and produces explicit quantum state values, naturally constructing a dataflow graph suited for canonicalization, gate cancellation, and complex circuit transformations. Unlike custom DAG implementations in older toolchains, QCO directly leverages MLIR's use-def chains, streamlining both the analysis and execution of transformation passes.
This functional abstraction enables the direct encoding and application of advanced optimization techniques, including global reordering, qubit mapping algorithms such as QMAP, and integrating optimization across quantum and classical operations. Sophisticated passes, previously infeasible due to architectural limitations in quantum-first compilers, become tractable.
Pipeline and Bidirectional Conversion
The mqt-cc pipeline allows seamless conversion between QC and QCO dialects via robust, automated passes. Linearization (QC to QCO) uncovers explicit dependencies by tracking the latest quantum state values, enabling fine-grained dataflow optimizations. Bufferization (QCO to QC) reconstructs imperative operation sequences for hardware back-ends and interoperability. This modular bridging is critical for workflow composability and framework extensibility, ensuring that optimizations remain decoupled from language frontends and target platforms.
Structured Control and Hybrid Logic
By embedding the SCF dialect, the framework supports native structured classical control flow constructs (e.g., if-conditionals, loops), which can be interleaved with quantum instructions. Measurement-dependent branching and dynamic circuit structure are easily represented and optimized, with classical passes such as loop unrolling or conditional simplification applied directly within the hybrid IR. The extensibility of this model further enables future quantum hardware to support more interactive or adaptive programming paradigms with minimal modification to the compiler core.
Results and Implications
The modular infrastructure of mqt-cc demonstrates that quantum-classical programs can be represented, transformed, and lowered using unified classical compiler technologies. The adoption of MLIR dialects for both quantum and classical program fragments enables extensive optimization, tight integration with classical control logic, and future scalability as quantum hardware and algorithms become more sophisticated.
Significantly, the framework supports transparent extension and modification: new optimizations (e.g., error mitigation, hardware-specific placement), dialects for novel programming models (e.g., variational solvers, dynamic circuits), and interoperation with external tools (e.g., direct MLIR plugin for PennyLane) are naturally enabled. The public availability of the codebase accelerates research adoption, facilitates benchmarking and comparative studies, and serves as a template for industrial and academic compiler development.
Notably, mqt-cc makes the bold claim of effectively synthesizing the advantages of quantum-first domain expertise with classical-first compiler robustness, presenting a path towards both immediate utility and long-term maintainability for the quantum software stack.
Outlook and Future Directions
Looking forward, the integration of quantum and classical program compilation is poised to become essential as practical quantum computing transitions from prototyping to production and hybrid HPC workflows. The design choices inherent in mqt-ccโMLIR-based modularity, dual-dialect optimization, and extensibilityโprovide a flexible substrate for the emergence of new quantum programming idioms, adaptive algorithms, and tight coupling with classical simulation or error correction.
Further development directions include:
- Improved inter-dialect optimization: Cross-dialect analysis and transformation strategies facilitating optimizations that span classical and quantum boundaries.
- Hardware-aware scheduling: Exploiting architectural descriptions and resource models to inform mapping, routing, and scheduling, directly within the extensible dialect framework.
- Support for domain-specific dialects: Enabling specialized extensions for error correction codes, fault-tolerance strategies, or analog quantum computing models.
- Integration with formal verification: Applying MLIR's infrastructure and explicit dataflows to facilitate equivalence checking, program validation, and certification of quantum-classical transformations.
Conclusion
The MQT Compiler Collection advances the state of quantum-classical compilation by architecting a modular, extensible framework that synthesizes established quantum-specific program analysis with the scalability and maintainability of mainstream compiler infrastructure. By leveraging MLIR, mqt-cc enables explicit, optimizable representations of both quantum and classical logic, supports the full compilation stack, and provides a public baseline for future development in hybrid quantum-classical programming. This architectural blueprint is well-positioned to accelerate both research and practical adoption in the coming generation of quantum software tooling.