Repository navigation
Drop @fastmath from ODE_DEFAULT_NORM so isnan/isfinite guards survive - #4600
Draft
ChrisRackauckas-Claude wants to merge 4 commits into
Draft
ChrisRackauckas-Claude wants to merge 4 commits into
ChrisRackauckas-Claude wants to merge 4 commits into
Conversation
@fastmath/sqrt_fast emit LLVM nnan/ninf flags that let the optimizer fold away isnan/isfinite on the inlined norm result. Use @simd for Array reductions to keep reassoc+contract vectorization. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.18-9a7762b Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/OrdinaryDiffEq.jl/jobs/4595-cursor/log.txt on amdci2.julia.csail.mit.edu
Assert inside compiled wrappers: a top-level check does not reproduce the LLVM fold (OrdinaryDiffEq.jl#4595). Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.09.18-9a7762b Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/OrdinaryDiffEq.jl/jobs/4595-cursor/log.txt on amdci2.julia.csail.mit.edu
This was referenced Sep 23, 2026
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4600 (no session URL)
Include the upstream TaylorDiff 0.3.6 compatibility floors and current master changes. The diff against master remains the norm implementation and tests. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4600 (no session URL)
This branch has not been deployed
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.
Please ignore until reviewed by @ChrisRackauckas.
Summary
DiffEqBase.ODE_DEFAULT_NORMused@fastmath/Base.FastMath.sqrt_fast, whose LLVMnnan/ninfflags let the optimizer fold awayisnan/isfiniteon the inlined result (g(u) = isnan(ODE_DEFAULT_NORM(u,0.0))compiled toret i8 0). Same hazard as SciML/NonlinearSolve.jl#1182. Dropped@fastmath/sqrt_fastand added@simdon theArrayreductions soreassoc+contractstill vectorize. Zip keeps a plain@inboundsloop (@simdrequiresfirstindex).Numerical behaviour on a smooth problem is unchanged (Tsit5 Lorenz step counts and
u_endidentical). Not a breaking change; no version bump.Fail-before / pass-after
Negative control: only
src/common_defaults.jlreverted to master; new test inode_default_norm.jlkept:With the fix:
Compiled check after fix:
g([NaN,0.5]) === true,h([Inf,0.5]) === false, and@code_llvm gno longer returnsret i8 0.Codegen / allocations (
ODE_DEFAULT_NORM(::Vector{Float64}, ::Float64))Dropping
@fastmathalone kills vectorization (<4 x double>21→0). Adding@simdrestores it. Counts measured in-process (load-independent):@fastmath)@simd, no fastmath)<4 x double>/fmul/faddfastreassoc,contractvfmadd/vaddpd/vmulpdSame vector width and flop scale; native mix shifts from separate mul/add under
fastto FMA underreassoc/contract(as in NonlinearSolve#1182 after they already had@simd). No wall-clock claim.Tsit5 spot-check (Lorenz, t∈[0,100], reltol=abstol=1e-6)
Commands run
What I did NOT verify
Reviewer pushback
@simdon thef-weighted Array method is always valid whenfhas side effects (same assumption@fastmathpreviously made about independence).@code_llvm-based assertion should lock out reintroduction of@fastmath(the behavioural test only bites when the optimizer folds).Fixes #4595
Please ignore this draft until reviewed by @ChrisRackauckas.
Harness: Cursor Agent CLI 2026.09.18-9a7762b · model: auto · transcript: /log.txt
Risk assessment (independent review, Codex CLI 0.164.0-alpha.11.1 gpt-6-astra, slot 1, head 545ebc8)
Review round 1, written by the reviewer named above (Codex CLI 0.164.0-alpha.11.1 / gpt-6-astra) in a session other than the PR author's, and copied here by the posting agent without change to its findings. The posting agent did not re-run the reviewer's commands.
Summary: Removes fast-math assumptions from the default RMS norm so compiled NaN/Inf guards remain effective. The focused regression is confirmed, but relevant current-head failures still lack a matching baseline or fresh passing execution.
Blast radius: DiffEqBase.ODE_DEFAULT_NORM for scalar, dense Array, static, partitioned and nested inputs; this norm feeds default step acceptance and nonlinear convergence throughout OrdinaryDiffEq.
Evidence: An actual-source base/head probe reproduces both broken guards on base and correct guards on head; head assertions pass 6/6. Retrieved stable DiffEqBase Core CI passes the 38-test norm group. Eight check failures remain, including DiffEqBase LTS/downgrade and a Mooncake downstream error, and the recent master failures inspected are different.
Blocking findings
lib/DiffEqBase/test/high_level_solve.jl:94— suspected from reading (needs-verification): the current-head LTS and downgrade logs faildespecialized_solved !== despecialized_default_problem, then error on missing callback fields at lines 98-101 (29 pass / 1 fail / 3 errors). Downstream Core1 also errors in Mooncake withMethodError: no constructors have been defined for Any. The focused norm success does not establish that these affected-package/downstream checks are unrelated. Recent master logs inspected show different Newton/Enzyme failures, so they do not substantiate baseline parity. Before merging, obtain fresh passing exact-head checks or reproduce these same failures on an unfixed base with matching dependency resolution; fix any head-only failure without weakening assertions. This requests verification, not an assertion that removing fast-math caused these errors. The cost is paired execution of the failing groups and, if needed, a CI refresh; it adds no runtime machinery.Non-blocking findings
None.
What I ran
git rev-parse HEAD; full SHA matches the recorded PR head.git diff origin/master...HEAD; inspected all changed files and relevant callers/test wiring. RootAGENTS.mdandCLAUDE.mdare absent. Initial risk was recorded before reading the author's risk assessment.git log -1 --first-parent --no-merges --format=%B; uses the newest PR-line non-merge commit, excluding master commits imported by a merge.gh pr view 4600 --repo SciML/OrdinaryDiffEq.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid,title,files,statusCheckRollup;gh pr checks 4600 --repo SciML/OrdinaryDiffEq.jl --json name,state,bucket,link,workflow; read the PR body after the initial risk freeze. Retrieval/git commands exited 0; failed check outcomes are described separately below.gh issue view 4595 --repo SciML/OrdinaryDiffEq.jl --json title,body,state,url: read the compiler-guard failure and acceptance conditions.isnan_norm(u) = isnan(ODE_DEFAULT_NORM(u, 0.0))andisfinite_norm(u) = isfinite(ODE_DEFAULT_NORM(u, 0.0)), base reportsisnan_norm([NaN, 0.5]) = falseandisfinite_norm([Inf, 0.5]) = true; head reportstrueandfalse. Both give3.5355339059327378for[3.0, 4.0]and zero for an empty Float64 array. Head scalar/array/complex assertions against analytic RMS and nonfinite behavior pass6/6. The persistent evaluator completed successfully, without a separate process exit code. This is an actual-source isolated probe, not a full package test.gh run view 35862360315 --repo SciML/OrdinaryDiffEq.jl --job 107203351314 --log, exit 0: stable DiffEqBase Core, Julia 1.13.0,ODE default norm | 38 38, package tests passed. This executes the added compiled Array and StaticArray guard regressions.gh run view 35862360315 --repo SciML/OrdinaryDiffEq.jl --log-failed, exit 0: Sublibrary CI has DiffEqBase LTS high-level-solve failures (29 pass / 1 fail / 3 errors), Differentiationdiag(::SciMLOperators.ScalarOperator)MethodError, BDF QA (1 pass / 17 fail / 23 broken), GlobalDiffEqGlobalErrorEstimation does not currently support callbacks, and NonlinearSolve mass-matrix errors (Trapezoid only works with diagonal mass matrices; 205 pass / 3 errors / 40 broken).gh run view 35862359851 --repo SciML/OrdinaryDiffEq.jl --log-failed, exit 0: downgrade CI repeats the DiffEqBase high-level-solve failure and Differentiation ScalarOperator MethodError.gh run view 35862359748 --repo SciML/OrdinaryDiffEq.jl --log-failed, exit 0: downstream Core1 errors inMooncake with MooncakeAdjoint,concrete_solve_derivatives.jl:451, withMethodError: no constructors have been defined for Any.gh run list --repo SciML/OrdinaryDiffEq.jl --branch master --event push --limit 5; inspected workflow-specific recent lists.gh run view 41058796614 --repo SciML/OrdinaryDiffEq.jl --log-failedandgh run view 41050161729 --repo SciML/OrdinaryDiffEq.jl --log-failed, exit 0: master Sublibrary and latest completed master IntegrationTest show Newton line-search and Enzyme Core4 failures respectively, not the failures listed above. I did not establish exact baseline parity for the eight red checks.What I did not verify
I did not locally run the full package, full downstream AD suites, or paired tests with the dependency resolutions from the older failed CI runs. The actual-source before/after probe covers scalar and dense Array methods; the retrieved green norm suite additionally covers StaticArrays and existing nested-array tests. No GPU kernel or AD rule is changed, and no runtime or allocation improvement is claimed. G1 is supported by analytic RMS values and nonfinite invariants; the regression suite covers the changed global default for G3. The remaining blocker is unverified baseline parity for current-head failures, not an observed defect in the corrected norm.
🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74
Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 9bfa329)
Merged upstream master normally, preserving the original commits. The diff against master remains the original two norm files. This includes the upstream fixes for callback-erasure expectations on LTS, ScalarOperator mass matrices, and GlobalDiffEq empty erased callbacks.
Local validation
Julia used four threads and one BLAS thread. Environment/probe variables below identify temporary local environments and scripts; their dependency versions and outputs are recorded here without machine-specific paths.
VALIDATION_ENVcontains the declared test dependencies and local monorepo packages; the sublibrary commands execute the existing official runners in full.Negative control loads the actual upstream norm definitions into DiffEqBase and executes the unchanged norm test file; the positive run uses the PR definitions:
The six broken assertions already exist in SciMLSensitivity; this fix changes no test assertions.
Matching baseline failures
QA | 18 passed, 1 error. The four stale imports areAbstractIntegralProblem,AbstractLinearProblem,AbstractNonlinearProblem, andAbstractSteadyStateProblem, exactly matching the default-branch QA job.339 passed, 2 failed, 15 errors, 9 broken, matching every failing line and occurrence. Both use SciMLBase 3.58.0, ForwardDiff 1.4.7, ReverseDiff 1.18.7, and SciMLStructures 1.10.6. Master CI passes on Julia 1.10.13; that version is unavailable from the installed juliaup catalog. The original high-level-solve LTS assertions now pass locally.TypeError: non-boolean (Symbolics.Num) used in boolean context. Importing OrdinaryDiffEqTaylorSeries on clean master with the copied exact docs manifest reproduces the same ChainRules tanh/TaylorDiff error. No documentation build success is claimed.No code was changed for these matching baseline failures. Local downgrade-floor environments, GPU groups, the entire monorepo suite, and downstream groups other than Core1 were not rerun. The broader default-branch Newton/ReverseDiff failures have existing investigations; they are distinct from the original PR errors.
Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).
Links
🤖 Posted by an AI agent — harness: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4600 (no session URL)
Fix by Codex CLI 0.164.0 gpt-6.1-sol (head eb30d97)
Merged upstream master normally, including the TaylorDiff 0.3.6 compatibility floors from #4994. Both Taylor libraries and the docs failed while importing TaylorDiff with
TypeError: non-boolean (Symbolics.Num) used in boolean context; the default branch's downgrade and docs runs reproduce that error. The merge also includes the upstream MagnusGauss4 correction. The diff against master remains the original two norm files. No tests or assertions were edited.Local validation
Julia 1.13.3 used four threads and one BLAS thread. Later package runs disabled automatic precompilation and used existing compiled modules in both parent and test processes. Scratch environment/script/diff locations below are represented by named variables.
The unchanged official norm test file was run with the actual upstream norm definitions loaded into DiffEqBase, then with the PR definitions:
A separate dependency comparison fixes ChainRules at 1.74.13 in both environments:
Selected trailing test summaries; all six commands exit 0:
The implicit Taylor runner executes the same convergence suite for both group labels. The broken allocation assertions are already present in the upstream suites; none were added or changed.
timeout 7200 julia +1.13.3 --compiled-modules=existing --project=docs -e 'using Pkg; Pkg.instantiate()' timeout 7200 julia +1.13.3 --compiled-modules=existing --project=docs docs/make.jlBoth exit 0. Final build messages include:
Pre-existing failures
GROUP=QA timeout 7200 julia +1.13.3 --compiled-modules=existing --project=lib/DiffEqBase -e 'using Pkg; Pkg.test(;julia_args=["--compiled-modules=existing"])'Exit 1:
QA | 18 passed, 1 error, with stale importsAbstractIntegralProblem,AbstractLinearProblem,AbstractNonlinearProblem, andAbstractSteadyStateProblem. A separate agent reproduced the identical failure with the official QA runner on clean upstream commit760d9306222480c1aa159e9cd8d3fd9b244e62cf(Julia 1.13.3); the default-branch QA job also matches.Default-branch push logs also reproduce the Default/root GPU
GPUCompiler.compile_hookwarning failures, the NewtonLineSearchException, and the LTS AD ReverseDifftape has finished recordingerror. Existing investigations identify the Newton and ReverseDiff introducing commits. The default-branch downstream run matches SciMLSensitivity Core2's 194 passed / 4 errors / 6 broken and ProbNumDiffEq Interface's 1227 passed / 6 failed / 4 broken; individual ProbNumDiffEq failed expressions are absent from the retrieved logs. No code was changed for these baseline failures.The earlier review's DiffEqBase LTS Core, DiffEqBase downgrade, and SciMLSensitivity Core1 failures are already green on the incoming PR head. This session did not rerun GPU groups, the full LTS suite, all downgrade dependency minima, downstream suites, or the entire monorepo. The prior high-risk assessment remains; no fresh counted review was performed here.
Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).
Links
🤖 Posted by an AI agent — harness: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4600 (no session URL)