Lifetime-Based Optimization for Simulating Quantum Circuits on a New Sunway Supercomputer

Yaojian Chen, Yong Liu, Xinmin Shi, Jiawei Song, Xin Liu, Lin Gan, Chu Guo, Haohuan Fu, Jie Gao, Dexun Chen, Guangwen Yang

TL;DR

This paper introduces a novel "lifetime" concept to optimize the simulation of quantum circuits using tensor network contraction (TNC) on the Sunway supercomputer. By understanding how tensor dimensions influence computations, they developed methods to significantly reduce the overhead associated with slicing (a memory-saving technique), leading to a substantial speedup in simulating large quantum circuits.

What Problem Does This Paper Address?

Simulating quantum computers on classical hardware is crucial for validating quantum hardware and algorithms. However, the exponential growth of quantum states with the number of qubits makes direct simulation infeasible for even moderately sized systems. Tensor Network Contraction (TNC) offers a promising approach by representing quantum circuits as networks of tensors. A key challenge in TNC is managing the memory required for intermediate tensors, especially for large circuits. The "slicing" technique is employed to break down large tensors into smaller ones, thereby reducing memory footprint. However, slicing introduces computational overhead, slowing down the simulation. This paper tackles the problem of minimizing this slicing overhead to achieve more efficient and scalable quantum circuit simulation.

Methods

The core innovation of this paper is the introduction of the "lifetime" concept for tensor network edges (representing tensor dimensions). Lifetime quantifies the influence of a dimension on the overall contraction process. Based on this concept, the authors propose several novel methods:

  • Lifetime-based Interpretation: A framework to understand and quantify the slicing overhead, explaining its origins.
  • In-place Slicing Strategy: An algorithm to find the smallest possible slicing set, aiming to minimize redundant computations. This strategy is designed to be a general post-processing step for existing path optimization software.
  • Adaptive Tensor Network Contraction Path Refiner: A method tailored for the Sunway architecture to further optimize the contraction path and reduce overhead.
  • Secondary Slicing: A fused design approach for thread-level optimization on the Sunway processor, organizing sub-paths on local data memory (LDM) to reduce frequent memory accesses and improve computational intensity.
  • Slice-Stacking Strategy: A technique that leverages multi-level storage systems to trade data movement for reduced computation overhead, particularly useful in scenarios with high bandwidth and high slicing overhead.

Datasets

The paper evaluates its methods using the tensor network representation of the Sycamore quantum processor's random quantum circuits (RQCs). They do not introduce new benchmark datasets but rather use a well-known benchmark in the field to demonstrate the effectiveness of their approach.

Key Insights and Ideas

  • Lifetime as a Unifying Concept: The "lifetime" of a tensor dimension provides a powerful lens to understand and predict the impact of slicing, offering a more interpretable approach than purely heuristic methods.
  • Slicing Overhead is Not Inevitable: The paper demonstrates that by carefully considering the lifetime of sliced dimensions, the computational overhead introduced by slicing can be significantly reduced, and in some cases, even eliminated through strategies like slice-stacking.
  • Hardware-Aware Optimization is Crucial: The proposed methods are tailored to the Sunway architecture, highlighting the importance of understanding hardware specifics (like LDM size and memory bandwidth) for achieving peak performance in large-scale simulations.
  • Shifting from Memory-Bound to Compute-Bound: In certain cases, the proposed fused design and secondary slicing techniques can transform computation kernels from being memory-intensive to compute-intensive, leading to higher FLOPs utilization.

Key Results

The paper reports significant performance improvements:

  • Reduced Slicing Overhead: Their in-place slicing strategy generally results in less slicing overhead compared to the widely used Cotengra software.
  • Substantial Simulation Speedup: For the Sycamore quantum processor RQC, their method achieved a simulation time of 96.1 seconds using over 41 million cores.
  • High Sustainable Performance: This translates to a sustainable single-precision performance of 308.6 Pflops, which is more than a 5-fold improvement compared to previous work (60.4 Pflops in 2021).
  • Improved Arithmetic Intensity: In some cases, the optimization techniques led to an arithmetic intensity of 2.6 to 42.3 times higher than the original mixed-precision intensity, and 1.22 to 40 times higher than the original single-precision intensity.

Limitations and Future Work

  • Stochastic Nature of SA: The slice refiner based on simulated annealing (SA) is a stochastic algorithm and does not guarantee finding the absolute optimal slicing set, though it balances time and quality.
  • Dispersed Computationally Intensive Regions: In a few exceptional cases, their strategy performed worse than Cotengra, which was attributed to dispersed computationally intensive regions within the contraction paths.
  • Generalizability: While the slice-stacking strategy is presented as generalizable to arbitrary multi-level storage systems, its effectiveness might vary across different architectures.

The authors suggest that the "lifetime" concept is promising and can be generalized to other tensor network applications beyond quantum circuit simulation, potentially playing a significant role in fields like statistical physics, data science, and sociology. Future work could explore further optimizations and applications of this concept.

Summary updated

BibTeX
@inproceedings{chen2023lifetime,
  author = {Yaojian Chen and Yong Liu and Xinmin Shi and Jiawei Song and Xin Liu and Lin Gan and Chu Guo and Haohuan Fu and Jie Gao and Dexun Chen and Guangwen Yang},
  title = {{Lifetime-Based Optimization for Simulating Quantum Circuits on a New Sunway Supercomputer}},
  booktitle = {PPoPP},
  year = {2023},
  url = {https://openreview.net/forum?id=nbDb38Mpwk},
}
Figure