Skip to content

Use public cache construction for ForwardDiff wrappers - #1073

Closed
ChrisRackauckas-Claude wants to merge 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-base-single-cache-public-api
Closed

Use public cache construction for ForwardDiff wrappers#1073
ChrisRackauckas-Claude wants to merge 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-base-single-cache-public-api

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jul 15, 2026

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

Summary

  • stop naming the non-public FunctionWrappersWrappers.SingleCacheStorage type
  • derive the cache-storage type selected by the public SingleCache() constructor through documented type parameters
  • use the documented explicit-parameter wrapper constructor without inference widening
  • exercise first use and cached reuse through the non-isbits BigFloat fallback path
  • require FunctionWrappersWrappers 1.9.3, the first release providing the public constructor, and bump NonlinearSolveBase to 2.35.3

Root cause

NonlinearSolveBaseForwardDiffExt directly constructed FunctionWrappersWrappers.SingleCacheStorage, which is intentionally not public. ExplicitImports therefore failed the NonlinearSolveBase QA job with NonPublicQualifiedAccessException.

The first public-constructor prototype removed that violation but widened both continuation driver return types to Any. The final implementation asks the public cache-mode constructor which documented CS type it selected, then uses the public FunctionWrappersWrapper{FW,P,CS}(f) constructor with a concrete heterogeneous wrapper tuple.

The compat floor matters: the explicit public constructor is absent in FunctionWrappersWrappers 1.0 and first appears in 1.9.3. Version 2.35.3 avoids the independently reserved NonlinearSolveBase 2.35.1 and #1061 version 2.35.2.

Investigation

  • reproduced the original QA failure on clean upstream with FunctionWrappersWrappers 1.10.1 and ExplicitImports 1.15.0
  • bisected the QA transition to 0343930c2e53b47da8fa35d06379b12f5875b584 (Make AutoSpecialize infer through functor residuals; zero-alloc homotopy stepping #1046)
  • reproduced the continuation inference regression independently of the Jacobian-reuse feature
  • inspected released FunctionWrappersWrappers tags to establish 1.9.3 as the first valid public-API floor
  • kept all access on documented public API

Validation

  • Julia 1.10.11, FunctionWrappersWrappers pinned exactly to 1.9.3, GROUP=Core Pkg.test() for lib/NonlinearSolveBase: passed
    • wrapper fallback: 6/6
    • linsolve workspace: 53/53
    • linear routing: 12/12
    • dense LU allocation coverage: 14/14
    • remaining Base Core testsets passed
  • Julia 1.12.6 Base Core: passed
  • Julia 1.12.6 Base QA: 18/18
  • exact repository continuation inference regression: 26/26
  • Runic 1.7.0 repository check: passed
  • git diff --check: passed

No assertion was loosened, skipped, disabled, or converted to broken.

Copy link
Copy Markdown
Member Author

Follow-up commit 11745660e fixes the inference regression introduced by the first public-cache implementation.

Isolation and rerun results:

  • parent stack: continuation inference 26/26
  • original PR implementation: 24/26 (Any for both continuation drivers)
  • current PR head: 26/26
  • NonlinearSolveBase Core: passed
  • NonlinearSolveBase QA: 18/18
  • Runic 1.7.0: passed

The follow-up removes storage-field extraction and constructs the concrete heterogeneous wrapper through the documented explicit-parameter public constructor.

Copy link
Copy Markdown
Member Author

CI classification for Downgrade run 29418505348:

  • exact failure: generalized Rosenbrock, bad Broyden alg Make iip a compile-time constant #4
  • observed residual: 4.3999999999999995 > 0.001
  • Broyden summary: 94 passed, 1 failed, 20 broken

This is the clean-base failure already bisected to #1039 and fixed independently by #1057; it does not exercise the ForwardDiff cache construction. The combined Jacobian-reuse stack applies #1057 before this PR. No test expectation or tolerance is changed here.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/fix-base-single-cache-public-api branch from 1174566 to 1182563 Compare July 16, 2026 18:26
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Rebased the two source/test commits onto current upstream 60736b5b6 after fetching and auditing the exact prior tip 11745660e, its two-commit authorship, comments, and absence of reviews. git range-diff reports both patches unchanged.

Added commit 1182563d1 to declare the verified FunctionWrappersWrappers 1.9.3 public-API floor and bump NonlinearSolveBase to 2.35.3. Before committing, Julia 1.10.11 resolved exactly FunctionWrappersWrappers 1.9.3 and the declared Base Core group passed, including wrapper fallback 6/6, workspace 53/53, routing 12/12, and dense-LU 14/14.

The branch update used --force-with-lease pinned to the audited prior SHA; no contributor commits were overwritten.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Superseded by #1121, which applies the public FunctionWrappersWrappers constructor fix to current master together with the remaining #1118 ExplicitImports cleanup and current local validation.

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