Repository navigation
Give SSPRK932 its own fsalfirst buffer - #4357
Merged
Merged
Conversation
singhharsh1708
force-pushed
the
fix-ssprk932-fsal
branch
from
August 24, 2026 07:43
33d7cbe to
d5caa5b
Compare
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.
SSPRK932is third order with dense output on and first order with it off.Measured against a fine
SSPRK104reference, overdt = 2^-4 … 2^-8:Cause
With no dense output, no intermediate saves, no callbacks and no
saveat, theintegrator sets
calck = false, and the in-place SSPRK caches then aliasfsalfirsttokto save an allocation(
lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl):Seventeen SSPRK caches do this, and for sixteen of them it is fine: they write
fsalfirstonce at the top of the step and never read it again.SSPRK932isthe exception. Its
u6*stage reads the value back out:By the time that line runs,
fsalfirstholdsf(u5)orf(u6)instead off(uprev).isfsal(::SSPRK932) == false, so this is not an FSAL value beingcarried between steps — it is a scratch buffer the method needs to keep for the
whole step, and it cannot share storage with
k.Fix
Always allocate
fsalfirstforSSPRK932. The other sixteen caches keep thealias.
This costs one array.
SSPRK932needsf(uprev)alive for the whole step whilekis reused by every stage, so there is no way for it to be both correct andshare the buffer. The storage assertions in the
SSPRK932block go from<= 6/<= 5to<= 7/<= 6(measured: 7 and 6). No other method's storagechanges --
SSPRK33is 4/3,SSPRK43andSSPRK104are 6/5, unchanged.Testing
Swept all sixteen exported SSPRK methods for a
dense=truevssave_everystep=false, dense=falseorder gap.SSPRK932was the only oneaffected, and it is 2.99 in both columns after this change.
lib/OrdinaryDiffEqSSPRK/test/ode_ssprk_tests.jlgains a testset that runs theexisting convergence problems with
save_everystep = false, dense = falseforSSPRK932plusSSPRK33/SSPRK43as controls. Every convergence test in thatfile currently runs with the default
calck = true, which is why this was notcaught. The new testset fails on master and passes here.
Bumps
OrdinaryDiffEqSSPRKone patch from master.AI Disclosure
Claude assisted with this change.