> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ionq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using native gates with PennyLane

> Learn how to use our hardware-native gateset to run a circuit with PennyLane

<Info>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](/guides/getting-started-with-native-gates).</Info>

## 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](/guides/getting-started-with-native-gates) and [Getting Started with PennyLane](/sdks/pennylane/index). Native gates are also supported in the [IonQ API](/api-reference/v0.3/native-gates-api), [Qiskit](/sdks/qiskit/native-gates-qiskit), and [Cirq](/sdks/cirq/native-gates-cirq).

<Warning>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.</Warning>

***

## Using native gates

Native gates are supported as of `v0.28.0` of the [PennyLane IonQ plugin](https://github.com/PennyLaneAI/PennyLane-IonQ).

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

* `GPI(phi)`
* `GPI2(phi)`
* `MS(phi0, phi1, theta=0.25)` for Aria systems (retired)

For more details about these gate definitions and parameters, refer to the [native gates guide](/guides/getting-started-with-native-gates#introducing-the-native-gates).

The native gates can be imported from `pennylane_ionq.ops`:

```python theme={null}
# Import circuit and gate definitions
import pennylane as qml
from pennylane_ionq.ops import GPI, GPI2, MS
```

<Tip>The parameters in the IonQ native gate specification are always defined in *turns*, not in radians. One turn is 2π radians.</Tip>

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

```python theme={null}
dev = qml.device('ionq.simulator', wires=3, gateset="native")
```

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

<CodeGroup>
  ```python QNode example theme={null}
  @qml.qnode(dev)
  def native_gate_circuit():
      GPI(0.5, wires=[0])
      GPI2(0, wires=[1])
      MS(0, 0.5, wires=[1, 2])
      return qml.probs(wires=[0, 1, 2])

  print(native_gate_circuit())
  ```

  ```python Tape example theme={null}
  with qml.tape.QuantumTape() as tape:
      GPI(0.5, wires=[0])
      GPI2(0, wires=[1])
      MS(0, 0.5, wires=[1, 2])
      qml.probs(wires=[0,1,2])

  dev.execute(tape)
  ```
</CodeGroup>

<Tip>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.</Tip>

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](/guides/getting-started-with-native-gates#converting-to-native-gates)) or using a different SDK.

***

## Additional resources

* [Getting Started with Native Gates](/guides/getting-started-with-native-gates)
* [Getting Started with PennyLane](/sdks/pennylane/index)
