This repository was archived by the owner on Aug 25, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 13
EnzymeExt ignores runtime activity #115
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
In Enzyme 0.13 runtime activity is now enabled in the ReverseMode type explicitly. For instance with ADtypes it would be done with
OptimizationFunction(f, AutoEnzyme(;mode=set_runtime_activity(Reverse)))However, this isn't being respected in OptimizationEnzymeExt where Reverse and Forward are hardcoded.
For example
OptimizationBase.jl/ext/OptimizationEnzymeExt.jl
Lines 98 to 113 in 1ebca6f
| if g == true && f.grad === nothing | |
| function grad(res, θ, p = p) | |
| Enzyme.make_zero!(res) | |
| Enzyme.autodiff(Enzyme.Reverse, | |
| Const(firstapply), | |
| Active, | |
| Const(f.f), | |
| Enzyme.Duplicated(θ, res), | |
| Const(p) | |
| ) | |
| end | |
| elseif g == true | |
| grad = (G, θ, p = p) -> f.grad(G, θ, p) | |
| else | |
| grad = nothing | |
| end |
forces Enzyme.Reverse regardless of the passed mode.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working