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

Pass control values to the L-Qubit kernels #576

Merged
merged 16 commits into from
Dec 14, 2023
Merged

Conversation

vincentmr
Copy link
Contributor

@vincentmr vincentmr commented Dec 12, 2023

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:
Following up on #516 , this PR introduces controlled_values everywhere to improve the flexibility of the n-control interface.

Description of the Change:
Pass controlled_values around everywhere controlled_wires are to be found. I also remove the extern definitions from GateImplementationsLM.hpp (not effect on build times AFAIK).

Benefits:
Simpler decompositions for non-strictly 1-controlled gates (improved perf). For example, this is important in Grover's algorithm. While it makes no difference when searching for the 111...111 string (best case scenario), it makes a significant difference (~50%) when searching for the 000...000 string (worst case scenario). These are extreme cases, but it gives an idea. Here are some benchmarks performed on a single Perlmutter core before and after this PR.
time_vs_nqubits

The extern definitions need not be maintained.

Possible Drawbacks:
Increased code complexity.

Related GitHub Issues:

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (998362a) 98.95% compared to head (57c86b4) 99.08%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #576      +/-   ##
==========================================
+ Coverage   98.95%   99.08%   +0.12%     
==========================================
  Files         167      201      +34     
  Lines       24382    29290    +4908     
==========================================
+ Hits        24128    29021    +4893     
- Misses        254      269      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vincentmr vincentmr added the ci:use-multi-gpu-runner Enable usage of Multi-GPU runner for this Pull Request label Dec 12, 2023
@vincentmr vincentmr marked this pull request as ready for review December 13, 2023 14:05
@vincentmr vincentmr requested a review from a team December 13, 2023 14:05
@vincentmr
Copy link
Contributor Author

Support arbitrary controlled values in lightning [sc-51996]

@vincentmr vincentmr changed the title Add ctrl values Pass control values to the L-Qubit kernels Dec 13, 2023
Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

Nice work. Super close to approval! I left some comments.

Copy link
Contributor

@AmintorDusko AmintorDusko 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 for your nice work!

@multiphaseCFD
Copy link
Member

Nice job @vincentmr ! Happy to approve. A kind reminder: please make sure all CI checks passed before merge.

@vincentmr vincentmr merged commit 5427421 into master Dec 14, 2023
85 checks passed
@vincentmr vincentmr deleted the add_ctrl_values branch December 14, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:use-multi-gpu-runner Enable usage of Multi-GPU runner for this Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants