We propose an IR for quantum computing that directly exposes quantum and classical data dependencies for the purpose of optimization. Our IR consists of two dialects, one input dialect and one that is specifically tailored to enable quantum-classical co-optimization. While the first employs a perhaps more intuitive memory-semantics (quantum operations act as side-effects), the latter uses value-semantics (operations consume and produce states). Crucially, this encodes the dataflow directly in the IR, allowing for a host of optimizations that leverage dataflow analysis. We discuss how to map existing quantum programming languages to the input dialect and how to lower the resulting IR to the optimization dialect. We present a prototype implementation based on MLIR that includes several quantum-specific optimization passes. Our benchmarks show that significant improvements in resource requirements are possible even through static optimization. In contrast to circuit optimization at runtime, this is achieved while incurring only a small constant overhead in compilation time, making this a compelling approach for quantum program optimization at application scale.
翻译:我们提议了一个量子计算IR, 直接暴露量子和传统数据依赖性, 以便优化。 我们的IR由两种方言组成, 一种输入方言, 一种是专门为允许量子古典同步化而定制的。 虽然第一个方言使用一种也许更直观的内存- 测义( 量子操作作为副作用), 但后者使用值测义( 操作消耗和生成状态) 。 关键是, 它将数据流直接编码在IR 中, 允许大量优化数据流分析。 我们讨论如何将现有的量子编程语言映射成输入方言, 以及如何将产生的量测程语言降为优化方言。 我们根据 MLIR 展示一个基于量子优化的原型执行模式, 其中包括几个量子优化通行证。 我们的基准显示, 即使静态优化, 资源需求也有可能得到重大改善。 与运行时的电路优化相比, 这在编译过程中只带来一个小的固定的间接时间, 从而在应用规模上使量子程序优化方法具有说服力。