-
Notifications
You must be signed in to change notification settings - Fork 715
Allow for users to set an arbitrary level when calling qml.specs
#8606
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
base: master
Are you sure you want to change the base?
Conversation
|
Hello. You may have forgotten to update the changelog!
|
Co-authored-by: Isaac De Vlugt <[email protected]>
mudit2812
left a 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.
Thanks Jake, the PR looks good to me from a technical standpoint. You have a soft approval from me - I'd like the testing PR in Catalyst to be approved before this one is approved.
Co-authored-by: Isaac De Vlugt <[email protected]>
Co-authored-by: Isaac De Vlugt <[email protected]>
…ne into feature/specs-levels
Co-authored-by: Isaac De Vlugt <[email protected]>
isaacdevlugt
left a 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.
Thanks Jake this looks great overall! Made some minor suggestions but this is ready 🚢
| about the circuit after applying the specified transforms, expansions, and/or compilation passes. | ||
| Args: | ||
| qnode (.QNode | .QJIT): the QNode to calculate the specifications for. |
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.
Is the .<class name> convention something we follow elsewhere?
| Some resource information from pass-by-pass specs may be estimated, since it is not always | ||
| possible to determine exact resource usage from intermediate representations. | ||
| For example, resources contained in a ``for`` loop with a non-static range or a ``while`` loop will only be counted as if one iteration occurred. | ||
| Additionally, resources contained in conditional branches from ``if`` or ``switch`` statements will take a union of resources over all branches, providing a tight upper-bound. |
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.
Is it the union of all resources, or the most expensive branch that is chosen?
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.
Let's also stick this warning up a bit higher. Right between these two lines:
a real device.
.. code-block:: python
Co-authored-by: Isaac De Vlugt <[email protected]>
Context:
For code compiled using Catalyst, the only currently supported
levelargument islevel="device"which does runtime resource tracking. Since users may specify compilation passes that get applied to their code, it would be useful to support intermediatelevels between the user-specified program and the final execution.Description of the Change:
Introduces several other legal levels:
int, will return information about the compiler pass or tape transform at that level (starting from 0)strmarker, returns information about the level where this marker is definedBenefits:
It is possible to learn gather information about the circuit during several/after various compilation levels
Possible Drawbacks:
Increased complexity of
qml.specsRelated GitHub Issues:
[sc-104118]
Relies upon a Catalyst utility added in PennyLaneAI/catalyst#2238
Integration tests for these new features are added in PennyLaneAI/catalyst#2272