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

Making arithmetic templates QJIT compatible #6307

Merged
merged 20 commits into from
Oct 9, 2024
Merged

Making arithmetic templates QJIT compatible #6307

merged 20 commits into from
Oct 9, 2024

Conversation

willjmax
Copy link
Contributor

This PR makes the following template QJIT compatible.

  1. PhaseAdder
  2. Adder
  3. Multiplier
  4. ModExp
  5. OutAdder
  6. OutMultiplier

The issue stems from the use of qml.adjoint() as an iterable in the PhaseAdder and Multiplier templates. In Catalyst, the corresponding HybridAdjoint class is compatible with PennyLane's Adjoint class for single operations, but incompatible for multiple operations (see this Catalyst PR). The solution is add each qml.adjoint(op) to the decomposition list individually, instead of extending the list by treating the adjoint as an iterable.

While this PR makes OutAdder and OutMultiplier QJIT compatible, there is another issue with them that prevents them from returning the correct answer when compiled with QJIT. This bug will be addressed in a separate PR.

This PR addresses sc-74445.

Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.40%. Comparing base (6c6b80f) to head (28ade00).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6307   +/-   ##
=======================================
  Coverage   99.39%   99.40%           
=======================================
  Files         446      446           
  Lines       42328    42364   +36     
=======================================
+ Hits        42073    42110   +37     
+ Misses        255      254    -1     

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

Copy link
Contributor

@KetpuntoG KetpuntoG 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 working on this, looks good! Is it possible to add a test using qjit?

@willjmax
Copy link
Contributor Author

willjmax commented Oct 2, 2024

Thank you for working on this, looks good! Is it possible to add a test using qjit?

The qjit tests live in the Catalyst repo. See this PR for the added tests.

Copy link
Contributor

@KetpuntoG KetpuntoG left a comment

Choose a reason for hiding this comment

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

🚀

@willjmax willjmax merged commit f54a888 into master Oct 9, 2024
37 checks passed
@willjmax willjmax deleted the qjit-phase branch October 9, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants