Skip to content

Fix ExplicitRK tableau c eltype for Float32 time - #4702

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:erk-tableau-c-eltype
Oct 3, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:erk-tableau-c-eltype

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

ExplicitRK cache construction previously set tableau c via promote_type(eltype(c), typeof(one(tType))), which left Float64 coefficients in place for Float32 time problems. Stage times t + c[i]*dt then promoted away from the FunctionWrapper signature under AutoSpecialize and raised NoFunctionWrapperFoundError. This narrows c to the dimensionless time type when both that type and the tableau eltype are IEEE floats (Float16/Float32/Float64); otherwise it keeps master's promote_type fallback so wider coefficient types (e.g. BigFloat) stay preserved and cache construction stays type-stable.

Rational time with the default Float64 tableau is not claimed fixed: Float64→Rational{Int} dyadic narrowing overflows for fine dt (e.g. 1//1000), and a Rational-built tableau already works on master for Rational{BigInt} time via promote_type (while Rational{Int} time still hits InexactError/OverflowError on both trees).

Verification

Failing before / passing after (src stashed to master helper vs fixed; same regression script):

Before (unfixed explicit_rk_caches.jl):

Float32 in-place ExplicitRK: Error During Test
  Got exception outside of a @test
  No matching function wrapper was found!
Test Summary:               | Error  Total  Time
Float32 in-place ExplicitRK |     1      1  13.8s
ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.

After (with fix):

Test Summary:               | Pass  Total  Time
Float32 in-place ExplicitRK |    3      3  19.0s
Test Summary:                              | Pass  Total  Time
ExplicitRKConstantCache c eltype inference |    1      1   1.6s

Float64 / BigFloat trajectories (adaptive=false, dt=0.1) were bitwise identical before vs after on this machine.

julia +1.10 (1.10.12) regression: Float32 3/3 pass, BigFloat-tableau @inferred 1/1 pass.

Test-group tails (Pkg.test("OrdinaryDiffEqExplicitRK"), GROUP=Core then GROUP=QA)

Test Summary:    | Pass  Total     Time
Generic RK Tests |   28     28  2m28.2s
     Testing OrdinaryDiffEqExplicitRK tests passed

Test Summary:    | Pass  Total     Time
Generic RK Tests |   28     28  2m34.2s
Test Summary:    | Pass  Total   Time
Allocation Tests |    1      1  49.5s
Test Summary: | Pass  Broken  Total     Time
JET Tests     |    1       2      3  1m14.3s
Test Summary: | Pass  Total     Time
Aqua          |   21     21  1m28.6s
     Testing OrdinaryDiffEqExplicitRK tests passed

Not verified

  • Downstream monorepo InterfaceI ode_numbertype_tests on this branch.
  • GPU / JLArray / Dual-Θ paths from the audit (out of scope for this fix).

Unitful time types were verified bitwise identical to master by the independent reviewer (Claude Code, claude-opus-5-5).

Reviewer pushback

  • Whether IEEE float narrowing (Float64→Float32 coefficients) should require round-trip exactness instead of always matching the time type (round-trip exactness would leave the Float32 bug in place for nodes like 0.2).
  • Whether a future PR should address Rational time with Rational-built tableaus / BigInt time only, rather than Float64→Rational conversion.

Please ignore until reviewed by @ChrisRackauckas.

Risk assessment

  • Risk: Low. Cache-only eltype choice for c; Float64/BigFloat/Unitful/Dual paths checked bitwise identical to master.
  • Blast radius: OrdinaryDiffEqExplicitRK ExplicitRK solves, especially Float32 time under AutoSpecialize.
  • Evidence: before/after regression logs; full sublibrary Core + QA green; julia 1.10 regression green; @inferred BigFloat tableau → concrete Vector{BigFloat} c.
  • Independent review: Claude Code (claude-opus-5-5) rated it low, high confidence: narrowing only applies IEEE-float tableaus to IEEE-float time; Float64/BigFloat/Unitful/Dual bitwise identical to master.
  • Round-2 review: Claude Code (claude-opus-5-5) MERGE, low risk, high confidence at 6a46d85: types-only narrowing, cache infers concretely, Float32 IIP fails on master and passes here.
  • Merge: auto-merge candidate once CI shows no new failures (bug fix, no public API change).
  • Merge: needs review

🤖 Generated with Cursor Agent 2026.09.28-64d2043 (model: unknown (Cursor auto)), transcript /home/crackauc/sandbox/goals/performance/jobs/pr-erk-c-eltype/log.txt on amdci2; orchestrated by Claude Code (claude-opus-5-5[1m]) https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv

Made with Cursor

ChrisRackauckas and others added 2 commits October 1, 2026 09:06
Prefer converting cache `c` to typeof(one(tType)) when exact (or IEEE
float narrowing) so AutoSpecialize FunctionWrappers keep matching stage
times; fall back to promote_type to preserve wider coefficient types.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent 2026.09.28-64d2043
Agent-Model: unknown (Cursor auto)
Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-erk-c-eltype/log.txt on amdci2
Drop value-dependent exact-conversion helpers and Float64→Rational
narrowing (overflows for fine dt). Keep IEEE→IEEE matching for the
Float32 FunctionWrapper fix; otherwise promote_type as on master.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent 2026.09.28-64d2043
Agent-Model: unknown (Cursor auto)
Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-erk-c-eltype/log.txt on amdci2
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Fix ExplicitRK tableau c eltype for Float32 and Rational time Fix ExplicitRK tableau c eltype for Float32 time Oct 1, 2026
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review October 3, 2026 11:51
@ChrisRackauckas
ChrisRackauckas merged commit 466327a into SciML:master Oct 3, 2026
130 of 134 checks passed
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>
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