Normalize CallbackAffectPWrapper VJP argument ordering #1348
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.
Summary
CallbackAffectPWrappersignature from(dp, p, u, t)to(dp, u, p, t)to match the standard(du, u, p, t)conventiondgradoutput path (p-derivative) invecjacobian!instead of hijacking thedλpath (u-derivative) via swapped arguments_get_wp_paramjac_confighelper for correct param-sized output buffers in Enzyme and ReverseDiff VJP pathsThis unblocks PRs #1335, #1292, #1260, #1223 that need SciMLStructures support, where
canonicalize(Tunable(), _p)was running on stateyinstead of actual parameters (becauseintegrator.pwas passed in theyposition), and Enzyme code assumed position 2 is a state-like object.Files changed
src/callback_tracking.jl— Signature change, normalizedvecjacobian!calls, added_get_wp_paramjac_confighelper, replacedget_paramjac_configwith param-aware versionsrc/derivative_wrappers.jl— ReverseDiff on-the-fly tape:CallbackSensitivityFunctionPSwapdispatch for param-sized output buffersrc/quadrature_adjoint.jl— QuadratureAdjoint callback path: normalizedwpcall order,vecjacobian!args, and paramjac configTest plan
🤖 Generated with Claude Code