We propose an IR for quantum computing that directly exposes quantum and classical data dependencies for the purpose of optimization. The Quantum Intermediate Representation for Optimization (QIRO) 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 run time, 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, 直接暴露量子和传统数据依赖性, 以便优化。 量子中间优化代表( QIRO) 由两种方言组成, 一种输入方言, 一种是专门设计, 使量子古典共同优化。 前者使用一种也许更直观的内存- 语义( 量子操作作为副作用), 而后者则使用价值- 语义( 操作消耗和生成状态) 。 关键是, 它将数据流直接编码在IR 中, 允许使用一系列优化数据流分析。 我们讨论如何将现有的量子编程语言绘制成输入方言, 以及如何将产生的IR 降为优化方言。 我们提出一个基于 MLIR 的原型执行模式, 其中包括几个量子优化通行证。 我们的基准显示, 资源需求可以通过静态优化得到重大改进。 与运行时的电路优化相比, 实现这一目的只是在编译过程中只带来少量的连续管理, 使得这种在应用规模上对量子方案进行优化。