Repository navigation
Correct and validate FBDF time and stability filters - #4484
ChrisRackauckas merged 5 commits into
Conversation
The time/stab filter merged in SciML#3878 called `backdiff`, `bdf_and_filt_coeff` and `bdf3stab_coeff`, none of which existed, so `FBDF(time_filter = true)` threw and JET's typo pass flagged the undefined globals. Add them in in-place form, together with the small divided-difference and step-ratio kernels the filter needs, and preallocate their time/coefficient buffers on both FBDF caches so the filter does not allocate per step. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent-Model: claude-opus-5-thinking-high Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish Co-authored-by: Cursor <[email protected]>
The filter was only wired into the out-of-place `perform_step!`, so `FBDF(time_filter = true)` silently fell back to plain FBDF for in-place problems. Lift both paths into `_fbdf_time_filter`/`_fbdf_time_filter!` with the same candidate selection, reusing the `u₀`/`terk_tmp`/`terkp1_tmp` scratch that is already dead by the time the error estimates are in, so the in-place path stays allocation free. The in-place step derives `fsallast` from the converged Newton condition rather than calling `f`, which is only valid at the nonlinear solution, so the filter now evaluates `f` itself whenever it moves `u`, and reuses that evaluation for its own residual-based error estimate. The order-4 candidate is skipped at `k == max_order` so the filter cannot emit a solution above the requested order, and the residual estimate falls back to halving the lower-order one under a mass matrix, where the identity it relies on does not hold. The out-of-place error estimates need no pre-filter copy since nothing between the solve and the filter mutates `u`. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent-Model: claude-opus-5-thinking-high Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish Co-authored-by: Cursor <[email protected]>
`fbdf_filter_accuracy.jl` was a benchmarking script that nothing ran, so it could not catch the missing helpers. Replace it with a test that exercises both the in-place and out-of-place filter paths on smooth, stiff and mass matrix problems, and pins the opt-in default by checking that `time_filter = false` reproduces plain `FBDF()` exactly. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent-Model: claude-opus-5-thinking-high Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish Co-authored-by: Cursor <[email protected]>
Derive the order-raising correction from the actual fixed-coefficient solve on unequal steps. Keep each candidate's state, derivative, error estimate, and reported order together, preserve BDF3-Stab at max_order=3, and use the selected order in step-size control. Repair filtered fixed-step history, restart bookkeeping, and dense output. Reject unsupported mass-matrix filtering explicitly and document the numerical and performance limits. The original PR fails 42 of the 70 primary regression assertions. The fixed implementation passes all 314 targeted assertions, including irregular-grid local convergence, candidate control, dense output, callbacks, and restarts. 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: local transcript /home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl
Qualify the Core controller and interpolation functions through their public owner. The aliases resolve to identical function objects; all 314 targeted assertions still pass. 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: local transcript /home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl
|
Completion changes are pushed, and the draft description now contains the numerical scope, failing-before/passing-after evidence, and measured performance limitations. Local validation: Core 713 passed / 2 pre-existing broken; QA 43 passed / 41 pre-existing broken; docs build, Runic, spelling, and diff checks passed. All 314 targeted assertions pass; the original PR fails 42 of the 70 primary regression assertions. The added filtered IIP runtime allocation checks observed zero allocations. No tests were skipped or marked broken for this work. The filter now uses weights derived for the fixed-coefficient solve, returns the selected state with its matching error/derivative/order, retains BDF3-Stab at max_order=3, and handles dense output, fixed-step history, and restarts. Mass matrices other than the default I are rejected explicitly for filtering. The scalar decay benchmark does not demonstrate a speedup. CI is now pending. Links🤖 Completed with Codex CLI 0.153.4 (model: gpt-6-astra; local session transcript: |
bdf_step_reject_controller! selects the next step size with min(h, hₖ₋₁) / hₖ₋₁ > hₖ on the signed step sizes h = dt/2, F·h. For tdir < 0 (backward integration, e.g. adjoint solves) dt is negative, so min picks the candidate with the *larger* magnitude. On repeated failures the retry dt can stay at a fixed point with EEst > 1 forever, looping until maxiters. This showed up as SciMLSensitivity DAE-adjoint tests failing on Julia 1.13 after the FBDF reinit ordering fix (#4484) moved restarts onto this path. Do the step-size selection on magnitudes and restore the sign via integrator.tdir when writing back integrator.dt. Behavior is unchanged for forward-in-time integration (tdir = 1). Agent-Harness: Devin CLI 3000.10.21 Agent-Model: SWE-2 High Agent-Session: local Devin CLI session (no shareable URL); session db at /home/crackauc/.local/share/devin/cli/sessions.db Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Precompile SDE solves through specialization levels (#4467) - Add 32-bit InterfaceI CI lane via test_groups.toml (#4480) - incorporate time/stab filter for larger steps in FBDF (#3878) - Keep 32-bit CI lane hard-failing. (#4482) - Correct and validate FBDF time and stability filters (#4484) - Keep DAE init from overwriting uprev during callback truncation (#4486) - DiffEqBase: Int64 interp_points range length for 32-bit (#4487) - Release OrdinaryDiffEqBDF 2.4.7 (#4490) - Unify companion global error estimators into GlobalErrorEstimation (#4492) - Add adjoint-based global error control as a SciMLSensitivity extension (#3953) 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]>
Please ignore this draft until reviewed by @ChrisRackauckas.
The original filter used variable-coefficient BDF weights with FBDF's fixed-coefficient solve, returned filtered states even when selecting an unfiltered error estimate, and disabled BDF3-Stab at
max_order=3. This completes the implementation with a correction derived from the actual fixed-coefficient equation, consistent candidate selection and step control, and discriminating numerical tests. The option remains off by default.Changes
k+1; it reduces to the paper's weight on equal steps. Estimate the higher candidate's defect using the higher-order BDF residual on the available history.qwaitandmax_order.time_filter=truewith a mass matrix other than the defaultIexplicitly. The previous half-error fallback was not a justified estimator. Its filtered-DAE success test is replaced by explicit rejection tests and checks that ordinary FBDF still solves the DAE; no test is skipped or marked broken to accommodate this change.max_order=3.Verification
Julia 1.12.4. Commands below use the repository root unless otherwise indicated.
Failing before, running the same regression file against a clean worktree at the original PR head:
julia --project=../filter-unfixed/lib/OrdinaryDiffEqBDF -e 'include("lib/OrdinaryDiffEqBDF/test/fbdf_filter_regression_tests.jl")'Passing after:
julia --project=lib/OrdinaryDiffEqBDF -e 'include("lib/OrdinaryDiffEqBDF/test/fbdf_filter_regression_tests.jl"); include("lib/OrdinaryDiffEqBDF/test/fbdf_time_filter_tests.jl")'All 314 assertions passed across these testsets, including:
From
lib/OrdinaryDiffEqBDF:Core exited 0: 713 passed, 2 pre-existing broken, 715 total. Its final summaries included:
The 41 broken QA cases were already present; none were added or disabled. The added filtered IIP runtime allocation cases observed zero allocated bytes.
julia --project=docs docs/make.jlexited 0; document checks and rendering completed with page/search-size warnings, and deployment was skipped locally. Runic.jl 1.7.0 formatting checks,typoson touched files, andgit diff --checkpassed.Numerical scope and performance
The fixed-coefficient weight is an extension of the cited construction, tested for local order on unequal grids. The paper's constant-step BDF3-Stab stability result is not a general G-stability proof for arbitrary unequal-step sequences. This mathematical extension and the explicit mass-matrix restriction deserve review.
No speedup is claimed. For scalar exponential decay, scanning tolerances
10.^(-(5:0.25:12)), the best observed RHS counts meeting each maximum saved-point absolute-error target were:1e-71e-9Not verified locally: GPU group, Float32/BigFloat and unitful states, or reverse-mode differentiation through filtered solves. Existing GPU CI coverage does not by itself establish support for the opt-in filter.
CI on the final revision
Final revision: bfd0b92
All 141 PR checks completed: 138 successful, 3 skipped, 0 failed. Main CI, sublibrary CI, documentation, downstream integration tests, and downgrade workflows succeeded. The BDF logs on Julia LTS and current Julia each report 41 time-filter tests and 273 filter regressions passing. BDF QA reports allocation tests 4 passed / 18 existing broken, JET 18 passed / 23 existing broken, and Aqua 21 passed. The final downstream logs explicitly report
Testing SciMLSensitivity tests passedandTesting PositiveIntegrators tests passed.A separate Dependabot Auto-merge workflow has a startup failure with no jobs or PR checks: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/34214152358. This predates the completion changes and also occurred on the original PR revision: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/34156404606. It is not a failing test and was not changed in this numerical PR.
Links
Original Cursor attribution remains in the earlier commit trailers.
🤖 Completed with Codex CLI 0.153.4 (model: gpt-6-astra; local session transcript:
/home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl).