Skip to content

Commit e83db6d

Browse files
v0.10 changelog (#1402)
**Context:** Changelog --------- Co-authored-by: Joey Carter <joseph.carter@xanadu.ai>
1 parent b46f05b commit e83db6d

File tree

1 file changed

+140
-78
lines changed

1 file changed

+140
-78
lines changed

doc/releases/changelog-dev.md

Lines changed: 140 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,156 +2,214 @@
22

33
<h3>New features since last release</h3>
44

5-
* Catalyst can now load local MLIR plugins from python. Including support for `entry_points`.
5+
* Catalyst can now load and apply local MLIR plugins from the PennyLane frontend.
66
[(#1317)](https://github.com/PennyLaneAI/catalyst/pull/1317)
77
[(#1361)](https://github.com/PennyLaneAI/catalyst/pull/1361)
88
[(#1370)](https://github.com/PennyLaneAI/catalyst/pull/1370)
99

10+
Custom compilation passes and dialects in MLIR can be specified for use in Catalyst via a shared
11+
object (`*.so` or `*.dylib` on MacOS) that implements the pass. Details on creating your own
12+
plugin can be found in our
13+
[compiler plugin documentation](https://docs.pennylane.ai/projects/catalyst/en/stable/dev/plugins.html).
14+
At a high level, there are three ways to utilize a plugin once it's properly specified:
15+
16+
* :func:`~.passes.apply_pass` can be used on QNodes when there is a
17+
[Python entry point](https://packaging.python.org/en/latest/specifications/entry-points/)
18+
defined for the plugin.
19+
20+
```python
21+
@catalyst.passes.apply_pass(pass_name)
22+
@qml.qnode(qml.device("lightning.qubit", wires=1))
23+
def qnode():
24+
return qml.state()
25+
26+
@qml.qjit
27+
def module():
28+
return qnode()
29+
```
30+
31+
* :func:`~.passes.apply_pass_plugin` can be used on QNodes when there is not an entry point
32+
defined for the plugin.
33+
34+
```python
35+
@catalyst.passes.apply_pass_plugin(path_to_plugin, pass_name)
36+
@qml.qnode(qml.device("lightning.qubit", wires=1))
37+
def qnode():
38+
return qml.state()
39+
40+
@qml.qjit
41+
def module():
42+
return qnode()
43+
```
44+
45+
* Specifying multiple compilation pass plugins or dialect plugins directly in :func:`~.qjit` via
46+
the `pass_plugins` and `dialect_plugins` keyword arguments, which must be lists of plugin paths.
47+
48+
```python
49+
from pathlib import Path
50+
51+
plugin = Path("shared_object_file.so")
52+
53+
@qml.qnode(qml.device("lightning.qubit", wires=0))
54+
def qnode():
55+
qml.Hadamard(wires=0)
56+
return qml.state()
57+
58+
@qml.qjit(pass_plugins=[plugin], dialect_plugins=[plugin])
59+
def module():
60+
return catalyst.passes.apply_pass(qnode, "pass_name")()
61+
```
62+
63+
For more information on usage,
64+
visit our [compiler plugin documentation](https://docs.pennylane.ai/projects/catalyst/en/stable/dev/plugins.html).
65+
1066
<h3>Improvements 🛠</h3>
1167

12-
* Lightning runtime shot-measurement support for Hermitian observables.
68+
* The lightning runtime now supports finite shots with measuring expectation values of `qml.Hermitian`.
1369
[(#451)](https://github.com/PennyLaneAI/catalyst/pull/451)
1470

15-
* Replace pybind11 with nanobind for C++/Python bindings in the frontend and in the runtime.
71+
* Pybind11 has been replaced with nanobind for C++/Python bindings in the frontend and in the runtime.
1672
[(#1173)](https://github.com/PennyLaneAI/catalyst/pull/1173)
1773
[(#1293)](https://github.com/PennyLaneAI/catalyst/pull/1293)
1874
[(#1391)](https://github.com/PennyLaneAI/catalyst/pull/1391)
1975

2076
Nanobind has been developed as a natural successor to the pybind11 library and offers a number of
21-
[advantages](https://nanobind.readthedocs.io/en/latest/why.html#major-additions), in particular,
22-
its ability to target Python's [stable ABI interface](https://docs.python.org/3/c-api/stable.html)
23-
starting with Python 3.12.
77+
[advantages](https://nanobind.readthedocs.io/en/latest/why.html#major-additions) like its ability
78+
to target Python's [stable ABI interface](https://docs.python.org/3/c-api/stable.html) starting
79+
with Python 3.12.
2480

25-
* Catalyst now uses the new compiler API to compile quantum code from the python frontend.
26-
Frontend no longer uses pybind11 to connect to the compiler. Instead, it uses subprocess instead.
81+
* Catalyst now uses the new compiler API (`catalyst-cli`) to compile quantum code from the Python
82+
frontend instead of using pybind11 as an interface between the compiler and the frontend.
2783
[(#1285)](https://github.com/PennyLaneAI/catalyst/pull/1285)
2884

29-
* Add a MLIR decomposition for the gate set {"T", "S", "Z", "Hadamard", "RZ", "PhaseShift", "CNOT"}
30-
to the gate set {RX, RY, MS}. It is useful for trapped ion devices. It can be used thanks to
31-
`quantum-opt --ions-decomposition`.
85+
* Gates in the gate set `{T, S, Z, Hadamard, RZ, PhaseShift, CNOT}` now have MLIR decompositions to
86+
the gate set `{RX, RY, MS}`, which are useful for trapped ion devices.
3287
[(#1226)](https://github.com/PennyLaneAI/catalyst/pull/1226)
3388

34-
* qml.CosineWindow is now compatible with QJIT.
89+
* `qml.CosineWindow` is now compatible with QJIT.
3590
[(#1166)](https://github.com/PennyLaneAI/catalyst/pull/1166)
3691

3792
* All PennyLane templates are tested for QJIT compatibility.
3893
[(#1161)](https://github.com/PennyLaneAI/catalyst/pull/1161)
3994

40-
* Decouple Python from the Runtime by using the Python Global Interpreter Lock (GIL) instead of
41-
custom mutexes.
95+
* Python is now decoupled from the Runtime by using the Python Global Interpreter Lock (GIL) instead
96+
of custom mutexes.
4297
[(#624)](https://github.com/PennyLaneAI/catalyst/pull/624)
4398

4499
In addition, executables created using :func:`~.debug.compile_executable` no longer require
45100
linking against Python shared libraries after decoupling Python from the Runtime C-API.
46101
[(#1305)](https://github.com/PennyLaneAI/catalyst/pull/1305)
47102

48-
* Improves the readability of conditional passes in pipelines
103+
* The readability of conditional passes in `catalyst.pipelines` has been improved.
49104
[(#1194)](https://github.com/PennyLaneAI/catalyst/pull/1194)
50105

51-
* Cleans up the output of compiler instrumentation.
106+
* The output of compiler instrumentation has been cleaned up by only printing stats after a `pipeline`.
107+
It is still possible to get the more detailed output with `qjit(verbose=True)`.
52108
[(#1343)](https://github.com/PennyLaneAI/catalyst/pull/1343)
53109

54-
* Generate stable ABI wheels for Python 3.12 and up.
110+
* Stable ABI wheels for Python 3.12 and up are now generated.
55111
[(#1357)](https://github.com/PennyLaneAI/catalyst/pull/1357)
56112
[(#1385)](https://github.com/PennyLaneAI/catalyst/pull/1385)
57113

58-
* A new circuit optimization pass, `--disentangle-CNOT`, is available.
114+
* Two new circuit optimization passes, `--disentangle-CNOT` and `--disentangle-SWAP`, are available.
59115
[(#1154)](https://github.com/PennyLaneAI/catalyst/pull/1154)
60116

61-
The pass disentangles CNOT gates whenever possible, e.g. when the control bit
62-
is known to be in |0>, the pass removes the CNOT. The pass uses a finite state
63-
machine to propagate simple one-qubit states, in order to determine
64-
the input states to the CNOT.
65-
66-
The algorithm is taken from [Relaxed Peephole Optimization: A Novel Compiler Optimization for Quantum Circuits, by Ji Liu, Luciano Bello, and Huiyang Zhou](https://arxiv.org/abs/2012.07711).
67-
68-
* A new circuit optimization pass, `--disentangle-SWAP`, is available.
69-
[(#1297)](https://github.com/PennyLaneAI/catalyst/pull/1297)
117+
The CNOT pass disentangles CNOT gates whenever possible, e.g., when the control bit is known to be
118+
in the `|0>` state, the pass removes the CNOT. The pass uses a finite state machine to propagate
119+
simple one-qubit states, in order to determine the input states to the CNOT.
120+
121+
Similarly, the SWAP pass disentangles SWAP gates whenever possible by using a finite state machine
122+
to propagate simple one-qubit states, similar to the `--disentangle-CNOT` pass.
70123

71-
The pass disentangles SWAP gates whenever possible by using a finite state
72-
machine to propagate simple one-qubit states, similar to the `--disentangle-CNOT` pass.
73-
74-
The algorithm is taken from [Relaxed Peephole Optimization: A Novel Compiler Optimization for Quantum Circuits, by Ji Liu, Luciano Bello, and Huiyang Zhou](https://arxiv.org/abs/2012.07711).
124+
Both passes are implemented in accordance with the algorithm from
125+
J. Liu, L. Bello, and H. Zhou, _Relaxed Peephole Optimization: A Novel Compiler Optimization for Quantum Circuits_, 2020, [arXiv:2012.07711](https://arxiv.org/abs/2012.07711) [quant-ph].
75126

76127
* Allow specifying a branch to switch to when setting up a dev environment from the wheels.
77128
[(#1406)](https://github.com/PennyLaneAI/catalyst/pull/1406)
78129

79130
<h3>Breaking changes 💔</h3>
80131

81-
* The `sample` and `counts` measurement primitives now support dynamic shot values across catalyst, although at the PennyLane side, the device shots still is constrained to a static integer literal.
132+
* The `sample` and `counts` measurement primitives now support dynamic shot values across Catalyst,
133+
although, on the PennyLane side, the device's shots is still constrained to a static integer
134+
literal.
135+
[(#1310)](https://github.com/PennyLaneAI/catalyst/pull/1310)
82136

83-
To support this, `SampleOp` and `CountsOp` in mlir no longer carry the shots attribute, since integer attributes are tied to literal values and must be static.
137+
To support this, `SampleOp` and `CountsOp` in MLIR no longer carry the shots attribute, since
138+
integer attributes are tied to literal values and must be static.
84139

85-
`DeviceInitOp` now takes in an optional SSA argument for shots, and the device init runtime CAPI will take in this SSA shots value as an argument and set it as the device shots.
86-
The sample and counts runtime CAPI functions no longer take in the shots argument and will retrieve shots from the device.
140+
`DeviceInitOp` now takes in an optional SSA argument for shots, and the device init runtime CAPI
141+
will take in this SSA shots value as an argument and set it as the device shots. The sample and
142+
counts runtime CAPI functions no longer take in the shots argument and will retrieve shots from
143+
the device.
87144

88-
Correspondingly, the device C++ interface should no longer parse the `DeviceInitOp`'s attributes dictionary for the shots.
89-
For now we still keep the shots as an attribute so device implementors can have time to migrate, but we will remove shots from the attribute dictionary in the next release.
90-
91-
[(#1170)](https://github.com/PennyLaneAI/catalyst/pull/1170)
92-
[(#1310)](https://github.com/PennyLaneAI/catalyst/pull/1310)
145+
Correspondingly, the device C++ interface should no longer parse the `DeviceInitOp`'s attributes
146+
dictionary for the shots. For now, we still keep the shots as an attribute so device implementors
147+
can have time to migrate, but we will remove shots from the attribute dictionary in the next
148+
release (`v0.11`)
93149

94150
* The `toml` module has been migrated to PennyLane with an updated schema for declaring device
95151
capabilities. Devices with TOML files using `schema = 2` will not be compatible with the latest
96-
Catalyst. See [Custom Devices](https://docs.pennylane.ai/projects/catalyst/en/stable/dev/custom_devices.html)
97-
for updated instructions on integrating your device with Catalyst and PennyLane
152+
Catalyst. See the [Custom Devices documentation page](https://docs.pennylane.ai/projects/catalyst/en/stable/dev/custom_devices.html)
153+
for updated instructions on integrating your device with Catalyst and PennyLane.
98154
[(#1275)](https://github.com/PennyLaneAI/catalyst/pull/1275)
99155

100156
* Handling for the legacy operator arithmetic (the `Hamiltonian` and `Tensor` classes in PennyLane)
101-
is removed.
157+
has been removed.
102158
[(#1308)](https://github.com/PennyLaneAI/catalyst/pull/1308)
103159

104160
<h3>Bug fixes 🐛</h3>
105161

106-
* Fix bug introduced in 0.8 that breaks nested invocations of `qml.adjoint` and `qml.ctrl`.
162+
* Fixed a bug introduced in 0.8 that breaks nested invocations of `qml.adjoint` and `qml.ctrl` (e.g.,
163+
`qml.adjoint(qml.adjoint(qml.H(0)))`).
107164
[(#1301)](https://github.com/PennyLaneAI/catalyst/issues/1301)
108165

109-
* Fix a bug in `debug.compile_executable` which would generate incorrect stride information for
166+
* Fixed a bug in :func:`~.debug.compile_executable` that would generate incorrect stride information for
110167
array arguments of the function, in particular when non-64bit datatypes are used.
111168
[(#1338)](https://github.com/PennyLaneAI/catalyst/pull/1338)
112169

113-
<h3>Deprecations 👋</h3>
114-
115170
<h3>Internal changes ⚙️</h3>
116171

117-
* Catalyst no longer depends on or pins the `scipy` package, instead OpenBLAS is sourced directly
118-
from [`scipy-openblas32`](https://pypi.org/project/scipy-openblas32/) or Accelerate is used.
172+
* Catalyst no longer depends on or pins the `scipy` package. Instead, OpenBLAS is sourced directly
173+
from [`scipy-openblas32`](https://pypi.org/project/scipy-openblas32/) or
174+
[Accelerate](https://developer.apple.com/accelerate/) is used.
119175
[(#1322)](https://github.com/PennyLaneAI/catalyst/pull/1322)
120176
[(#1328)](https://github.com/PennyLaneAI/catalyst/pull/1328)
121177

122-
* The `QuantumExtension` module (previously implemented with pybind11) has been removed. This module
178+
* The `QuantumExtension` modulepreviously implemented with pybind11has been removed. This module
123179
was not included in the distributed wheels and has been deprecated to align with our adoption of
124180
Python's stable ABI, which pybind11 does not support.
125181
[(#1187)](https://github.com/PennyLaneAI/catalyst/pull/1187)
126182

127-
* Remove Lightning Qubit Dynamic plugin from Catalyst.
183+
* Code for using `lightning.qubit` with Catalyst has been moved from the Catalyst repository to
184+
the [Lightning repository](https://github.com/PennyLaneAI/pennylane-lightning) so that Catalyst
185+
wheels will build faster.
128186
[(#1227)](https://github.com/PennyLaneAI/catalyst/pull/1227)
129187
[(#1307)](https://github.com/PennyLaneAI/catalyst/pull/1307)
130188
[(#1312)](https://github.com/PennyLaneAI/catalyst/pull/1312)
131189

132-
* `catalyst-cli` and `quantum-opt` are compiled with `default` visibility, which allows for MLIR plugins to work.
190+
* `catalyst-cli` and `quantum-opt` are now compiled with `default` visibility, which allows for MLIR
191+
plugins to work.
133192
[(#1287)](https://github.com/PennyLaneAI/catalyst/pull/1287)
134193

135-
* Sink patching of autograph's allowlist.
194+
* The patching mechanism of autograph's `allowlist` has been streamlined to only be used in places
195+
where it's required.
136196
[(#1332)](https://github.com/PennyLaneAI/catalyst/pull/1332)
137197
[(#1337)](https://github.com/PennyLaneAI/catalyst/pull/1337)
138198

139-
* Each qnode now has its own transformation schedule.
140-
Instead of relying on the name of the qnode, each qnode now has a transformation module,
141-
which denotes the transformation schedule, embedded in its MLIR representation.
199+
* Each qnode now has its own transformation schedule. Instead of relying on the name of the qnode,
200+
each qnode now has a transformation module, which denotes the transformation schedule, embedded in
201+
its MLIR representation.
142202
[(#1323)](https://github.com/PennyLaneAI/catalyst/pull/1323)
143203

144-
* The `apply_registered_pass_p` primitive is removed. The API for scheduling passes
145-
to run using the transform dialect has been refactored. In particular,
146-
passes are appended to a tuple as they are being registered and they will
147-
be run in order. If there are no local passes, the global `pass_pipeline` is
148-
scheduled. Furthermore, this commit also reworks the caching mechanism for
149-
primitives, which is important as qnodes and functions are primitives and
150-
now that we can apply passes to them, they are distinct based on which
151-
passes have been scheduled to run on them.
204+
* The `apply_registered_pass_p` primitive has been removed and the API for scheduling passes to run
205+
using the transform dialect has been refactored. In particular, passes are appended to a tuple as
206+
they are being registered and they will be run in order. If there are no local passes, the global
207+
`pass_pipeline` is scheduled. Furthermore, this commit also reworks the caching mechanism for
208+
primitives, which is important as qnodes and functions are primitives and now that we can apply
209+
passes to them, they are distinct based on which passes have been scheduled to run on them.
152210
[(#1317)](https://github.com/PennyLaneAI/catalyst/pull/1317)
153211

154-
* Replace Python C-API calls with Stable ABI calls.
212+
* Python C-API calls have been replaced with Stable ABI calls.
155213
[(#1354)](https://github.com/PennyLaneAI/catalyst/pull/1354)
156214

157215
* A framework for loading and interacting with databases containing hardware information and
@@ -176,7 +234,8 @@
176234
Support for OQD devices is still under development, therefore the OQD modules are currently not
177235
included in the distributed wheels.
178236

179-
* `expval` and `var` operations no longer keep the static shots attribute, as a step towards supporting dynamic shots across catalyst.
237+
* As a step towards supporting dynamic shots across catalyst, `expval` and `var` operations no
238+
longer keep the static shots attribute.
180239
[(#1360)](https://github.com/PennyLaneAI/catalyst/pull/1360)
181240

182241
* A new `ion` dialect has been added for Catalyst programs targeting OQD trapped-ion quantum devices.
@@ -189,25 +248,28 @@
189248

190249
A new pass, `--quantum-to-ion`, has also been added to convert logical gate-based circuits in the
191250
Catalyst `quantum` dialect to laser pulse operations in the `ion` dialect. This pass accepts
192-
logical quantum gates from the set {RX, RY, Mølmer–Sørensen (MS)}. Doing so enables the insertion
193-
of physical device parameters into the IR, which will be necessary when lowering to OQD's backend
194-
calls. The physical parameters are read in from [TOML](https://toml.io/en/) files during the
195-
`--quantum-to-ion` conversion. The TOML files are assumed to exist by the pass (the paths to the
196-
TOML file locations are taken in as pass options), with the intention that they are generated
197-
immediately before compilation during hardware-calibration runs.
198-
199-
* IR is now extended to support literal values as opposed to SSA Values for static parameters of
200-
quantum gates by adding a new gate called StaticCustomOp with lowering to regular customOp.
251+
logical quantum gates from the set `{RX, RY, MS}`, where `MS` is the Mølmer–Sørensen gate. Doing
252+
so enables the insertion of physical device parameters into the IR, which will be necessary when
253+
lowering to OQD's backend calls. The physical parameters are read in from
254+
[TOML](https://toml.io/en/) files during the `--quantum-to-ion` conversion. The TOML files are
255+
assumed to exist by the pass (the paths to the TOML file locations are taken in as pass options),
256+
with the intention that they are generated immediately before compilation during
257+
hardware-calibration runs.
258+
259+
* The Catalyst IR has been extended to support literal values as opposed to SSA Values for static
260+
parameters of quantum gates by adding a new gate called `StaticCustomOp` with lowering to regular
261+
`CustomOp`.
201262
[(#1387)](https://github.com/PennyLaneAI/catalyst/pull/1387)
202263

203264
<h3>Documentation 📝</h3>
204265

205266
* A new tutorial going through how to write a new MLIR pass is available. The tutorial writes an
206-
empty pass that prints hello world. The code of the tutorial is at
267+
empty pass that prints `hello world`. The code for the tutorial is located in
207268
[a separate github branch](https://github.com/PennyLaneAI/catalyst/commit/ba7b3438667963b307c07440acd6d7082f1960f3).
208269
[(#872)](https://github.com/PennyLaneAI/catalyst/pull/872)
209270

210-
* Updated catalyst-cli documentation to reflect the removal of func-name option for trasnformation passes.
271+
* The `catalyst-cli` documentation has been updated to reflect the removal of the `func-name` option
272+
for transformation passes.
211273
[(#1368)](https://github.com/PennyLaneAI/catalyst/pull/1368)
212274

213275
<h3>Contributors ✍️</h3>
@@ -219,7 +281,7 @@ Joey Carter,
219281
David Ittah,
220282
Erick Ochoa Lopez,
221283
Mehrdad Malekmohammadi,
222-
William Maxwell
284+
William Maxwell,
223285
Romain Moyard,
224286
Shuli Shu,
225287
Ritu Thombre,

0 commit comments

Comments
 (0)