Repository navigation
Precompile SDE solves through specialization levels - #4467
ChrisRackauckas merged 3 commits into
Conversation
Add SDE specialization handling to DiffEqBase concretization and mirror the ODE specialization preference matrix in StochasticDiffEq precompilation. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: OpenAI Codex <[email protected]> Agent-Harness: Codex CLI 0.153.4 Agent-Model: unknown Agent-Session: local thread 01a06c1d-564b-7ef0-ada6-d83a233b55e2
|
CI note (2026-09-05): every failed job inspected so far stops during dependency resolution, before tests run. The checked-out StochasticDiffEq 7.2.0 requires SciMLBase 3.51, while General currently contains SciMLBase only through 3.50.2. The resolver therefore reports This PR is intentionally stacked on SciML/SciMLBase.jl#1580. After that prerequisite is merged and SciMLBase 3.51 is available, these jobs need to be rerun. The PR body records the local validation performed with both feature checkouts developed together. |
SDE AutoSpecialize now installs FunctionWrappers, matching the ODE path. AllocCheck flags the FunctionWrappers ccall as dynamic dispatch, and `@allocated` of `perform_step!` inside a `@testset` measures runtime dispatch of the wrapped integrator rather than the step. Use FullSpecialize for the sparse EulerHeun AllocCheck, as the ODE allocation tests already do, and run `perform_step!` through a function barrier like `step_void!`. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Grok <[email protected]> Agent-Harness: Grok CLI 1.0.13 Agent-Model: grok-4.6 Agent-Session: local session 01a07b4a-0048-7b82-bdcf-da33c4b4d812
|
CI follow-up on SDE
Failing before, passing afterSame assertions on this checkout, Julia 1.12.7: Before (unfixed tests, wrapped AutoSpecialize): After ( Precompilation tests still exit 0. Runic GPU jobs were not part of this; they were still queued on the previous run. 🤖 Generated with Grok CLI 1.0.13 (model: grok-4.6; session: local 01a07b4a-0048-7b82-bdcf-da33c4b4d812) |
- Precompile SDE solves through specialization levels (#4467) - Add 32-bit InterfaceI CI lane via test_groups.toml (#4480) - incorporate time/stab filter for larger steps in FBDF (#3878) - Keep 32-bit CI lane hard-failing. (#4482) - Correct and validate FBDF time and stability filters (#4484) - Keep DAE init from overwriting uprev during callback truncation (#4486) - DiffEqBase: Int64 interp_points range length for 32-bit (#4487) - Release OrdinaryDiffEqBDF 2.4.7 (#4490) - Unify companion global error estimators into GlobalErrorEstimation (#4492) - Add adjoint-based global error control as a SciMLSensitivity extension (#3953) Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
What changed and why
SDE concretization now applies the existing SciML specialization levels to both the drift and diffusion functions, preserving the marker and producing reusable concrete function types for
AutoSpecialize,AutoDespecialize,AutoDePSpecialize/AutoRespecialize,FunctionWrapperSpecialize, andNoSpecialize. Non-diagonal diffusion usesnoise_rate_prototypefor its wrapper signature, and repeated concretization is type-stable instead of nesting wrappers.StochasticDiffEq now mirrors the ODE precompile preference matrix and constructs its workloads with
SDEProblem{isinplace, specialize}. The earlier typedRef{Function}default-dispatch workaround has been removed; this revision does not change the default forwarding methods.This supersedes the rejected implementation in #4457.
This PR depends on the missing public SDE constructor route added in SciML/SciMLBase.jl#1580. Its
SciMLBase = "3.51"compatibility floor is intentionally unreleased until that prerequisite merges and is tagged, so registry-only CI may remain unresolved in the meantime.PrecompileTools and Preferences are both MIT-licensed, matching this repository.
Failing before, passing after
I ran the same two assertions against clean OrdinaryDiffEq master
c241543c4b, with the SciMLBase constructor prerequisite developed locally, and against this branch:Before:
After:
Fresh-process measurement
Julia 1.12.7, same resolved environment, one process per measurement. The explicit vector
SOSRI()solve compiled in 1.14 s and 2.09 s in two runs, compared with 6.64 s on master (68%–83% lower). Process elapsed time was 10.25 s and 12.03 s, compared with 12.91 s on master.The no-algorithm default path did not improve in the revised design, so the earlier default-path performance claims have been removed. This PR now claims only the specialization-backed explicit-solver workload improvement.
Benchmark command:
/usr/bin/time -f 'process_elapsed=%e max_rss_kb=%M' \ /home/crackauc/.juliaup/bin/julia +1.12 --startup-file=no \ --project=lib/StochasticDiffEq ../benchmark_sde.jl SOSRI vectorVerification
Julia 1.12.4:
Julia 1.10.11 in an isolated environment developing SciMLBase 3.51.0, DiffEqBase 7.21.0, and StochasticDiffEq 7.2.0:
Not run locally: GPU, convergence, downstream, or documentation jobs. No documentation or public name was added in this repository; the new public constructor is documented and docs-built in the prerequisite SciMLBase PR.
Reviewer judgment: stochastic implicit methods use function-derived ForwardDiff tags that cannot be represented by the fixed dual signatures used for the ODE wrapper path. Those SDE functions therefore retain their specialization marker and parameter despecialization but skip installation of the fixed ForwardDiff wrapper; the
ImplicitRKMiland mass-matrix tests cover this branch.🤖 Generated with Codex CLI 0.153.4 (model: unknown; session: local thread 01a06c1d-564b-7ef0-ada6-d83a233b55e2; no shareable URL was exposed).