-
Notifications
You must be signed in to change notification settings - Fork 68
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
Second order derivative error #2102
Comments
using Enzyme
f_nest(x) = x*x*x*x
function df1(x)
first(first(autodiff_deferred(Reverse, Const(f_nest), Active, Active(x))))
end
function df1_nd(x)
first(first(autodiff(Reverse, Const(f_nest), Active(x))))
end
function df2(x)
first(first(autodiff(Reverse, df1, Active(x))))
end
function df2_nd(x)
first(first(autodiff(Reverse, df1_nd, Active(x))))
end
@code_typed df1(2.0)
@code_typed df2(2.0)
@code_typed df1_nd(2.0)
@code_typed df2_nd(2.0)
|
so I think it's an issue with the deferred auto upgrade, investigating |
@aviatesk I think I need some absint help here: x/ref https://github.com/EnzymeAD/Enzyme.jl/pull/2115/files So basically the problem at hand is that we call autodiff of autodiff. the abstract interpreter plugin we added should change autodiff -> autodiff_deferred here: Enzyme.jl/src/compiler/interpreter.jl Line 862 in 1292a53
the outer autodiff asks what the return type of its inner differentiated function is (e.g. here it asks the return type of e.g. df1_nd). However, it gets told the result is a Union{}, here: Line 3129 in 1292a53
This seems to imply the overload doesn't happen, yet on all runs (e.g. see the debug logs I added to the autodiff interpreter overload linked above), it definiteyl changes autodiff->autodiff_deferred, incuding in the type computation. The way we do this (reproduced below) has something that begs a question.
Specifically, we modify arginfo and f, but we left si/sv alone. Is there something we need to do to change these, and if so what. Similarly could this be the cause of the issue? |
I am on Enzyme main (b63f36f) and Julia 1.10.6. The following used to work.
The text was updated successfully, but these errors were encountered: