Home Audience Developers Open Source Quantum Compilers: A Technical Overview Of The Current Landscape

Open Source Quantum Compilers: A Technical Overview Of The Current Landscape

0
9

Quality quantum compilers are a necessity to get the best results from noisy quantum machines. Fortunately, there are quite a few open source compilers that are up to the task.

Every quantum program needs to transform abstract logic of qubits and gates into a sequence of control signals a machine can interpret. Software that carries out this function is called a quantum compiler. Constructing a compiler for early-stage quantum machines that have limited connectivity, coherence, and suffer from noise is a major challenge for quantum computing. For such machines, the quality of a compiler can make a considerable difference in the performance of an algorithm.

In classical computing, the main challenges are speed and code size, whereas in quantum computing, the main problems are decoherence, gate errors, and qubit connectivity. Despite these problems, hardware vendors have been sustaining an active open source community of quantum compiler builders. Vendor competition has made the quality of available quantum compilers a priority.

What a quantum compiler does

A quantum compiler lowers a circuit from a high level of abstraction to a level that a machine can execute. The stages in this process include:

  • Circuit translation — Conversion of a circuit to an internal intermediate representation, which is typically a directed acyclic graph (DAG) of gates.
  • Circuit optimisation — Combining, cancelling, and rewriting gate sequences to lower the circuit depth and the overall number of gates using algebraic identities.
  • Qubit mappings and routing — Logical qubits are linked to physical qubits, and SWAP gates are placed to ensure that two-qubit gates only connect physically neighbouring qubits.
  • Basis gate decomposition — Decomposing arbitrary gates in terms of the gate set that a particular machine supports.
  • Noise-aware scheduling — This is about reducing error by using calibration data, which includes error rates, gate durations and crosstalk, to identify the least noisy qubits and the optimal gate order. The output is usually a hardware-executable circuit, which is often accompanied by detailed, pulse-level, instructions for the control electronics.
 The logical circuit as written, before compilation
Figure 1: The logical circuit as written, before compilation
The same circuit as Figure 1, after transpilation: qubits remapped (q2↦0, q1↦1, q0↦2, q3↦3), non-adjacent CX gates routed through SWAPs, and every gate decomposed into the device’s native basis
Figure 2: The same circuit as Figure 1, after transpilation: qubits remapped (q2↦0, q1↦1, q0↦2, q3↦3), non-adjacent CX gates routed through SWAPs, and every gate decomposed into the device’s native basis

The major open source compilers

A handful of projects dominate current usage, each shaped by the hardware vendor or lab behind it.

Qiskit Transpiler (IBM)

Qiskit is the most feature-rich open source library, covering the entirety of circuit construction, control, and dynamic circuits as well as modelling, noise, and simulation. It also has tight integration with IBM hardware.

Cirq (Google)

Cirq is built for experimentation on near-term hardware and gives users flexibility in control, which is Google’s superconducting processor. Until recently, access to Google’s hardware was more limited than IBM’s, which has kept its mindshare somewhat behind Qiskit.

tket/pytket (Quantinuum)

Unlike Cirq and Qiskit, tket is a modular compiler that includes optimisation passes, which produce very thin circuits with low gate counts. It is easy to incorporate tket into other libraries.

PennyLane and Catalyst (Xanadu)

Instead of focusing on optimisation, PennyLane has built tools for quantum machine learning. It’s Catalyst just-in-time compiler now compiles directly to hardware control signals and is one of the first fully open source stacks spanning software through hardware.

XACC, Staq, ProjectQ, and more

Past the four main SDKs, a lengthier tail of community and lab-driven efforts targets unique use cases. XACC aims to facilitate integration of quantum kernels within classical high performance-computing frameworks, while Staq and ProjectQ provide circuit synthesis and format translation tools that are more appropriate for use in academia.

A comparison of the major open source compilers

Compiler/ SDK Backer Language Distinguishing focus
Qiskit (Transpiler) IBM Python Broadest feature set: pulse control, dynamic circuits, noise-aware passes, largest hardware install base
Cirq Google Python Fine-grained control for NISQ research; native path to Google superconducting hardware
tket/pytket Quantinuum (CQC) C++/Python Retargetable optimiser prized for aggressive circuit-depth and gate-count reduction
PennyLane + Catalyst Xanadu Python JIT compilation for differentiable, hybrid quantum-classical programs; strong QML fit
XACC Oak Ridge Nat’l Lab C++ Extensible, HPC-oriented compiler for integrating quantum kernels into classical supercomputing workflows
Staq/ ProjectQ Academic/
Community
C++/Python Lightweight, research-friendly toolchains for circuit synthesis and translation between formats

Core compilation techniques

Gate-level optimisation

Here, various peephole optimisation rewrite rules are applied to circuits. Gates are cancelled by their inverse and moved between circuits, while rotations are merged. To the best of my knowledge, no hardware mapping is employed at this level.

Qubit mapping and routing

Since most superconducting and many trapped-ion devices only connect a subset of qubit pairs, the compiler determines the placement of logical qubits and inserts SWAP networks to overcome connectivity constraints. This is usually implemented through heuristic or graph-based search algorithms..

Noise-aware and calibration-driven passes

Transpilers that support noise mitigation now integrate daily calibration data to perform the least error-prone routing and scheduling.

Pulse-level and hybrid compilation

This involves compiling beyond just mapping to gates and includes variational algorithms. In a hybrid approach, Catalyst extends this through classical control.

Actual console output: depth grew from 5 to 21 and gate count from 9 to 41 purely to satisfy hardware constraints, with no change to the circuit's logic
Figure 3: Actual console output: depth grew from 5 to 21 and gate count from 9 to 41 purely to satisfy hardware constraints, with no change to the circuit’s logic

Choosing a compiler

The right choice highly depends on your target hardware and what you aim to achieve:

  • If you want general-purpose learning and broad flexibility over the hardware you control, Qisket has the best resources and tutorials.
  • If you want to maximise circuit depth for a noisy device, tket’s optimiser is often used as the second-pass compiler, even with another SDK’s frontend.
  • If you want to pursue QML (quantum machine learning) or variational algorithms and to include gradients, PennyLane with Catalyst is the optimal choice.
  • If you want to engage in research focused on Google’s hardware or use gate-model prototyping, Cirq is a good choice.
  • If you want to integrate quantum kernels into classical HPC, use XACC.
Actual console output: the optimiser collapsed the redundant H·H and zero-angle Rz into a single combined TK1 rotation, cutting depth from 7 to 5 and gate count from 11 to 8 while leaving the three CX gates untouched
Figure 4: Actual console output: the optimiser collapsed the redundant H·H and zero-angle Rz into a single combined TK1 rotation, cutting depth from 7 to 5 and gate count from 11 to 8 while leaving the three CX gates untouched

Implementation walkthrough

The next two examples were executed in Python to illustrate compilation in a more practical manner. They both use a 4-qubit GHZ-like entangling circuit to illustrate before and after images of what one pass of the compiler looks like.

Qiskit: Transpiling for limited hardware connectivity

This example builds a circuit in which logical CX gates connect qubit 0 to every other qubit, and then transpiles it for a device that only has linear nearest-neighbour connectivity (0–1–2–3) and a restricted native gate set.

  1. Install the SDK: pip install qiskit
  2. Build the logical circuit with QuantumCircuit(4), adding an H gate and three CX gates fanning out from qubit 0.
  3. Define the target hardware’s coupling map ([[0,1],[1,2],[2,3]]) and native basis gates (cx, rz, sx, x).
  4. Call transpile(circuit, coupling_map=…, basis_gates=…, optimization_level=3).
  5. Compare circuit.depth() and count_ops() before and after to see the routing and decomposition cost.

pytket: Peephole optimisation

This example deliberately adds redundant operations — a double Hadamard (H·H = identity) and a zero-angle rotation — to a similar GHZ-style circuit, then runs tket’s FullPeepholeOptimise pass to show automatic simplification.

6. Install the SDK: pip install pytket

7. Build the circuit with Circuit(4), adding the entangling gates plus the two deliberately redundant operations.

8. Record depth(), n_gates, and the CX count before optimisation.

9. Apply the pass: FullPeepholeOptimise().apply(circuit).

10. Re-check the same metrics and print the resulting gate list to confirm the redundant operations are gone.

Together, the two examples illustrate the two complementary jobs a quantum compiler does: Qiskit’s transpiler shows the cost of adapting a circuit to real hardware constraints, while tket’s optimiser shows how much of that cost can be clawed back through algebraic simplification before or after routing.

All these projects aim at interoperability instead of settling on a single winner. Tket runs circuits in both Qiskit and Cirq. PennyLane offers plugins to interface with multiple backends. Cloud QPUs (IBM Quantum, Azure Quantum, Amazon Braket, etc) provide a choice of compilers as a pluggable layer, as opposed to a completely integrated and set stack. With improvements in hardware, focus in compiler research will likely shift to error correction compilation and resource estimation in conjunction with noise-aware, calibration driven optimisation.

Open source quantum compilation tools have advanced to the point where they can be considered serious competition. Qiskit, Cirq, tket and PennyLane, for instance, have a great deal of flexibility, each in their own ways. Most serious open source projects leverage multiple compilers. It is now essential to understand what each compiler optimises, and why, in order to get the best results from today’s noisy quantum devices.

Loading form…

LEAVE A REPLY

Please enter your comment!
Please enter your name here