diff --git a/.dep-versions b/.dep-versions index 5bf366b639..f7e68582d9 100644 --- a/.dep-versions +++ b/.dep-versions @@ -10,7 +10,7 @@ enzyme=v0.0.203 # For a custom PL version, update the package version here and at # 'doc/requirements.txt' -pennylane=0.44.0-dev48 +pennylane=0.44.0-dev50 # For a custom LQ/LK version, update the package version here and at # 'doc/requirements.txt' diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 79638514c4..2423589756 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -366,6 +366,10 @@

Internal changes ⚙️

+* Integration tests for `qml.specs` have been updated to match the new output format introduced + in PennyLane. + [(#2255)](https://github.com/PennyLaneAI/catalyst/pull/2255) + * Resource tracking now writes out at device destruction time instead of qubit deallocation time. The written resources will be the total amount of resources collected throughout the lifetime of the execution. For executions that split work between multiple functions, diff --git a/doc/requirements.txt b/doc/requirements.txt index fe60e0a4ae..503092fb69 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -33,4 +33,4 @@ lxml_html_clean --extra-index-url https://test.pypi.org/simple/ pennylane-lightning-kokkos==0.44.0-dev16 pennylane-lightning==0.44.0-dev16 -pennylane==0.44.0-dev48 +pennylane==0.44.0-dev50 diff --git a/frontend/test/pytest/test_specs.py b/frontend/test/pytest/test_specs.py index 61abdcf3da..2f5930bd70 100644 --- a/frontend/test/pytest/test_specs.py +++ b/frontend/test/pytest/test_specs.py @@ -11,7 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Test for qml.specs() Catalyst integration""" +"""Tests for qml.specs() Catalyst integration""" + import pennylane as qml import pytest from jax import numpy as jnp @@ -21,22 +22,22 @@ # pylint:disable = protected-access,attribute-defined-outside-init +# TODO: Remove this method once feature parity has been reached, and instead use `==` directly def check_specs_same(specs1, specs2): """Check that two specs dictionaries are the same.""" assert specs1["device_name"] == specs2["device_name"] - assert specs1["resources"].num_wires == specs2["resources"].num_wires - assert specs1["resources"].num_gates == specs2["resources"].num_gates - assert specs1["resources"].depth == specs2["resources"].depth + assert specs1["num_device_wires"] == specs2["num_device_wires"] + assert specs1["shots"] == specs2["shots"] - assert len(specs1["resources"].gate_types) == len(specs2["resources"].gate_types) - for gate, count in specs1["resources"].gate_types.items(): - assert gate in specs2["resources"].gate_types - assert count == specs2["resources"].gate_types[gate] + assert specs1["resources"].gate_types == specs2["resources"].gate_types + assert specs1["resources"].gate_sizes == specs2["resources"].gate_sizes - assert len(specs1["resources"].gate_sizes) == len(specs2["resources"].gate_sizes) - for gate, count in specs1["resources"].gate_sizes.items(): - assert gate in specs2["resources"].gate_sizes - assert count == specs2["resources"].gate_sizes[gate] + # Measurements are not yet supported in Catalyst device-level specs + # assert specs1["resources"].measurements == specs2["resources"].measurements + + assert specs1["resources"].num_allocs == specs2["resources"].num_allocs + assert specs1["resources"].depth == specs2["resources"].depth + assert specs1["resources"].num_gates == specs2["resources"].num_gates @pytest.mark.parametrize("level", ["device"]) @@ -85,14 +86,9 @@ def circuit(): assert cat_specs["device_name"] == "lightning.qubit" - # Catalyst level specs should report the number of controls for multi-controlled gates - assert "2C(S)" in cat_specs["resources"].gate_types - cat_specs["resources"].gate_types["C(S)"] += cat_specs["resources"].gate_types["2C(S)"] - del cat_specs["resources"].gate_types["2C(S)"] - # Catalyst will handle Adjoint(PauliY) == PauliY assert "CY" in cat_specs["resources"].gate_types - cat_specs["resources"].gate_types["C(Adjoint(PauliY))"] += cat_specs["resources"].gate_types[ + cat_specs["resources"].gate_types["C(Adjoint(PauliY))"] = cat_specs["resources"].gate_types[ "CY" ] del cat_specs["resources"].gate_types["CY"]