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

Revert Enzyme hack #620

Open
maleadt opened this issue Aug 26, 2024 · 4 comments
Open

Revert Enzyme hack #620

maleadt opened this issue Aug 26, 2024 · 4 comments

Comments

@maleadt
Copy link
Member

maleadt commented Aug 26, 2024

#619

@vchuravy
Copy link
Member

Not fully up to speed here, but my hope is #582 will help with these situations.
But currently it does still create the issue that Enzyme want's to run some optimization passes,

For C++ we solve this by using Enzyme as a plugin, via a magic function, instead of using it as a frontend driver,
so maybe we could use a "EnzymePass", but the challenge would be to register that.

So the Idea would be to write:

ptr =  var"gpuc.deferred"(f, primal_args...)
__enzyme_autodiff(ptr, ad_args...)

Instead of #599, but then schedule a custom pass that recognizes __enzyme_autodiff.

@maleadt
Copy link
Member Author

maleadt commented Aug 26, 2024

the challenge would be to register that

What about a ScopedValue allowing a third-party app to customize the GPUCompiler pipeline? We could do something like LLVM, with different extension points that allow Enzyme to insert passes where needed.

@vchuravy
Copy link
Member

That would be wicked, but currently

function mykernel_grad(x, dx)
     autodiff_deferred(mykernel, Duplicated(x, dx))
end

@cuda mykernel_grad

And so we never enter on the CPU an Enzyme scope.

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

No branches or pull requests

3 participants
@vchuravy @maleadt and others