Variational algorithms are a representative class of quantum computing workloads that combine quantum and classical computing. This paper presents an LLVM-based C++ compiler toolchain to efficiently execute variational hybrid quantum-classical algorithms on a computational system in which the quantum device acts as an accelerator. We introduce a set of extensions to the C++ language for programming these algorithms. We define a novel Executable and Linking Format (ELF) for Quantum and create a quantum device compiler component in the LLVM framework to compile the quantum part of the C++ source and reuse the host compiler in the LLVM framework to compile the classical computing part of the C++ source. A variational algorithm runs a quantum circuit repeatedly, each time with different gate parameters. We add to the quantum runtime the capability to execute dynamically a quantum circuit with different parameters. Thus, programmers can call quantum routines the same way as classical routines. With these capabilities, a variational hybrid quantum-classical algorithm can be specified in a single-source code and only needs to be compiled once for all iterations. The single compilation significantly reduces the execution latency of variational algorithms. We evaluate the framework's performance by running quantum circuits that prepare Thermofield Double (TFD) states, a quantum-classical variational algorithm.
翻译:变式算法是一种具有代表性的量子计算工作量类别, 包括量子计算和古典计算。 本文展示了一个基于 LLVM 的 C++ 编译器工具链, 以便在一个计算系统中高效地执行量子设备作为加速器的变异混合量子古典算法。 我们为这些算法的编程引入了一套C++语言扩展。 我们为量子算法定义了一个新的可执行和链接格式( ELF), 在 LLLVM 框架中创建一个量子设备编集器组件, 以编译 C++ 源的量子部分, 并在 LLVM 框架中重新使用主机编集器来编译 C++ 源的经典计算部分。 变式算法在计算系统中反复运行量子电路, 每次使用不同的门参数。 我们在量子运行时添加了一套能力, 以动态方式执行量子电路路。 因此, 程序员可以将量子程序用与古典程序相同的方式调。 有了这些能力, 一个变式混合的量子- 级算算法可以在单一源代码中指定, 只需要一次编译一次来编辑 C++ 。 。 单级演算法框架 大大降低性演算。