Skip to content

[v6-backport] Specialize on deriv type and Rosenbrock tableau types for trim compat#3510

Merged
ChrisRackauckas merged 1 commit intoSciML:v6-backportfrom
ChrisRackauckas-Claude:cr/trim-compat-v6
Apr 23, 2026
Merged

[v6-backport] Specialize on deriv type and Rosenbrock tableau types for trim compat#3510
ChrisRackauckas merged 1 commit intoSciML:v6-backportfrom
ChrisRackauckas-Claude:cr/trim-compat-v6

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Summary

v6 backport of the type-inference portions of #3326 (companion to #3509 on master). On v6-backport, all Rosenbrock tableaus still live in OrdinaryDiffEqRosenbrock (they get split into OrdinaryDiffEqRosenbrockTableaus on master), so only two files pick up the tableau changes.

  • Specialize ode_interpolant, default_ode_interpolant, composite_ode_interpolant, and interp_at_saveat on ::Type{deriv} to force compiler specialization and static dispatch.
  • Specialize every Rosenbrock tableau constructor on ::Type{T} / ::Type{T2} so Julia propagates the concrete element type through the builders.

The initdt changes from #3326 are omitted — v6-backport already computes _tType = eltype(t) inside the function body instead of taking it as a positional argument, which achieves the same effect a different way.

These changes close dynamic-dispatch paths that cause --trim=safe (JuliaC AOT) to fail, by adding type parameters that let the compiler statically resolve method calls.

Test plan

  • Local smoke test on v6-backport: Rosenbrock23, Rosenbrock32, Rodas4, Rodas5P all solve the linear ODE du/dt = 1.01u to within tolerance.
  • saveat path exercised (interp_at_saveatode_interpolant(..., ::Type{Val{0}})).
  • Explicit sol(t) interpolation exercised.
  • CI green on full convergence, allocation, JET, and Aqua test groups.

🤖 Generated with Claude Code

Co-Authored-By: Chris Rackauckas accounts@chrisrackauckas.com

…ibility

Backport of SciML#3326 minus the initdt changes (the v6-backport branch already
fixes that via eltype(t) inside the function body, so the ::Type{_tType}
dispatch from the original PR no longer applies).

- Specialize ode_interpolant, default_ode_interpolant, composite_ode_interpolant
  and interp_at_saveat on ::Type{deriv} to force compiler specialization
- Specialize Rosenbrock tableau constructors on ::Type{T}/::Type{T2} so Julia
  propagates the concrete element type through the tableau builders

These changes close dynamic-dispatch paths that cause --trim=safe (JuliaC AOT)
to fail, by adding type parameters that let the compiler statically resolve
method calls.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas ChrisRackauckas merged commit 3eb62b4 into SciML:v6-backport Apr 23, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants