Versatile Cross-platform Compilation Toolchain for Schrödinger-style Quantum Circuit Simulation

Yuncheng Lu, Shuang Liang, Hongxiang Fan, Ce Guo, Wayne Luk, Paul H. J. Kelly

TL;DR

CAST (Cross-platform Adaptive Schrödinger-style Simulation Toolchain) is a novel compilation framework that dramatically accelerates classical quantum circuit simulation on both CPUs and GPUs. By introducing sparsity-aware gate fusion and dynamic kernel generation, CAST bypasses the limitations of rigid, hand-coded simulation libraries to deliver up to a 39.3x speedup over industry-standard tools like NVIDIA's cuQuantum.

What Problem Does This Paper Address?

Before fault-tolerant quantum computers become widely available, researchers rely heavily on classical computers to simulate and verify quantum algorithms. Schrödinger-style simulation is the gold standard for full verification because it tracks the entire quantum statevector, but its memory and computational requirements scale exponentially with the number of qubits.

To keep up, modern simulators use "gate fusion"—combining multiple quantum gates into a single larger operation to minimize slow memory accesses. However, existing tools suffer from two major flaws:

  1. Sparsity Blindness: They treat all gates of the same size equally, completely ignoring matrix sparsity (e.g., Pauli gates consist mostly of zeros, which could be skipped to save compute).
  2. Rigid Backends: They rely on pre-compiled, hand-crafted hardware kernels. This makes it incredibly tedious to optimize code across diverse hardware platforms, such as different CPU SIMD instruction sets or GPU architectures.

Methods

The authors introduce CAST, an automated compilation toolchain that bridges the gap between high-level quantum circuits and low-level hardware features.

Fig. 2. CAST Workflow.

CAST relies on three core innovations:

  • CircuitTile Data Structure & Agglomerative Fusion: Circuits are ingested into an intermediate representation called a CircuitTile. CAST actively shifts gates around to exploit commutation rules and maximize fusion opportunities (as illustrated in Tile Traversal and Agglomerative Fusion).
  • Sparsity-Aware Cost Model: Instead of blindly fusing gates up to a fixed qubit limit, CAST uses a hardware-profiling cost model. It counts the actual number of non-zero floating-point operations required at runtime. This allows it to aggressively fuse sparse gates while avoiding oversized dense gates that would overwhelm the processor's cache.
  • Dynamic Kernel Generation: Rather than using a static library of pre-defined kernels, CAST dynamically generates optimized code on the fly. It emits vectorized LLVM IR for CPUs (automatically targeting NEON, SSE, AVX2, or AVX512) and PTX code for NVIDIA GPUs, supporting both Just-In-Time (JIT) execution and static compilation.
Fig. 4. Tile traversal.
Fig. 5. Demonstration of agglomerative gate fusion. Each top block shows CAST serialization of the CircuitTile. The @ symbol denotes fusing gates together.

Datasets

The toolchain was evaluated using six standard quantum circuit benchmarks, divided into two categories based on their inherent structure:

  • Sparse-class benchmarks: Quantum Fourier Transform (QFT), Random Quantum Circuit (RQC), Instantaneous Quantum Polynomial (IQP), and Hamiltonian Evolution Simulation (HES).
  • Dense-class benchmarks: Alternating Layered Ansatz (ALA) and Quantum Volume Circuit (QVC).

Simulations were evaluated on up to 32 qubits for CPU benchmarks and 30 qubits for GPU benchmarks.

Key Insights and Ideas

  • Sparsity is a Hidden Superpower: Traditional simulators treat a fused multi-qubit gate as a dense matrix. CAST realizes that fused sparse gates retain predictable zero-patterns. Skipping these zeros during dynamic code generation eliminates unnecessary memory loads and math operations.
  • The Fusion Aggressiveness Trade-off: There is a clear performance peak when tuning gate fusion aggressiveness (Operation Count vs Simulation Time). Too little fusion bottlenecks the simulation on memory bandwidth (moving data back and forth). Too much fusion creates massive matrices that bottleneck the system on raw compute power. CAST's hardware-specific cost model automatically finds this sweet spot.
  • Bypassing Hand-Coded Kernels: Writing architecture-specific vector intrinsics by hand is a losing battle. Generating LLVM IR directly allows the compiler to handle low-level register allocation and hardware-native shuffling instructions dynamically (Bit Masking and Shuffling).
Fig. 6. Operation Count versus Simulation Time. Reference time is measured at the 4-thread 32-op-count-limit experiment. All experiments were carried out on CPU-based 30-qubit statevectors with double precision.
Fig. 7. Illustration when s = 2 and target qubits are {1, 4, 6}.

Key Results

  • GPU Performance: On 30-qubit sparse benchmarks, CAST achieved a massive 6.71x to 39.3x speedup compared to IBM Qiskit backed by NVIDIA's cuQuantum in single-precision mode. In double-precision, it outperformed both Qiskit and Qulacs by 2.08x to 10.3x.
  • CPU Performance: On a 32-core AMD EPYC processor simulating 32 qubits, CAST achieved up to an 8.03x speedup over Qiskit and a 17.4x speedup over Qibo. It also consistently outperformed or matched Google's highly optimized QSimCirq on sparse circuits.
  • Ablation Success: The adaptive, sparsity-aware fusion strategy alone reduced simulation runtime by 28.7% to 40.4% on CPUs and 18.5% to 36.6% on GPUs for sparse circuits compared to traditional size-only fusion methods.

Limitations and Future Work

  • Compilation Overhead: Because CAST generates and compiles code at runtime, it introduces a front-end compilation overhead. However, the authors demonstrate that this overhead quickly becomes negligible (dropping to just 0.59% of total execution time for a 32-qubit simulation) as the circuit size scales up.
  • Hardware Expansion: While the workflow diagram hints at FPGA memory and instruction scheduling support, the paper's experimental evaluation focuses exclusively on x86/ARM CPUs and NVIDIA GPUs. Fully implementing and benchmarking the toolchain on FPGAs or emerging architectures like RISC-V remains an open avenue for future work.

Summary updated

BibTeX
@inproceedings{lu2025versatile,
  author = {Yuncheng Lu and Shuang Liang and Hongxiang Fan and Ce Guo and Wayne Luk and Paul H. J. Kelly},
  title = {{Versatile Cross-platform Compilation Toolchain for Schrödinger-style Quantum Circuit Simulation}},
  booktitle = {DAC},
  year = {2025},
  doi = {10.1109/dac63849.2025.11132539},
}
Figure