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

Callbacks with return values #610

Merged
merged 30 commits into from
Apr 8, 2024

Conversation

erick-xanadu
Copy link
Contributor

@erick-xanadu erick-xanadu commented Mar 18, 2024

Context: Adds support for callbacks with return values.

Description of the Change: The callback will flatten the returns and cast them to unranked_memrefs. The unranked_memrefs are copied over using mlir_c_runner's library.

Benefits: Callbacks may have return values

Possible Drawbacks: None.

Related GitHub Issues: None.

[sc-47690]

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.41%. Comparing base (9f84618) to head (1134a53).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #610   +/-   ##
=======================================
  Coverage   99.41%   99.41%           
=======================================
  Files          54       55    +1     
  Lines        9053     9109   +56     
  Branches      684      694   +10     
=======================================
+ Hits         9000     9056   +56     
  Misses         28       28           
  Partials       25       25           

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

@erick-xanadu erick-xanadu force-pushed the eochoa/2024-03-08/callbacks-parameters branch from 659b5d3 to 8cf8b3a Compare March 19, 2024 19:38
@erick-xanadu erick-xanadu force-pushed the eochoa/2024-03-14/callbacks-with-return-values branch from 9cfb321 to 229b4e6 Compare March 20, 2024 15:24
@erick-xanadu erick-xanadu changed the title 🚧 Callbacks with return values Callbacks with return values Mar 20, 2024
@erick-xanadu erick-xanadu marked this pull request as ready for review March 20, 2024 15:31
Base automatically changed from eochoa/2024-03-08/callbacks-parameters to main March 22, 2024 19:02
@erick-xanadu erick-xanadu force-pushed the eochoa/2024-03-14/callbacks-with-return-values branch from e6e7293 to d28e199 Compare March 22, 2024 19:42
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.

Thanks @erick-xanadu, it looks good! I have left some questions. Could you also add a call back test (e2e in python) of a more elaborated function?

doc/changelog.md Show resolved Hide resolved
frontend/catalyst/compiler.py Outdated Show resolved Hide resolved
frontend/catalyst/pennylane_extensions.py Show resolved Hide resolved
frontend/catalyst/pennylane_extensions.py Show resolved Hide resolved
frontend/catalyst/pennylane_extensions.py Show resolved Hide resolved
frontend/catalyst/pennylane_extensions.py Show resolved Hide resolved
frontend/catalyst/utils/jnp_to_memref.py Show resolved Hide resolved
Copy link
Contributor

@dime10 dime10 left a comment

Choose a reason for hiding this comment

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

I don't have much, just two comments when I briefly looked at it last week :)

doc/changelog.md Outdated Show resolved Hide resolved
frontend/catalyst/pennylane_extensions.py Show resolved Hide resolved
@erick-xanadu erick-xanadu enabled auto-merge (squash) April 5, 2024 18:07
Copy link
Member

@mlxd mlxd 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 @erick-xanadu
Just some thoughts and suggestions

frontend/catalyst/compiler.py Show resolved Hide resolved
frontend/catalyst/utils/types.py Outdated Show resolved Hide resolved
frontend/test/pytest/test_callback.py Outdated Show resolved Hide resolved
runtime/lib/registry/Registry.cpp Outdated Show resolved Hide resolved
runtime/lib/registry/Registry.cpp Outdated Show resolved Hide resolved
runtime/lib/registry/Registry.cpp Outdated Show resolved Hide resolved
runtime/lib/registry/Registry.cpp Outdated Show resolved Hide resolved
@erick-xanadu erick-xanadu requested a review from mlxd April 5, 2024 20:49
Copy link
Member

@mlxd mlxd 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 @erick-xanadu
Nothing more from my side.

@erick-xanadu erick-xanadu merged commit 387af82 into main Apr 8, 2024
35 checks passed
@erick-xanadu erick-xanadu deleted the eochoa/2024-03-14/callbacks-with-return-values branch April 8, 2024 13:26
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