Skip to content

Use separate cache flags for A and b in ForwardDiff extension (rebased #1054 + test)#1062

Merged
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:cache_separate_A_b_rebased
Jun 26, 2026
Merged

Use separate cache flags for A and b in ForwardDiff extension (rebased #1054 + test)#1062
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:cache_separate_A_b_rebased

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

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 main from before #1053, so test/Core/resolve.jl errored on SuperLUDISTFactorization() (the alg wasn't yet in the resolve skip list). This branch is #1054 rebased cleanly onto current main (which has the #1053 fix), plus a test.

Contents

  • Use separate cache flags for A and b in the ForwardDiff extension (original commit by @hersle, rebased). Splits the single rhs_cache_valid flag into independent A_partials_valid / b_partials_valid flags, so mutating only A or only b no longer forces the other side's partials list to be recomputed (e.g. in an ODE where A is fixed while b changes, and vice versa).
  • New test DualLinearCache separate A/b partials validity in test/Core/forwarddiff_overloads.jl: asserts a one-sided A/b mutation invalidates only that side's flag, that solve! 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.
  • Runic format check on changed files — clean.

Credit for the underlying change goes to @hersle (#1054); the original commit is preserved with authorship.

🤖 Generated with Claude Code

hersle and others added 2 commits June 26, 2026 14:39
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>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review June 26, 2026 21:19
@ChrisRackauckas ChrisRackauckas merged commit 8d48c30 into SciML:main Jun 26, 2026
52 of 56 checks passed
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.

3 participants