This guide covers how to use IonQ’s native gates in PennyLane. To learn more about what the native gates are and when to use them, refer to our guide on getting started with native gates.

Introduction

Building and submitting circuits using IonQ’s hardware-native gateset enables you to bypass our compiler and optimizer, providing more control and transparency than the default abstract gateset (though often at the cost of performance and convenience).

Before working with native gates in PennyLane, we recommend reviewing our guides on Getting Started with Native Gates and Getting Started with PennyLane. Native gates are also supported in the IonQ API, Qiskit, and Cirq.

This is an advanced-level feature. Using the hardware-native gate interface without a thorough understanding of quantum circuits is likely to result in less-optimal circuit structure and worse algorithmic performance overall than using our abstract gate interface.

Using native gates

Native gates are supported as of v0.28.0 of the PennyLane IonQ plugin.

Gates are provided as part of the pennylane-ionq package, including:

  • GPI(phi)
  • GPI2(phi)
  • MS(phi0, phi1, theta=0.25) for Aria systems

For more details about these gate definitions and parameters, refer to the native gates guide.

The native gates can be imported from pennylane_ionq.ops:

# Import circuit and gate definitions
import pennylane as qml
from pennylane_ionq.ops import GPI, GPI2, MS
The parameters in the IonQ native gate specification are always defined in turns, not in radians. One turn is 2π radians.

To use native gates, set up an IonQ device with gateset="native":

dev = qml.device('ionq.simulator', wires=3, gateset="native")

Native gate circuits can then be built and executed using this device:

Each quantum circuit submitted to the IonQ Cloud must use a consistent gateset throughout—you cannot mix and match native gates and abstract gates in the same circuit.

The pennylane-ionq plugin currently does not support automatic transpilation from abstract to native gates, but we may add this capability in the future. For now, we recommend following this general procedure (also described in our main native gates guide) or using a different SDK.


Additional resources