基于张量核心上的SGEMM仿真与自动精度选择的量子电路模拟
Quantum Circuit Simulation by SGEMM Emulation on Tensor Cores and Automatic Precision Selection
AI总结:
本文提出利用输入张量指数范围统计自动选择TF32或FP16张量核心执行GEMM,在保持SGEMM精度的同时将量子电路模拟吞吐量最高提升1.86倍。
摘要:
量子电路模拟为量子算法的开发和量子优越性的验证提供了基础。在各种量子电路模拟方法中,张量网络缩并因其能够模拟更多量子比特而日益受到欢迎。在张量缩并过程中,输入张量被重塑为矩阵并通过GEMM运算进行计算,这些GEMM运算可能占总计算时间的90%。通过利用张量核心等混合精度硬件可以提高GEMM吞吐量,但直接实现会导致深度和大规模量子电路的保真度不足。先前的工作已经证明,即使在仅使用TF32或FP16张量核心的情况下,通过特别处理舍入模式的补偿求和也能完全恢复SGEMM的FP32精度。在将此类技术应用于量子电路模拟时,指数范围是一个关键问题。虽然TF32支持与FP32几乎相同的指数范围,但FP16支持的指数范围要小得多。在这项工作中,我们利用输入张量元素的指数范围统计信息来选择用于GEMM的张量核心。我们在随机电路采样(RCS)上评估了我们的方法,包括Sycamore的量子电路,结果表明在保持精度的同时,吞吐量最高可提升1.86倍。
英文摘要:
Quantum circuit simulation provides the foundation for the development of quantum algorithms and the verification of quantum supremacy. Among the various methods for quantum circuit simulation, tensor network contraction has been increasing in popularity due to its ability to simulate a larger number of qubits. During tensor contraction, the input tensors are reshaped to matrices and computed by a GEMM operation, where these GEMM operations could reach up to 90\% of the total calculation time. GEMM throughput can be improved by utilizing mixed-precision hardware such as Tensor Cores, but straightforward implementation results in insufficient fidelity for deep and large quantum circuits. Prior work has demonstrated that compensated summation with special care of the rounding mode can fully recover the FP32 precision of SGEMM even when using TF32 or FP16 Tensor Cores. The exponent range is a critical issue when applying such techniques to quantum circuit simulation. While TF32 supports almost the same exponent range as FP32, FP16 supports a much smaller exponent range. In this work, we use the exponent range statistics of input tensor elements to select which Tensor Cores we use for the GEMM. We evaluate our method on Random Circuit Sampling (RCS), including Sycamore's quantum circuit, and show that the throughput is 1.86 times higher at maximum while maintaining accuracy.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。