Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the LQ new device API to work with Catalyst #665

Merged
merged 20 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.36.0-dev20"
__version__ = "0.36.0-dev21"
1 change: 1 addition & 0 deletions pennylane_lightning/lightning_kokkos/lightning_kokkos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ observables = [
"SProd",
"Prod",
"Exp",
"LinearCombination",
]

# The union of all gate types listed in this section must match what
Expand Down
12 changes: 7 additions & 5 deletions pennylane_lightning/lightning_qubit/lightning_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@
_CPP_BINARY_AVAILABLE = LQ_CPP_BINARY_AVAILABLE
_new_API = True
_backend_info = backend_info if LQ_CPP_BINARY_AVAILABLE else None
_config = Path(__file__).parent / "lightning_qubit.toml"

# This `config` is used in Catalyst-Frontend
config = Path(__file__).parent / "lightning_qubit.toml"
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved

# TODO: Move supported ops/obs to TOML file
operations = _operations
Expand Down Expand Up @@ -413,7 +415,7 @@
self._num_burnin = num_burnin
else:
self._kernel_name = None
self._num_burnin = None
self._num_burnin = 0

Check warning on line 418 in pennylane_lightning/lightning_qubit/lightning_qubit.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_qubit/lightning_qubit.py#L418

Added line #L418 was not covered by tests

@property
def name(self):
Expand Down Expand Up @@ -465,7 +467,7 @@
* Currently does not intrinsically support parameter broadcasting

"""
config = self._setup_execution_config(execution_config)
exec_config = self._setup_execution_config(execution_config)

Check warning on line 470 in pennylane_lightning/lightning_qubit/lightning_qubit.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_qubit/lightning_qubit.py#L470

Added line #L470 was not covered by tests
maliasadi marked this conversation as resolved.
Show resolved Hide resolved
program = TransformProgram()

program.add_transform(validate_measurements, name=self.name)
Expand All @@ -475,9 +477,9 @@
program.add_transform(decompose, stopping_condition=stopping_condition, name=self.name)
program.add_transform(qml.transforms.broadcast_expand)

if config.gradient_method == "adjoint":
if exec_config.gradient_method == "adjoint":

Check warning on line 480 in pennylane_lightning/lightning_qubit/lightning_qubit.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_qubit/lightning_qubit.py#L480

Added line #L480 was not covered by tests
_add_adjoint_transforms(program)
return program, config
return program, exec_config

Check warning on line 482 in pennylane_lightning/lightning_qubit/lightning_qubit.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_qubit/lightning_qubit.py#L482

Added line #L482 was not covered by tests

# pylint: disable=unused-argument
def execute(
Expand Down
3 changes: 3 additions & 0 deletions pennylane_lightning/lightning_qubit/lightning_qubit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ observables = [
"SProd",
"Prod",
"Exp",
"LinearCombination",
]

# The union of all gate types listed in this section must match what
Expand Down Expand Up @@ -92,6 +93,8 @@ matrix = [
"QubitSum",
"DiagonalQubitUnitary",
"BlockEncode",
"MidMeasureMP",
maliasadi marked this conversation as resolved.
Show resolved Hide resolved
"Conditional",
]

[measurement_processes]
Expand Down
Loading