Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* Updated qiskit ecosystem versions: qiskit to 2.3.0 and qiskit-ibm-runtime to 0.45.0.
[(#681)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/681)

* The circuit conversion from PennyLane no longer inserts a superfluous `barrier` to
delineate the circuit operations from the terminal measurements. This will allow support
for remote backends that don't support `barrier`.
[(#677)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/677)

### Breaking changes 💔

### Deprecations 👋
Expand Down
1 change: 1 addition & 0 deletions pennylane_qiskit/aer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
evaluation and differentiation of Qiskit Aer's C++ simulator
using PennyLane.
"""

import qiskit_aer

from .qiskit_device_legacy import QiskitDeviceLegacy
Expand Down
1 change: 1 addition & 0 deletions pennylane_qiskit/basic_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
evaluation and differentiation of Qiskit Terra's BasicAer simulator
using PennyLane.
"""

from qiskit.providers.basic_provider import BasicProvider

from .qiskit_device_legacy import QiskitDeviceLegacy
Expand Down
5 changes: 2 additions & 3 deletions pennylane_qiskit/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
This module contains functions for converting between Qiskit QuantumCircuit objects
and PennyLane circuits.
"""

import warnings
from collections.abc import Iterable, Sequence
from functools import partial, reduce
Expand Down Expand Up @@ -501,7 +502,7 @@ def _function(*args, params: dict = None, wires: list = None, **kwargs):
# Processing the dictionary of parameters passed
# pylint: disable=too-many-nested-blocks
for idx, circuit_instruction in enumerate(qc.data):
(instruction, qargs, cargs) = (
instruction, qargs, cargs = (
circuit_instruction.operation,
circuit_instruction.qubits,
circuit_instruction.clbits,
Expand Down Expand Up @@ -712,8 +713,6 @@ def circuit_to_qiskit(circuit, register_size, diagonalize=True, measure=True):
for rot in rotations:
qc &= operation_to_qiskit(rot, reg, creg)

# barrier ensures we first do all operations, then do all measurements
qc.barrier(reg)
Comment on lines -715 to -716
Copy link
Contributor

@lillian542 lillian542 Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the related changes in tests/test_converter.py is the actual change. Everything else is black formatting.

# we always measure the full register
qc.measure(reg, creg)

Expand Down
1 change: 1 addition & 0 deletions pennylane_qiskit/noise_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
This module contains functions for converting Qiskit NoiseModel objects
into PennyLane NoiseModels.
"""

from collections import defaultdict
from warnings import warn

Expand Down
1 change: 1 addition & 0 deletions pennylane_qiskit/qiskit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
This module contains a prototype base class for constructing Qiskit devices
for PennyLane with the new device API.
"""

# pylint: disable=too-many-instance-attributes,attribute-defined-outside-init,too-many-positional-arguments

import inspect
Expand Down
1 change: 1 addition & 0 deletions pennylane_qiskit/qiskit_device_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains a base class for constructing Qiskit devices for PennyLane.
"""

# pylint: disable=too-many-instance-attributes,attribute-defined-outside-init


Expand Down
1 change: 1 addition & 0 deletions tests/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains tests for applying operations on PennyLane IBMQ devices.
"""

import numpy as np
import pennylane as qml

Expand Down
1 change: 1 addition & 0 deletions tests/test_base_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""
This module contains tests for the base Qiskit device for the new PennyLane device API
"""

# pylint: disable=too-many-positional-arguments

from unittest.mock import Mock, patch
Expand Down
9 changes: 5 additions & 4 deletions tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains tests for converting circuits for PennyLane IBMQ devices.
"""

import functools as ft
import itertools as it

Expand Down Expand Up @@ -1722,10 +1723,10 @@ def test_circuit_to_qiskit_diagonalize_kwarg(self, diagonalize):

qc = circuit_to_qiskit(qscript, 2, diagonalize=diagonalize, measure=True)

# get list of instruction names up to the barrier (played right before measurements)
# get list of instruction names up to the first measurement
instructions = []
for instruction in qc.data:
if instruction.operation.name == "barrier":
if instruction.operation.name == "measure":
break
instructions.append(instruction.operation.name)

Expand All @@ -1745,10 +1746,10 @@ def test_circuit_to_qiskit_measurements_with_overlapping_wires(self):

qc = circuit_to_qiskit(tape, 2, diagonalize=True, measure=True)

# get list of instruction names up to the barrier (played right before measurements)
# get list of instruction names up to the first measurement
instructions = []
for instruction in qc.data:
if instruction.operation.name == "barrier":
if instruction.operation.name == "measure":
break
instructions.append(instruction.operation.name)

Expand Down
1 change: 1 addition & 0 deletions tests/test_expval.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains tests for using expvals for PennyLane IBMQ devices.
"""

import numpy as np
import pennylane as qml

Expand Down
1 change: 1 addition & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains integration tests for PennyLane IBMQ devices.
"""

# pylint: disable=too-many-positional-arguments
import sys
from functools import partial
Expand Down
1 change: 1 addition & 0 deletions tests/test_inverses.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains tests for using adjoints for PennyLane IBMQ devices.
"""

import cmath
import math

Expand Down
1 change: 1 addition & 0 deletions tests/test_noise_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains tests for converting Qiskit NoiseModels to PennyLane NoiseModels.
"""

import itertools as it
from functools import reduce

Expand Down
1 change: 1 addition & 0 deletions tests/test_qiskit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains tests qiskit devices for PennyLane IBMQ devices.
"""

from unittest.mock import Mock

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
r"""
This module contains tests for computing variances on PennyLane IBMQ devices.
"""

import numpy as np
import pennylane as qml

Expand Down
Loading