-
Notifications
You must be signed in to change notification settings - Fork 41
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
[dyn-alloc-base] Lightning dynamically allocate qubit memory #1043
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1043 +/- ##
==========================================
+ Coverage 98.04% 98.95% +0.91%
==========================================
Files 233 266 +33
Lines 39556 44514 +4958
==========================================
+ Hits 38782 44049 +5267
+ Misses 774 465 -309 ☔ 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.
Nice job! A few comments and suggestions.
pennylane_lightning/core/src/simulators/lightning_qubit/StateVectorLQubit.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_qubit/StateVectorLQubitManaged.hpp
Outdated
Show resolved
Hide resolved
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.
Thank you @josephleekl! Nice job!
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 work @josephleekl! Just a few minor comments before merging the PR 🎉
Hey @josephleekl, super useful posting the links to the changes for each comment/suggestion. Much easier to follow, thank you! 🙏 |
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.
Awesome! Happy to approve 🥳
Before submitting
Please complete the following checklist when submitting a PR:
All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to the
tests
directory!All new functions and code must be clearly commented and documented.
If you do make documentation changes, make sure that the docs build and
render correctly by running
make docs
.Ensure that the test suite passes, by running
make test
.Add a new entry to the
.github/CHANGELOG.md
file, summarizing thechange, and including a link back to the PR.
Ensure that code is properly formatted by running
make format
.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Context:
This PR enables lightning devices to dynamically allocate memory for statevectors just before execution. The usual
qml.device("lightning.x", wires=y)
is still supported, but user can also not providewires
, i.e.qml.device("lightning.x")
, and the qubits required for the statevector is provided by the circuitDescription of the Change:
For LQ/LK/LG - the state-vector is only created at the execute step, and not during device creation. For all devices, if wires is provided during device creation, this will be the number of wires allocated in the device state-vector/tensornet; otherwise, it will be determined from the circuit to be executed.
Benefits:
Possible Drawbacks:
Related GitHub Issues:
[sc-82702]