Skip to main content
QUICK REVIEW

[Paper Review] Extending C++ for Heterogeneous Quantum-Classical Computing

Thien Nguyen, Anthony Santana|arXiv (Cornell University)|Oct 8, 2020
Quantum Computing Algorithms and ArchitectureComputer Science36 references4 citations
TL;DR

This paper presents qcor, a C++ language extension and compiler that enables seamless heterogeneous quantum-classical programming through a novel Clang plugin interface. It compiles quantum kernels to the XACC intermediate representation, supports hardware-agnostic compilation, and integrates with quantum optimization and error correction workflows, enabling high-level, performant execution of variational quantum algorithms on near-term devices.

ABSTRACT

We present qcor - a language extension to C++ and compiler implementation that enables heterogeneous quantum-classical programming, compilation, and execution in a single-source context. Our work provides a first-of-its-kind C++ compiler enabling high-level quantum kernel (function) expression in a quantum-language agnostic manner, as well as a hardware-agnostic, retargetable compiler workflow targeting a number of physical and virtual quantum computing backends. qcor leverages novel Clang plugin interfaces and builds upon the XACC system-level quantum programming framework to provide a state-of-the-art integration mechanism for quantum-classical compilation that leverages the best from the community at-large. qcor translates quantum kernels ultimately to the XACC intermediate representation, and provides user-extensible hooks for quantum compilation routines like circuit optimization, analysis, and placement. This work details the overall architecture and compiler workflow for qcor, and provides a number of illuminating programming examples demonstrating its utility for near-term variational tasks, quantum algorithm expression, and feed-forward error correction schemes.

Motivation & Objective

  • To enable high-level, performant quantum-classical programming in C++ for near-term quantum hardware.
  • To provide a hardware-agnostic, retargetable compiler pipeline for quantum kernels targeting diverse physical and virtual quantum backends.
  • To integrate quantum compilation tasks—such as circuit optimization, analysis, and qubit placement—into a unified, extensible workflow.
  • To support advanced quantum algorithms, including variational methods and feed-forward error correction, within a single-source C++ environment.
  • To promote tight integration of quantum co-processors with existing high-performance computing stacks through a standards-compliant, open-source compiler infrastructure.

Proposed method

  • The qcor compiler uses a novel Clang plugin, SyntaxHandler, to enable domain-specific language pre-processing for quantum kernel expressions within C++.
  • Quantum kernels are translated into the XACC intermediate representation, enabling hardware-agnostic compilation and retargeting to multiple quantum backends.
  • The system integrates with the XACC framework to expose user-extensible hooks for quantum compilation routines, including circuit optimization and qubit placement.
  • A high-level library, qcor_hybrid, provides abstractions for advanced algorithms like ADAPT-VQE, abstracting low-level circuit construction and optimization.
  • The compiler supports feed-forward control and gradient-based optimization, enabling iterative quantum algorithms such as VQE and QAOA.
  • The workflow is fully open source and available via GitHub, with support for both simulation and execution on real quantum processors.

Experimental results

Research questions

  • RQ1How can C++ be extended to natively express quantum kernels in a single-source, heterogeneous quantum-classical programming model?
  • RQ2What compiler architecture enables hardware-agnostic, retargetable compilation of quantum kernels while preserving performance and extensibility?
  • RQ3How can quantum compilation tasks such as optimization, analysis, and qubit placement be integrated into a unified, extensible workflow within a C++-based system?
  • RQ4Can high-level quantum algorithms like ADAPT-VQE be efficiently expressed and executed in C++ with minimal performance overhead?
  • RQ5How can feed-forward control and gradient-based optimization be supported in a C++-based quantum compiler for near-term quantum applications?

Key findings

  • The qcor compiler successfully compiles C++ quantum kernels to the XACC intermediate representation, enabling execution on multiple quantum backends including the TNQVM simulator.
  • The ADAPT-VQE algorithm was successfully implemented and executed using the qcor_hybrid library, achieving convergence to an energy of approximately -1.81363 Hartree for a four-hydrogen chain system.
  • The system supports iterative, adaptive circuit ansatz generation in VQE workflows, dynamically selecting the most relevant Pauli or fermionic operators based on gradient analysis.
  • The integration of L-BFGS optimization with central finite difference gradient computation enables efficient variational parameter updates in the ADAPT framework.
  • The compiler supports feed-forward error correction schemes and other complex control flows, demonstrating viability for advanced quantum-classical workloads.
  • The entire stack is open source and available at https://github.com/ornl-qci/qcor, enabling community extension and integration with HPC workloads.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.