-
Notifications
You must be signed in to change notification settings - Fork 17
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
Leverage function_annotation
for AutoEnzyme
#407
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #407 +/- ##
==========================================
+ Coverage 96.68% 96.70% +0.01%
==========================================
Files 103 103
Lines 4981 5003 +22
==========================================
+ Hits 4816 4838 +22
Misses 165 165 ☔ View full report in Codecov by Sentry. |
Some of the failures I see here are for |
@gdalle it's probably worth testing that an error is thrown for closure scenaios that write (and nor for ones that don't) |
….jl into gd/annot
@wsmoses I think this is ready, care to take a second look?
At the moment I can't do that easily because my function |
I'm gonna merge this because the new version of Enzyme causes errors in my existing tests without it (see e.g. the current state of #329). We can hash out the details later |
DI extensions
Enzyme: adapt to SciML/ADTypes.jl#77 with the new
function_annotation
kwarg:get_f_and_df(f, backend)
to every operator with the following behavior with the following behavior:function_annotation <: Nothing
, passf
function_annotation <: Const
, passConst(f)
function_annotation <: Duplicated
, passDuplicated(f, make_zero(f))
BatchDuplicated
onf
not necessary yet but it will be once I implement batched operatorsEnzyme.gradient
andEnzyme.jacobian
to cases wheref
is either not annotated orConst
:function_annotation <: Union{Nothing,Const}
autodiff
when callingautodiff_thunk
:Const(f)
iff
is not annotatedf
withEnzymeCore.set_err_if_func_written
DI tests
Enzyme:
function_annotation=Nothing
andfunction_annotation=Const
work on normal scenariosfunction_annotation=Duplicated
works on closurized scenariosSecondOrder
tests, forEnzyme.Reverse
overForwardDiff
, markf
asConst
because the analysis is too conservative@wsmoses would you add any other annotation? We'll worry about performance later (e.g. zero-ing in place instead of re-creating
make_zero(f)
).Related: