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

add user data to EnzymeRegisterCallHandler #2223

Closed
wants to merge 2 commits into from

Conversation

martinjrobins
Copy link
Contributor

This adds two items to the C API:

  1. a void *data arg to EnzymeRegisterCallHandler so users can supply their own data to the callbacks
  2. EnzymeRegisterCallHandler and EnzymeGradientUtilsNewFromOriginal added to the C API header

My particular motivation for 1. is that I need access to the LLVM module pointer in my reverse callback, so the data arg allows me to pass this in. I know the LLVM C++ API has getParent that can be used to get the module from the original call instruction, but I'm using the LLVM C API from rust, which as far as I can see does not have this functionality. In any case, I figure it would be generally useful for users to pass arbitrary data to these callbacks.

@wsmoses
Copy link
Member

wsmoses commented Jan 17, 2025

@martinjrobins
Copy link
Contributor Author

yea, you are right, thanks! Ok I guess I just need 2. then. I'll open another PR with just that

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.

2 participants