Skip to content

Fix OrdinaryDiffEqStabilizedRK cache/JET failures from #3420 and #3439 - #3442

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-stabilizedrk-svector-and-tsrkc3-undefvar
Apr 15, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-stabilizedrk-svector-and-tsrkc3-undefvar

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Summary

Two unrelated failures are hitting the OrdinaryDiffEqStabilizedRK_QA sublibrary job:

  1. Latent cache-construction bug exposed by Standardize QA test environments across sublibraries #3439. With QA now running in its own isolated test/qa/Project.toml, StaticArrays is no longer in the dep graph, only StaticArraysCore. That breaks the stabilized-RK caches three ways:

    • SERK2 / ESERK4 / ESERK5 — struct fields are SVector{N, Int} but the tableaus return plain Vector{Int}; there is no convert(SVector, Vector) in StaticArraysCore.
    • ROCK2 / ROCK4 — tableaus call SVector{46,Int}(x1, …, x46) / SVector{50,Int}(…); the varargs constructor is not in StaticArraysCore.
    • ROCK4 perform_step! — indexes fpa[i][j] over entries built as SVector{6, Float64}; getindex(::SArray, ::Int) is not in StaticArraysCore.

    These allocate-once-per-solve fields do not need the SVector specialization — they are indexed by a runtime deg_index in the hot loop, which is no faster on SVector than on Vector / NTuple. Switching ms / fp1 / fp2 / Cᵤ / Cₑ struct fields to Vector{T} and the ROCK4 per-step blocks from SVector{N, T} to NTuple{N, T} removes the StaticArrays requirement without touching numerics. Verified by the Core test suite below.

  2. TSRKC3 undefined-variable regression from TSRKC3 method #3420. dtsw0 and d2tsw0 are defined only in the else branch (!rkcstep) at rkc_perform_step.jl:1108–1109 / 1238–1239, then read unconditionally in if (!rkcstep) later at 1168 / 1298. The two ifs are correlated so it runs fine, but JET (correctly) flagged both as may be undefined, failing the JET test. Pre-initializing both to zero(typeof(cache.tsw0)) / zero(typeof(constantcache.tsw0)) before the branch makes the definitions dominate every use.

Test plan

Run locally on Julia 1.12.5 in the standardized QA env and the Core env:

  • ODEDIFFEQ_TEST_GROUP=QA julia --project=. -e 'using Pkg; Pkg.test()' → Allocation Tests 6 broken (expected, broken=true in the test), JET 1 pass, Aqua 11 pass.
  • ODEDIFFEQ_TEST_GROUP=Core julia --project=. -e 'using Pkg; Pkg.test()' → RKC Tests 84 pass (covers ROCK2, ROCK4, RKC, TSRKC3, SERK2, ESERK4, ESERK5 — numerical behavior preserved).
  • CI green on the affected-sublibraries matrix.

Bumps OrdinaryDiffEqStabilizedRK from 1.11.0 to 1.11.1.

🤖 Generated with Claude Code

…ly import

The package imports SVector from StaticArraysCore rather than full
StaticArrays, which only supplies the tuple-form constructor and
leaves out the varargs constructor and getindex. In the isolated QA
test environment (no transitive StaticArrays) this surfaced two
distinct failures:

1. SERK2, ESERK4, ESERK5 cache construction failed because the
   struct fields ms/Cᵤ/Cₑ were typed as SVector{N, Int} but the
   tableaus returned plain Vector{Int}, and no Vector -> SVector
   convert method was available.
2. ROCK2 and ROCK4 cache construction failed because the tableaus
   called SVector{N, Int}(args...) with 46 / 50 varargs, a
   constructor not defined in StaticArraysCore.
3. ROCK4 perform_step failed with CanonicalIndexError on
   SVector{6, Float64} because StaticArraysCore does not define
   getindex for SArray.

Switch the ms / fp1 / fp2 / Cᵤ / Cₑ struct fields to plain Vector
(they are built once per cache at solve time and indexed, so the
SVector specialization is not buying anything in the hot loop) and
drop the SVector wrapping from the ROCK2 / ROCK4 tableaus. Convert
the ROCK4 per-step tableau blocks from SVector{N, T} to NTuple{N, T}
to preserve the static-length, tuple-indexable shape without
requiring the full StaticArrays package.

Also fix a separate JET regression introduced in SciML#3420 (TSRKC3):
dtsw0 and d2tsw0 are defined only in the non-rkcstep branch but
read unconditionally in a later if (!rkcstep) block; JET flagged
them as possibly-undefined. Initialize both to
zero(typeof(cache.tsw0)) (and the constantcache variant) before
the branch so the definitions dominate every use.

Fixes CI failures in the OrdinaryDiffEqStabilizedRK_QA sublibrary
job exposed by SciML#3439 and the TSRKC3 JET failure introduced by SciML#3420.

Co-Authored-By: Chris Rackauckas <[email protected]>
@ChrisRackauckas
ChrisRackauckas merged commit 27a5304 into SciML:master Apr 15, 2026
87 of 92 checks passed
singhharsh1708 pushed a commit to singhharsh1708/OrdinaryDiffEq.jl that referenced this pull request Apr 16, 2026
…ly import (SciML#3442)

The package imports SVector from StaticArraysCore rather than full
StaticArrays, which only supplies the tuple-form constructor and
leaves out the varargs constructor and getindex. In the isolated QA
test environment (no transitive StaticArrays) this surfaced two
distinct failures:

1. SERK2, ESERK4, ESERK5 cache construction failed because the
   struct fields ms/Cᵤ/Cₑ were typed as SVector{N, Int} but the
   tableaus returned plain Vector{Int}, and no Vector -> SVector
   convert method was available.
2. ROCK2 and ROCK4 cache construction failed because the tableaus
   called SVector{N, Int}(args...) with 46 / 50 varargs, a
   constructor not defined in StaticArraysCore.
3. ROCK4 perform_step failed with CanonicalIndexError on
   SVector{6, Float64} because StaticArraysCore does not define
   getindex for SArray.

Switch the ms / fp1 / fp2 / Cᵤ / Cₑ struct fields to plain Vector
(they are built once per cache at solve time and indexed, so the
SVector specialization is not buying anything in the hot loop) and
drop the SVector wrapping from the ROCK2 / ROCK4 tableaus. Convert
the ROCK4 per-step tableau blocks from SVector{N, T} to NTuple{N, T}
to preserve the static-length, tuple-indexable shape without
requiring the full StaticArrays package.

Also fix a separate JET regression introduced in SciML#3420 (TSRKC3):
dtsw0 and d2tsw0 are defined only in the non-rkcstep branch but
read unconditionally in a later if (!rkcstep) block; JET flagged
them as possibly-undefined. Initialize both to
zero(typeof(cache.tsw0)) (and the constantcache variant) before
the branch so the definitions dominate every use.

Fixes CI failures in the OrdinaryDiffEqStabilizedRK_QA sublibrary
job exposed by SciML#3439 and the TSRKC3 JET failure introduced by SciML#3420.

Co-authored-by: ChrisRackauckas-Claude <[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