Dynamic quantum circuits with mid-circuit measurement and classical feedforward are essential for near-term algorithms such as error mitigation, adaptive phase estimation, and Variational Quantum Eigensolvers (VQE), yet transpiling these programs across frameworks remains challenging due to inconsistent support for control flow and measurement semantics. We present a transpilation pipeline that converts OpenQASM 3.0 programs with classical control structures (conditionals and bounded loops) into optimized CUDA-Q C++ kernels, leveraging CUDA-Q's native mid-circuit measurement and host-language control flow to translate dynamic patterns without static circuit expansion. Our open-source framework is validated on comprehensive test suites derived from IBM Quantum's classical feedforward guide, including conditional reset, if-else branching, multi-bit predicates, and sequential feedforward, and on VQE-style parameterized circuits with runtime parameter optimization. Experiments show that the resulting CUDA-Q kernels reduce circuit depth by avoiding branch duplication, improve execution efficiency via low-latency classical feedback, and enhance code readability by directly mapping OpenQASM 3.0 control structures to C++ control flow, thereby bridging OpenQASM 3.0's portable circuit specification with CUDA-Q's performance-oriented execution model for NISQ-era applications requiring dynamic circuit capabilities.
翻译:中测量与经典前馈的动态量子电路对于近期算法(如误差缓解、自适应相位估计和变分量子本征求解器)至关重要,但由于各框架对控制流与测量语义的支持不一致,跨框架编译此类程序仍颇具挑战。我们提出一种编译流水线,可将含经典控制结构(条件语句与有界循环)的OpenQASM 3.0程序转换为优化的CUDA-Q C++内核,利用CUDA-Q原生的中测量与宿主语言控制流,在不进行静态电路扩展的前提下实现动态模式的转换。本开源框架基于IBM量子经典前馈指南的完整测试集(包括条件重置、if-else分支、多位谓词与顺序前馈)以及含运行时参数优化的VQE型参数化电路进行验证。实验表明,生成的CUDA-Q内核通过避免分支复制降低了电路深度,借助低延迟经典反馈提升了执行效率,并通过将OpenQASM 3.0控制结构直接映射为C++控制流增强了代码可读性,从而为需要动态电路能力的近中期量子(NISQ)时代应用,架起了OpenQASM 3.0可移植电路规范与CUDA-Q面向性能的执行模型之间的桥梁。