Skip to content
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

Open
wants to merge 49 commits into
base: master
Choose a base branch
from

Conversation

multiphaseCFD
Copy link
Member

@multiphaseCFD multiphaseCFD commented Oct 8, 2024

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 the
    change, 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:

@multiphaseCFD multiphaseCFD changed the title initial commit Add native N-control gate support to lightning.gpu Oct 8, 2024
@multiphaseCFD multiphaseCFD marked this pull request as ready for review October 21, 2024 14:11
tests/test_gates.py Outdated Show resolved Hide resolved
tests/test_gates.py Outdated Show resolved Hide resolved
tests/test_gates.py Outdated Show resolved Hide resolved
Copy link
Contributor

@josephleekl josephleekl left a 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!

Copy link
Contributor

@LuisAlfredoNu LuisAlfredoNu left a 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 😄

Copy link
Contributor

@LuisAlfredoNu LuisAlfredoNu left a 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](
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto func = [gate_name = gate_name](
auto func = [&gate_name](

Comment on lines +408 to +412
auto &gateMap =
cuGates::DynamicGateDataAccess<PrecisionT>::getInstance();
auto &&matrix_cu = gateMap.getGateData(opName, params);

gate_cache_.add_gate(opName, params[0], matrix_cu);
Copy link
Contributor

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

Comment on lines +341 to +344
# 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."
)
Copy link
Contributor

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? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:build_wheels Activate wheel building. ci:use-gpu-runner Enable usage of GPU runner for this Pull Request ci:use-multi-gpu-runner Enable usage of Multi-GPU runner for this Pull Request urgent Mark a pull request as high priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants