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

Adds Catalyst specification files. #566

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7e0d6ff
Adds Catalyst specification files.
erick-xanadu Nov 24, 2023
c096a19
Adds path config files.
erick-xanadu Nov 24, 2023
c5ec709
Add file as a field to the device class.
erick-xanadu Nov 24, 2023
d00308c
Changelog.
erick-xanadu Nov 24, 2023
8bdd9dd
Just use parent
erick-xanadu Nov 28, 2023
d48f229
Apply suggestions from code review
erick-xanadu Dec 4, 2023
6758a77
Rename files.
erick-xanadu Dec 4, 2023
7eb9afc
Remove version.
erick-xanadu Dec 4, 2023
e960fc4
Add lightning_gpu.toml
erick-xanadu Dec 4, 2023
f0db1e0
Lightning gpu.
erick-xanadu Dec 4, 2023
c8ed49d
Move logic to devices
erick-xanadu Dec 4, 2023
462deca
Update .github/CHANGELOG.md
erick-xanadu Dec 4, 2023
0ab84d2
All gates in supported gates are now in the toml file.
erick-xanadu Dec 5, 2023
ce85bd8
Accounting for overlap.
erick-xanadu Dec 5, 2023
265cc3a
Adds options to lightning_qubit.
erick-xanadu Dec 5, 2023
54f8ebd
Add mid circuit measurement to lightning kokkos.
erick-xanadu Dec 5, 2023
eb20725
Update MANIFEST.in
erick-xanadu Dec 5, 2023
eb61f7d
Apply suggestions from code review
erick-xanadu Dec 6, 2023
cc7fd90
Move all matrix gates to decomp
erick-xanadu Dec 6, 2023
e48a38f
Keep multicontrolledX as matrix gate as that is the current behaviour…
erick-xanadu Dec 6, 2023
06cd612
Add toml files with new fields.
erick-xanadu Dec 6, 2023
dfba562
Merge branch 'master' into eochoa/2023-11-24/catalyst-spec-files
mlxd Dec 7, 2023
1537fdc
New toml
erick-xanadu Dec 9, 2023
224eb0b
Update toml files.
erick-xanadu Dec 12, 2023
2a7ccfe
Merge branch 'master' into eochoa/2023-12-08/spec
erick-xanadu Dec 12, 2023
651e3fc
Merge branch 'master' into eochoa/2023-12-08/spec
erick-xanadu Dec 12, 2023
8c40df2
Update dev version.
erick-xanadu Dec 12, 2023
7fea774
Update toml according to maintainers preference.
erick-xanadu Dec 12, 2023
d50bcb9
Move adjoint to native gates.
erick-xanadu Dec 12, 2023
4df3f84
Move files.
erick-xanadu Dec 12, 2023
3d9fcf5
Remove adjoint gates from toml.
erick-xanadu Dec 12, 2023
159f6a8
Move ControlledQubitUnitary and MultiControlledX to decomp.
erick-xanadu Dec 12, 2023
c2af0b1
Move ControlledQubitUnitary to matrix gate set.
erick-xanadu Dec 12, 2023
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: 4 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

### Improvements

* Add configuration files to improve compatibility with Catalyst.
[(#566)](https://github.com/PennyLaneAI/pennylane-lightning/pull/566)

* Refactor shot-noise related methods of MeasurementsBase class in the C++ layer and eigenvalues are not limited to `1` and `-1`. Add `getObs()` method to Observables class. Refactor `applyInPlaceShots` to allow users to get eigenvalues of Observables object. Deprecated `_preprocess_state` method in `MeasurementsBase` class for safer use of the `LightningQubitRaw` backend.
[(#570)](https://github.com/PennyLaneAI/pennylane-lightning/pull/570)

Expand Down Expand Up @@ -76,7 +79,7 @@

This release contains contributions from (in alphabetical order):

Isaac De Vlugt, Amintor Dusko, Vincent Michaud-Rioux, Lee James O'Riordan, Shuli Shu
Isaac De Vlugt, Amintor Dusko, Vincent Michaud-Rioux, Erick Ochoa Lopez, Lee James O'Riordan, Shuli Shu

---

Expand Down
5 changes: 4 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
include requirements.txt
include CHANGELOG.rst
include CHANGELOG.rst
include lightning_qubit.toml
include lightning_gpu.toml
include lightning_kokkos.toml
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.34.0-dev17"
__version__ = "0.34.0-dev18"
2 changes: 2 additions & 0 deletions pennylane_lightning/lightning_gpu/lightning_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""

from warnings import warn
from pathlib import Path
import numpy as np

from pennylane_lightning.core.lightning_base import (
Expand Down Expand Up @@ -230,6 +231,7 @@ class LightningGPU(LightningBase): # pylint: disable=too-many-instance-attribut
operations = allowed_operations
observables = allowed_observables
_backend_info = backend_info
config = Path(__file__).parent / "lightning_gpu.toml"

def __init__(
self,
Expand Down
122 changes: 122 additions & 0 deletions pennylane_lightning/lightning_gpu/lightning_gpu.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
schema = 1

[device]
name = "lightning.gpu"

[operators]
# Observables supported by the device
observables = [
"PauliX",
"PauliY",
"PauliZ",
"Hadamard",
"Hermitian",
"Identity",
"SparseHamiltonian",
"Hamiltonian",
"Sum",
"SProd",
"Prod",
"Exp",
]

# The union of all gate types listed in this section must match what
# the device considers "supported" through PennyLane's device API.
[[operators.gates]]
native = [
"Identity",
"PauliX",
"PauliY",
"PauliZ",
"Hadamard",
"S",
"T",
"PhaseShift",
"RX",
"RY",
"RZ",
"Rot",
"CNOT",
"CY",
"CZ",
"SWAP",
"CSWAP",
"Toffoli",
"IsingXX",
"IsingXY",
"IsingYY",
"IsingZZ",
"ControlledPhaseShift",
"CRX",
"CRY",
"CRZ",
"CRot",
"SingleExcitation",
"SingleExcitationPlus",
"SingleExcitationMinus",
"DoubleExcitation",
"DoubleExcitationPlus",
"DoubleExcitationMinus",
"MultiRZ",
"QubitUnitary",
]

# Operators that should be decomposed according to the algorithm used
# by PennyLane's device API.
# Optional, since gates not listed in this list will typically be decomposed by
# default, but can be useful to express a deviation from this device's regular
# strategy in PennyLane.
decomp = [
"BasisState",
"QFT",
"QubitStateVector",
"StatePrep",
"MultiControlledX",
]

# Gates which should be translated to QubitUnitary
matrix = [
"ControlledQubitUnitary",
"ECR",
"SX",
"ISWAP",
"PSWAP",
"SISWAP",
"SQISW",
"CPhase",
"OrbitalRotation",
"QubitCarry",
"QubitSum",
"DiagonalQubitUnitary",
]

[measurement_processes]
exactshots = [
"Expval",
"Var",
"Probs",
"State",
]
finiteshots = [
"Expval",
"Var",
"Probs",
"Sample",
"Counts",
]

[compilation]
# If the device is compatible with qjit
qjit_compatible = false
# If the device requires run time generation of the quantum circuit.
runtime_code_generation = false
# If the device supports adjoint
quantum_adjoint = false
# If the device supports quantum control instructions natively
quantum_control = false
# If the device supports mid circuit measurements natively
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
2 changes: 2 additions & 0 deletions pennylane_lightning/lightning_kokkos/lightning_kokkos.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""

from warnings import warn
from pathlib import Path
import numpy as np

from pennylane_lightning.core.lightning_base import (
Expand Down Expand Up @@ -185,6 +186,7 @@
operations = allowed_operations
observables = allowed_observables
_backend_info = backend_info
config = Path(__file__).parent / "lightning_kokkos.toml"

Check warning on line 189 in pennylane_lightning/lightning_kokkos/lightning_kokkos.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_kokkos/lightning_kokkos.py#L189

Added line #L189 was not covered by tests

def __init__(
self,
Expand Down
122 changes: 122 additions & 0 deletions pennylane_lightning/lightning_kokkos/lightning_kokkos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
schema = 1

[device]
name = "lightning.kokkos"

[operators]
# Observables supported by the device
observables = [
"PauliX",
"PauliY",
"PauliZ",
"Hadamard",
"Hermitian",
"Identity",
"SparseHamiltonian",
"Hamiltonian",
"Sum",
"SProd",
"Prod",
"Exp",
]

# The union of all gate types listed in this section must match what
# the device considers "supported" through PennyLane's device API.
[[operators.gates]]
native = [
"Identity",
"PauliX",
"PauliY",
"PauliZ",
"Hadamard",
"S",
"T",
"PhaseShift",
"RX",
"RY",
"RZ",
"Rot",
"CNOT",
"CY",
"CZ",
"SWAP",
"CSWAP",
"Toffoli",
"IsingXX",
"IsingXY",
"IsingYY",
"IsingZZ",
"ControlledPhaseShift",
"CRX",
"CRY",
"CRZ",
"CRot",
"SingleExcitation",
"SingleExcitationPlus",
"SingleExcitationMinus",
"DoubleExcitation",
"DoubleExcitationPlus",
"DoubleExcitationMinus",
"MultiRZ",
"QubitUnitary",
]

# Operators that should be decomposed according to the algorithm used
# by PennyLane's device API.
# Optional, since gates not listed in this list will typically be decomposed by
# default, but can be useful to express a deviation from this device's regular
# strategy in PennyLane.
decomp = [
"BasisState",
"QubitStateVector",
"StatePrep",
"QFT",
"MultiControlledX",
]

# Gates which should be translated to QubitUnitary
matrix = [
"ControlledQubitUnitary",
"ECR",
"SX",
"ISWAP",
"PSWAP",
"SISWAP",
"SQISW",
"CPhase",
"OrbitalRotation",
"QubitCarry",
"QubitSum",
"DiagonalQubitUnitary",
]

[measurement_processes]
exactshots = [
"Expval",
"Var",
"Probs",
"State",
]
finiteshots = [
"Expval",
"Var",
"Probs",
"Sample",
"Counts",
]

[compilation]
# If the device is compatible with qjit
qjit_compatible = true
# If the device requires run time generation of the quantum circuit.
runtime_code_generation = false
# If the device supports adjoint
quantum_adjoint = true
# If the device supports quantum control instructions natively
quantum_control = false
# If the device supports mid circuit measurements natively
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
2 changes: 2 additions & 0 deletions pennylane_lightning/lightning_qubit/lightning_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""

from warnings import warn
from pathlib import Path
import numpy as np

from pennylane_lightning.core.lightning_base import (
Expand Down Expand Up @@ -207,6 +208,7 @@ class LightningQubit(LightningBase):
operations = allowed_operations
observables = allowed_observables
_backend_info = backend_info
config = Path(__file__).parent / "lightning_qubit.toml"

def __init__( # pylint: disable=too-many-arguments
self,
Expand Down
Loading
Loading