Quantum circuit simulation is important in the evolution of quantum software and hardware. Novel algorithms can be developed and evaluated by performing quantum circuit simulations on classical computers before physical quantum computers are available. Unfortunately, compared with a physical quantum computer, a prolonged simulation time hampers the rapid development of quantum algorithms. Inspired by the feedback-directed optimization scheme used by classical compilers to improve the generated code, this work proposes a quantum compiler framework QOPS to enable profile-guided optimization (PGO) for quantum circuit simulation acceleration. The QOPS compiler instruments a quantum simulator to collect performance data during the circuit simulation and it then generates the optimized version of the quantum circuit based on the collected data. Experimental results show the PGO can effectively shorten the simulation time on our tested benchmark programs. Especially, the simulator-specific PGO (virtual swap) can be applied to the benchmarks to accelerate the simulation speed by a factor of 1.19. As for the hardware-independent PGO, compared with the brute force mechanism (turning on all available compilation flags), which achieves 21% performance improvement against the non-optimized version, the PGO can achieve 16% speedup with a factor of 63 less compilation time than the brute force approach.
翻译:量子电路模拟在量子软件与硬件的发展中具有重要意义。在物理量子计算机可用之前,通过经典计算机执行量子电路模拟,能够开发和评估新型量子算法。然而,与物理量子计算机相比,冗长的模拟时间阻碍了量子算法的快速发展。受经典编译器采用反馈导向优化方案改进生成代码的启发,本文提出一种量子编译器框架QOPS,以实现性能剖析引导优化(PGO)来加速量子电路模拟。QOPS编译器通过在电路模拟过程中对量子模拟器进行插装以收集性能数据,随后基于收集的数据生成优化版本的量子电路。实验结果表明,PGO能有效缩短测试基准程序的模拟时间。特别是,模拟器特定的PGO(虚拟交换)应用于基准测试时,可将模拟速度提升至1.19倍。对于硬件无关的PGO,相较于暴力优化机制(启用所有可用编译选项)相比非优化版本实现的21%性能提升,PGO在达到16%加速比的同时,其编译时间仅为暴力方法的1/63。