SciML / OptimizationBase.jl

The base package for Optimization.jl, containing the structs and basic functions for it.
MIT License
8 stars 5 forks source link

Re-test enzyme #53

Closed Vaibhavdixit02 closed 2 weeks ago

Vaibhavdixit02 commented 1 month ago

Checklist

Additional context

Add any other context about the problem here.

Vaibhavdixit02 commented 1 month ago

https://github.com/SciML/OptimizationBase.jl/actions/runs/9276344283/job/25523222868?pr=53#step:6:1044

wsmoses commented 1 month ago

@Vaibhavdixit02 can you open an issue with a MWE of the error. I'll try to get it quickly thereafter.

wsmoses commented 3 weeks ago

@Vaibhavdixit02 @ChrisRackauckas do you have a MWE (I didn't see one by chance). I'll try to get it fixed quickly

Vaibhavdixit02 commented 3 weeks ago

I literally mentioned this to Chris like 2 hours ago haha, we are on the same page. Would you be able to help review the sparse support here? I started the effort in the previous home for this code https://github.com/SciML/Optimization.jl/pull/688/files I'll revive that

Vaibhavdixit02 commented 3 weeks ago

Ref MWE let's see if the latest release still throws the same error first

ChrisRackauckas commented 3 weeks ago

This is now blocking https://github.com/SciML/SciMLSensitivity.jl/pull/1067

wsmoses commented 3 weeks ago

again, happy to help but need a MWE.

In interim just going to be plugging away at mixed activity stuff.

wsmoses commented 3 weeks ago

bumping this

Vaibhavdixit02 commented 3 weeks ago

I have been trying to recreate but ended up with a duplicated returns not handled error instead of the one on CI here - when running ]test this one does show up so it's kind of tricky to figure out a MWE. The issue happens in hessian of a out-of-place closure created here https://github.com/SciML/OptimizationBase.jl/blob/581f4f82675f3f0c100dfd15131881c59cbe53bb/ext/OptimizationEnzymeExt.jl#L368-L377 I suspect the f2 is incorrect but have been unable to pin down the exact issue yet (I am still trying)

wsmoses commented 3 weeks ago

That implies type inference fails. Assuming the return is a float, that should likely be changed to the following to explicitly specify that the return is active (if type inference fails)

 function f2(x, dx, fnc) 
     Enzyme.autodiff_deferred(Enzyme.Reverse, fnc, Enzyme.Active, Enzyme.Duplicated(x, dx)) 
     return nothing 
 end