Skip to content

Keep estimate_terk; drop duplicate OOP FBDF inline terk - #4785

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/4641-oop-dead-terk
Oct 8, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/4641-oop-dead-terk

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Please ignore until reviewed by @ChrisRackauckas.

Summary

In FBDF's out-of-place adaptive perform_step!, the 12-line inline FD-weight terk block duplicated estimate_terk(..., k + 1, ...) and allocated a fresh weights matrix every step. This PR keeps estimate_terk (matching the IIP and DFBDF paths) and deletes the inline copy. No behaviour change intended.

Evidence

I compared master bdf_perform_step.jl vs this change in one process (Base.include swap). Trajectories are bit-identical (sol.t, sol.u, stats, retcode) for Number / Vector / SVector OOP FBDF:

problem identical acc/rej/nf
scalar_exp 1e-4 / 1e-8 true 45/0/124 ; 187/2/420
scalar_stiff 1e-4 / 1e-8 true 112/6/315 ; 387/21/1003
rober_vec 1e-4 / 1e-8 true 185/5/574 ; 856/17/2025
rober_svec 1e-4 / 1e-8 true 185/5/574 ; 856/17/2025
vdp_svec 1e-4 / 1e-8 true 408/63/1645 ; 1643/90/5103

ALL IDENTICAL: true (I observed).

Allocation (minimum over 20 samples after warmup, OOP scalar at order 3):

  • @allocated estimate_terk(...): 0 bytes
  • @allocated equivalent inline calc_finite_difference_weights path: 384 bytes

So dropping the inline removes a 384-byte per-step allocation on the OOP adaptive path.

I ran julia -m Runic --check on the touched file (exit 0) and typos (exit 0). Full GROUP=Core was not completed on this host (same overload limit as #4784).

What was not verified

  • Full GROUP=Core suite completion
  • Wall-clock speedup beyond the allocation count above

Part of #4641

Risk assessment

Low: deletes a pure duplicate of estimate_terk on the OOP path; bit-identical trajectories on the probed problems. Independent review: Claude Code claude-opus-5-5[1m] (a different harness from the author, Cursor Agent): round 2 on c127765 rated it VERDICT MERGE, RISK low, high confidence. It is bit-identical to master in 18 runs (scalar, Vector and SVector; 3 problems; tol 1e-4 and 1e-8), and allocations drop 55–76% for scalar/SVector and 11–15% for Vector. Auto-merge candidate once CI is green. Non-blocking: the out-of-place calc_finite_difference_weights now has no callers.


Cursor Agent (auto). Transcript: /home/crackauc/sandbox/tmp_20260923_181807_1012334/jobs-root/jobs/4641-small-cursor-fix/log.txt on amdci2.

Independent review and orchestration: 🤖 Claude Code (model: claude-opus-5-5[1m]), session https://claude.ai/code/session_015tNYhuzygK9z8yhh6MNCAz

Risk assessment

  • Risk: low
  • Blast radius: Out-of-place adaptive FBDF (perform_step! for the OOP FBDF cache) only. The deleted block recomputed terk and overwrote the value estimate_terk(integrator, cache, k + 1, Val(max_order), u) had just returned. Both use the same ts_tmp, t + dt, order k weights and abs(dt^k) scaling, so the step math is unchanged.
  • Evidence: Head c127765 has 4 failing checks, all pre-existing on master push runs (cceca42, 6ef1364 and 0fd3326 on 2026-10-07): tests / GPU (julia 1) with the same 3 failures at test/gpu/dae_tests.jl:481, SciMLSensitivity.jl/Core1 with the same error at concrete_solve_derivatives.jl:451, and downgrade-sublibraries / test (lib/DiffEqBase) and (lib/OrdinaryDiffEqDifferentiation). 132 checks pass, including the BDF sublibrary groups.
  • Independent review: Claude Code (claude-opus-5-5) rated it low, high confidence: a 13-line deletion of dead code whose result was immediately superseded, with no API, test or tolerance change. It is consistent with the IIP and DFBDF paths, which already use estimate_terk.
  • Merge: auto-merge candidate

🤖 Risk assessment posted by an AI agent (fleet master) — harness: Claude Code 2.1.285 · model: claude-opus-5-5
Conversation: local session 3c311569-dda6-4687-bc9f-65febb212c33 (local transcript)

ChrisRackauckas and others added 2 commits October 7, 2026 11:19
The out-of-place adaptive path computed terk via estimate_terk and then
immediately overwrote it with the identical inline FD formula.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/tmp_20260923_181807_1012334/jobs-root/jobs/4641-small-cursor/log.txt on amdci2
Matches the IIP/DFBDF path and removes the per-step allocating
calc_finite_difference_weights copy; no narrating comment.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/tmp_20260923_181807_1012334/jobs-root/jobs/4641-small-cursor-fix/log.txt on amdci2
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Remove dead OOP FBDF estimate_terk before inline terk Keep estimate_terk; drop duplicate OOP FBDF inline terk Oct 7, 2026
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review October 8, 2026 17:56
@ChrisRackauckas
ChrisRackauckas merged commit 6072e89 into SciML:master Oct 8, 2026
135 of 139 checks passed
ChrisRackauckas referenced this pull request Oct 14, 2026
…inaryDiffEqBDF, OrdinaryDiffEqExplicitRK, OrdinaryDiffEqFIRK, OrdinaryDiffEqFeagin, OrdinaryDiffEqHighOrderRK, OrdinaryDiffEqPDIRK, OrdinaryDiffEqRKN, OrdinaryDiffEqSDIRK, StochasticDiffEqHighOrder, StochasticDiffEqLowOrder, and StochasticDiffEqMilstein for release (#4871)

Agent-Harness: Devin CLI 3000.11.3
Agent-Model: Fusion (Claude Opus 5.5 Medium + SWE-2 Medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/flash-hour.json

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.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