Repository navigation
Avoid algorithm boxing in DefaultODEAlgorithm stiff steps - #4665
Merged
ChrisRackauckas merged 7 commits intoOct 31, 2026
Merged
Conversation
ChrisRackauckas-Claude
force-pushed
the
unwrap-alg-dispatch
branch
from
September 30, 2026 10:56
a88e597 to
9581365
Compare
Member
Merged the default branch into this PR (clean merge, no conflicts; head beea975) so CI runs on current master. Its earlier failures in SciMLSensitivity Core1 and the downgrade jobs were fixed on master after this PR's last CI run. 🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (merge), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI codex-cli 0.157.1 Agent-Model: gpt-6-sol Agent-Session: local codex session (log /home/crackauc/sandbox/goals/performance/jobs/pr-unwrap-alg/log.txt)
The generated-function dispatch in _with_current_alg compiled every wrapped function for all DefaultODEAlgorithm members on first solve (~0.65 -> 1.85 s CPU on ROBER). Replace it with _current_alg in OrdinaryDiffEqCore: - member caches that carry the concrete algorithm (the Rosenbrock family) expose it through cache.alg, so the hot differentiation paths dispatch statically with no extra specialization cost; - other callers fall back to the runtime-selected member, which stays an over-split-limit union at the call site, so only the member that actually executes gets compiled. Also de-nest the stiff differentiation path: _calc_rosenbrock_differentiation! and _calc_W! now call the alg-taking inner functions (_calc_W!, _calc_tderivative!, _calc_J!, _calc_J_dae!, _rosenbrock_jac_reuse_decision_alg) directly instead of re-entering the dispatch helper, and dolinsolve takes an alg keyword with cache.alg passed at Rosenbrock call sites. Fresh-process CPU, pinned, 6 interleaved reps vs master: first solve ROBER 0.633 s vs 0.605 s (+4.7%), VdP 22.6 s vs 21.9 s (+3.1%); load time unchanged. Warmed step! bytes: VdP Default FD 8448 -> 0, ROBER Default FD 4224 -> 0, ROBER Default AD 3888 -> 48, ROBER rtol=1e-8 Rodas5P member 6336 -> 0. Custom three-member composites match master (48/304 B). JET report_opt on 1.10: 47 reports (28 recursion failures) -> 18, versus 41 on master. All 19 serialized comparison cases remain bitwise identical to master. The FBDF/Newton-path residual (Heat100 ~2.1 kB/step, at master level) is inside nlsolve!/isadaptive/unwrap_alg in OrdinaryDiffEqNonlinearSolve and is left for a follow-up. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: devin 3000.11.1 Agent-Model: swe-2-high Agent-Session: local Devin session (log /home/crackauc/sandbox/goals/performance/jobs/pr-unwrap-alg/log-dv.txt)
OrdinaryDiffEqCore QA requires every public name to appear in a @docs block; _current_alg is selected through cache.alg / unwrap_alg alongside the other composite-algorithm helpers. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: devin 3000.11.1 Agent-Model: swe-2-high Agent-Session: local Devin session (log /home/crackauc/sandbox/goals/performance/jobs/pr-unwrap-alg/log-dv.txt)
The PR adds public _current_alg in OrdinaryDiffEqCore and an alg keyword on dolinsolve in OrdinaryDiffEqDifferentiation; OrdinaryDiffEqRosenbrock is the only caller that passes it. Registered releases would load mismatched versions without the bumps — monorepo CI resolves siblings from local [sources] paths and cannot catch this (same trap as in the SciML#4590 fix). - OrdinaryDiffEqCore 4.18.1 -> 4.19.0 (minor: new public name) - OrdinaryDiffEqDifferentiation 3.12.4 -> 3.13.0 (minor: new alg keyword); compat OrdinaryDiffEqCore >= 4.19 since it imports _current_alg - OrdinaryDiffEqRosenbrock 2.7.5 -> 2.7.6 (patch); compat OrdinaryDiffEqDifferentiation >= 3.13 since it passes alg= Also drops the one-argument _current_alg(integrator): it was a verbatim duplicate of unwrap_alg(integrator, true) for ODE integrators; its two call sites now call unwrap_alg directly. Packages must be registered in the order Core -> Differentiation -> Rosenbrock for the floors to resolve. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: devin 3000.11.1 Agent-Model: swe-2-high Agent-Session: local Devin session (log /home/crackauc/sandbox/goals/performance/jobs/pr-unwrap-alg/log-dv.txt)
The de-nested stiff-differentiation paths call _jacobian! directly, bypassing the isempty(x) guard that jacobian! provided. With a null state (u0 = nothing) the Jacobian inputs are empty, so dense_ad color vector construction hits `maximum(1:0)` and throws `ArgumentError: range must be non-empty` for Rosenbrock23, Rodas5P and TRBDF2 in test/InterfaceI/null_u0_callbacks_test.jl. Give _jacobian! the same early return so direct callers get the behavior jacobian! callers had. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: devin 3000.11.1 Agent-Model: swe-2-high Agent-Session: local Devin session (log /home/crackauc/sandbox/goals/performance/jobs/pr-unwrap-alg/log-dv.txt)
Sublibrary QA environments develop the package under test together with the repository root, so the root [sources] path-pins OrdinaryDiffEqDifferentiation 3.13.0 and OrdinaryDiffEqRosenbrock 2.7.5. Differentiation 3.13.0 requires OrdinaryDiffEqCore 4.19, which is not yet registered, while each QA environment declares OrdinaryDiffEqCore as a direct dependency and therefore resolves it from the registry (<= 4.18.0). The result is an unsatisfiable requirements error in the Extrapolation, Feagin, IMEXMultistep, PDIRK and TaylorSeries QA jobs (same class of trap as SciML#4590). Following the established convention (e.g. StochasticDiffEqImplicit/test/qa, OrdinaryDiffEqBDF), every local dependency of these projects and test environments now gets a matching path entry in [sources]: - Package projects with no [sources] section gain one covering all local deps: Extrapolation, Feagin, IMEXMultistep, NonlinearSolve, PDIRK. - Partial [sources] tables are completed: StochasticDiffEq (OrdinaryDiffEqDifferentiation), GlobalDiffEq (OrdinaryDiffEqSSPRK), TaylorSeriesImplicit (DiffEqDevTools), and the root project (OrdinaryDiffEqFeagin). - Test/QA environments gain path entries for their non-self local direct deps, most importantly OrdinaryDiffEqCore where the bumped compat floor applies (Extrapolation, Feagin, IMEXMultistep, NonlinearSolve, PDIRK, TaylorSeries, Default QA envs, plus DiffEqDevTools/ImplicitDiscreteSolve in the modelingtoolkit and threaded envs). Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: devin 3000.11.1 Agent-Model: swe-2-high Agent-Session: local Devin session (log /home/crackauc/sandbox/goals/performance/jobs/pr-unwrap-alg/log-dv.txt)
3b26603 swept 18 files; only the five QA test environments that hit the unsatisfiable-Core resolver error needed entries. The extra pins made other envs (e.g. OrdinaryDiffEqNonlinearSolve's downgrade job) resolve local sibling code they were meant to test against registered releases. Revert everything except: - Extrapolation/Feagin/PDIRK/TaylorSeries test/qa: OrdinaryDiffEqCore (their QA envs declare Core directly; registry caps it at 4.18.0 while path-pinned Differentiation 3.13.0 needs 4.19) - IMEXMultistep test/qa: OrdinaryDiffEqCore + OrdinaryDiffEqDifferentiation (Differentiation is also a direct dep there; path-pinned Rosenbrock 2.7.5 needs 3.13) All five QA envs resolve locally via activate_group_env; Feagin QA passes (AllocCheck 3/3, JET 1/1, Aqua 21/21). Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: devin 3000.11.1 Agent-Model: swe-2-high Agent-Session: local Devin session (log /home/crackauc/sandbox/goals/performance/jobs/pr-unwrap-alg/log-dv.txt)
ChrisRackauckas-Claude
force-pushed
the
unwrap-alg-dispatch
branch
from
October 31, 2026 11:53
8a7b0d4 to
d3be325
Compare
ChrisRackauckas
marked this pull request as ready for review
October 31, 2026 12:01
ChrisRackauckas
referenced
this pull request
Nov 27, 2026
* Avoid per-step deepcopy in ExplicitTaylorAdaptiveOrder Order-selection trials cloned the whole controller cache and grew order_history every step. Snapshot only the restored fields into preallocated storage and drop the unused history. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-taylor-deepcopy/log.txt on amdci2 * Preserve native types in AdaptiveOrder controller snapshots Order-selection restore was converting every controller field through typeof(t), which MethodError'd Dual tspan and rounded Float32-t PID history. Snapshot the cache's own isbits/array values as a NamedTuple. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-taylor-deepcopy/log.txt on amdci2 * Snapshot non-isbits AdaptiveOrder controller scalars isbits-only NamedTuple snapshots dropped BigFloat PIController q11/errold, so order trials leaked state. Include every scalar scratch field and make array history length-generic; tighten Float32 PID and add BigFloat regressions. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-taylor-deepcopy/log.txt on amdci2 * Restore 0-alloc PIDController AdaptiveOrder snapshots Runtime-length ntuple boxed the length-3 err history (~1 KB/step). Specialize on Val(3) after an explicit length check and add a PID allocation regression. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-taylor-deepcopy/log.txt on amdci2 * Compare PID AdaptiveOrder step! allocs to ExplicitTaylor2 Julia 1.10/1.11 step! has a fixed 16-byte infrastructure allocation for every solver, so == 0 fails CI while the PID snapshot path is still 0 extra bytes. Keep the bound tight against the round-3 1 KB ntuple regression. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-taylor-deepcopy/log.txt on amdci2 * Keep deepcopy + sync_controllers! for custom controller caches in AdaptiveOrder The allocation-free field snapshot assumed every array field was a length-3 history (PIDControllerCache.err), so a user-defined AbstractControllerCache with, e.g., a length-4 Vector threw an ArgumentError on the first step. Restrict the field snapshot to OrdinaryDiffEqCore's I/PI/PID/Predictive caches, whose sync_controllers! copies exactly the walked fields, and send every other controller cache through the documented protocol: deepcopy before the order trial, sync_controllers! after. Adds a Core regression test with a custom controller holding a length-4 history and an accept counter, run IIP and OOP; it errors before this change and checks that the counter equals stats.naccept after it. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Agent-Session: local session ID bf8d6de7-a858-41b2-b438-bc6101c93513 (headless claude -p, no URL) * Add public snapshot_controller / restore_controller! to OrdinaryDiffEqCore ExplicitTaylorAdaptiveOrder pseudo-steps the step-size controller once per candidate order and rolls it back. The allocation-free rollback depended on four non-public OrdinaryDiffEqCore cache types and their field layouts, with matching ExplicitImports exemptions in the Taylor QA test. OrdinaryDiffEqCore now owns that protocol as documented public API: snapshot_controller(cache) / restore_controller!(cache, snapshot). The default is deepcopy + sync_controllers!, so every custom controller that implements sync_controllers! keeps working. The I/PI/PID/Predictive caches get allocation-free NamedTuple methods next to their sync_controllers!. OrdinaryDiffEqTaylorSeries calls only the public pair, its local snapshot code and the four QA exemptions are gone, and its QA environment resolves the in-repo OrdinaryDiffEqCore like the other sublibrary QA environments. OrdinaryDiffEqCore 4.19.0 -> 4.20.0 (new public API). OrdinaryDiffEqTaylorSeries 2.4.0 -> 2.5.0 with OrdinaryDiffEqCore compat raised to 4.20, since it needs the new functions. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Agent-Session: local session ID bf8d6de7-a858-41b2-b438-bc6101c93513 (headless claude -p, no URL) --------- Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Devin <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Stiff steps in
DefaultODEAlgorithmrepeatedly boxed the selected algorithm while differentiation and linear-solve helpers used it. Dispatch now selects a concrete constituent before entering those helpers. A regression test covers warmed stiffstep!allocations for Van der Pol and ROBER.Second round (
e43ed932b6,a22e897cfe; post-review): the first implementation dispatched through a generated function that specialized every wrapped helper on all sixDefaultODEAlgorithmmembers, which tripled first-solve compile time. The barrier is now_current_alginOrdinaryDiffEqCore(next tounwrap_alg/_eval_index): caches that carry the concrete member algorithm (the Rosenbrock family) dispatch statically throughcache.alg; other callers take the runtime-selected member as an over-split-limit union, so only the executed member is compiled. The stiff differentiation path was also de-nested —_calc_rosenbrock_differentiation!/_calc_W!call the member-alg inner functions directly instead of re-entering the dispatch helper — anddolinsolvetakes the memberalgas a keyword.Third round (
ca0f2f2d77; packaging): the PR adds a cross-package public name (OrdinaryDiffEqCore._current_alg) and a new keyword (alg=onOrdinaryDiffEqDifferentiation.dolinsolve), so the affected sublibraries are bumped and the compat floors raised — monorepo CI resolves siblings from local[sources]paths and cannot catch a registered-release mismatch.OrdinaryDiffEqCore4.18.1 → 4.19.0 (minor: new public name),OrdinaryDiffEqDifferentiation3.12.4 → 3.13.0 (minor: newalg=keyword) with[compat] OrdinaryDiffEqCorefloor raised to 4.19 since it imports_current_alg, andOrdinaryDiffEqRosenbrock2.7.5 → 2.7.6 (patch) with[compat] OrdinaryDiffEqDifferentiationfloor raised to 3.13 since it passesalg=todolinsolve. No other sublibrary uses either API. The packages must be registered in the order Core → Differentiation → Rosenbrock for the floors to resolve. The redundant one-argument_current_alg(integrator)was also dropped — it was a verbatim duplicate ofunwrap_alg(integrator, true); its two call sites now callunwrap_algdirectly.Fourth round (
7d8de6cd19,706084d3c2,9581365ec1; CI fixes): two follow-ups for real CI failures. (1) Empty-state stiff solves threwArgumentError: range must be non-emptyintest/InterfaceI/null_u0_callbacks_test.jlfor Rosenbrock23/Rodas5P/TRBDF2 — the de-nested differentiation paths call_jacobian!directly, bypassing theisempty(x)guard thatjacobian!provided;_jacobian!now returns early on empty input, restoring master's behavior (null_u0_callbacks_test.jlpasses 42/42 on the branch and on clean master). (2) Sublibrary QA environments develop the package under test plus the repository root, whose[sources]path-pin Differentiation 3.13.0 / Rosenbrock 2.7.6; those require Core 4.19 (not yet registered) while each QA environment's direct Core dependency resolved from the registry (≤ 4.18.1) — unsatisfiable in the Extrapolation, Feagin, IMEXMultistep, PDIRK and TaylorSeries QA jobs. Following the established convention (same trap as #4590), each of those five QA environments gets a matching[sources]path entry forOrdinaryDiffEqCore— IMEXMultistep's additionally forOrdinaryDiffEqDifferentiation, which is a direct dep there and must satisfy path-pinned Rosenbrock 2.7.6's 3.13 floor.9581365ec1trimmed an earlier broader sweep (18 files) to exactly this set: the extra package-level pins made other jobs (e.g. OrdinaryDiffEqNonlinearSolve downgrade) resolve local sibling code they were meant to test against registered releases. All five QA environments resolve viaactivate_group_env; the Feagin QA group resolves and passes locally.Rebase (
739379950dbase): rebased onto current master, which had released Core 4.18.1, Differentiation 3.12.4 and Rosenbrock 2.7.5 in the meantime; the bumps were recomputed from those values (Rosenbrock now goes to 2.7.6) and the code diff is unchanged. The five QA[sources]entries still apply. The remaining CI reds are all pre-existing on master: the NonlinearSolve NewtonLineSearchException(bisected to498c765ccc, also red on #4667/#4689),ScalarOperator mass matrixin Differentiation Core (#4661, also on #4689), the Rosenbrock QARosenbrock32inference error (also on #4689), the GlobalDiffEq companion-callback error (identical on #4689), the DiffEqBase/Differentiation downgrade jobs (also on #4667), and the SciMLSensitivity downstream job (also on #4667).Diagnosis (profile)
On Julia 1.12.4,
Profile.Allocswithsample_rate = 1.0over 20 warmed ROBER steps attributed 83,200 bytes tounwrap_algatOrdinaryDiffEqCore/src/alg_utils.jl:959, reached throughdolinsolve,calc_tderivative!,calc_rosenbrock_differentiation!,_rosenbrock_jac_reuse_decision,jacobian!, andcalc_W!. After the change, the same profile records 2,240 bytes total: a finite-difference Jacobian config tuple and a boxed scalar. No selected-algorithm allocation remains in the profile.First-solve (TTFX) check
Fresh process per rep, pinned,
JULIA_NUM_THREADS=1, 6 interleaved master/head reps; process CPU:e43ed932b6using OrdinaryDiffEqDefaultScope note
Warm
step!allocations are eliminated on the Rosenbrock differentiation path (VdP FD 8,448 → 0 B, ROBER FD 4,224 → 0 B, ROBERreltol=1e-8Rodas5P member 6,336 → 0 B) and reduced on the AD variants (VdP AD 7,776 → 96 B, ROBER AD 3,888 → 48 B). The Newton/FBDF path still allocates at master level (~2.1 kB/step while the switch sits on the FBDF member): the remainder lives inisadaptive/nlsolve_f/unwrap_alginsidenlsolve!in OrdinaryDiffEqNonlinearSolve and is left for a follow-up.Verification
All commands used
TMPDIR=<job>/tmp,JULIA_DEPOT_PATH=<job>/depot:$HOME/.julia,JULIA_NUM_THREADS=1, andOPENBLAS_NUM_THREADS=1.JULIA_REVISE_POLL=1 GROUP=Core taskset -c 18 julia --project=lib/OrdinaryDiffEqDefault -e 'using Pkg; Pkg.test()'(exit 0):JULIA_REVISE_POLL=1 GROUP=QA taskset -c 24 julia --project=lib/OrdinaryDiffEqDefault -e 'using Pkg; Pkg.test()'(exit 0):JULIA_REVISE_POLL=1 GROUP=QA taskset -c 25 julia --project=lib/OrdinaryDiffEqDifferentiation -e 'using Pkg; Pkg.test()'(exit 0):GROUP=Core taskset -c 19 julia --project=lib/OrdinaryDiffEqDifferentiation -e 'using Pkg; Pkg.test()'(exit 1) passed its first three testsets (4/4, 7/7, 11/11), then stopped in the unrelated SDIRKScalarOperator mass matrixtest:The same minimal
ScalarOperator/TRBDF2()solve fails on clean current master and passes on the parent of the introducing commit. This baseline failure is tracked in SciML/OrdinaryDiffEq.jl issue 4661. The first QA attempt also hit the host's file-watcher limit (EMFILE); rerunning with Revise polling completed successfully. The final Default Core run reported a duplicate-method precompile error inDifferentiationInterfaceGPUArraysCoreExtforOrdinaryDiffEqBDF;Pkg.test()continued and passed.On
e43ed932b6+a22e897cfe, the same groups were re-run via the repo-root dispatcher (GROUP=<Sublib>_<group>): OrdinaryDiffEqDefault_Core 59/59, OrdinaryDiffEqDefault_QA JET 1/1 + Aqua 20/20, OrdinaryDiffEqDifferentiation_QA JET 1/1 + Aqua 19/19 + JVPCache 13/15 (2 broken), OrdinaryDiffEqCore_QA AllocCheck 1/1 + JET 30+1broken + Aqua 26/26. OrdinaryDiffEqDifferentiation_Core reaches the same baselineScalarOperator mass matrixerror (issue 4661) after three clean testsets, as on master.On
7d8de6cd19+9581365ec1, the CI fixes were verified locally:test/InterfaceI/null_u0_callbacks_test.jlpasses 42/42 on the branch and 42/42 on clean master (0fac2d0611); all five formerly unsatisfiable QA environments (Extrapolation, Feagin, IMEXMultistep, PDIRK, TaylorSeries) resolve viaactivate_group_envwith Core 4.19.0 from the local path; andGROUP=QA julia --project=lib/OrdinaryDiffEqFeagin -e 'using Pkg; Pkg.test()'passes — Allocation Tests 3/3, JET 1/1, Aqua 21/21.Re-run on
ca0f2f2d77: OrdinaryDiffEqCore_QA (AllocCheck 1/1, JET 30+1broken, Aqua 26/26), OrdinaryDiffEqDifferentiation_QA (JET 1/1, Aqua 19/19, JVPCache 13/15 with 2 broken), and OrdinaryDiffEqDefault_QA (JET 1/1, Aqua 20/20) all pass. OrdinaryDiffEqRosenbrock_QA reports 39/40 with one error inRosenbrock32 perform_step! inference: the test initsRosenbrock32()on a singular-mass-matrix DAE, which master commitffbc2cdc3b(#4653) made throwRosenbrock32 is unstable on DAEswithout updating this test. The guard and the test file are identical toorigin/master(this PR touches neither), so the error reproduces on clean master — same class of pre-existing baseline failure as issue 4661.The
OrdinaryDiffEqNonlinearSolveltsNewton TestsLineSearchExceptionis also a pre-existing master regression, bisected to master commit498c765ccc("Add implicit Taylor solvers requiring TaylorSeries 2.4"). Itscalc_dt_propose!change snapsdtnewto(t + dtnew) - t, which perturbs the step-size sequence enough to flip the finite-differencedϕ0used byNLNewton'sBackTrackingline search positive atreltol = abstol = 1e-12;LineSearchesthen throwsLineSearchExceptionon the first Lorenz solve ofnewton_tests.jl. The file fails identically on clean master (0fac2d0611) on Julia 1.10.12 and 1.12.4, passes on498c765ccc^, and passes in a pure-registry environment (Core 4.18.0, Differentiation 3.12.3, NonlinearSolve 2.9.8, SDIRK 2.9.6, LineSearches 7.8.2). LineSearches itself is exonerated:BackTracking's descent check and itsls(ϕ, α, ϕ_0, dϕ_0)body are identical between 7.7.2 and 7.8.2, and master + LineSearches 7.7.2 fails too. This PR touches neitherOrdinaryDiffEqNonlinearSolve/srcnorOrdinaryDiffEqSDIRK/src.Runic
format_stringon all changed files,typoson added diff lines, andgit diff --checkall exited 0;derivative_wrappers.jlcarries a pre-existing indentation drift that fails Runic identically on the unmodified base and was left untouched.Failing-before/passing-after
The test block added to
default_solver_tests.jlwas run unchanged from a detachedorigin/masterworktree (exit 1):The same testset passes on this branch with
bytes = 0on both Julia 1.12.4 and Julia 1.10.12.Before/after numbers (same machine)
Julia 1.12.4,
JULIA_NUM_THREADS=1,taskset -c 9,@benchmarkminimum of 10 samples with one evaluation each (first commit):Behaviour-equivalence check
19 serialized cases (Default on Lorenz, VdP, ROBER, mass-matrix and OOP variants,
nothingalgorithm, AutoTsit5/AutoVern7/AutoAlgSwitch composites, custom 3-member composites, Rosenbrock23, Rodas5P, FBDF, KenCarp4, TRBDF2):(sol.t, sol.u, all stats fields, sol.alg_choice)bitwise identical to master. Custom composite warmed allocations match master (48 B / 304 B).JET dispatch check (Julia 1.10)
JET.report_optonperform_step!for a warmed Default ROBER integrator,target_modules = (OrdinaryDiffEqDifferentiation, OrdinaryDiffEqCore): 47 reports with 28 "failed to optimize due to recursion" on the first commit → 18 reports, zero recursion failures and zerounwrap_alg/_with_current_algframes, versus 41 reports on master (15 of them thecalc_W! > calc_J! > jacobian!union dispatch this change removes).What was not verified
GPU paths, downstream packages, and Julia versions other than 1.10/1.12 were not run locally. The documentation build was not run because no docstring, public API, or
docs/file changed. The Newton-path allocation residual (FBDF scope) is unchanged and listed above.Please ignore until reviewed by @ChrisRackauckas.
Risk assessment
OrdinaryDiffEqCore._current_algand a keyword ondolinsolve, covered by the version bumps/compat floors above (register Core → Differentiation → Rosenbrock).🤖 Generated with Codex CLI (model: gpt-6-sol), orchestrated by Claude Code (claude-opus-5-5[1m]) session https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
🤖 Review-fix and packaging rounds by Devin (model: swe-2-high); local session log at /log-dv.txt
Review findings addressed
Review: codex-cli 0.162.1 / gpt-6.1-sol on
f904dbad5, VERDICT: CHANGES (one finding)._current_alg. Fixed in8a7b0d49e. Master releasedOrdinaryDiffEqCore4.19.0 on its own (tagOrdinaryDiffEqCore-v4.19.0at 53e7d1d), and that release has no_current_alg; the branch's Core version had merged to the same 4.19.0. This PR now bumpsOrdinaryDiffEqCore4.19.0 → 4.20.0 (minor, new public name) and raisesOrdinaryDiffEqDifferentiation's[compat] OrdinaryDiffEqCoreto"4.20". Registration order: Core 4.20.0 → Differentiation 3.13.0 → Rosenbrock 2.7.6. This order replaces the 4.19.0 numbers in the third-round note above. Rosenbrock keepsOrdinaryDiffEqCore = "4.17.1"because it does not import_current_alg. It reaches Core ≥ 4.20 through its Differentiation 3.13 floor.Consumer check without monorepo
[sources]. This copies the branch'sOrdinaryDiffEqDifferentiationwith[sources]stripped, adds registeredOrdinaryDiffEqRosenbrock2.7.5, and solves ROBER withRodas5P()on Julia 1.13.0:f904dbad5), resolution selects registered Core 4.19.0:[sources]stripped) standing in for the release:Test-environment resolution under the unregistered 4.20 floor. Each test sub-environment was resolved the way its
runtests.jlactivates it, usingSciMLTesting.activate_group_env(...; instantiate = false). That covers 56 QA envs, the ABM threaded env, rootAD/Downstream/ODEInterfaceRegression, Differentiationsparse/modelingtoolkit, the four DiffEqBase sub-envs anddocs. A check that drops Feagin QA'sOrdinaryDiffEqCore[sources]entry makes it unsatisfiable, which confirms the five existing QA pins are still required.lib/OrdinaryDiffEqDefault/test/qa, which nothing activates: Default'sruntests.jlruns its QA files inside thePkg.testenvironment.OrdinaryDiffEqNonlinearSolve/test/qaandOrdinaryDiffEqRosenbrock/test/qafail on the Rosenbrock 2.7.6 → Differentiation 3.13 floor. That failure is identical on unmodifiedf904dbad5, and QA-on-LTS jobs are not in this PR's CI matrix.Local validation of
8a7b0d49e(Julia 1.13.0,JULIA_NUM_THREADS=4):GROUP=QA julia --project=lib/OrdinaryDiffEqDifferentiation -e 'using Pkg; Pkg.test()'resolved Core v4.20.0 from the path and passed: JET 1/1, Aqua 19/19, JVPCache allocation 13 pass + 2 broken (pre-existing).GROUP=Core julia --project=lib/OrdinaryDiffEqDefault -e 'using Pkg; Pkg.test()'resolved Core v4.20.0 from the path and passed: SciMLBase reexport 2/2, Default Solver Tests 59/59. The latter includes this PR's stiffstep!allocation testset.typosandgit diff --checkpass on the changed files. OnlyProject.tomlfiles changed, so Runic has nothing to format.Not verified: the change is two version fields, so the full CI matrix, GPU, and downstream jobs were not rerun locally. The 4.20.0 release itself is only simulated: the stripped branch Core stood in for it.
Risk assessment (this round)
Project.tomlversion fields.🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 693654d9-8c20-4cee-ac2a-8cbdf35185fd (headless, no URL)
Risk assessment (independent review, codex-cli gpt-6.1-sol, reviewed head 8a7b0d4)
_current_algand the optionaldolinsolve(...; alg=...)keyword; existing signatures/defaults remain supported.JULIA_NUM_THREADS=4: OrdinaryDiffEqDefault Core passed 61/61 assertions, including both new allocation regressions. A standalone consumer with sibling[sources]removed fails before the compatibility fix, rejects incompatible registered Core after the fix, and solves ROBER successfully with branch Core 4.20.0 and registered Rosenbrock 2.7.5. CI at both checks: 22 pending, no completed failing jobs. Current runs: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/38918138469 and https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/38918138405 .🤖 Posted by an AI agent — harness: codex-cli · model: gpt-6.1-sol (independent reviewer; appended by Claude Code 2.1.301 · claude-opus-5-5)
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq
Risk assessment (independent review, Codex CLI 0.164.0-alpha.11.1 gpt-6-astra, slot 1, head 8a7b0d4)
Review round 1, written by the reviewer named above (Codex CLI 0.164.0-alpha.11.1 / gpt-6-astra) in a session other than the PR author's, and copied here by the posting agent without change to its findings. The posting agent did not re-run the reviewer's commands.
Summary: The PR carries concrete cache algorithms through differentiation and Rosenbrock linear solves to avoid algorithm boxing. The public helper, documentation, release floors and allocation tests are present, and I found no blocking defect.
Blast radius: DefaultODEAlgorithm stiff branches, Core algorithm selection, Differentiation Jacobian/W paths, Rosenbrock solves, and dependent package compatibility floors.
Evidence: Exact-head call-chain, API and manifest review; Default, Differentiation and Rosenbrock CI pass; 272 success, 2 failure, 1 skipped checks. Both failures match inspected default-branch signatures; reviewer did not repeat timing/allocation benchmarks.
Blocking findings
None.
Non-blocking findings
lib/OrdinaryDiffEqDefault/test/default_solver_tests.jl:282: Assert the selected stiff branch in the allocation test before measuring. A bytes bound alone does not prove the intended stiff dispatch was reached if solver switching changes.lib/OrdinaryDiffEqCore/src/alg_utils.jl:170: Retain reproducible cold and warmed measurements for the tradeoff described in this docstring; it currently states compiler-cost consequences without measurements in the diff.The branch assertion costs one test-only inspection; preserving benchmark evidence costs an additional cold/warm measurement run outside production execution.
What I ran
The exact-head checkout was verified with
git rev-parse HEAD(exit 0, SHA in header).git diff origin/master...HEADandgit diff --check origin/master...HEADcompleted with exit 0; the latter produced no diagnostics. I inspected changed files, callers, tests, package manifests, and the absence of rootAGENTS.md/CLAUDE.md.git log -1 --format=%B,git log --no-merges -1 --format=%B, andgit log --no-merges -1 --format=%B origin/master..HEADwere inspected (exit 0); author trailers below come from the newest PR-specific non-merge commit. The header Base is fetchedorigin/master; GitHub's comparison base at review time was59ba40e4b5bbae713d8df7b792f6ea62f033ff78.I followed
_current_algthrough cache-bearing and fallback callers, including NLNewtonCache (which lacks analgfield), checked the empty-input Jacobian guard, and checkeddolinsolve(...; alg=...)in Rosenbrock stage and addsteps calls._current_algis declared public with a docstring and docs entry. The Core 4.20.0 / Differentiation 3.13.0 / Rosenbrock 2.7.6 release sequence and Differentiation's Core 4.20 floor exclude the earlier released Core without this helper. The added allocation tests warm the solver and measure repeated default stiff steps; no unmeasured speedup is asserted here.CI: Default, Differentiation, and Rosenbrock pass. Failed logs Core4 and NonlinearSolve identify the Enzyme assertion and Newton line-search exception. I compared failure text with recent completed default-branch runs, rather than accepting the description's classification. Master IntegrationTest 41050161729 has the same Core4
ensembles.jl:19EnzymeAssertionError: mi2 !== nothing; master Sublibrary CI 41058796614 has the same Julia-1 NewtonLineSearchException: Search direction is not a direction of descent. Step length: 0.0. These are matching baseline failures, not green integration validation.What I did not verify
No reviewer Julia process or benchmark ran for this PR; no local Julia version/test exit code applies. I did not independently repeat the body's allocation counts, 19-case bitwise matrix, DDE/SDE consumer runs or first-solve timings. CI provides exercised solver paths, but not fully green integration validation. The first assessment froze risk and candidates before opening the PR description. A fresh independent assessor then froze a complete review of this exact PR head before reading its description, any prior review, other assessment notes, or coordinator-run Julia output. The final comparison and REVIEWER_GRADE below come from that fresh assessment. It subsequently evaluated prior same-head findings and newly available raw execution evidence; prior claims are distinguished from executions in this review session. The independent freeze remains unchanged.
🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74