Skip to content

Keep what the interpolant reads when stripping a solution - #4921

Open
singhharsh1708 wants to merge 10 commits into
SciML:masterfrom
singhharsh1708:strip-composite-cache
Open

singhharsh1708 wants to merge 10 commits into
SciML:masterfrom
singhharsh1708:strip-composite-cache

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

strip_cache now keeps what the interpolant reads instead of setting every field to nothing: the tableau (tab, tabs, ExplicitRK's B_interp), number fields (d, interp_order, num_stages, BS5's and OwrenZen's coefficients), and fields whose declared type cannot hold nothing, together with the fields that share a type parameter with them. DefaultCache and CompositeCache strip each sub-cache and keep current.
Before, rebuilding a cache with nothing everywhere threw for every cache with a concretely typed field (#4926: FBDF, QNDF, NordsieckBDF, RadauIIA3/5/9, AdaptiveRadau, every RosenbrockCache method, the AB/ABM caches, CompositeCache in #4907), left Rosenbrock23/32, BS5, OwrenZen3/4/5 and Vern6/Vern8(lazy = false) throwing on interpolation after a successful strip, and replaced a default-solver cache by an empty one, so stripped(t) silently used the Hermite fallback on Tsit5's stages (#4927).
Function and solver-state fields are still dropped (f, uf, tf, jac_config, grad_config, linsolve, nlsolver, alg, limiters) where their declared type allows nothing, and the existing assertions on them pass. Arrays of non-numbers whose element type is a parameter that admits nothing (per-stage linear solvers and stage buffers in AdaptiveRadau, Rosenbrock, FBDF/QNDF and the extrapolation caches) become empty Array{Nothing}, so no user function type stays in the stripped cache's type. On a 200-state problem with a function in p, the stripped in-place AdaptiveRadau, ImplicitEulerExtrapolation, Rodas5P and FBDF caches are 3.4 kB, 0.9 kB, 2.6 kB and 152 bytes, against 3.8 MB, 1.2 MB, 1.0 MB and 1.1 MB unstripped. All four threw on strip before.
I stripped every algorithm exported by the sublibraries in the test environment, plus DefaultODEAlgorithm and two composites, on Lorenz, in place and out of place (524 cases that solve), and compared stripped(t) with sol(t) at 101 points. Master: 178 match, 269 throw on strip, 73 throw on interpolation and 4 differ (the default solver by 2.4). This branch: 362 match and none get worse. Still failing: 133 cases, mostly low-storage and SSP methods, that store no k, so their interpolation calls f through the generic _ode_addsteps! (63 of them failed that way on master, the other 70 threw on strip), 17 constant caches with no default constructor (same as master), and 12 lazy Vern6-Vern9, BS5 and RKV76IIa defaults, which strip_solution rejects by design. In-place Tsit5 differs from the unstripped solution by 4.3e-14.
The first new testset strips eleven algorithms (including two composites, DefaultODEAlgorithm(lazy = Val(false)) and ExplicitRK), in place and out of place, and requires stripped(t) ≈ sol(t); it fails on master. A second testset deserializes stripped solutions in a separate Julia process.
Fixes #4907, fixes #4926, fixes #4927

Risk assessment

  • Risk: medium (M3: changes what strip_cache, and so strip_solution, keeps for every ODE cache type).
  • Blast radius: stripped solutions of all OrdinaryDiffEq caches, including DefaultCache and CompositeCache, and their interpolation. Unstripped solves are untouched; function and solver-state fields are still dropped where their type allows nothing. Stripped caches keep fields that share a type parameter with typed fields (Rodas5P 2.6 kB and FBDF 152 bytes against 1.0 MB and 1.1 MB unstripped on a 200-state problem with a function in p).
  • Evidence: A new testset strips with strip_alg = true and deserializes in a separate Julia process that defines neither the RHS nor the function in p. It covers DefaultODEAlgorithm(lazy = Val(false)) (in-place FullSpecialize and out-of-place), AdaptiveRadau, ImplicitEulerExtrapolation, RadauIIA5, Rodas5P, FBDF and Tsit5, and checks that each interpolates like the unstripped solution. Of 524 algorithm and in-place/out-of-place cases on Lorenz, master matches sol(t) in 178, throws on strip in 269, throws on interpolation in 73 and differs in 4 (the default solver by 2.4); this branch matches in 362 and none get worse.

AI Disclosure: Claude assisted with this change.

@singhharsh1708

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @singhharsh1708, not written or reviewed by the account holder.

Independent review (Codex CLI 0.163.0, model gpt-6.1-sol, reasoning effort high): CHANGES, risk medium-high (MH1). Reviewed head: baa7b640cb6e4459539c53414b8e5ce7890f0be3.

Full review

VERDICT: CHANGES
PR: #4921
Round: 1
Head: baa7b64
Base: 45ff46a
Slot: 1
Reviewer: Codex CLI 0.163.0 / gpt-6.1-sol
Session: 01a19752-68ab-7992-b15d-c201cebb4cf8
Reviewed: 2026-11-01T13:47:17Z
Summary: The PR preserves data needed to interpolate stripped standalone, composite, and default-solver solutions. The regression tests pass, but stripping still retains user functions through AdaptiveRadau’s solver caches, and the committed numerical tests lack the independent reference required by G1.

Risk

medium-high (MH1: Changes post-solve interpolation behavior across OrdinaryDiffEq’s default, Rosenbrock, BDF, and composite paths.)

Risk assessment

  • Risk: medium-high (MH1: Generic cache reconstruction affects the interpolation main lane across multiple solver families.)
  • Blast radius: strip_cache, strip_interpolation, and strip_solution; serialization and dense evaluation of stripped solutions.
  • Evidence: Changed test file passes on head and fails after copying it into the base worktree. Reviewer probes confirm default-solver accuracy and retained function-valued parameters. CI reports 251 successes, seven failures, and one skipped check.
  • Verdict: CHANGES
  • Round: 1
  • Blocking priorities: P2
  • Merge: needs changes (remove retained function-bearing solver state and commit independent numerical coverage)

Blocking findings

  1. [P2] Function-bearing solver state survives stripping - confirmed by running. At lib/OrdinaryDiffEqCore/src/interp_func.jl:145, retaining every field whose declared type rejects nothing preserves AdaptiveRadau’s entire linsolve2::Vector{F2} (lib/OrdinaryDiffEqFIRK/src/firk_caches.jl:596). Each linear solver contains the original parameters. With p = (rate = parameter_rate,), stripping an AdaptiveRadau solution with strip_alg=true leaves:

    stripped.interp.cache.linsolve2[1].p[3].rate === parameter_rate # true

    This occurs even though interp.f, prob.p, and alg are all nothing. The result retains user functions and parameter payloads that interpolation does not need, defeating stripping’s function-removal purpose. Add a cache-specific stripping method that replaces unused solver containers with safe placeholders, and test function-valued parameters.

  2. [P2] The PR lacks the independent numerical regression required by G1 - suspected from reading. At test/InterfaceI/ode_strip_test.jl:78, the numerical reference is exclusively sol(t) from the same solver. This is useful preservation coverage, but it supplies no analytic or independent accuracy oracle for the changed default-cache interpolation behavior. Commit an off-grid analytic test, such as u′=u, u(0)=1 against exp(t), and demonstrate its failure on base and success on head. My head probe measured maximum error 3.410116633517646e-10, but that independent test is absent from the PR.

Non-blocking findings

None.

What I ran

Absolute executable, worktree, and scratch locations are parameterized below to comply with the path restriction. $runner denotes the mandated jrun wrapper. All Julia runs were sequential and used Julia 1.13.1.

  • Read-only inspection commands, exit 0:

    git rev-parse HEAD
    git diff origin/master...HEAD
    git diff --check origin/master...HEAD
    git merge-base HEAD origin/master
    git log -1 --no-merges --format=%B

    Head and merge-base matched the supplied SHAs. The newest non-merge commit has no harness/model trailers. Head remained clean; base contained only the copied test modification.

  • Live PR and linked-issue inspection, exit 0:

    gh pr view 4921 --repo SciML/OrdinaryDiffEq.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid
    gh issue view 4907 --repo SciML/OrdinaryDiffEq.jl --json number,title,body,state
    gh issue view 4926 --repo SciML/OrdinaryDiffEq.jl --json number,title,body,state
    gh issue view 4927 --repo SciML/OrdinaryDiffEq.jl --json number,title,body,state

    PR remains open at the specified head.

  • Changed test file on head, exit 0:

    "$runner" --project=. -e 'using TestEnv; TestEnv.activate(); using Test, SafeTestsets; include("test/InterfaceI/ode_strip_test.jl")'

    Output tail:

    Composite Solution Stripping                     | 6  6
    Stripped solutions interpolate like the original | 40 40
    

    Earlier testsets and the lazy-interpolation exception assertion also passed.

  • Copied the changed test into base, verified identical hashes, and ran the same invocation there:

    cp test/InterfaceI/ode_strip_test.jl "$base_worktree/test/InterfaceI/ode_strip_test.jl"

    Copy exit 0; base test exit 1:

    MethodError: no method matching CompositeCache(::Nothing, ::Nothing, ::Nothing)
    Composite Solution Stripping | 1 passed, 1 errored
    
  • First head probe, $probe = reviewer_analytic_20261101.jl, exit 1:

    "$runner" --project=. "$probe"

    Tested analytic cosine solutions, derivatives, repeated stripping, and serialization:

    Analytic stripped dense output | 54 passed, 6 failed
    

    Both unstripped Rosenbrock23 integrations reached MaxIters, producing all six failures. This does not establish a PR regression. Other tested algorithms had maximum value errors between approximately 2.1e-11 and 1.3e-9.

  • Final head probe, $probe = reviewer_final_20261101.jl, exit 0:

    "$runner" --project=. "$probe"

    Output tail:

    Retained original parameter function: true
    Top-level f removed: true; problem p removed: true; alg removed: true
    Retained linear solvers: 3
    Default exponential max_abs_error=3.410116633517646e-10
    Analytic accuracy and serialization | 6 passed, 6 total
    

    The default-solver probe used fixed dt=1/16, checked off-grid values and first derivatives against exp(t), and checked same-process serialization and repeated stripping.

  • Inspected live checks with:

    gh pr checks 4921 --repo SciML/OrdinaryDiffEq.jl --json name,state,link

    Compared supplied failed-job excerpts from head CI, head sublibraries, and head downstream tests against master CI, master sublibraries, and master downstream tests. Six failure signatures match: GPUCompiler warnings, ReverseDiff tape errors, stiff-adjoint unexpected passes, Enzyme’s mi2 assertion, and the nonlinear line-search exception. The ModelingToolkit equation-orientation failure has no matching supplied baseline signature; its cause remains unattributed.

What I did not verify

  • The final numerical testset on base: the earlier composite error terminated the file.
  • Fresh-process deserialization of the retained AdaptiveRadau function.
  • Actual composite algorithm switching or the author’s full 532-case survey.
  • GPU, AD-specific, MPI, package-wide, or heavy downstream execution locally.
  • The tight-tolerance Rosenbrock23 probe failures on base.

AUTHOR_GRADE: {"task":"bugfix","score":3,"difficulty":3,"rounds":1,"author_harness":"unknown","author_model":"unknown","note":"The targeted regression fails on base and passes on head, but AdaptiveRadau stripping retains user functions through linear-solver parameters and the committed numerical tests lack an independent accuracy reference. Generic reconstruction across heterogeneous solver caches is a moderate integration task."}


🤖 Posted by an AI agent · harness: Claude Code · model: claude-opus-5-5 (coordinating gpt-6.1-sol reviewers)
Review: unreviewed
Session: 01a19752-68ab-7992-b15d-c201cebb4cf8

@singhharsh1708
singhharsh1708 force-pushed the strip-composite-cache branch 2 times, most recently from 06f9e66 to 154ed77 Compare November 3, 2026 06:00
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #4921

Reviewed head: fb98277
Raw SHA-256: 136c13aeb39825ec6d7cf3a5fce8bff04ba191fd98a3c93fdd092fb2d993ec6f
Source SHA-256: c118ce1d880595b2f472ac926594bcf9379c2ce5805ffb44de496a3dc1877bc2
Source: standard-review-v1 (harness-log)
Reviewer session: 01a1d256-3ef8-7012-98d8-9865bc897661
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes

Risk assessment

  • Risk: medium-low (ML8)
  • Verdict: CHANGES
  • Reviewed head: fb98277

Review report

VERDICT: CHANGES
Round: 1
Head: fb98277
Slot: 1
CI: CI is not green (regress:SciMLSensitivity.jl/Core4/1 / Downstream Tests - Core4)
Session: 01a1d256-3ef8-7012-98d8-9865bc897661

Risk

medium-low (ML8: changes retained solver-cache state and composite traversal on the optional solution-stripping path; execution evidence is missing).

Blocking findings

  • [P2] Needs verification — affected tests and adversarial probes did not execute. lib/OrdinaryDiffEqCore/src/interp_func.jl:139 changes generic cache reconstruction, and lines 181–191 change default/composite cache handling. The capacity-gated launcher exhausted its 3,600-second timeout with exit 124 before launching Julia; scratch/affected.log was absent afterward. This is an infrastructure limit, not an observed test failure or confirmed code defect. Run test/InterfaceI/ode_strip_test.jl and the prepared interpolation/serialization probes, obtain failing-before/passing-after evidence, and determine whether the supplied downstream failure reproduces on the default branch. Missing execution evidence blocks this recommendation independently of P2 issue deferral.

Non-blocking findings

  • test/InterfaceI/ode_strip_test.jl:82, lib/OrdinaryDiffEqCore/src/interp_func.jl:163, lib/OrdinaryDiffEqCore/src/interp_func.jl:184 — Suspected from reading; not confirmed by running: the retention walker skips types, while stripping preserves array element types and original types of uninitialized default subcaches. These types may retain references to user function types even when the function value is unreachable. Add a fresh-process serialization/deserialization test without defining the original RHS or parameter functions. The prepared writer/reader probes isolate this concern; they have not run. No deserialization failure is claimed.

What I ran

  • git diff origin/master...HEAD, source/test inspection, and the prescribed risk criteria. No PR body, discussion, author rating, or earlier review was read. Newest-commit attribution trailers are absent, so both author attribution fields are unknown.
  • git diff --check origin/master...HEAD: exit 0. Final git status --porcelain: empty; HEAD matches the SHA above.
  • julia --version: julia version 1.13.2.
  • uv run --locked python --version: Python 3.15.0; uv warned that --locked has no effect outside a project. The checkout contains no Python project/uv lock or Julia Manifest/exact interpreter pin, so this is not evidence of a project-locked Python environment.
  • Exported the requested TMPDIR, preserved the supplied layered JULIA_DEPOT_PATH, and prepared a scratch environment from the package dependencies, test target, compat constraints, and local sources. Prepared affected/InterfaceI suite drivers, shape/precision/derivative/composite probes, fresh-process serialization probes, and an exact merge-base strip_cache negative control.
  • Ran the capacity-gated test launcher under timeout 3600. It never reached dependency instantiation or test execution. Its final wait reported five Julia roots, 18,637,184 KiB available, and load 21.45 24.73 25.83; five existing jobs left no permitted test slot. No launched command remains running.
  • Reviewer: codex-cli 0.164.0, assigned model gpt-6.1-sol; actual local session is recorded above, with no session URL available.

What I did not verify

No affected test suite or targeted probe executed. Interpolation equivalence, independent analytic accuracy, function/type erasure, serialization round trips, and failing-before/passing-after behavior remain unverified. The supplied Core4 downstream failure was not independently investigated. QA, docs, and other supported Julia versions were not run.

  • Verdict: CHANGES
  • Round: 1
  • Blocking priorities: P2
  • Deferred P2 issues: None supplied.

AUTHOR_GRADE: {"task": "bugfix", "score": 3, "difficulty": 3, "rounds": 1, "author_harness": "unknown", "author_model": "unknown", "note": "Focused cache-stripping change adds interpolation and retention assertions without weakening existing tests. Runtime correctness and serialization independence remain unverified because the reviewer could not obtain capacity within one hour; no code defect was confirmed."}

Head link: fb98277


🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol
Conversation: local session 01a1d256-3ef8-7012-98d8-9865bc897661 (no session URL)

@singhharsh1708

Copy link
Copy Markdown
Member Author

Core4 has been green on master since 11-04 and the run here predates that; I merged master to re-run. On serialization: stripped Tsit5, default, Rodas5P and FBDF solutions deserialize and interpolate in a fresh process that defines neither the RHS nor p.

@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

@singhharsh1708 The PR body has no risk assessment. Please add this block, filled in for this change, so the review at 9800dbaf can be rated:

## Risk assessment
- **Risk:** low | medium-low | medium | medium-high | high (<criterion ID>: <why>)
- **Blast radius:** code paths touched, public API or not, downstream packages
- **Evidence:** failing-before/passing-after test output, CI runs

Criteria: risk policy. The remaining red checks on this head also fail on the base branch (AD, GPU, Core, ProbNumDiffEq and the DiffEqDevTools downgrade job), so they do not block the review.


🤖 Posted by an AI agent — harness: Claude Code 2.1.325 · model: claude-sonnet-5-5
Conversation: local session 3878b54e-28f2-4a01-a176-a8f5468d1997 (no session URL)

@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #4921

Reviewed head: 9800dba
Raw SHA-256: 4fbd5791fc8de6a08c8ce516c4bfe736a6b1f3e5b46636ed685b7bc90a82b6a0
Source SHA-256: 0349309222040aa06ec7b158a98869f3e674b8520393c535f96c2d5a30a146df
Source: standard-review-v1 (harness-log)
Reviewer session: 1ed77f43-d9be-4f6e-9df3-f0bb138b7e7a
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: medium-low (ML8)
  • Verdict: CHANGES
  • Reviewed head: 9800dba

Review report

VERDICT: CHANGES
Round: 6
Head: 9800dba
Slot: 1
CI: CI is not green (regress:downgrade-sublibraries / test (lib/DiffEqDevTools))
Session: 1ed77f43-d9be-4f6e-9df3-f0bb138b7e7a
Reviewer: Antigravity CLI 1.5.10; model: gemini-4-carbon-high

Risk

medium-low (ML8: rewrites solver-cache stripping and retained cache/type state across generic, DefaultCache, and CompositeCache paths on the opt-in SciMLBase.strip_interpolation / SciMLBase.strip_solution path; regular solve and unstripped interpolation paths are untouched)

Blocking findings

  • [P1] SciMLBase.strip_solution retains user function types in cache type parameters for DefaultCache and AdaptiveRadauCache, breaking fresh-process deserialize, while holds in the test skips Type (lib/OrdinaryDiffEqCore/src/interp_func.jl:163-164, lib/OrdinaryDiffEqCore/src/interp_func.jl:181-188, test/InterfaceI/ode_strip_test.jl:81-96).

    • Confirmed by running: Executing the fresh-process serialization round-trip requested in the preceding review (the branch delta since fb98277c47f895cde001af6cc543dd157a72499b consists only of two merges of upstream/master) shows that SciMLBase.strip_solution(sol; strip_alg = true) fails its primary serialization contract when deserialized in a fresh Julia process where the original user functions are not defined:
      1. Running the exact growth problem and parameter_rate(t) = 1.0 from test/InterfaceI/ode_strip_test.jl:88-96 at top-level Main, serializing stripped_sol with Serialization.serialize, and calling Serialization.deserialize in a fresh Julia process without parameter_rate defined succeeds for RadauIIA5() (DESERIALIZE_OK (exact_match=true)), but fails with UndefVarError: #parameter_rate not defined in Main for both AdaptiveRadau() and DefaultODEAlgorithm(lazy = Val(false)).
      2. Even with no function in p (NullParameters()), solving a plain out-of-place ODEProblem(plain_oop_rhs, [1.0], (0.0, 1.0)) (default AutoSpecialize) or an in-place ODEProblem{true, SciMLBase.FullSpecialize}(plain_iip_rhs!, [1.0], (0.0, 1.0)) with DefaultODEAlgorithm(lazy = Val(false)), stripping with SciMLBase.strip_solution(sol; strip_alg = true), and deserializing in a fresh process throws UndefVarError: #plain_oop_rhs not defined in Main and UndefVarError: #plain_iip_rhs! not defined in Main. On origin/master, strip_cache(::DefaultCache) constructed DefaultCache{Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}(nothing, nothing, 0, nothing), which we confirmed deserializes cleanly in a fresh process without plain_oop_rhs defined (DESERIALIZE_OK); keeping unstripped subcache types on DefaultCache is therefore a deserialization regression against origin/master.
      3. Two lines in lib/OrdinaryDiffEqCore/src/interp_func.jl cause this retention:
        • Line 184 (types = map((c, n) -> isdefined(cache, n) ? typeof(c) : fieldtype(typeof(cache), n), caches, names)) preserves the unstripped fieldtype(typeof(cache), n) (Rosenbrock23Cache, RosenbrockCache, FBDFCache, etc., whose type parameters embed ODEFunction / UJacobianWrapper / LinearCache with user RHS and parameter function types) for every uninitialized candidate subcache (!isdefined(cache, n)), even though those fields remain #undef and evaluate_default_cache never reads an uninitialized subcache.
        • Lines 163-164 (_strip_kept returning similar(value, ntuple(_ -> 0, ndims(value)))) preserve the concrete eltype(value) on kept non-numeric Array fields such as AdaptiveRadauCache.linsolve2::Vector{F2}, leaving F2 = LinearCache{..., Tuple{Nothing, Vector{Float64}, @NamedTuple{rate::typeof(parameter_rate)}, Float64}, ...} in typeof(stripped_sol.interp.cache). (Preserving Array element types also forces _mentions at lines 148-156 to keep full-length working buffers like u::uType and du::rateType whenever Vector{uType} or Vector{rateType} fields exist, e.g. on RosenbrockCache and AdaptiveRadauCache.)
      4. In test/InterfaceI/ode_strip_test.jl:81-87, holds(x, y) guards traversal with !(x isa Union{Module, Type}) and never inspects typeof(x) or type parameters. Because Julia functions like parameter_rate are zero-size singletons (sizeof(parameter_rate) == 0), @test !holds(stripped_sol.interp, parameter_rate) at line 94 passes in-process even though typeof(parameter_rate) is still embedded in typeof(stripped_sol.interp.cache) and breaks deserialization.
    • Suggested fix:
      1. In strip_cache(cache::DefaultCache) (lib/OrdinaryDiffEqCore/src/interp_func.jl:184), replace fieldtype(typeof(cache), n) with Nothing for uninitialized subcaches: types = map((c, n) -> isdefined(cache, n) ? typeof(c) : Nothing, caches, names).
      2. In strip_cache(cache) (lib/OrdinaryDiffEqCore/src/interp_func.jl:139-165), treat Array-typed fields (outside :tab/:tabs) whose element TypeVar accepts Nothing and is not pinned by another kept field as strippable to Array{Nothing, ndims(value)}(undef, ntuple(_ -> 0, ndims(value))) rather than similar(value, ...) (matching the existing ESDIRKIMEXCache pattern in lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl:94-95). A scratch prototype of both changes deserialized cleanly in a fresh Julia process without user functions defined and matched unstripped interpolation across AdaptiveRadau, RadauIIA5, Rodas5P, FBDF, and DefaultODEAlgorithm (in-place, out-of-place, AutoSpecialize, FullSpecialize, and parameter_rate).
      3. In test/InterfaceI/ode_strip_test.jl:81-96, verify stripped solutions with an actual fresh-process (or Cmd subprocess) Serialization.serialize / deserialize round-trip where the RHS and parameter functions are undefined, or traverse typeof(x) and DataType parameters in holds.
  • Blocking priorities: P1

Non-blocking findings

  • lib/OrdinaryDiffEqCore/src/interp_func.jl:145 — Confirmed by running: Out-of-place ExplicitRK with a dense B_interp tableau silently loses its high-order interpolant when stripped. ExplicitRKCache (in-place) wraps an ExplicitRKConstantCache in a .tab field so fieldname(T, i) in (:tab, :tabs) preserves cache.tab.B_interp, whereas out-of-place ExplicitRK uses ExplicitRKConstantCache directly (lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl:40-49), where B_interp::BType is a top-level Matrix field whose unconstrained TypeVar accepts nothing. strip_cache sets B_interp to nothing while keeping stages::Int, and OrdinaryDiffEqExplicitRK._ode_interpolant (lib/OrdinaryDiffEqExplicitRK/src/interpolants.jl:115-126) then silently falls back to cubic Hermite using k[2] — which _ode_addsteps! populated with the stage-2 derivative at t + c[2]*dt rather than the right-endpoint derivative f(u₁, p, t₁). Solving u' = u, u(0) = [1.0] on (0.0, 1.0) with ExplicitRK(tableau = OrdinaryDiffEqExplicitRK.constructTsit5ExplicitRK()), dt = 0.25, adaptive = false: in-place max|strip(t) - exp(t)| stays 2.07e-7 (max|strip - orig| = 0.0), whereas out-of-place jumps from 2.29e-6 to 1.89e-2 (st_oop(0.25, Val{1}; continuity = :left) returns k[2] = 1.04025 instead of 1.2840254). Including :B_interp alongside (:tab, :tabs) (or specializing strip_cache(::ExplicitRKConstantCache)) restores exact agreement (max|strip - orig| = 0.0).

What I ran

  • Reviewed git diff origin/master...HEAD (lib/OrdinaryDiffEqCore/Project.toml, lib/OrdinaryDiffEqCore/src/interp_func.jl, test/InterfaceI/ode_strip_test.jl) and the round delta since fb98277c47f895cde001af6cc543dd157a72499b (two merges of upstream/master, fef5806aa and 9800dbafb, with no new PR-specific edits). Blind code-only review; no PR body, comments, or sibling round directories were read. Newest-commit agent trailers are absent (author_harness and author_model are unknown).
  • git diff --check origin/master...HEAD: exit 0. git status --porcelain on the checkout: empty; HEAD is 9800dbafbb70f55657d7feff7ed52ff2dff5f5b2.
  • typos lib/OrdinaryDiffEqCore/Project.toml lib/OrdinaryDiffEqCore/src/interp_func.jl test/InterfaceI/ode_strip_test.jl: exit 0.
  • julia --project=@runic --startup-file=no -m Runic --check on copies of lib/OrdinaryDiffEqCore/src/interp_func.jl and test/InterfaceI/ode_strip_test.jl in scratch: exit 0.
  • julia --version: julia version 1.13.2.
  • uv run --locked python --version: Python 3.15.0 (with warning: --locked has no effect when used outside of a project; the repository has no uv.lock or committed Julia Manifest.toml).
  • Instantiated an isolated scratch Julia environment on the build host from Project.toml ([deps], [extras], [compat], and local [sources] pointing to the checkout and all lib/* sublibraries, preserving the layered JULIA_DEPOT_PATH and job TMPDIR):
    • test/InterfaceI/ode_strip_test.jl: 69 / 69 passed (56.7s).
    • lib/OrdinaryDiffEqCore/test/qa/qa.jl (Aqua + ExplicitImports), interpolation_hint_tests.jl, interpolation_idxs_bounds_tests.jl, and left_continuity_knot_tests.jl: 199 / 199 passed (40.3s).
    • Failing-before vs passing-after probe against origin/master's strip_cache: confirmed AutoTsit5(Rosenbrock23()), Rodas5P(), RadauIIA5(), and AdaptiveRadau() threw MethodError before; Rosenbrock23() and BS5(lazy = false) threw FieldError on interpolation before; DefaultODEAlgorithm(lazy = Val(false)) had 1.179 interpolation error before; all 7 matched the unstripped solution (err = 0.0) after.
    • Stiff-switching composite & DefaultODEAlgorithm probe on stiff Van der Pol (μ = 200, both in-place and out-of-place, exercising actual alg_choice switches [1, 2] and [2, 4]): max|strip(t) - sol(t)| = 0.0, Val{1} derivative max_d1 = 0.0, scalar idxs = 2 max_idx = 0.0, and in-place sol(out, t) exact match across 60 query points.
    • Fresh-process Serialization.serialize / deserialize writer/reader probes (both top-level Main and module-scoped) without user RHS or parameter functions defined in the reader process, plus ExplicitRK(tableau = constructTsit5ExplicitRK()) dense interpolation probe and scratch fix verification: reproduced the UndefVarError failures and ExplicitRK out-of-place error jump reported above, and confirmed the suggested fixes resolve all of them.

What I did not verify

  • Remote CI logs and reproduction of downgrade-sublibraries / test (lib/DiffEqDevTools) under Julia 1.11 lowest-compat resolution were not run (blind mode forbids GitHub reads; locally git diff origin/master...HEAD -- lib/DiffEqDevTools .github/workflows/DowngradeSublibraries.yml is empty, DowngradeSublibraries.yml lists OrdinaryDiffEqCore in skip, and lib/DiffEqDevTools does not call strip_cache, strip_interpolation, or strip_solution).
  • Full InterfaceI group beyond test/InterfaceI/ode_strip_test.jl and the OrdinaryDiffEqCore interpolation/QA tests, JET static analysis (lib/OrdinaryDiffEqCore/test/qa/jet.jl), GPU tests, docs build (docs/make.jl), and Julia 1.10 LTS were not run.

AUTHOR_GRADE: {"task": "bugfix", "score": 3, "difficulty": 3, "rounds": 6, "author_harness": "unknown", "author_model": "unknown", "note": "Compact cache-stripping redesign fixes CompositeCache, DefaultCache, and non-nullable solver cache interpolation (69/69 in ode_strip_test.jl, 199/199 in OrdinaryDiffEqCore QA/interpolation, Runic and typos clean), but no code changes landed after round 1 beyond upstream merges and fresh-process deserialization confirms that DefaultCache and AdaptiveRadauCache still retain user function types in type parameters (regressing DefaultCache deserialization relative to origin/master) while the new holds helper masks the leak by skipping Type."}

Head link: 9800dba


🤖 Posted by an AI agent — harness: Antigravity CLI 1.5.10 · model: gemini-4-carbon-high
Conversation: local session 1ed77f43-d9be-4f6e-9df3-f0bb138b7e7a (no session URL)

@singhharsh1708

Copy link
Copy Markdown
Member Author

Fixed in 2fcc7a7 and b2e5556: sub-caches that were never created and per-stage arrays like linsolve2 now strip to Nothing types, ExplicitRK keeps B_interp, and a new subprocess test deserializes eight cases without the RHS or p defined. This corrects my 11-15 reply: it held for Tsit5, Rodas5P and FBDF, but with lazy = Val(false), in-place AdaptiveRadau and the in-place implicit extrapolation methods, deserializing failed before.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants