Skip to content

Allow Newton refresh retries in MethodOfSteps - #4396

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/sdirk2-methodofsteps-current-regression
Sep 7, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/sdirk2-methodofsteps-current-regression

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

What changed

MethodOfSteps fixed-point recomputations could retry Newton indefinitely: Newton requested a fresh Jacobian after divergence, but repeat_step=true suppressed that refresh on every retry. Both in-place and out-of-place recomputations now pass false, allowing the existing Newton refresh-and-retry logic to run. This addresses the Robertson failure investigated in #4389.

The final implementation changes only two call arguments and their explanatory comments. DelayDiffEq advances from 6.3.0 to 6.3.1. The tests enforce the existing owned-scratch invariant after a deliberately failed first stage and a subsequent retry, and run Robertson to t=1.0 for in-place/out-of-place RHS functions with the default controller and two first-step growth settings. A 100,000-RHS-call guard makes nontermination fail promptly.

Ignore this PR until reviewed by @ChrisRackauckas.

Failing before / passing after

Julia 1.11.9, one thread. The identical final regression file was copied into the official test dependency environment, whose local package paths pointed to clean base 666e7fc. The after run changed only the two perform_step! arguments in that checkout. SDIRK's scratch-copy implementation and cache dispatch were unchanged.

TMPDIR="$PWD/base-tmp" JULIA_NUM_THREADS=1 /home/crackauc/.juliaup/bin/julia +1.11 --project=base-env -e 'using InteractiveUtils; versioninfo(); include("base-env/official-regression-final.jl")'

Before (exit 1):

Test Summary:                                          | Pass  Total   Time
implicit-first-stage nlsolver.tmp does not alias uprev |    2      2  24.0s
Test Summary:                               | Pass  Total   Time
failed implicit first stage preserves uprev |   16     16  33.5s
SDIRK2 exceeded the RHS evaluation budget
Test Summary:                              | Error  Total   Time
multi-stage implicit-first DDE fixed point |     1      1  27.9s

After (exit 0, 42/42):

Test Summary:                                          | Pass  Total   Time
implicit-first-stage nlsolver.tmp does not alias uprev |    2      2  24.6s
Test Summary:                               | Pass  Total   Time
failed implicit first stage preserves uprev |   16     16  34.7s
Test Summary:                              | Pass  Total     Time
multi-stage implicit-first DDE fixed point |   24     24  1m03.4s

The original issue's default-controller options were also run separately: the base exceeded 100,000 RHS calls; the two-argument fix returned Success at t=1.0 with 3,450 calls, 477 accepted steps, and 19 rejected steps.

Local validation

All commands below ran locally with Julia 1.11.9. Test commands used TMPDIR="$PWD/../review-tmp", JULIA_DEPOT_PATH="$PWD/../review-tmp/depot:/home/crackauc/.julia", and JULIA_PKG_PRECOMPILE_AUTO=0 from the repository root.

GROUP=Regression /home/crackauc/.juliaup/bin/julia +1.11 --startup-file=no --threads=1 --project=lib/DelayDiffEq -e 'using Pkg; Pkg.test()'
GROUP=QA /home/crackauc/.juliaup/bin/julia +1.11 --startup-file=no --threads=1 --project=lib/DelayDiffEq -e 'using Pkg; Pkg.test()'
GROUP=SDDE /home/crackauc/.juliaup/bin/julia +1.11 --startup-file=no --compiled-modules=no --threads=1 --project=lib/DelayDiffEq -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=no"])'

Each exited 0:

Allocation Tests                 | 12 pass
Inference Tests                  | 18 pre-existing broken
Waltman Problem Tests            | 26 pass
Issue #3636: DDE tstop overshoot  | 20 pass
DDE/SDIRK stage-1 tmp aliasing    | 42 pass
Testing DelayDiffEq tests passed

QA Tests                         | 20 pass
Testing DelayDiffEq tests passed

SDDE Problem/Solution Tests      | 16 pass
Event Tests                      |  2 pass
Non-diagonal Sparse Noise Tests  |  2 pass
Implicit Method Tests            | 12 pass
Testing DelayDiffEq tests passed

Runic, typos on all three changed files, and git diff --check exited 0:

/home/crackauc/.juliaup/bin/julia +1.11 --startup-file=no --project=/home/crackauc/sandbox/runicenv -e 'using Runic; exit(Runic.main(ARGS))' -- --check lib/DelayDiffEq/src/fpsolve/functional.jl lib/DelayDiffEq/test/regression/dde_sdirk_stage1_tmp_aliasing.jl
typos lib/DelayDiffEq/Project.toml lib/DelayDiffEq/src/fpsolve/functional.jl lib/DelayDiffEq/test/regression/dde_sdirk_stage1_tmp_aliasing.jl
git diff --check

The full DelayDiffEq Integrators group also exited 0 using the same environment prefix:

GROUP=Integrators /home/crackauc/.juliaup/bin/julia +1.11 --startup-file=no --compiled-modules=no --threads=1 --project=lib/DelayDiffEq -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=no"])'
Cache Tests             | 44 pass
Event Tests             | 20 pass
Iterator Tests          | 12 pass
Reinitialization Tests  | 24 pass
Residual Control Tests  | 18 pass
Return Code Tests       |  6 pass
Rosenbrock Tests        | 42 pass
SDIRK Tests             | 45 pass, 36 pre-existing broken
Unique Timepoints Tests |  2 pass
Verner Tests            | 16 pass
Initialization          |  2 pass
Testing DelayDiffEq tests passed

The full OrdinaryDiffEqSDIRK Core group also exited 0 using the same environment prefix:

GROUP=Core /home/crackauc/.juliaup/bin/julia +1.11 --startup-file=no --compiled-modules=no --threads=1 --project=lib/OrdinaryDiffEqSDIRK -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=no"])'
Test Summary:       | Pass  Total      Time
Tableau consistency |  103    103  49m33.2s
Test Summary:    | Pass  Total   Time
Stage predictors |  115    115  24.2s
Test Summary: | Pass  Broken  Total      Time
Convergence   |  129       2    131  90m24.5s
Test Summary: | Pass  Total      Time
DAE tests     |    8      8  21m24.2s
Testing OrdinaryDiffEqSDIRK tests passed

The two broken convergence assertions were pre-existing; no tests were disabled or weakened.

A separate Regression attempt with --compiled-modules=no hit LinearSolve's QR world-age error. It also reproduces in a standalone 2×2 LinearSolve solve, without DelayDiffEq or OrdinaryDiffEq, and is tracked in SciML/LinearSolve.jl#1282 (comment). The successful Regression command uses normal compilation; no assertions or error handling were changed to bypass the failure.

CI

The complete DelayDiffEq sublibrary workflow passed on this commit: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/33964185740. Its logs show the updated regression passing 42/42 on Julia LTS, stable, and prerelease, and QA passing 20/20. All configured Integrators, Interface, Regression, and SDDE jobs passed. The main repository CI workflow, including GPU, also passed: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/33964185826. The downstream workflow also passed: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/33964185677, as did all sublibrary downgrade checks: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/33964185765. Final PR check rollup: 138 successful checks, 3 workflow-skipped jobs, no pending or failed validation checks. These results are for 408f31f.

The existing Dependabot Auto-merge workflow fails at startup because the called workflow requests checks: read and statuses: read, while the caller grants neither. No jobs run in that workflow: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/33964185706. This workflow is unchanged by this PR.

GPU, Julia prerelease, and downstream jobs were not run locally. No dependency, public API, docstring, or rendered documentation changes are included.

Links

🤖 Generated with Codex CLI 0.153.4 (model: gpt-6-astra; local session: 01a07107-0ed2-7aa1-bfd7-561836cc87fd). Transcript: /home/crackauc/.codex/sessions/2026/09/05/rollout-2026-09-05T06-04-43-01a07107-0ed2-7aa1-bfd7-561836cc87fd.jsonl

`repeat_step=true` on DelayDiffEq fixed-point recomputes made do_newJW skip
J/W even though the history (hence f) had changed, so SDIRK Newton spun in
LinearSolve QR (SciML#4389). Recompute with a fresh W. Bind implicit-first stage
1 to uprev only for the Newton solve, then restore the owned scratch so
get_tmp_cache cannot write uprev after a failed first stage.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Grok 4.6 <[email protected]>
Agent-Harness: Grok Build TUI
Agent-Model: grok-4.6
Agent-Session: 01a052a0-1183-7d23-bfe2-539976f69d01 (local Grok Build TUI session)
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the fix/sdirk2-methodofsteps-current-regression branch from 8d439f1 to 4a969e3 Compare August 30, 2026 14:31
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Fix implicit-first SDIRK state during DDE fixed-point iterations Rebuild MethodOfSteps W after history updates Aug 30, 2026
Keep SDIRK scratch ownership unchanged and use the existing Newton retry
logic for fixed-point recomputations. Cover failed first-stage retries and
both Robertson RHS forms through t=1 with three controller settings.

Merge current upstream master to validate the final patch against its base.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.153.4
Agent-Model: gpt-6-astra
Agent-Session: 01a07107-0ed2-7aa1-bfd7-561836cc87fd (local session; transcript: /home/crackauc/.codex/sessions/2026/09/05/rollout-2026-09-05T06-04-43-01a07107-0ed2-7aa1-bfd7-561836cc87fd.jsonl)
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Rebuild MethodOfSteps W after history updates Allow Newton refresh retries in MethodOfSteps Sep 5, 2026
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 7, 2026 06:22
@ChrisRackauckas
ChrisRackauckas merged commit 5a993f0 into SciML:master Sep 7, 2026
141 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 7, 2026
- DiffEqBase: wrap mass-matrix problems on the finite-difference promote_f path (#4459)
- Preserve the DAE step start during callback interpolation (#4466)
- Release DiffEqBase 7.20.1 (#4474)
- Release OrdinaryDiffEqCore 4.16.1 (#4475)
- Release OrdinaryDiffEqNonlinearSolve 2.9.5 (#4476)
- Run IDSolve's nonlinear solve at the integrator's tolerances (#4468)
- Build W through the allocating path for a sparse GPU Jacobian with a scalar mass matrix (#4452)
- Fix threaded stochastic work-precision isolation (#4462)
- Differentiate wrapped DAEFunctions with chunk size 1, like ODEFunctions (#4464)
- Rebuild MethodOfSteps W after history updates (#4396)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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