-
Notifications
You must be signed in to change notification settings - Fork 30
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
Catalyst support for qml.CosineWindow
#1166
base: main
Are you sure you want to change the base?
Conversation
…l add support to qml.qml.CosineWindow when it's called as the first op in tapes
qml.CosineWindow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @willjmax! 🎉 Just some formatting changes below, but we should also make sure to add a test to confirm the template is working (e.g. in catalyst/frontend/test/pytest/test_templates.py
).
.dep-versions
Outdated
# For a custom LQ/LK version, update the package version here and at | ||
# 'doc/requirements.txt'. Also, update the 'LIGHTNING_GIT_TAG' at | ||
# 'runtime/Makefile' and at all GitHub workflows, using the exact | ||
# commit hash corresponding to the merged PR that implements the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to also update the LIGHTNING_GIT_TAG
variable as described in this comment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide some more details on this? This is my first Catalyst contribution and I'm not sure I understand the comment 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the process to update the dependency requires setting the version in a few places at the moment (this will become easier some time this quarter), the .dep-versions
file you already noticed, and
Lines 33 to 35 in 934726f
pennylane-lightning-kokkos==0.38.0 pennylane-lightning==0.38.0 pennylane==0.39.0.dev16 Line 17 in 934726f
LIGHTNING_GIT_TAG_VALUE?=latest_release -DLIGHTNING_GIT_TAG=latest_release \ -DLIGHTNING_GIT_TAG=latest_release \
There are two kinds of dependencies, "version strings" which can be used by pip when installing packages, and git refs which can be used by git when cloning repositories. For lightning because we currently build the lightning qubit device in the runtime, we have to make sure the git commit we use for this is the same as the lightning python package that will be installed by pip. To match the two take a particular PR that you want to depend on, say PennyLaneAI/pennylane-lightning#929. In the PR we see the package version string assigned to it:
PennyLaneAI/pennylane-lightning@02140db
Once the PR is merged, you will be able to see the merge commit on main and get its hash. Use this as the LIGHTNING_GIT_TAG
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For pennylane the idea is the same, although you don't need to worry about the git tag. Wait until the pennylane PR is merged, then get the package version that contains the PR you want. PennyLane updates its version and pushes a development package to pypi every night (contrary to lightning which does it every PR).
If you want the released dev package quicker, you can also trigger the action manually.
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
…I/catalyst into cosinewindow_catalyst_support
Lastly, you'll need a changelog entry, you can put your change in the improvements section: catalyst/doc/releases/changelog-dev.md Line 150 in 934726f
|
…I/catalyst into cosinewindow_catalyst_support
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1166 +/- ##
=======================================
Coverage 97.93% 97.93%
=======================================
Files 77 77
Lines 10921 10921
Branches 971 971
=======================================
Hits 10695 10695
Misses 179 179
Partials 47 47 ☔ View full report in Codecov by Sentry. |
Compiling a circuit with QJIT that begins with a CosineWindow state preparation results in a compiler error. This is because Catalyst has optimizations for when the first operation is a state preparation, but these optimizations are not supported for CosineWindow. A workaround is to only perform the state preparation optimizations on the
StatePrep
andBasisState
classes, rather than the more generalStatePrepBase
class.This workaround requires additional changes to PennyLane (PR #6318) and PennyLane lightning (PR #929).