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
Remove qextract_p
and qinst_p
from forced-order primitives
#469
Conversation
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.
Great first contribution to Catalyst 💯
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #469 +/- ##
=======================================
Coverage 99.56% 99.56%
=======================================
Files 43 43
Lines 7666 7666
Branches 514 514
=======================================
Hits 7633 7633
Misses 17 17
Partials 16 16 ☔ View full report in Codecov by Sentry. |
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.
This change was driven by a performance issue, correct? What was the impact on performance before and after this change? Just saw the ticket comment. 😎
Thanks!
Context:
Generating the JAX
jaxpr
from a PennyLaneQNode
composed of many (unrolled) gates can be quite slow. This is partially due to the topological sorting of jaxpr equations which form a dependency graph with a near-quadratic number of edges. Most of these edges are a result of forced-order constraints that are added using:Currently, the set of forced-order primitives is
{qdevice_p, qextract_p, qinst_p}
; however, the data dependencies ofqextract_p
andqinst_p
should already be captured by the relationships of input and output variables in thejaxpr
.Description of the Change:
qextract_p
andqinst_p
from the list of forced-order primitives.Benefits:
Possible Drawbacks:
qextract_p
andqinst_p
primitives must (continue to) be encoded via input-output variable dependencies.Related GitHub Issues:
None.