Skip to content

Precompile AutoDespecialize DAE defaults and BDF algorithms - #4241

Merged
ChrisRackauckas merged 4 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/precompile-autodespecialized-dae
Aug 14, 2026
Merged

ChrisRackauckas merged 4 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/precompile-autodespecialized-dae

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

What changed

This precompiles all three AutoDespecialize DAE entry points requested here:

  • explicit DFBDF() initialization and solve;
  • explicit DNordsieckBDF() initialization and solve;
  • the no-algorithm solve(dae_prob) default, which resolves to DFBDF(AutoFiniteDiff()).

OrdinaryDiffEqDefault now extends the public DiffEqBase.prepare_alg hook for its ODE and DAE defaults. That lets DiffEqBase concretize an AutoDespecialize problem using the algorithm that will actually run, before the late default-solver handoff. The BDF regression test covers different residual types and parameter layouts under both ForwardDiff and FiniteDiff, and requires identical concrete problem/cache types for both BDF algorithms.

This is stacked on the generic default-algorithm handoff in #4247. The DAE residual wrapping prerequisite has merged as #4239 and was removed from this branch during the rebase.

Ignore this PR until it has been reviewed by @ChrisRackauckas.

Failing before

Without the early prepare_alg(nothing, u0, p, prob) handoff, the focused DiffEqBase regression test reached:

High Level solve Interface | 17 pass / 1 error
Error: Default algorithm choices require DifferentialEquations.jl.

The existing OrdinaryDiffEqDefault discriminator also showed that the implicit default was concretized differently from the equivalent explicit algorithm:

Default Solver Tests | 46 pass / 2 fail
naccept: 48 != 54
nf:      182 != 241

With the precompile preference disabled, median first-initialization times from three fresh Julia processes were:

DFBDF()             2.411 s
DNordsieckBDF()     2.608 s
default DAE solve   2.598 s

Passing after

The generic handoff regression passes 21/21 and full DiffEqBase Core passes in #4247.

The exact monorepo BDF group passed:

GROUP=OrdinaryDiffEqBDF_Core julia +release --startup-file=no --project=. \
    -e 'using Pkg; Pkg.test(coverage=false)'

AutoDespecialize reuses DAE solver caches | 24 pass / 24 total
DAE Convergence Tests                     | 50 pass / 50 total
DAE AD Tests                              | 40 pass / 40 total
DAE Event Tests                           | 4 pass / 4 total
DAE derivative_discontinuity Tests        | 11 pass / 11 total
DAE Initialization Tests                  | 38 pass / 2 broken / 40 total
DAE Nonlinear Solve Path                  | 16 pass / 16 total
BDF Inference Tests                       | 1 pass / 1 total
BDF Convergence Tests                     | 84 pass / 84 total
BDF Regression Tests                      | 35 pass / 35 total
Nordsieck BDF Tests                       | 101 pass / 101 total
Testing OrdinaryDiffEqBDF tests passed

An isolated environment developed the local DiffEqBase, OrdinaryDiffEqBDF, and OrdinaryDiffEqDefault stack. The official Default test suite then passed:

Pkg.test("OrdinaryDiffEqDefault"; allow_reresolve=false)

Default Solver Tests | 48 pass / 48 total
Testing OrdinaryDiffEqDefault tests passed

The default init(prob) and explicit init(prob, DFBDF(autodiff=AutoFiniteDiff())) produced identical concrete problem/cache types and identical trajectories. Explicit DFBDF and DNordsieckBDF both solved successfully.

Both required sublibrary QA groups passed:

OrdinaryDiffEqDefault: JET 1/1, Aqua 20/20
OrdinaryDiffEqBDF:     Allocation 2 pass/18 broken,
                       JET 18 pass/23 broken, Aqua 21/21

Julia Runic, typos over the diff, and git diff --check exited 0. No public API, docstring, or documentation changed, so a docs build was not required.

Compile-time measurement

With PrecompileAutoDespecialize=true, the same benchmark in three fresh Julia processes produced these medians:

DFBDF()             0.577 s  (76.1% reduction)
DNordsieckBDF()     0.570 s  (78.2% reduction)
default DAE solve   0.531 s  (79.6% reduction)

The benchmark used a distinct residual type and a parameter layout not present in the workload. Each measurement was the elapsed time of init in a new Julia process after separately precompiling isolated preference-on and preference-off environments.

Not verified

GPU, Julia prerelease, and downstream package suites were not run locally.

@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/precompile-autodespecialized-dae branch from 33a1674 to 4eecadb Compare August 13, 2026 23:01
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Precompile AutoDespecialize DFBDF initialization Precompile AutoDespecialize DAE defaults and BDF algorithms Aug 13, 2026
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/precompile-autodespecialized-dae branch from 4eecadb to c13f39c Compare August 13, 2026 23:06
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 14, 2026 02:25
@ChrisRackauckas
ChrisRackauckas merged commit 27faa3a into SciML:master Aug 14, 2026
239 of 274 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