Skip to content

use LazyBufferCache instead of FixedSizeDiffCache #1191

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SciMLSensitivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using FunctionWrappersWrappers: FunctionWrappersWrappers
using GPUArraysCore: GPUArraysCore
using LinearSolve: LinearSolve
using PreallocationTools: PreallocationTools, dualcache, get_tmp, DiffCache,
FixedSizeDiffCache
FixedSizeDiffCache, LazyBufferCache
using RandomNumbers: Xorshifts
using RecursiveArrayTools: RecursiveArrayTools, AbstractDiffEqArray,
AbstractVectorOfArray, ArrayPartition, DiffEqArray,
Expand Down
17 changes: 8 additions & 9 deletions src/adjoint_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ function get_paramjac_config(autojacvec::EnzymeVJP, p::SciMLBase.NullParameters,
autojacvec.chunksize
end

paramjac_config = FixedSizeDiffCache(zero(y), chunk), p,
FixedSizeDiffCache(zero(y), chunk),
FixedSizeDiffCache(zero(y), chunk),
FixedSizeDiffCache(zero(y), chunk)
paramjac_config = LazyBufferCache(), p,
LazyBufferCache(),
LazyBufferCache(),
LazyBufferCache()
else
paramjac_config = zero(y), p, zero(y), zero(y), zero(y)
end
Expand All @@ -464,11 +464,10 @@ function get_paramjac_config(autojacvec::EnzymeVJP, p, f, y, _p, _t; numindvar,
autojacvec.chunksize
end

paramjac_config = FixedSizeDiffCache(zero(y), chunk),
zero(_p),
FixedSizeDiffCache(zero(y), chunk),
FixedSizeDiffCache(zero(y), chunk),
FixedSizeDiffCache(zero(y), chunk)
paramjac_config = LazyBufferCache(), zero(_p),
LazyBufferCache(),
LazyBufferCache(),
LazyBufferCache()
else
paramjac_config = zero(y), zero(_p), zero(y), zero(y), zero(y)
end
Expand Down
2 changes: 1 addition & 1 deletion src/derivative_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ function _vecjacobian!(dλ, y, λ, p, t, S::TS, isautojacvec::EnzymeVJP, dgrad,

_tmp1, tmp2, _tmp3, _tmp4, _tmp5, _tmp6 = S.diffcache.paramjac_config

if _tmp1 isa FixedSizeDiffCache
if _tmp1 isa LazyBufferCache
tmp1 = get_tmp(_tmp1, dλ)
tmp3 = get_tmp(_tmp3, dλ)
tmp4 = get_tmp(_tmp4, dλ)
Expand Down
Loading