-
Notifications
You must be signed in to change notification settings - Fork 39
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
(LK-C-4) Add controlled QubitUnitary support to Lightning Kokkos #955
Conversation
Hello. You may have forgotten to update the changelog!
|
42f9cd3
to
23f398c
Compare
8807e39
to
07c38a1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## lk-control-base #955 +/- ##
===================================================
+ Coverage 94.54% 96.08% +1.53%
===================================================
Files 231 231
Lines 37600 38191 +591
===================================================
+ Hits 35550 36695 +1145
+ Misses 2050 1496 -554 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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 job! Thank you, @josephleekl!
I'm running into some test errors with pennylane and |
Tests are passing with the merge now |
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.
Happy to approve 🥳
@@ -436,6 +436,7 @@ class StateVectorKokkos final | |||
matrix_trans, wires)); | |||
break; | |||
default: | |||
// TODO: runtime determine scratch space level |
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.
Also the optimization on L0
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.
Updated the todo comment to clarify :)
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.
LGTM! Thanks @josephleekl !
Thanks @maliasadi @multiphaseCFD @AmintorDusko ! |
### Before submitting Please complete the following checklist when submitting a PR: - [X] 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`](../tests) directory! - [X] 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`. - [X] Ensure that the test suite passes, by running `make test`. - [X] Add a new entry to the `.github/CHANGELOG.md` file, summarizing the change, and including a link back to the PR. - [X] 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:** Native arbitrary controlled operations have already been implemented in Lightning Qubit and Lightning GPU. This PR adds support for controlled operations to Lightning Kokkos as well. This PR is the base branch of combination of multiple PRs ([1](#952), [2](#953), [3](#954), [4](#955), [5](#956), [6](#958), [7](#965)) **Description of the Change:** Controlled named-gates, matrix, generators, and adjoint differentiation capability is added to Lightning Kokkos C++ layer. **Benefits:** Better performance for controlled operations in Lightning Kokkos (CPU + GPU). Adjoint differentiation now supported in Lightning Kokkos. **Possible Drawbacks:** **Related GitHub Issues:** [sc-78995] --------- Co-authored-by: ringo-but-quantum <[email protected]> Co-authored-by: Ali Asadi <[email protected]>
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:
Description of the Change:
This PR adds support for controlled QubitUnitary for Lightning Kokkos. There are specialized implementations for 1/2/3-qubits (
applyNC1/2/3QubitOpFunctor
) and a general case implementation (NCMultiQubitOpFunctor
). These functors are defined inMatrixGateFunctors.hpp
. These are called byapplyControlledMatrix
orapplyOperation
/applyNCMultiQubitOp
inStateVectorKokkos.hpp
Benefits:
Performance benchmarks for gates are shown here: https://www.notion.so/xanaduai/Lightning-Kokkos-Native-Controlled-Operation-Gate-Benchmarks-12ebc6bd17648017a2dcd237748b24fe
Possible Drawbacks:
Related GitHub Issues:
[sc-76776]