Repository navigation
Fix PDIRK44 DimensionMismatch on callback resize! - #4744
Merged
ChrisRackauckas merged 3 commits intoOct 7, 2026
Merged
Conversation
k1/k2 are Array{rateType} so full_cache never reaches the stage vectors;
add resize_non_user_cache! (and cover deleteat! via the same hook).
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent 2026.10.01-14929f9
Agent-Model: unknown (Cursor auto)
Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-pdirk-resize/log.txt on amdci2
Parameterize grow/shrink and deleteat! regressions over both Boolean threading modes so the default two-nlsolver path is protected. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-pdirk-resize/log.txt on amdci2
…resize PDIRK stores nlsolver as an Array; pre-2.9.9 resize_nlsolver! still accessed .alg on the container after resizing elements, so downgrade CI failed the new resize regression. Align Core/Differentiation/SciMLBase floors with 2.9.9. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-pdirk-resize/log.txt on amdci2
ChrisRackauckas
marked this pull request as ready for review
October 7, 2026 04:54
This was referenced Oct 8, 2026
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>
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
PDIRK44Cache.k1/k2areArray{rateType}(vectors of stage vectors), so@cache'sfull_cachenever reaches them and a callbackresize!(integrator, n)leaves the stage buffers at the old length —perform_step!then hitsDimensionMismatch. This addsresize_non_user_cache!forPDIRK44Cache(same SciMLBase hook as SDC #4673 / ABM #4703 / BDF #4719), resizing everyk1[i]/k2[i]and the nested nlsolvers sodeleteat!(which only calls that hook) stays consistent. Regression test: coupled linearu'=Au(nonzero off-diagonals), grow 2→3 then shrink back viaDiscreteCallback, compared to piecewiseexp(At)atrtol=1e-8; also coversdeleteat!. Both Booleanthreadingmodes (falseand defaulttrue) are exercised independently. The grow callback initializes the newuprevslot (see #4722).Compat: raised
OrdinaryDiffEqNonlinearSolvefloor from2.9.1to2.9.9(and alignedOrdinaryDiffEqCore/OrdinaryDiffEqDifferentiation/SciMLBasewith 2.9.9's floors). PDIRK storesnlsolveras anArray; pre-2.9.9resize_nlsolver!resized each element but still accessed.algon the container (type Array has no field alg), which broke downgrade-sublibraries CI on the new resize test. Verified: pinned=2.9.1fails that way; pinned=2.9.9and current env both Pass 14.Scope: in-place
PDIRK44Cache/Vectorstate only. Out-of-place RHS /PDIRK44ConstantCachecallback resize is not covered and still fails (MethodErroronfull_cache(::PDIRK44ConstantCache...)); that needs a separate constant-cache + mutable-nlsolver resize change.Evidence
Failing before (src stashed;
includeofpdirk_resize_tests.jlon Julia 1.12.4):Passing after (round 2/3, Julia 1.12,
--threads=4):Downgrade repro (scratch env,
OrdinaryDiffEqNonlinearSolve = "=2.9.1"):FieldError: type Array has no field algon grow/shrink for both threading values. Same env with=2.9.9: Pass 14.Logs: job dir
before.txt/after.txt(round 1); round 2 resize smoke inscratch/resize_r2.log; round 3 downgrade inscratch/downgrade_fail.log/scratch/downgrade29_pass.log. Also passes on Julia 1.10.12 (round 1/2).Test-group tails
Core (
GROUP=Core Pkg.test,--check-bounds=yes):QA (
GROUP=QA Pkg.test,--check-bounds=yes --threads=4, round 2):Not verified
PDIRK44ConstantCacheresize (explicitly unsupported; fails at callback on base and this branch).Sequential(),BaseThreads(),PolyesterThreads()) — fail atalg_cacheconstruction with non-BooleanTypeErroron base as well.Vectorstate types under resize.uprevslots on every resize (resize! in a callback leaves new uprev/uprev2 entries uninitialized; ImplicitEuler EEst reads them (nondeterministic Unstable) #4722); test only sets them in the grow callback.Reviewer pushback
resize!path (Core'sresize_nlsolver!then this hook) worth avoiding by only resizingk1/k2here?deleteat!needs the nlsolver resize in this hook because it does not callresize_nlsolver!.deleteat!properlydeleteat!stage indices instead of truncating viaresize!(default Core policy: "ordering doesn't matter in deterministic cache")?dt=1e-3choice for the coupled-linear exact comparison.Please ignore until reviewed by @ChrisRackauckas.
Risk assessment
Independent review: Codex CLI (gpt-6-astra) rated it medium, high confidence: in-place resize correct against exp(At); round 2 adds threading=true coverage and scopes OOP; round 3 raises NonlinearSolve floor to 2.9.9 for downgrade CI (
Arraynlsolver.algbug).🤖 Generated with Cursor Agent 2026.10.01-14929f9 (model: unknown (Cursor auto)), transcript /home/crackauc/sandbox/goals/performance/jobs/pr-pdirk-resize/log.txt on amdci2; orchestrated by Claude Code (claude-opus-5-5[1m]) https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
Made with Cursor
Risk assessment
Risk: low
Blast radius: Only
OrdinaryDiffEqPDIRK. The code change is a newresize_non_user_cache!(::ODEIntegrator, ::PDIRK44Cache, i)method, so it only runs when someone callsresize!ordeleteat!on an in-place PDIRK44 integrator. That case threwDimensionMismatchbefore this PR. All other paths are unchanged. The compat floors inlib/OrdinaryDiffEqPDIRK/Project.tomlgo up: OrdinaryDiffEqCore 4.6→4.13, OrdinaryDiffEqDifferentiation 3.3→3.10, OrdinaryDiffEqNonlinearSolve 2.9.1→2.9.9, SciMLBase 3.39→3.46. Users pinned below those floors will not resolve the next PDIRK release. LinearAlgebra is added as a test-only dependency (stdlib, MIT). Public API is unchanged, so no SemVer major bump is needed. The PR does not change the PDIRK version number.Evidence: On head
1f886de, 127 checks pass, 4 fail and 1 is skipped (the matrix-template placeholder). All 4 failures are pre-existing: each also fails on the currentmastertip4a5c0e7and on the PR base217e0ad.downgrade-sublibraries / test (lib/DiffEqBase): failures in DiffEqBasehigh_level_solve.jl:94–101, which has nothing to do with PDIRK.downgrade-sublibraries / test (lib/OrdinaryDiffEqDifferentiation)tests / GPU (julia 1, self-hosted Linux X64 gpu) / Tests - GPU (Julia 1)SciMLSensitivity.jl/Core1/1 / Downstream Tests - Core1Every PDIRK check passes on head:
downgrade-sublibraries / test (lib/OrdinaryDiffEqPDIRK), which confirms the new floors work in CI;sublibrary-ci / lib/OrdinaryDiffEqPDIRKCore on Julia 1, lts and pre; and PDIRK[QA].downgrade-sublibrariesfor Core and NonlinearSolve also pass. No regressions.Other findings:
exp(At)atrtol=1e-8on a coupled system.nls.cache.firstcalland callsresize!(nls, integrator, i). Both are non-public, but they live in sibling packages in the same monorepo, and the code matchesresize_nlsolver!in OrdinaryDiffEqNonlinearSolve and the already-merged SDC hook line for line.ODEIntegratorandisnewtonare declared public in OrdinaryDiffEqCore.resize!path the nlsolvers are resized twice, by Core'sresize_nlsolver!and then by this hook. The second call resizes to the same length, so it is harmless.ODEIntegrator/isnewtonimports. Nothing material is left out.Independent review: Devin CLI (Mac) / fusion-claude-opus-5-5-high-sidekick-swe-2-medium rated it low, high confidence: the new method only runs on a resize path that threw before, it copies the merged SDC resize pattern, and every PDIRK check including downgrade passes, with all 4 head failures also red on
master.Merge: auto-merge candidate. It is still a draft and the body says "Please ignore until reviewed by @ChrisRackauckas", so it has to be marked ready first. The design questions the description raises (OOP/constant-cache resize as a follow-up, the double nlsolver resize) do not block merging.
🤖 Risk assessment posted by an AI agent (fleet master) — harness: Devin CLI (Mac) / fusion-claude-opus-5-5-high-sidekick-swe-2-medium; dispatched by Devin CLI 3000.11.3 (Mac) fleet-master caretaker, model Fusion (claude-opus-5-5 medium + swe-2 medium)
Conversation: local transcript ~/.local/share/devin/cli/transcripts/speckle-whale.json (Chris's Mac)