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 Reactant #265

Open
wsmoses opened this issue May 17, 2024 · 8 comments
Open

Add Reactant #265

wsmoses opened this issue May 17, 2024 · 8 comments
Labels
backend Related to one or more autodiff backends

Comments

@wsmoses
Copy link

wsmoses commented May 17, 2024

It's not quite an AD engine in its own right, but given how it traces things and can make for much better performance/compatibility, and can be used with an AD engine, it seems like a natural fit.

@gdalle gdalle added the backend Related to one or more autodiff backends label May 17, 2024
@gdalle
Copy link
Owner

gdalle commented May 17, 2024

Why not but I don't understand what the package does or how it would fit within DI, so you'll have to hold my hand on this one ^^

@wsmoses
Copy link
Author

wsmoses commented May 17, 2024

Yeah so basically, Reactant exports a compile utility which takes a julia function and arguments, and compiles it to a nice/fast version of it. It does require that all data one cares about to be passed in using ConcreteRArrays rather than Ararys [and structs of those/etc]. We do have a tracer utility which will take an arg and auotmatically changes arrays to ConcreteRArrays for you though.

This can obviously compile code with an autodiff call on the inside, such as Enzyme. See here: https://github.com/EnzymeAD/Reactant.jl/blob/292dc03593ceb1a7a1f022fd7d3289bd69b000b5/test/basic.jl#L81. Enzyme usage should end up with quite good performance since the fancy optimizations that Reactant applies will be able to interoperate with AD.

@wsmoses
Copy link
Author

wsmoses commented May 17, 2024

We also now have a brief tldr in the readme: https://github.com/EnzymeAD/Reactant.jl/tree/main

@gdalle
Copy link
Owner

gdalle commented May 17, 2024

So how would you see this in the context of DI? As a variant of the Enzyme backend which Reactant-compiles the function during preparation?

@wsmoses
Copy link
Author

wsmoses commented May 17, 2024 via email

@gdalle
Copy link
Owner

gdalle commented May 17, 2024

And do what with it? Compile and convert everything before and after use?

@wsmoses
Copy link
Author

wsmoses commented May 17, 2024

Yup

@gdalle
Copy link
Owner

gdalle commented May 18, 2024

I would welcome a PR with an example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to one or more autodiff backends
Projects
None yet
Development

No branches or pull requests

2 participants