Add dynamic parameter despecialization for all SciML functions - #1511
Conversation
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
|
Follow-up commit ChrisRackauckas-Claude@e03cee0 expands the dynamic barrier beyond ODEFunction. What changed:
Discriminator on the preceding commit ebe2bbf: The identical NonlinearFunction probe on e03cee0 passes and prints: Focused verification on e03cee0: Whole-repository Runic check, typos --diff, and git diff --check exit 0. Full Core, QA, and docs reruns for this follow-up are in progress; this remains a draft and should be ignored until reviewed by @ChrisRackauckas. |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
|
Follow-up commit ChrisRackauckas-Claude@4da04dc adds the type-level specialization query needed by ModelingToolkit problem construction. SciMLBase.specialization now accepts both a SciMLFunction instance and its type/partially applied constructor. Specialization-bearing function families report their marker; function families without that marker, including OptimizationFunction, report FullSpecialize rather than treating their unrelated second type parameter as a specialization mode. Focused verification: Whole-repository Runic check, typos --diff, and git diff --check exit 0. Full group reruns will be restarted on this latest commit after the active earlier snapshot runs finish. |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
|
Full Core exposed an OptimizationFunction remake regression in the type-trait expansion: the existing instance-level |
|
Fresh current-head validation is now green: |
|
Clean-base docs comparison is now complete. The exact docs build on clean upstream/master also exits 1 solely at link checking: the pre-existing |
|
Downstream AD validation is now green against the current feature stack: The test uses ForwardDiff, Zygote, SciMLSensitivity, SciMLStructures, and ModelingToolkitBase, and exercises the public |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
|
The new OrdinaryDiffEq Rosenbrock precompile workload exposed and now discriminates an AD-discovery ambiguity. Failing before commit Passing after adding the specific Runic, diff check, and |
|
The dedicated clean-master docs audit is complete. Existing #1485 is the correct focused fix: clean current master failed with sixteen HTTP 403 link errors and |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
|
Expanded the common barrier to Failing before: Passing after: Final local validation after the change: Runic, typos over the diff, and |
Ignore this draft until it has been reviewed by @ChrisRackauckas.
What changed and why
Adds the public
DespecializedParameterscontainer and a shared dynamic function barrier. Itsparams::Anyfield gives solver-facing code one stable parameter type;invoke_with_despecialized_parametersunwraps immediately before the concrete model call, containing inference loss at that boundary.The barrier is applied to every callable built-in SciMLFunction family: ODE, nonlinear and interval nonlinear, homotopy nonlinear, integral and batched integral, discrete and implicit discrete, DAE, DDE and SDDE, SDE and RODE, ODE input, optimization and multi-objective optimization, BVP and dynamical BVP, plus split, dynamical, and incrementing variants. FunctionWrappersWrapper keeps receiving the stable outer parameter type so its fixed signature remains valid.
The wrapper forwards common collection operations, SciMLStructures, SymbolicIndexingInterface, ArrayInterface, and Adapt.
unwrap_parametersgives AD and transformation code a public opt-out hook.specializationnow has instance and type-level queries so modeling packages can choose this behavior without inspecting concrete type-parameter positions.This is distinct from
AutoRespecialize:DespecializedParameterssupports arbitrary dynamic parameter objects at the cost of one dispatch barrier, whileAutoRespecializelets supporting solvers recover a concrete parameter type without dynamic dispatch but has solver-specific packing, symbolic-indexing, and differentiation constraints.This PR is stacked on the rename/API clarification in #1510. ModelingToolkit integration is SciML/ModelingToolkit.jl#4919.
Failing before / passing after
Against the prerequisite branch before
DespecializedParametersexists, the exact new test file errors immediately:The all-family barrier discriminator was also run on commit
ebe2bbffd08b660e98f4e6636c83853a9d38e8bf, before the shared SciMLFunction call methods.NonlinearFunctiondeliveredSciMLBase.DespecializedParametersto the user function instead of the concrete wrapped parameter type and failed. With the barrier commit applied, the same discriminator printednonlinear barrier: pass.On current HEAD, the complete focused test passes:
The first test executes 21 callable SciMLFunction containers and verifies that every user function sees the concrete wrapped parameter type.
Runic,
typosover the diff, andgit diff --checkall exit 0.Additional verification
The focused ModelingToolkitBase ForwardDiff/Zygote/SciMLSensitivity test passes 2/2 in 5m37.1s. The exact docs build reaches document expansion and then exits only because the pre-existing
Problem_Traitslink returns HTTP 403; clean upstream/master reproduces the same sixteen link-check failures.Still running / not yet verified
The draft was pushed before those long validations completed at the explicit request of @ChrisRackauckas. Results will be added from actual runs.
No dependency was added or newly enabled.