-
Notifications
You must be signed in to change notification settings - Fork 595
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
#6318
base: master
Are you sure you want to change the base?
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6318 +/- ##
=======================================
Coverage 99.70% 99.70%
=======================================
Files 445 445
Lines 42260 42264 +4
=======================================
+ Hits 42137 42141 +4
Misses 123 123 ☔ View full report in Codecov by Sentry. |
…I/pennylane into cosinewindow_catalyst_support
if tape.operations and isinstance(tape[0], StatePrepBase) and skip_initial_state_prep: | ||
if tape.operations and isinstance(tape[0], (StatePrep, BasisState)) and skip_initial_state_prep: |
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.
It is better to update Catalyst to target the more general base class StatePrepBase instead of changing this here. Alternatively, we might include all 3 state prep classes in this condition.
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.
Including all three state prep classes would reintroduce the bug. The issue is that CosineWindow
inherits from StatePrepBase
, so Catalyst will attempt to optimize it.
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.
What if CosineWindow inherits from StatePrep? Does it solve the problem?
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 Catalyst (PR #1166) and PennyLane lightning (PR #929).