Repository navigation
Make event tests independent of @muladd fusion differences - #4594
Merged
ChrisRackauckas merged 1 commit intoSep 23, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
The saveat-at-event tests took the event time from a `save_everystep = false` solve and reused it as `saveat` in solves with a different integrator type. Since SciML#4376 the former can run pkgimage code while the latter is JIT-compiled, and `@muladd` may fuse differently in code compiled for different CPU targets, so the located root moved by a few ULPs and the exact-equality checks failed. The event time is now found with a scalar `saveat` solve that shares the integrator type. The AutoTsit5-vs-Tsit5 TerminateSteadyState check compared two different compiled algorithms bitwise; it now requires the same step count and agreement to rtol = 1e-5 per step (observed drift up to 7e-7, solver reltol 1e-3). Fixes SciML#4589 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Agent-Harness: Claude Code Agent-Model: claude-opus-5-5[1m] Agent-Session: https://claude.ai/code/session_012H1cxx1FFbAEP7nkpdapJc Claude-Session: https://claude.ai/code/session_012H1cxx1FFbAEP7nkpdapJc
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.
Fixes #4589. Test-only change.
What changed and why
@muladdlets LLVM either fuse into an FMA or not, depending on the CPU target the code was compiled for. Since #4376, a default AutoSpecialize solve with a callback can run code from the pkgimage, while a solve with a different integrator type (e.g.saveat = t), and every FullSpecialize solve, is JIT-compiled. When the pkgimage target and the JIT target fuse differently, the located event time moves by a few ULPs. The package is behaving within@muladdsemantics. The tests assumed bitwise equality across different compiled methods.saveatat the event time (ContinuousCallback and VectorContinuousCallback blocks):tis now found with a scalarsaveat = tspan[2]solve. That solve shares its integrator type, and so its compiled code, with thesaveat = t/saveat = t - eps(t)solves. All the exact assertions are kept.TerminateSteadyState(wassol.u == sol1.u): these are inherently different compiled methods. The test now requires the same step count and per-steprtol = 1e-5. Observed drift is up to 7e-7 relative, from rounding-level differences amplified by the step controller; the solver's reltol is 1e-3.Verification
Reproduced on x86 (znver2) by building pkgimages with
JULIA_CPU_TARGET=generic(no FMA) and running natively. Pkgimages built forhaswell(which has FMA) make all variants agree, which confirms FMA fusion is the cause on x86.Before (master, generic pkgimages),
test/Integrators_I/ode_event_tests.jl. These are the same 7 assertions as in the issue:After, same setup:
After, normal setup,
GROUP=Integrators_I: Reinit 31/31, Events 58/58, Alg Events 177/177, Discrete Callback Dual 4/4, Callback Allocation (1 pre-existing broken), Iterator 15/15, Integrator Interface 36/36, Symbolic Interpolation 12/12, Error Check 10 + 1 pre-existing broken, Event Detection 23/23, Event Repetition 6/6.Runic and typos are clean on the changed file.
Not verified
Integrators_Itestsets (Multi-VCC Mask, Step Limiter, Discontinuity Detection) were cut off by my local 1 h timeout. They do not touch the changed file.For the reviewer
The line-398 change replaces exact equality with a tolerance. The justification is in the comment next to it and above.
🤖 Generated with Claude Code (model: claude-opus-5-5[1m])
https://claude.ai/code/session_012H1cxx1FFbAEP7nkpdapJc