Enzyme.jl
Enzyme.jl copied to clipboard
Query for Enzyme compatibility without running the code
In DiffEq we're doing a bit of:
try
Enzyme.autodiff(Enzyme.Duplicated(du, du),
u0,p,prob.tspan[1]) do out,u,_p,t
prob.f(out, u, _p, t)
nothing
end
true
catch
false
end
to see whether Enzyme is compatible with a given function, but it would be nice to be able to do this without actually calling the function.
Yeah, @wsmoses minimum improvement here is not to assert, but to report a catch-able error.
https://github.com/wsmoses/Enzyme/pull/438 This should start to enable julia errors rather than having to use llvm unreachable/assertions.
@ChrisRackauckas once https://github.com/wsmoses/Enzyme.jl/pull/193 lands (with corresponding jll bump) the BLAS (and other errors) should come through as proper julia errors, rather than LLVM assertions.
And then how hard is it to do the next step of compiling and throwing an error if the program would through a type-based error (i.e. guaranteed error, rather than something based on values of branches), but not requiring the computation?
Closing this since our stance is to give a runtime error where ever possible. Please open individual issues for things that remain compile-time errors.