Skip to content

Commit 72f6ef8

Browse files
Fix AutoSpecialize compatibility for ODEFunction
Two fixes to support AutoSpecialize as default for ODEFunction (SciMLBase v3/v4): 1. ExplicitRKConstantCache: Accept time type parameter and convert tableau c coefficients to match, preventing BigFloat c from promoting t past FunctionWrapper signatures. 2. promote_f: Skip jac wrapping when jac_prototype is an AbstractSciMLOperator, avoiding Union{} from promote_op(similar). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 279e4bf commit 72f6ef8

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

lib/OrdinaryDiffEqDifferentiation/src/derivative_wrappers.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@ function build_jac_config(
287287
autodiff_alg = gpu_safe_autodiff(alg_autodiff(alg), u)
288288
dense = autodiff_alg isa AutoSparse ? ADTypes.dense_ad(autodiff_alg) : autodiff_alg
289289

290-
# Unwrap FunctionWrappersWrapper for Jacobian preparation so that
291-
# sparsity tracers and other non-standard types can pass through.
292-
uf_unwrapped = SciMLBase.@set uf.f = SciMLBase.unwrapped_f(uf.f)
293-
294290
if dense isa AutoFiniteDiff
295291
dir_forward = @set dense.dir = 1
296292
dir_reverse = @set dense.dir = -1
@@ -304,15 +300,15 @@ function build_jac_config(
304300
end
305301

306302
jac_config_forward = DI.prepare_jacobian(
307-
uf_unwrapped, du1, autodiff_alg_forward, u, strict = Val(false)
303+
uf, du1, autodiff_alg_forward, u, strict = Val(false)
308304
)
309305
jac_config_reverse = DI.prepare_jacobian(
310-
uf_unwrapped, du1, autodiff_alg_reverse, u, strict = Val(false)
306+
uf, du1, autodiff_alg_reverse, u, strict = Val(false)
311307
)
312308

313309
jac_config = (jac_config_forward, jac_config_reverse)
314310
else
315-
jac_config1 = DI.prepare_jacobian(uf_unwrapped, du1, autodiff_alg, u, strict = Val(false))
311+
jac_config1 = DI.prepare_jacobian(uf, du1, autodiff_alg, u, strict = Val(false))
316312
jac_config = (jac_config1, jac_config1)
317313
end
318314

0 commit comments

Comments
 (0)