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

ZNE local folding #1006

Merged
merged 106 commits into from
Sep 10, 2024
Merged

ZNE local folding #1006

merged 106 commits into from
Sep 10, 2024

Conversation

WrathfulSpatula
Copy link
Contributor

Context:

Unitary Fund has partnered with Xanadu PennyLane Catalyst to add local folding functionality to Catalyst. As discussed previously, the implementation does not yet match the unit test, but we would like to share the content state of progress, for feedback.

Description of the Change:

This is a work-in-progress to add local folding functionality, of all gates in a quantum circuit, to Catalyst, with a unit test. (Local folding of random gates in a circuit will follow, after this PR.)

Benefits:

Local folding, of single quantum gates, is an alternative method to global folding, of the entire circuit effectively as a single overall operator. Certain circuits and quantum computer architectures might benefit more from either method.

Possible Drawbacks:

There are no particular drawbacks to offering an additional option of local folding, along with global folding.

Related GitHub Issues:

#755

Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

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

Could you add some some pytest parametrization to test the local folding? (global folding python tests)

@rmoyard
Copy link
Contributor

rmoyard commented Sep 5, 2024

@WrathfulSpatula I think there are some integration issues between the type in the frontend and the one in MLIR for local folding.

@cosenal
Copy link
Contributor

cosenal commented Sep 6, 2024

@WrathfulSpatula I think there are some integration issues between the type in the frontend and the one in MLIR for local folding.

I did some debugging on this. I double checked all the Enums both in Python and C++ and those are working fine.

The situation that raises an error is when the circuit has a parameter. E.g.

def circuit(x):
   ...
   qml.RZ(x, wires=0)
   ...

as opposed to

def circuit()
   ...

Co-authored-by: Romain Moyard <rmoyard@gmail.com>
Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

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

A changelog entry and add "all" to the Zne function docs and I am happy to approve it 👍

@WrathfulSpatula
Copy link
Contributor Author

A change log entry has been added, and the all option is noted in the Python docs! Thank you!

Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

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

It looks good to me, thanks a lot great job!

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
Copy link
Contributor

@cosenal cosenal left a comment

Choose a reason for hiding this comment

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

Awesome work! Left some nits.

It looks like the linter job is still complaining about test_mitigation.py

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
mlir/test/Mitigation/ZneFoldingAllTest2.mlir Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.63%. Comparing base (df61af6) to head (9955872).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1006   +/-   ##
=======================================
  Coverage   97.63%   97.63%           
=======================================
  Files          76       76           
  Lines       10782    10782           
  Branches     1251     1251           
=======================================
  Hits        10527    10527           
  Misses        205      205           
  Partials       50       50           

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

@rmoyard
Copy link
Contributor

rmoyard commented Sep 9, 2024

@WrathfulSpatula Can you update the changelog and merge main. Then I can merge the PR 👍

@rmoyard rmoyard closed this Sep 9, 2024
@rmoyard rmoyard reopened this Sep 9, 2024
@cosenal
Copy link
Contributor

cosenal commented Sep 10, 2024

@rmoyard I fixed the changelog indentation. Which build do I check to see if it renders correctly?

@rmoyard rmoyard merged commit 5feed5f into PennyLaneAI:main Sep 10, 2024
41 of 42 checks passed
@rmoyard
Copy link
Contributor

rmoyard commented Sep 10, 2024

It looks good, in the github action there is a read the docs one you can click on details. Then you see the generated docs.

rauletorresc pushed a commit that referenced this pull request Sep 11, 2024
**Context:**

Unitary Fund has partnered with Xanadu PennyLane Catalyst to add local
folding functionality to Catalyst. As discussed previously, the
implementation does not yet match the unit test, but we would like to
share the content state of progress, for feedback.

**Description of the Change:**

This is a work-in-progress to add local folding functionality, of all
gates in a quantum circuit, to Catalyst, with a unit test. (Local
folding of random gates in a circuit will follow, after this PR.)

**Benefits:**

Local folding, of single quantum gates, is an alternative method to
global folding, of the entire circuit effectively as a single overall
operator. Certain circuits and quantum computer architectures might
benefit more from either method.

**Possible Drawbacks:**

There are no particular drawbacks to offering an additional option of
local folding, along with global folding.

**Related GitHub Issues:**

#755

---------

Co-authored-by: Alessandro Cosentino <cosenal@gmail.com>
Co-authored-by: Romain Moyard <rmoyard@gmail.com>
mehrdad2m pushed a commit that referenced this pull request Sep 17, 2024
**Context:**

Unitary Fund has partnered with Xanadu PennyLane Catalyst to add local
folding functionality to Catalyst. As discussed previously, the
implementation does not yet match the unit test, but we would like to
share the content state of progress, for feedback.

**Description of the Change:**

This is a work-in-progress to add local folding functionality, of all
gates in a quantum circuit, to Catalyst, with a unit test. (Local
folding of random gates in a circuit will follow, after this PR.)

**Benefits:**

Local folding, of single quantum gates, is an alternative method to
global folding, of the entire circuit effectively as a single overall
operator. Certain circuits and quantum computer architectures might
benefit more from either method.

**Possible Drawbacks:**

There are no particular drawbacks to offering an additional option of
local folding, along with global folding.

**Related GitHub Issues:**

#755

---------

Co-authored-by: Alessandro Cosentino <cosenal@gmail.com>
Co-authored-by: Romain Moyard <rmoyard@gmail.com>
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.

3 participants