Repository navigation
Handle despecialized parameter cotangents in solution AD - #1574
ChrisRackauckas merged 1 commit into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Claude-Session: https://chatgpt.com/codex/tasks/01a03a17-ad6f-7131-82fc-d0fd57ea6512
|
Downstream Catalyst docs result at this PR's head ( TMPDIR="$PWD/.tmp" JULIA_PKG_PRECOMPILE_AUTO=0 GKSwstype=100 timeout 14400 xvfb-run -a julia +1.12 --project=.validation/catalyst-docs-pr1574 --color=no --code-coverage=user docs/make.jlExit 1 after 2:52:04. Documenter reported 4 This is independent of this PR's solution-AD fix. Follow-up validation found that SciML/NonlinearSolve.jl#1199 fixes public cache reinitialization but not initialization's nested Catalyst source: SciML/Catalyst.jl@c01cce6 |
Ignore this PR until it has been reviewed by @ChrisRackauckas.
What changed and why
Unwrap a
ChainRulesCore.Tangent{DespecializedParameters}before the observableODESolutionpullback remakes its problem. The tangent'sparamscomponent is the cotangent for the original parameter object; passing the outer structural tangent intoremakeinstead reaches ModelingToolkit initialization as if it were a primal parameter value.This is a three-line extension fix. It adds no public API, dependency, documentation, or version change.
Root cause
ModelingToolkit commit SciML/ModelingToolkit.jl@5585668 from SciML/ModelingToolkit.jl#4919 changed generated problems from
AutoSpecializetoAutoDespecialize. The exact registered boundary is ModelingToolkitBase 1.65.0 to 1.66.0, as independently established in #1545.The observable pullback consequently receives a structural tangent around
DespecializedParameters. SciMLBase's rrule passed that wrapper directly toremake, leading to:The ModelingToolkit error is downstream fallout: the invalid primal value is created at the SciMLBase rrule/remake boundary, so the fix belongs here.
Failing before
On clean SciMLBase master
3d95609f7dc1c86a8fded41b9d357bcf25b83ad3, Julia 1.10.12:The hosted Julia LTS lane has the same method, argument types, and stack through
ODESolution_getindex_pullback: https://github.com/SciML/SciMLBase.jl/actions/runs/33447000990/job/99668297921.Passing after
The same owning testset passes with the fix:
QA passes with the system Python selected to avoid a broken generated CondaPkg environment on this host:
Runic, typos, and
git diff --checkpass for the changed file.Independent failures / not verified
The full local DownstreamAD group proceeds past
Autodiff Remake, then fails in the pre-existingobservables_autodiff.jlfailures: three Mooncake_copy_outputNamedTuple type assertions, plus two AutoZygote assertions that still assume the pre-AutoDespecialize parameter shape. Those failures do not execute the changed rrule path. The independent AutoZygote fixture assumptions are being handled separately.The hosted Julia 1 job https://github.com/SciML/SciMLBase.jl/actions/runs/33447000990/job/99668297994 has only the three Mooncake errors; it does not contain this PR's
promote_type_with_nothingerror. This PR does not claim to fix that lane.Docs were not built because this PR changes neither public API nor documentation. GPU paths were not run.
🤖 Generated with Claude Code
https://chatgpt.com/codex/tasks/01a03a17-ad6f-7131-82fc-d0fd57ea6512