Use separate cache flags for A and b in ForwardDiff extension (rebased #1054 + test)#1062
Merged
ChrisRackauckas merged 2 commits intoJun 26, 2026
Conversation
Verify that mutating only A or only b invalidates that side's partials list independently, that solving revalidates both, and that the result stays correct across one-sided updates. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
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.
Please ignore until reviewed by @ChrisRackauckas.
Finishes and supersedes #1054 (by @hersle). That PR's change is correct but its CI was red only because it was based on
mainfrom before #1053, sotest/Core/resolve.jlerrored onSuperLUDISTFactorization()(the alg wasn't yet in the resolve skip list). This branch is #1054 rebased cleanly onto currentmain(which has the #1053 fix), plus a test.Contents
rhs_cache_validflag into independentA_partials_valid/b_partials_validflags, so mutating onlyAor onlybno longer forces the other side's partials list to be recomputed (e.g. in an ODE whereAis fixed whilebchanges, and vice versa).DualLinearCache separate A/b partials validityintest/Core/forwarddiff_overloads.jl: asserts a one-sidedA/bmutation invalidates only that side's flag, thatsolve!revalidates both, and that results stay correct across one-sided updates.Verification (local, Julia 1.10)
test/Core/forwarddiff_overloads.jl— all testsets pass, including the new one (12/12).test/AD/caching_allocation_tests.jl— all pass.Credit for the underlying change goes to @hersle (#1054); the original commit is preserved with authorship.
🤖 Generated with Claude Code