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

Fix Lightning GPU Rot adjoint bug and enable Rot in toml #1004

Merged
merged 11 commits into from
Nov 25, 2024

Conversation

josephleekl
Copy link
Contributor

@josephleekl josephleekl commented Nov 22, 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:
Previously the implementation of Rot and CRot gates (e.g. Rot(a, b, c)) with adjoint in LGPU ended up multiplying Rot(-a, -b, -c) instead of Rot(-c, -b, -a). The error was not found in tests since the C++ tests used the wrong adjoint rotation matrix, and since Adjoint(Rot) and Adjoint(CRot) were not in the frozenset, they were not executed in the Python tests. The error is found when adding the invertible capability for Rot and CRot and the following test fails.

Description of the Change:
This PR fixes the implementation and C++ tests. The toml file is also updated to enable Adjoint(Rot) and Adjoint(CRot) from Python.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

[sc-78931]

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.42%. Comparing base (c7846c3) to head (1478176).
Report is 49 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1004      +/-   ##
==========================================
+ Coverage   95.80%   96.42%   +0.61%     
==========================================
  Files         228      138      -90     
  Lines       35803    21785   -14018     
==========================================
- Hits        34301    21006   -13295     
+ Misses       1502      779     -723     

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

@josephleekl josephleekl marked this pull request as ready for review November 22, 2024 20:34
@josephleekl josephleekl added ci:use-multi-gpu-runner Enable usage of Multi-GPU runner for this Pull Request urgent Mark a pull request as high priority ci:use-gpu-runner Enable usage of GPU runner for this Pull Request labels Nov 22, 2024
@josephleekl josephleekl added the ci:build_wheels Activate wheel building. label Nov 22, 2024
@LuisAlfredoNu
Copy link
Contributor

Do you think that we need to change something in the Python test to prevent this error again? 🤔

Copy link
Member

@maliasadi maliasadi left a comment

Choose a reason for hiding this comment

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

Thanks @josephleekl for the prompt fix! 🙌

Copy link
Member

@multiphaseCFD multiphaseCFD left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @josephleekl !

@josephleekl josephleekl merged commit d37e638 into master Nov 25, 2024
85 of 86 checks passed
@josephleekl josephleekl deleted the fix_lgpu_adjoint_rot branch November 25, 2024 20:45
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.

5 participants