TL;DR
This paper introduces Amaro, a novel framework that automates the generation of quantum compilers for qubit mapping and routing (QMR). By defining QMR problems using a domain-specific language, Amaro can automatically synthesize specialized compilers, demonstrating competitive performance against hand-written solutions and simplifying the development of quantum software for diverse hardware.
What Problem Does This Paper Address?
Quantum computers, while promising, are notoriously difficult to program. A crucial step in running quantum algorithms is the qubit mapping and routing (QMR) problem. This involves translating a high-level quantum circuit into a sequence of operations executable on a specific quantum processor (QPU). This requires mapping logical qubits to physical qubits and planning the execution of quantum gates, all while adhering to the QPU's unique connectivity constraints and error characteristics.
The challenge is that the landscape of quantum hardware is rapidly evolving, with diverse qubit technologies (superconducting, trapped ions, neutral atoms) and varying connectivity. Traditionally, addressing the QMR problem for each new architecture has meant developing entirely new, specialized compilers from scratch. This is a time-consuming and resource-intensive process. The authors aim to automate this by creating a system that can generate QMR compilers based on a description of the target QPU's constraints.
Methods
The core of the Amaro framework is its ability to abstract and generalize the QMR problem. The authors propose viewing QMR as a device state machine problem. A "state" represents the current configuration of the QPU, including the mapping of logical to physical qubits and the gates being executed. The "transitions" between states represent operations (like SWAP gates) that change the qubit map.
Key methodological contributions include:
- Abstract QMR Formulation: A unified model based on device state machines that captures the common structure of various QMR problems.
- Amaro Language: A domain-specific language (DSL) for concisely specifying the unique constraints of a QPU's states and transitions. This allows users to define a QMR problem with just a few lines of code.
- Parametric Solver: A generic solver that takes an Amaro program (a QMR problem specification) and automatically instantiates a specialized compiler. This solver employs a maximal-state construction strategy, aiming to execute as many gates in parallel as possible at each step.
- Simulated Annealing: For complex problems where finding the optimal solution is challenging, Amaro uses simulated annealing to search for good initial qubit maps and to explore different transition choices.
- Static Analysis: Techniques to identify properties like "non-interference" in QPU state machines, which can significantly speed up the solver by eliminating unnecessary search.
Datasets
The paper evaluates Amaro on a suite of 243 application circuits collected from existing benchmarks (Molavi et al. [39], Zulehner et al. [67]). This suite includes:
- Arithmetic circuits
- Programs from quantum programming languages (Quipper, ScaffoldCC)
- Implementations of major quantum algorithms (Shor's, Quantum Fourier Transform, Bernstein-Vazirani, QAOA, Grover's)
These circuits range in size from a few qubits and gates to hundreds of qubits and tens of thousands of gates. The paper also defines and uses several QMR problem instances based on real-world quantum hardware architectures, including NISQ devices (Rigetti Aspen-M, Google Sycamore, IBM Eagle), and architectures with error correction (Surface Code).
Key Insights and Ideas
- Unifying QMR: The insight that diverse QMR problems share a common underlying structure (device state machines) is crucial. This allows for a single, general-purpose solver to be adapted to many different hardware types.
- Declarative Specification: The Amaro language enables a declarative approach to defining QMR problems. Instead of writing imperative code for each compiler, users describe the hardware constraints, and the system generates the compiler. This significantly lowers the barrier to entry for developing quantum compilers.
- Generality and Performance: The authors demonstrate that a single, generic approach can yield compilers that are competitive with highly specialized, hand-tuned solutions across a wide range of QMR problems. This suggests that automated compiler generation is a viable path forward.
- Trade-offs in Quantum Compilation: The results highlight the complex trade-offs in quantum compilation. For instance, while one compiler might add more SWAP gates (increasing circuit depth), another might be better at handling variable error rates, leading to a higher overall success probability.
Key Results
Amaro's generated compilers demonstrate strong performance across various QMR problems:
- NISQMR: Amaro matches or outperforms QISKIT (a leading industrial toolkit) on roughly 48% of benchmarks. It also solves many instances where QSYNTH2 (an optimal solver) times out. For the NISQ-VE (variable error) problem, Amaro is essentially equivalent to QISKIT on average, suggesting its suitability for devices with accurate error rate information.
- SCMR: Amaro outperforms the state-of-the-art tool DASCOT, finding better solutions for 57% of benchmarks and matching DASCOT's performance for another 8%.
- TIQMR: Amaro significantly outperforms SHAPER, reducing the cost by at least 50% in many cases and finding solutions where SHAPER fails.
- Convergence: For many benchmarks, Amaro finds solutions close to the final cost within minutes, demonstrating efficient convergence. For example, in NISQMR, 80% of benchmarks reach a solution within 10% of the final cost in under 492 seconds.
Limitations and Future Work
- Optimality: Amaro is an approximate algorithm and is not guaranteed to find the globally optimal solution for all QMR problems, especially given their NP-hard nature.
- Resource Bounds: While Amaro generally performs well, it can sometimes fail to find a solution within the given resource bounds (e.g., time limits), as indicated by timeouts in some benchmarks.
- Future Work: The authors suggest two main avenues for future research:
- Improving Search: Exploring reinforcement learning for constructing mapping and routing policies that can transfer between QPUs, and further optimizing the search algorithm's runtime and accuracy.
- Circuit Optimization: Combining mapping and routing with circuit optimization synthesis to co-optimize the circuit and its execution on the device.
Summary updated