-
Notifications
You must be signed in to change notification settings - Fork 40
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-2) Add controlled named 2/4-qubit gate (e.g. NCIsingXX) support to Lightning Kokkos #953
Conversation
Hello. You may have forgotten to update the changelog!
|
3df0a20
to
d99ad20
Compare
af0f04d
to
eaac78f
Compare
eaac78f
to
a1c498f
Compare
692c2cf
to
5497be5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## lk-control-base #953 +/- ##
==================================================
Coverage ? 97.00%
==================================================
Files ? 221
Lines ? 34366
Branches ? 0
==================================================
Hits ? 33338
Misses ? 1028
Partials ? 0 ☔ View full report in Codecov by Sentry. |
5497be5
to
2d5b58e
Compare
a2d6fe4
to
82b0b85
Compare
b84263f
to
020c215
Compare
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
Only a few questions before to move forward 😄
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
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.
Nice work @josephleekl! Happy to approve once the last comments have been addressed.
..._lightning/core/src/simulators/lightning_kokkos/gates/tests/Test_StateVectorKokkos_Param.cpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
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.
Nice work @josephleekl ! Just a few questions.
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
@@ -600,7 +651,7 @@ template <class PrecisionT, class FuncT> class applyNC2Functor { | |||
template <class ExecutionSpace> | |||
applyNC2Functor([[maybe_unused]] ExecutionSpace exec, | |||
Kokkos::View<Kokkos::complex<PrecisionT> *> arr_, | |||
std::size_t num_qubits, | |||
const std::size_t num_qubits, |
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 necessary to set num_qubits
as const
for the argument?
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.
I will keep consistent with the original file that e.g. applyNC2Functor
applyNC1Functor
etc. does not use const, just std::size_t num_qubits
, but I will keep the const std::size_t num_qubits
in specific functions applyPauliY
. This could be revisited in a later PR.
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGeneratorFunctors.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGeneratorFunctors.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGeneratorFunctors.hpp
Show resolved
Hide resolved
I have addressed the comments above, please have a look and approve if ready, thanks! @maliasadi @LuisAlfredoNu @multiphaseCFD |
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 work!
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp
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.
LGTM 🥳
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 @josephleekl ! Nice work
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 named controlled 2/4-qubit gates (e.g. Swap / IsingXX / SingleExcitation / Double Excitation). These are defined in
BasicGateFunctor.hpp
, and are applied throughapplyNC2Functor
andapplyNC4Functor
defined in the same file.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-76774]