Skip to content

Preserve inference for ordinary NonlinearFunction calls - #1526

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/preserve-nonlinear-function-inference
Aug 20, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/preserve-nonlinear-function-inference

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

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

What changed and why

Ordinary concrete-parameter calls still dispatch directly from NonlinearFunction to the wrapped callable, preserving inference through deep SimpleHomotopySweep call chains. Calls receiving DespecializedParameters now invoke the documented despecialization hook on the wrapped callable itself, before the parameter wrapper can be removed.

The first rebased draft head routed the barrier through the whole NonlinearFunction. That fixed the allocation regression but bypassed NonlinearSolveBase's wrapped-callable hook: the wrapper was unwrapped to a NamedTuple and then sent directly to a FunctionWrappersWrapper, causing the source-triggered NonlinearSolve precompile failure. This revision covers both paths and bumps SciMLBase from 3.49.1 to 3.49.2.

The original regression is tracked at SciML/NonlinearSolve.jl#1161 and begins at a932b02 (SciMLBase 3.45.0; 3.44.0 passes the focused downstream control).

Failing before

On clean current NonlinearSolve master with released SciMLBase 3.49.1, the exact allocation group produced:

Test Summary:    | Pass  Total
Allocation Tests |   18     18
Test Summary:                        | Error  Total
SimpleHomotopySweep Allocation Tests |   125    125
ERROR: Package SimpleNonlinearSolve errored during testing

The regression test added here also discriminates the correction to the first draft head. With the previous source and the identical test:

MethodError: no method matching WrappedDespecializedCallable(
    ::Vector{Float64}, ::Vector{Float64}, ::@NamedTuple{rate::Float64})
Test Summary:              | Pass  Error  Total
Despecialized parameters   |   42      1     43

Passing after

With the final hook routing:

Test Summary:            | Pass  Total  Time
Despecialized parameters |   43     43  7.1s
Test Summary: | Pass  Total
Remake        | 4430   4430
Testing SciMLBase tests passed

The unchanged NonlinearSolve checkout then crossed both former precompile failure points:

✓ NonlinearSolve
21 dependencies successfully precompiled in 250 seconds

✓ NonlinearSolve
25 dependencies successfully precompiled in 1651 seconds

The exact CI-style allocation group with this SciMLBase source also passed:

Test Summary:    | Pass  Total     Time
Allocation Tests |   18     18  1m13.0s
Test Summary:                        | Pass  Total  Time
SimpleHomotopySweep Allocation Tests |    2      2  5.5s
Testing SimpleNonlinearSolve tests passed

Final local validation:

Test Summary: | Pass  Total      Time
QA            |   51     51  3m06.0s
Testing SciMLBase tests passed

Runic --check ., typos over the diff, and git diff --check all exited 0 with no output.

No public API, docstring, dependency, or documentation file changes are included, so a docs build was not required. The full downstream NonlinearSolve Core test body, GPU paths, and other downstream groups were not run to completion locally.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI equivalence audit

I compared every failing job on this PR with the clean master workflows at the exact base SHA ce0ffdf7179a5e8dada8130aa74389790d953850. No patch-specific failure was found.

Therefore all 50 failures are clean-master failures, not regressions from this patch. The remaining non-resolver runtime cluster is the existing OrdinaryDiffEq Diagonal construction failure; the callback cluster already has the focused fix linked above.

@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/preserve-nonlinear-function-inference branch from 5c473fe to 4d15bdd Compare August 20, 2026 10:46
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Rebased unchanged onto current SciMLBase master fd427fd3e262804c853cdc475ece07e095838155 and force-updated only after re-fetching and auditing the single remote bot-authored commit.

Fresh local validation on Julia 1.12.7:

GROUP=Core ... Pkg.test()
Remake | 4430/4430
Testing SciMLBase tests passed

GROUP=QA ... Pkg.test()
QA | 51/51
Testing SciMLBase tests passed

The exact NonlinearSolve SimpleNonlinearSolve/Alloc downstream control still fails before with two sets of 125 AllocCheck errors and passes after with Allocation Tests 18/18 and SimpleHomotopySweep 2/2. Runic --check ., typos over the diff, and git diff --check also exit 0.

@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/preserve-nonlinear-function-inference branch from 4d15bdd to 64ca35d Compare August 20, 2026 11:52

Copy link
Copy Markdown
Member Author

Updated the draft to commit 64ca35d044e4ff8234b58f7ee252f3b58ed5d57d.

The first rebased head exposed a second, distinct dispatch error in source-triggered NonlinearSolve precompilation. The revised helper now invokes the public despecialization hook on the wrapped callable while the parameter is still a DespecializedParameters. The new same-test control fails on the prior head with 42 passes/1 NamedTuple MethodError and passes here 43/43. Exact SimpleNonlinearSolve Alloc passes 18/18 and 2/2; SciMLBase Core and QA (51/51) pass; Runic, typos, and diff checks pass. The PR body contains the complete command/output evidence.

Copy link
Copy Markdown
Member Author

The requested NonlinearSolveBase source touch has now expanded the full sublibrary matrix and independently reproduced the same SimpleNonlinearSolve allocation regression on the reset-fix branch:

sublibraries / lib/SimpleNonlinearSolve [Alloc] / Julia 1: failure

This is the expected unresolved owner failure; the exact local fail-before/pass-after evidence remains in this PR body.

CI job: https://github.com/SciML/NonlinearSolve.jl/actions/runs/32368371749/job/96432302024

Co-Authored-By: Chris Rackauckas <[email protected]>
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/preserve-nonlinear-function-inference branch from 64ca35d to 91991d2 Compare August 20, 2026 14:31

Copy link
Copy Markdown
Member Author

CI triage: the completed ReleaseTest / Catalyst/All/1 failure is the independently reproduced Catalyst owner-migration regression, not this dispatch patch:

UndefVarError: `SymbolCache` not defined in `ModelingToolkitBase`
ReactionSystem Structure | 137 pass, 1 error

The focused Catalyst correction routes SymbolCache through its public owner, SymbolicIndexingInterface. Its stacked QA/Modeling/Spatial validation is currently running; I will link the draft once published.

Job: https://github.com/SciML/SciMLBase.jl/actions/runs/32380648173/job/96462736354

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 20, 2026 15:28
@ChrisRackauckas
ChrisRackauckas merged commit 26b80c9 into SciML:master Aug 20, 2026
55 of 69 checks passed

Copy link
Copy Markdown
Member Author

The focused fix for this ReleaseTest failure is now draft SciML/Catalyst.jl#1542. It depends on the two separate clean-master Catalyst prerequisites linked in that body; their combined QA, Modeling, and Spatial groups all pass locally.

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