TL;DR
This paper introduces HiSVSIM, a novel hierarchical state-vector simulator for quantum circuits that uses acyclic graph partitioning to improve simulation efficiency. By breaking down large circuits into smaller, manageable sub-circuits, HiSVSIM significantly reduces memory bottlenecks and communication overhead, leading to substantial speedups over existing simulators.
What Problem Does This Paper Address?
Simulating quantum circuits on classical computers is crucial for developing quantum algorithms and hardware. However, the memory requirements for state-vector simulation grow exponentially with the number of qubits, quickly exceeding the capacity of even the largest supercomputers. This "memory wall" limits the size and complexity of circuits that can be simulated. Existing simulators often struggle with data locality and communication overhead, especially on hierarchical memory architectures common in high-performance computing (HPC) systems. The paper aims to overcome these limitations by developing a simulation strategy that efficiently utilizes memory hierarchies and minimizes communication.
Methods
The core of HiSVSIM is its acyclic graph partitioning approach. Quantum circuits are represented as directed acyclic graphs (DAGs), where nodes are gates and edges represent qubit dependencies. The key idea is to partition this DAG into smaller sub-circuits (parts) that exhibit better data locality. This partitioning is done hierarchically:
- Circuit Partitioning: The input quantum circuit's DAG is partitioned into several smaller sub-circuits. The goal is to create parts that fit within smaller, faster memory layers (like CPU caches) and minimize the number of parts while respecting a maximum working set size limit. Three partitioning strategies are proposed:
- Nat (Natural Topological Order Cutoff): A deterministic approach based on the circuit's natural gate order.
- DFS (Depth-First Search): Explores random DFS topological orders to find a better partition.
- dagP (Acyclic-partitioning-based Partitioning): A novel heuristic based on an existing DAG partitioner, modified to minimize the number of parts while adhering to working set size constraints. This is found to be the most effective.
- Hierarchical Simulation (Gather-Execute-Scatter): Each partitioned sub-circuit is simulated using a smaller "inner" state vector. The simulation employs a "Gather-Execute-Scatter" model:
- Gather: Relevant amplitudes from the larger "outer" state vector are gathered into the smaller inner state vector.
- Execute: The gates within the current sub-circuit are simulated on the inner state vector.
- Scatter: The resulting amplitudes are scattered back to their original positions in the outer state vector.
- Multi-node Design: For circuits exceeding the memory of a single node, HiSVSIM extends its hierarchical approach to distributed HPC systems using MPI. It partitions qubits into "process" and "local" sets to manage communication and computation across multiple nodes.
- Multi-level Partitioning: This further refines the hierarchical approach by recursively partitioning parts, allowing for better exploitation of different memory levels (e.g., L1, L2, L3 caches, and main memory).
Datasets
The paper evaluates HiSVSIM on a suite of 13 benchmark quantum circuits from the QASMBench suite [23]. These circuits cover various application domains and range in size from 30 to 37 qubits. For some circuits (bv, cc, ising), they explore different qubit and gate configurations to test scalability.
Key Insights and Ideas
- Memory Hierarchy is Key: The paper strongly emphasizes that for large-scale quantum circuit simulation, efficiently utilizing the memory hierarchy (caches, main memory, distributed memory) is more critical than simply reducing gate counts.
- Acyclic Partitioning for Predictability: By ensuring partitions are acyclic, the simulator can process them in a well-defined order, simplifying synchronization and reducing the complexity of managing dependencies. This contrasts with approaches that might require complex reordering or synchronization for cyclic dependencies.
- dagP Outperforms Other Strategies: The novel
dagPpartitioning strategy consistently yields the best simulation times, demonstrating the effectiveness of a global view of the circuit DAG for optimization. - Hierarchical Simulation Reduces Bottlenecks: The "Gather-Execute-Scatter" model effectively breaks down the large state vector into smaller, cache-friendly working sets, significantly mitigating memory access latency.
- Scalability is Achieved: HiSVSIM shows strong scaling performance, with significant improvements as the number of MPI ranks (cores) increases.
Key Results
- Significant Speedups: HiSVSIM, particularly with the
dagPpartitioning strategy, achieves substantial speedups over the state-of-the-art Intel IQS simulator. - On a single node,
dagPpartitioning resulted in up to 3.9x improvement. - On a multi-node cluster (up to 1024 MPI ranks),
dagPachieved improvement factors ranging from 1.15x to 3.87x, with a geometric mean of 1.7x. - For larger qubit counts (≥ 35), improvements were even more pronounced, reaching up to 3.9x.
- Reduced Memory Access Latency:
dagPpartitioning consistently led to the lowest DRAM stalled time, indicating more efficient cache utilization. - Multi-level Partitioning Benefits: The multi-level partitioning strategy provided further improvements, achieving up to a 15.8% reduction in execution time compared to single-level partitioning, translating to up to 5.67x improvement over IQS.
- Efficient Partitioning: The
dagPpartitioning heuristic is computationally efficient, with runtimes typically in the milliseconds, making it practical for large circuits.
Limitations and Future Work
- Partitioning Complexity: While
dagPis efficient, the paper notes that finding the optimal partition is an NP-hard problem, and their heuristic may not always find the absolute minimum number of parts, though it performs very close to optimal solutions found via Integer Linear Programming (ILP). - GPU Integration: The paper explores a hybrid approach with a GPU simulator (HyQuas), showing promise for future work. They suggest that their partitioning approach could be beneficial for other GPU-based simulators.
- Weak Scaling: The paper mentions that weak scaling was not considered due to the non-linear nature of computation complexity and memory footprint changes with qubit count.
- Constraint Relaxation: The multi-node design currently requires the number of MPI ranks to be a power of two, though they note this constraint could be relaxed with virtual ranks.
The authors envision their graph-based partitioning approach being useful for other accelerator-based quantum simulators and real quantum computing platforms.
Summary updated