Repository navigation
Make FBDF/DFBDF dense interpolation allocation-free - #4645
Merged
ChrisRackauckas merged 2 commits intoSep 28, 2026
Merged
Conversation
_CHEB_NODES and _BARY_WEIGHTS are tuples of differently sized tuples, so indexing them with the runtime active order in the _ode_interpolant(!) methods was type-unstable and boxed the lookup result. sol(out, t) on an in-place FBDF ROBER solution allocated 128 bytes per call. The interpolant bodies now live in _fbdf_interp(!) kernels dispatched on a literal Val(1)..Val(6) through an unrolled branch, giving each kernel a statically known order so the table lookups constant-fold. QNDF and Nordsieck interpolants index homogeneous containers and are unchanged. Derivative orders above 3 still throw DerivativeOrderNotPossibleError and active orders above 6 BoundsError, matching the previous behavior. Measured on ROBER with FBDF, 1,000 sol(out, t) calls (single thread): 128 B -> 0 B per call and ~286 us -> ~165 us minimum. Interpolated values are bitwise identical to master at all 1,000 sample points. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: devin 3000.11.1 Agent-Model: swe-2-high Agent-Session: local Devin session in /home/crackauc/sandbox/goals/performance/jobs/pr-bdf/repo (log /home/crackauc/sandbox/goals/performance/jobs/pr-bdf/log.txt)
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: devin 3000.11.1 Agent-Model: swe-2-high Agent-Session: local Devin session in /home/crackauc/sandbox/goals/performance/jobs/pr-bdf/repo (log /home/crackauc/sandbox/goals/performance/jobs/pr-bdf/log.txt)
ChrisRackauckas
marked this pull request as ready for review
September 28, 2026 11:56
ChrisRackauckas
referenced
this pull request
Sep 29, 2026
* Bump DiffEqBase to 7.21.3 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.11.3 (Mac) Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json * Bump OrdinaryDiffEqBDF to 2.4.12 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.11.3 (Mac) Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json * Bump OrdinaryDiffEqSDIRK to 2.9.7 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.11.3 (Mac) Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json * Bump OrdinaryDiffEqRosenbrock to 2.7.5 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.11.3 (Mac) Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json * Bump OrdinaryDiffEqLowOrderRK to 2.2.6 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.11.3 (Mac) Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json * Bump OrdinaryDiffEqTsit5 to 2.1.5 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.11.3 (Mac) Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json * Bump OrdinaryDiffEqVerner to 2.4.2 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.11.3 (Mac) Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json * Bump OrdinaryDiffEqSymplecticRK to 2.2.3 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.11.3 (Mac) Agent-Model: Fusion (claude-opus-5-5 medium + swe-2 medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/helpful-exception.json --------- Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lib/OrdinaryDiffEqBDF/src/bdf_interpolants.jlindexed the per-order tables_CHEB_NODES[n]and_BARY_WEIGHTS[n]with the runtime active ordern = _bdf_active_order(k). Both tables are tuples of differently sized tuples, so the lookups were type-unstable and boxed the result:sol(out, t)on an in-place FBDF solution allocated 128 bytes per call.The FBDF/DFBDF interpolation bodies now live in
_fbdf_interp(!)kernels that take the order as a::Val{n}parameter. The two_ode_interpolant(!)entry points dispatch to them through an unrolled branch over literalVal(1)–Val(6), so every kernel sees a statically known order and the table lookups constant-fold to concreteNTupletypes. QNDF and Nordsieck interpolants only index homogeneous containers and are unchanged. Behavior is preserved: derivative orders without a kernel still throwDerivativeOrderNotPossibleError, and an active order above 6 still throwsBoundsError(the tables have 6 entries).Verification
Profile.Allocson master attributes the allocations tobdf_interpolants.jl:386-387(getindexon the two tuples), 95,936 B sampled per 1,000 calls — matching the prior audit.test/qa/allocation_tests.jl:@allocated sol(out, t)and@allocated sol(out, t, Val{1})inside a function after warmup.fbdf_dense_interp_allocs() = (128, 384)→ test fails.fbdf_dense_interp_allocs() = (0, 0)→ test passes.Val{0}–Val{3},idxsandnothingvariants, and in-place/out-of-place forms — except 12 values (scalar-ODEVal{1}outputs on tinydt ≈ 1e-12first steps). Those differ at ulp-amplified level because the order-unrolled@muladdkernel changes FMA/summation order relative to the runtime-indexed loop; magnitudes are within normal floating-point reassociation noise.--checkandtyposclean on the changed files.GROUP=CoreandGROUP=QAfor OrdinaryDiffEqBDF both pass locally (Pkg.test, Julia 1.12.4): all 14 Core testsets pass, and QA passes with the new allocation test among the 5 runtime-allocation passes.Benchmarks
1,000
sol(out, t)calls on the in-place FBDF ROBER problem (reltol = abstol = 1e-8,dense = true),JULIA_NUM_THREADS=1 taskset -c 4, Julia 1.12.4, 3 repetitions (minimum over 7 samples each):@allocated sol(out, 1.0): 128 B → 0 B;@allocated sol(out, 1.0, Val{1}): 384 B → 0 B.Profile.Allocson this branch records zero allocations from the interpolation path.What was not verified
GROUP=GPU) tests — no GPU runner available locally; the new dispatch path uses only staticValbranches and athrow, so it should remain GPUCompiler-safe.elsefallback (n > 6) is unreachable in practice because the tables cap the active order at 6.Please ignore until reviewed by @ChrisRackauckas.
Risk assessment
Val{1}reassociation cases noted above).🤖 Generated with Devin (model: swe-2-high), orchestrated by Claude Code (claude-opus-5-5[1m]) session https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
Risk assessment
_ode_interpolant(!)are declared public extension points. The description discloses floating-point differences in 12 scalar derivative values; no breaking SemVer change identified.master: GPU / Tests - GPU (Julia 1)—QNDFgpu_mismatch(head, master); downgrade-sublibraries / test (lib/DiffEqBase)—despecialized callback assertions (head, master); downgrade-sublibraries / test (lib/OrdinaryDiffEqDifferentiation)—missingdiag(::ScalarOperator)(head, master); SciMLSensitivity.jl/Core1/1—MooncakeAnyconstructor error (head, master). These are pre-existing. SciMLSensitivity.jl/Core5/1 failshybrid_de.jl:64,15.393055f0 < 1.0, on head, but passes on preceding master and recent master: regression under the stipulated merge bar, with causation unresolved. BDF Core, QA, GPU, and downgrade checks pass. No review comments exist.🤖 Risk assessment posted by an AI agent (fleet master) — harness: Codex CLI 0.156.1 (Mac) / gpt-6-astra; dispatched by Claude Code head, model claude-opus-5-5[1m]
Conversation: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 on Chris's Mac (session ID, no URL)