-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add native N-control gate support to lightning.gpu #938
base: master
Are you sure you want to change the base?
Conversation
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.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.
Looks really great Shuli! Just some very small comments, otherwise happy to approve!
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 very much @multiphaseCFD
It is super nice to have this feature.
Only a few questions and suggestions 😄
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Show resolved
Hide resolved
...tning/core/src/simulators/lightning_gpu/gates/tests/Test_StateVectorCudaManaged_NonParam.cpp
Show resolved
Hide resolved
...tning/core/src/simulators/lightning_gpu/gates/tests/Test_StateVectorCudaManaged_NonParam.cpp
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 @multiphaseCFD
Really nice work!
This will improve the functionality and the performance of LGPU.
Just a few questions
const auto gate_name = | ||
std::string(lookup(Constant::controlled_gate_names, gate_op)); | ||
const std::string doc = "Apply the " + gate_name + " gate."; | ||
auto func = [gate_name = gate_name]( |
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.
auto func = [gate_name = gate_name]( | |
auto func = [&gate_name]( |
auto &gateMap = | ||
cuGates::DynamicGateDataAccess<PrecisionT>::getInstance(); | ||
auto &&matrix_cu = gateMap.getGateData(opName, params); | ||
|
||
gate_cache_.add_gate(opName, params[0], matrix_cu); |
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.
Could you explain to us why we use here auto &
and auto &&
, please? We can not guess the reason for this. @josephleekl
# TODO: To move this line to the _apply_lightning_controlled method once the MPI backend supports controlled gates natively | ||
raise DeviceError( | ||
"Lightning-GPU-MPI does not support Controlled GlobalPhase gates." | ||
) |
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 this feature close to being added? 🤔
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:
[SC-73168]
[SC-75443] (duplicate)
Description of the Change:
Benefits:
Possible Drawbacks:
Related GitHub Issues: