Skip to content

Commit f86b92f

Browse files
actually add remake_zero
1 parent 040b04c commit f86b92f

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

src/derivative_wrappers.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,7 @@ function _vecjacobian!(dλ, y, λ, p, t, S::TS, isautojacvec::EnzymeVJP, dgrad,
720720
isautojacvec = get_jacvec(sensealg)
721721

722722
if inplace_sensitivity(S)
723-
724-
# Correctness over speed
725-
# TODO: Get a fix for `remake_zero!` to allow reusing zero'd memory
726-
# https://github.com/EnzymeAD/Enzyme.jl/issues/2400
727-
_tmp6 = Enzyme.make_zero(f)
723+
_tmp6 = Enzyme.remake_zero!(f)
728724

729725
if W === nothing
730726
Enzyme.autodiff(Enzyme.Reverse, Enzyme.Duplicated(f, _tmp6),

src/gauss_adjoint.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,7 @@ function vec_pjac!(out, λ, y, t, S::GaussIntegrand)
508508
Enzyme.remake_zero!(out)
509509

510510
if SciMLBase.isinplace(sol.prob.f)
511-
# Correctness over speed
512-
# TODO: Get a fix for `remake_zero!` to allow reusing zero'd memory
513-
# https://github.com/EnzymeAD/Enzyme.jl/issues/2400
514-
tmp6 = Enzyme.make_zero(tmp6)
511+
tmp6 = Enzyme.remake_zero!(tmp6)
515512

516513
Enzyme.autodiff(
517514
Enzyme.Reverse, Enzyme.Duplicated(pf, tmp6), Enzyme.Const,

src/quadrature_adjoint.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,7 @@ function vec_pjac!(out, λ, y, t, S::AdjointSensitivityIntegrand)
314314
end
315315

316316
if SciMLBase.isinplace(sol.prob.f)
317-
# Correctness over speed
318-
# TODO: Get a fix for `remake_zero!` to allow reusing zero'd memory
319-
# https://github.com/EnzymeAD/Enzyme.jl/issues/2400
320-
tmp6 = Enzyme.make_zero(f)
317+
tmp6 = Enzyme.remake_zero!(f)
321318
Enzyme.autodiff(
322319
Enzyme.Reverse, Enzyme.Duplicated(f, tmp6), Enzyme.Const,
323320
Enzyme.Duplicated(tmp3, tmp4),

0 commit comments

Comments
 (0)