Repository navigation
Add tolerance solves to MTK precompile workloads - #5248
Merged
ChrisRackauckas merged 3 commits intoOct 16, 2026
Merged
ChrisRackauckas merged 3 commits into
ChrisRackauckas merged 3 commits into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI Agent-Model: gpt-6-luna Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolws/log.txt on amdci2
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: Devin CLI 3000.11.3 (conflict resolution), Claude Code 2.1.285 (orchestration) Agent-Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium Agent-Session: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master); Devin log /Users/chrisrackauckas/sandbox/master/fusion-fixes/SciML_ModelingToolkit.jl-5248/log.txt
Member
Merged the default branch into this PR (clean merge, no conflicts; head 2b29fbf) so CI runs on current master. 🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (merge), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
ChrisRackauckas
marked this pull request as ready for review
October 16, 2026 18:49
This was referenced Oct 16, 2026
ChrisRackauckas
referenced
this pull request
Oct 17, 2026
…5284) Bump versions: ModelingToolkitBase 1.77.5, ModelingToolkit 11.45.5 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Agent-Harness: Claude Code 2.1.302 Agent-Model: claude-sonnet-5-5 Claude-Session: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq
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.
Adds Float64-tolerance solves to the existing Tsit5 and FBDF precompile workloads for MTK’s ODE and DAE problem shapes, reducing first-solve inference for the covered keyword calls to their no-tolerance counts. This PR helps with or without OrdinaryDiffEq.jl #4618 and does not depend on that PR; it changes only precompile workloads.
Measurements
The original design campaign used MTK c97bfa70 (11.45.3). Its fresh-process SnoopCompile MI counts and minimum of three solve-only wall timings (seconds), comparing #4618 alone with #4618 plus B, are:
abstol,reltolchain_ode(4)chain_ode(4)abstol,reltolabstol,reltolchain_ode(4)chain_ode(4)abstol,reltolRound 1 independent review (Claude Code, claude-opus-5-5) measured the PR against its actual master base, including OrdinaryDiffEq without #4618. These are newly inferred MethodInstances during a first solve in a fresh process, with Float64
abstolfollowed byreltol:chain_ode(4), Tsit5chain_ode(4), FBDFchain_ode(4), Tsit5The combined native pkgimage growth of the two extensions is about 600 KiB without #4618, versus about 345 KiB with #4618. The review measured one build per configuration: without #4618, Tsit5 grew by 240,352 bytes and BDF by 373,576 bytes (613,928 bytes total); with #4618, the total was 351,232 bytes (about 343 KiB). The design campaign’s median-size delta with #4618 was 353,152 bytes (about 345 KiB, 2.03%).
Precompile-time delta was not measured reliably. The review ran at machine loads of 130–320. Across the design campaign’s three extension-cache rebuilds, the min/median time delta was −1.88/−0.39 s for Tsit5 and +1.10/+1.12 s for BDF; these noisy observations do not establish an overall rebuild-time penalty. Wall-time minima are also noisy and should not be treated as precise speedup estimates.
A DiffEqBase-side alternative (A2) was also prototyped and rejected: it only partially reduced inference and changes the kwargs visible to problem-concretization hooks.
Merge interaction
This PR conflicts with ModelingToolkit.jl #5202 in
ext/MTKOrdinaryDiffEqBDFExt.jl: both add calls aftersolve(daeprob, FBDF()). A realgit merge --no-commit --no-ff review/pr5202into this PR’s committed head in a scratch clone returned exit 1:The trivial resolution is to keep all three added calls: this PR’s two FBDF tolerance solves and #5202’s
solve(sccprob, FBDF()). Keeping both sides in the scratch clone removed the unmerged path and passedgit diff --cached --check; the trial merge was then aborted without a commit. Whichever PR merges second needs a rebase. The earlier clean-merge claim was incorrect: its trial tree omitted the unstaged B patch, and legacy Git 2.34merge-treeexits 0 even for conflicts.Coverage limits
Full coverage is limited to the keyword set and order used in the workloads:
abstolfollowed byreltol, with Float64 values. Round 1 measured the following Tsit5 workload cases with B and without #4618; counts are total newly inferred MIs during the first solve, not differences from the covered count:abstol,reltolreltol,abstolreltolaloneabstol,reltol,saveat=0.1Reordering keywords or adding
saveatleaves substantial inference. Tolerances read fromRefs reproduced the covered literal-value counts (1 for the workload, 302 forchain_ode(4)). A measured side benefit without #4618 is reduced tolerance-call inference for Rodas5P (158 → 21 MIs) and the default solver (158 → 23 MIs), though their tolerance calls are not explicitly in these workloads.Verification
OrdinaryDiffEq.jl was checked out at PR StackOverflowError during ODEProblem construction #4618 head
faf84f7004324080e2dbdf4d5fa3fa5c847ad979; its root package,lib/DiffEqBase, andlib/OrdinaryDiffEqCorewere developed in the verification environment. With that environment active, this precompiled MTK and checked both extensions (exit 0):Output:
Both Tsit5 and BDF extensions loaded after precompilation.These separate fresh-process commands used the design’s
measure.jland both exited 0:export TMPDIR=/home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolws/tmp JULIA_MAX_NUM_PRECOMPILE_FILES=100 JULIA_DEPOT_PATH=/home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolws/depot:/home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolgap/depot JULIA_PKG_PRECOMPILE_AUTO=0 /home/crackauc/.juliaup/bin/julia +1.12 --startup-file=no --project=/home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolws/scratch/verification /home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolgap/scratch/measure.jl workload tol snoop /home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolws/scratch/inference-tol /home/crackauc/.juliaup/bin/julia +1.12 --startup-file=no --project=/home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolws/scratch/verification /home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolgap/scratch/measure.jl workload none snoop /home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolws/scratch/inference-noneOutputs:
RESULT snoop workload tol nMI=1andRESULT snoop workload none nMI=1.Runic check mode on both changed files exited 0:
typos ext/MTKOrdinaryDiffEqTsit5Ext.jl ext/MTKOrdinaryDiffEqBDFExt.jlalso exited 0.Round 1 also verified Julia 1.10.12 in a fresh environment: both targeted extensions precompiled and loaded, and the Tsit5 ODE and FBDF DAE tolerance solves ran successfully. The reviewer’s
scratch/run_lts.shloggedsetup exit 0,1.10.12 exts loaded, andload exit 0. The precompile output reported 27.8 s for Tsit5Ext and 50.1 s for BDFExt; these are individual durations, not a measured time delta.Review evidence:
/home/crackauc/sandbox/agent-jobs/mtk-ttfx/reviews/pr-5248/round1/REVIEW.md; raw measurements and Julia 1.10 results are in itsscratch/results/directory. These reviewer measurements were inspected for this body correction; the author did not rerun the Julia campaign.Not verified
Neither the author nor the reviewer ran the full ModelingToolkit test groups locally, including InterfaceII. The review measured FBDF/DAE inference counts, but not FBDF/DAE wall-clock TTFX, non-Float64 tolerances, total fresh-install precompile time, a reliable rebuild-time delta, pkgimage sizes on Julia 1.10, or behavior after #4618 and #5202 are merged. Results establish coverage only for the measured cases, not arbitrary user models or keyword combinations.
Risk assessment
Part of the MTK TTFX effort: https://github.com/ChrisRackauckas/InternalJunk/issues/113
🤖 Generated with Codex CLI (model: gpt-6-luna; session transcript: /home/crackauc/sandbox/agent-jobs/mtk-ttfx/jobs/tolws/log.txt on amdci2)
Risk assessment (independent review, codex-cli gpt-6.1-sol, reviewed head a5b5325)
a5b532557563eb62538f693587f835f67eae8779(unchanged at completion), the full three-call diff, authorship, the linked TTFX hand-off https://github.com/ChrisRackauckas/InternalJunk/issues/113, and companion Resolve default ODE tolerances before specialized init (TTFX) OrdinaryDiffEq.jl#4618. Locally, withJULIA_NUM_THREADS=4,TMPDIR=$PWD/tmp,JULIA_DEPOT_PATH=$PWD/depot:/home/crackauc/.julia,/home/crackauc/.juliaup/bin/julia +release --startup-file=no --project=env-5248 tmp/test-5248.jlprecompiled/loaded both extensions and passed 8/8 assertions (test body 1.5 s after loading). The added Tsit5 ODE, FBDF ODE, and FBDF DAE tolerance calls all returnedSuccess; final states agreed with default-tolerance solves at relative tolerance1e-3. The DAE tolerance solve ended at[0.7560475128929396, 0.5704325631985844]. CI snapshot: {'SKIPPED': 1, 'QUEUED': 36, 'SUCCESS': 43, 'FAILURE': 2}. Full local output is inevidence/5248.test.log.🤖 Posted by an AI agent — harness: codex-cli · model: gpt-6.1-sol (independent reviewer; appended by Claude Code 2.1.301 · claude-opus-5-5)
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq