-
Notifications
You must be signed in to change notification settings - Fork 47
Support Static and Dynamic Variables in PLxPR Programs with QJIT #1810
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
Conversation
5a1f63a
to
717a2f6
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1810 +/- ##
=======================================
Coverage 96.56% 96.56%
=======================================
Files 85 85
Lines 9324 9326 +2
Branches 871 872 +1
=======================================
+ Hits 9004 9006 +2
Misses 261 261
Partials 59 59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This will need to wait for #1801 , by the way. |
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.
Nice, simple fix 💯
Remember to add a test : )
b7130c4
to
df483ab
Compare
I just realized this doesn't actually produce static IR...
It's only static in the sense the the qnode is being called with a static number. The underlying kernel is still dynamic. |
https://github.com/jax-ml/jax/blob/main/jax/_src/interpreters/partial_eval.py#L2408 this line in However this is only happening for the plxpr path. |
Note that the above is not
aka the plxpr does not pick up the static arg already |
The only difference I can see before reaching this |
Ok, I now think all of my troubles are because the qjit static argnums and the qnode static argnums are fighting with each other 😅 To which I strongly suggest we disallow specifying both at the same time! |
No I guess that's impossible because we never really encounter the qnode on the catalyst side, happy to disallow this case for now :) |
So we actually already do this for non-plxpr pipeline https://github.com/PennyLaneAI/catalyst/blob/main/frontend/catalyst/jit.py#L587 But this is not picked up by But anyway, if we are fine with not explicitly disallowing two configs together, then this PR is now ready for merging. I also updated the tests to directly check the gates are using the static angles. |
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.
Looks good!
Context:
Control over static variables in compilation is a general necessity. At the moment, with
qml.capture.enable()
, additionally specifying a static variable inqjit
does not work. With this epic, we want to add support for static variables in the plxpr-qjit execution pipeline.Description of the Change:
trace_from_pennylane
function signature to includedynamic_argnums
.from_plxpr
.[[sc-93318]]