Skip to content

Recognize explicit second-order AutoSparse AD#1269

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/recognize-sparse-second-order
Draft

Recognize explicit second-order AutoSparse AD#1269
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/recognize-sparse-second-order

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Summary

  • recognize AutoSparse AD types that explicitly wrap DifferentiationInterface.SecondOrder
  • retain the missing_second_order_ad warning for implicit first-order AutoSparse inputs
  • add focused regression coverage for both cases

Context

Optimization's exact-Hessian cache warning only recognized a top-level SecondOrder. The documented sparse form is instead AutoSparse(SecondOrder(inner, outer)), so an explicitly configured sparse second-order backend was incorrectly warned as missing second-order AD.

This became visible in BoundaryValueDiffEq after OptimizationIpopt 1.3 switched to the generic OptimizationCache. A separate downstream follow-up supplies an explicit sparse SecondOrder; this PR only fixes OptimizationBase's classification.

Related prior art: #1061 called out this false warning while working around it downstream, and #1240 concerns another second-order warning edge case. I found no open duplicate PR.

Investigation

  1. Reproduced the warning on current master and confirmed the parent of OptimizationIpopt 1.3 remained silent because it did not use the generic cache path.
  2. Verified that AutoSparse(SecondOrder(AutoForwardDiff(), AutoForwardDiff())) solves successfully.
  3. Verified that moving AutoSparse outside the individual SecondOrder backends is the working sparse representation; the alternative top-level construction fails in DifferentiationInterface's pullback path.
  4. Added a positive no-warning assertion for explicit sparse second-order AD and a negative assertion that implicit sparse AD still warns.

Local verification

  • OPTIMIZATION_TEST_GROUP=Core: 54 passed
  • OPTIMIZATION_TEST_GROUP=QA: 16 passed, 1 pre-existing broken assertion; package test passed
  • Runic check on all changed Julia files: passed
  • Stacked BoundaryValueDiffEq integration reproduction: 4/4 assertions passed across bounded and unbounded MIRK/Ipopt problems (no warning and successful return code for each)

Please ignore this draft until it has been reviewed by @ChrisRackauckas.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
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.

2 participants