From 766ee7640e3cf4974082d72278b44513787b1259 Mon Sep 17 00:00:00 2001 From: David Ittah Date: Tue, 23 Jan 2024 16:37:54 -0500 Subject: [PATCH 1/7] Add support for BlockEncode operation A recent operation added to PennyLane, only supports application via matrix. --- pennylane_lightning/lightning_gpu/lightning_gpu.py | 1 + pennylane_lightning/lightning_gpu/lightning_gpu.toml | 3 ++- pennylane_lightning/lightning_kokkos/lightning_kokkos.py | 1 + pennylane_lightning/lightning_kokkos/lightning_kokkos.toml | 3 ++- pennylane_lightning/lightning_qubit/lightning_qubit.py | 1 + pennylane_lightning/lightning_qubit/lightning_qubit.toml | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pennylane_lightning/lightning_gpu/lightning_gpu.py b/pennylane_lightning/lightning_gpu/lightning_gpu.py index 3d0861d4a3..349e821959 100644 --- a/pennylane_lightning/lightning_gpu/lightning_gpu.py +++ b/pennylane_lightning/lightning_gpu/lightning_gpu.py @@ -185,6 +185,7 @@ def _mebibytesToBytes(mebibytes): "OrbitalRotation", "QFT", "ECR", + "BlockEncode", } allowed_observables = { diff --git a/pennylane_lightning/lightning_gpu/lightning_gpu.toml b/pennylane_lightning/lightning_gpu/lightning_gpu.toml index 7e2944755d..a88eb0cd6a 100644 --- a/pennylane_lightning/lightning_gpu/lightning_gpu.toml +++ b/pennylane_lightning/lightning_gpu/lightning_gpu.toml @@ -88,6 +88,7 @@ matrix = [ "QubitCarry", "QubitSum", "DiagonalQubitUnitary", + "BlockEncode", ] [measurement_processes] @@ -119,4 +120,4 @@ mid_circuit_measurement = false # This field is currently unchecked but it is reserved for the purpose of # determining if the device supports dynamic qubit allocation/deallocation. -dynamic_qubit_management = false +dynamic_qubit_management = false diff --git a/pennylane_lightning/lightning_kokkos/lightning_kokkos.py b/pennylane_lightning/lightning_kokkos/lightning_kokkos.py index da7c58e5b7..f3153dcfe9 100644 --- a/pennylane_lightning/lightning_kokkos/lightning_kokkos.py +++ b/pennylane_lightning/lightning_kokkos/lightning_kokkos.py @@ -140,6 +140,7 @@ def _kokkos_configuration(): "OrbitalRotation", "QFT", "ECR", + "BlockEncode", } allowed_observables = { diff --git a/pennylane_lightning/lightning_kokkos/lightning_kokkos.toml b/pennylane_lightning/lightning_kokkos/lightning_kokkos.toml index fd1b20de7a..700a19d292 100644 --- a/pennylane_lightning/lightning_kokkos/lightning_kokkos.toml +++ b/pennylane_lightning/lightning_kokkos/lightning_kokkos.toml @@ -88,6 +88,7 @@ matrix = [ "QubitCarry", "QubitSum", "DiagonalQubitUnitary", + "BlockEncode", ] [measurement_processes] @@ -119,4 +120,4 @@ mid_circuit_measurement = true # This field is currently unchecked but it is reserved for the purpose of # determining if the device supports dynamic qubit allocation/deallocation. -dynamic_qubit_management = false +dynamic_qubit_management = false diff --git a/pennylane_lightning/lightning_qubit/lightning_qubit.py b/pennylane_lightning/lightning_qubit/lightning_qubit.py index 32e6a1d5ff..860f9bb2dd 100644 --- a/pennylane_lightning/lightning_qubit/lightning_qubit.py +++ b/pennylane_lightning/lightning_qubit/lightning_qubit.py @@ -154,6 +154,7 @@ "OrbitalRotation", "QFT", "ECR", + "BlockEncode", } allowed_observables = { diff --git a/pennylane_lightning/lightning_qubit/lightning_qubit.toml b/pennylane_lightning/lightning_qubit/lightning_qubit.toml index bd5d3994d3..36289471e4 100644 --- a/pennylane_lightning/lightning_qubit/lightning_qubit.toml +++ b/pennylane_lightning/lightning_qubit/lightning_qubit.toml @@ -90,6 +90,7 @@ matrix = [ "QubitCarry", "QubitSum", "DiagonalQubitUnitary", + "BlockEncode", ] [measurement_processes] From 1c2623fa775d2a2d75ebe0235165ceb540ea3e9d Mon Sep 17 00:00:00 2001 From: David Ittah Date: Tue, 23 Jan 2024 16:46:29 -0500 Subject: [PATCH 2/7] Add test --- tests/test_gates.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_gates.py b/tests/test_gates.py index df66b3ab5b..aef3ba33cb 100644 --- a/tests/test_gates.py +++ b/tests/test_gates.py @@ -76,6 +76,7 @@ def op(op_name): "QubitSum": [qml.QubitSum, [], {"wires": [0, 1, 2]}], "QubitCarry": [qml.QubitCarry, [], {"wires": [0, 1, 2, 3]}], "QubitUnitary": [qml.QubitUnitary, [], {"U": np.eye(16) * 1j, "wires": [0, 1, 2, 3]}], + "BlockEncode": [qml.BlockEncode, [[[0.2, 0, 0.2], [-0.2, 0.2, 0]]], {"wires": [0, 1, 2]}], } return ops_list.get(op_name) From 682cf44908b96c204b7defd4a6b11d24fa8d7f7d Mon Sep 17 00:00:00 2001 From: David Ittah Date: Tue, 23 Jan 2024 16:49:13 -0500 Subject: [PATCH 3/7] Add changelog --- .github/CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index acb29e5823..c24bde4474 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -9,6 +9,9 @@ ### Improvements +* The `BlockEncode` operation from PennyLane is now supported on all Lightning devices. + [(#599)](https://github.com/PennyLaneAI/pennylane-lightning/pull/599) + * OpenMP acceleration can now be enabled at compile time for all `lightning.qubit` gate kernels using the "-DLQ_ENABLE_KERNEL_OMP=1" CMake argument. [(#510)](https://github.com/PennyLaneAI/pennylane-lightning/pull/510) @@ -32,7 +35,7 @@ This release contains contributions from (in alphabetical order): -Amintor Dusko, Vincent Michaud-Rioux, Lee J. O'Riordan, Shuli Shu +Amintor Dusko, David Ittah, Vincent Michaud-Rioux, Lee J. O'Riordan, Shuli Shu --- From 8768cb03d1c5d33f19c2edbed7259362ed12b0d2 Mon Sep 17 00:00:00 2001 From: David Ittah Date: Tue, 23 Jan 2024 17:09:50 -0500 Subject: [PATCH 4/7] Bump version --- pennylane_lightning/core/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index 018ad2ba80..1465a76bbb 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.35.0-dev5" +__version__ = "0.35.0-dev6" From bbae07d530712c34fd1cdca60a6557419c0b488f Mon Sep 17 00:00:00 2001 From: AmintorDusko Date: Wed, 24 Jan 2024 08:27:25 -0500 Subject: [PATCH 5/7] trigger CI From 9e5f79bf50c7b2aee1ed0ff09f450f4ec349809c Mon Sep 17 00:00:00 2001 From: Dev version update bot Date: Wed, 24 Jan 2024 17:31:54 +0000 Subject: [PATCH 6/7] Auto update version --- pennylane_lightning/core/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index 1465a76bbb..5d80b68583 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.35.0-dev6" +__version__ = "0.35.0-dev7" From e7c0a3bdc57e4bd8cf52bd5903ac8657e10cf9f8 Mon Sep 17 00:00:00 2001 From: AmintorDusko Date: Wed, 24 Jan 2024 13:08:00 -0500 Subject: [PATCH 7/7] Trigger CI