Catalyst Quantum Runtime

The Catalyst Runtime is a C++ QIR runtime that enables the execution of Catalyst-compiled quantum programs, and is currently backed by PennyLane-Lightning state-vector simulators, and Amazon Braket devices. Additional hardware support, including QPUs, to come.

The runtime employs the QuantumDevice public interface to support an extensible list of backend devices. This interface comprises two collections of abstract methods:

  • The Qubit management, device shot noise, and quantum tape recording methods are utilized for the implementation of Quantum Runtime (QR) instructions.

  • The quantum operations, observables, measurements, and gradient methods are used to implement Quantum Instruction Set (QIS) instructions.

A complete list of instructions supported by the runtime can be found in RuntimeCAPI.h.

Contents

The directory is structured as follows:

  • include:

    This contains the public header files of the runtime including the QuantumDevice API for backend quantum devices and the runtime CAPI.

  • lib:

    The core modules of the runtime are structured into lib/capi and lib/backend. lib/capi implements the semantics for QIR instructions lowered to our custom runtime. lib/backend contains implementations of the QuantumDevice API for backend simulators.

  • tests:

    A collection of C++ tests for modules and methods in the runtime.

Backend Devices

New device backends for the runtime can be realized by implementing the quantum device interface. The following table shows the available devices along with supported features:

Features

PennyLane-Lightning

PennyLane-Lightning-Kokkos

Amazon-Braket-OpenQasm

Qubit Management

Dynamic allocation/deallocation

Static allocation/deallocation

Static allocation/deallocation

Gate Operations

Lightning operations

Lightning operations

Braket operations

Quantum Observables

Identity, PauliX, PauliY, PauliZ, Hadamard, Hermitian, Hamiltonian, and Tensor Product of Observables

Identity, PauliX, PauliY, PauliZ, Hadamard, Hermitian, Hamiltonian, and Tensor Product of Observables

Identity, PauliX, PauliY, PauliZ, Hadamard, Hermitian, and Tensor Product of Observables

Expectation Value

All observables; Finite-shots supported except for Hermitian

All observables; Finite-shots supported except for Hermitian

All observables; Finite-shots supported

Variance

All observables; Finite-shots supported except for Hermitian

All observables; Finite-shots supported except for Hermitian

All observables; Finite-shots supported

Probability

Only for the computational basis on the supplied qubits; Finite-shots supported except for Hermitian

Only for the computational basis on the supplied qubits; Finite-shots supported except for Hermitian

The computational basis on all active qubits; Finite-shots supported

Sampling

Only for the computational basis on the supplied qubits

Only for the computational basis on the supplied qubits

The computational basis on all active qubits; Finite-shots supported

Mid-Circuit Measurement

Only for the computational basis on the supplied qubit

Only for the computational basis on the supplied qubit

Not supported

Gradient

The Adjoint-Jacobian method for expectation values on all observables

The Adjoint-Jacobian method for expectation values on all observables

Not supported

Requirements

To build the runtime from source, it is required to have an up to date version of a C/C++ compiler such as gcc or clang with support for the C++20 standard library.

Installation

By default, the runtime builds all supported backend devices. You can build the runtime with custom devices from the list of Backend Devices. You can use ENABLE_LIGHTNING_KOKKOS=OFF to disable building the runtime with lightning.kokkos:

make runtime ENABLE_LIGHTNING_KOKKOS=OFF

Lightning-Kokkos provides support for other Kokkos backends including OpenMP, HIP and CUDA. Please refer to the installation guideline for the requirements. You can further use the CMAKE_ARGS flag to issue any additional compiler arguments or override the preset ones in the make commands. To build the runtime with the Kokkos::OpenMP backend execution space:

make runtime CMAKE_ARGS="-DKokkos_ENABLE_OPENMP=ON"

You can also use ENABLE_OPENQASM=OFF to disable building the runtime with Amazon-Braket-OpenQasm:

make runtime ENABLE_OPENQASM=OFF

This device currently offers generators for the OpenQasm3 specification and Amazon Braket assembly extension. Moreover, the generated assembly can be executed on Amazon Braket devices leveraging amazon-braket-sdk-python.

To check the runtime test suite from the root directory:

make test-runtime