Repository navigation
Preserve AD wrappers in Rosenbrock stages - #4101
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
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Member
|
Doesn't JuliaArrays/ArrayInterface.jl#498 cover this? |
This was referenced Aug 8, 2026
…ixes Require ArrayInterface 7.29 and retain the analytic ReverseDiff regression. Use the owning package's tracked-array restructuring support directly. Merge upstream/master to include its differentiation and CI fixes while preserving the existing branch history. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Agent-Harness: Codex CLI 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4101 (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Muse <noreply@meta.com> Agent-Harness: Muse CLI Code Agent-Model: muse-wonder-full-1.0 Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4101 (no session URL)
On Julia 1.10 the broadcasted stage right-hand side of an out-of-place Rosenbrock step can widen to an abstract element type for ReverseDiff tracked states, and the generic factorization solve then converts the factors to an integer element type. Copy the right-hand side into the factorization element type when they differ. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Muse <noreply@meta.com> Agent-Harness: Muse CLI Code Agent-Model: muse-wonder-full-1.0 Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4101 (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.
Summary
ArrayPartition, unless the struct-of-arrays conversion matches the original container typeinit/solve!pathRoot cause
The first commit of #3996 (
100fe236) replaced the former reshape helper withArrayInterface.restructure. For an out-of-place ReverseDiff state, that changes aTrackedArraytemplate into a plainVector{TrackedReal}, and the Rosenbrock stage update later attempts to convert the tracked scalars back toFloat64.The focused reproducer passes at the parent commit (
5e3c607) and fails at100fe236. Converting the restructured result with the publicArrayInterface.aos_to_soaAPI restores the tracked wrapper. The type guard avoids changing other state-container representations.Validation
GROUP=Core julia +1.10 --project=lib/OrdinaryDiffEqRosenbrock -e 'using Pkg; Pkg.test()'Ignore this PR until reviewed by @ChrisRackauckas.
Risk assessment (independent review, Codex CLI 0.164.0-alpha.11.1 gpt-6-astra, slot 1, head a2461bc)
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: The PR restores structure-of-arrays AD wrappers after Rosenbrock stage solves and adds an analytic ReverseDiff regression. The regression passes current-dependency Core CI but fails the downgrade job, leaving the advertised fix incomplete on supported dependencies.
Blast radius: Out-of-place Rosenbrock/Rodas stage and dense-output reconstruction, including main-lane Rodas algorithms; scalar handling is unchanged.
Evidence: Exact head/diff inspected; Julia 1.12.6 Core CI passes 192/192 Rosenbrock convergence checks. Julia 1.11.9 downgrade CI errors in the newly added tracked-state test (191 passed, 1 error). G1 has the independent gradient [1,1.2,-0.22]; G2 has executed AD coverage, but execution exposes a supported-stack failure. No independent fail-before control was run, so the missing-evidence modifier cannot lower the already MH1 rating.
Blocking findings
lib/OrdinaryDiffEqRosenbrock/Project.toml:61andlib/OrdinaryDiffEqRosenbrock/test/ode_rosenbrock_tests.jl:564— confirmed by running (PR CI; reviewer inspected the log): the downgrade job resolves ReverseDiff 1.16.0 and ArrayInterface 7.28.0, both permitted by this head, then the new regression throwsMethodError: Cannot convert Vector{ReverseDiff.TrackedReal{...}} to ReverseDiff.TrackedArray{...}. The failing assignment isjac_reuse.cached_dT = dTinlib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl:999; the expected contract is a completed solve with gradient[1.0, 1.2, -0.22]. Current-dependency CI passes with ReverseDiff 1.17.0/ArrayInterface 7.28.1, but that does not validate the declared lower bounds. Preserve the required tracked wrapper through this differentiation cache path, or determine and encode the actual required dependency minima, then rerun the exact regression in the minimum-version job. Do not skip the failing test.Non-blocking findings
None.
What I ran
git rev-parse HEADreturneda2461bc60992ba6ef6de4651dcb77e43836131b4; exact detached PR head verified (exit 0).git diff origin/master...HEADandgit diff --check origin/master...HEADcompleted (exit 0); changed files, tests, callers, and repository instructions inspected. RootAGENTS.mdandCLAUDE.mdare absent. Risk was frozen before opening the description.git rev-parse origin/masterreturned14b964b315e1310b5e3621a1bcfe6b92e9e506aa; GitHub's PR metadata base isa7080c6f6d992edee79fa40450e0bd6eb0b8f735. The review diff uses the three-dot merge base; the header records the fetched base-branch tip.git log -1 --first-parent --no-merges --format=%Binspected (exit 0); author trailers recorded below, orunknownwhen absent.gh pr view 4101 --repo SciML/OrdinaryDiffEq.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid,title,files,statusCheckRollupand the subsequent PR body read succeeded. Live state was OPEN.gh pr checks 4101 --repo SciML/OrdinaryDiffEq.jldata: 123 success, 13 failure, 1 skipped.gh run view 30757654870 --repo SciML/OrdinaryDiffEq.jl --job 91522550568 --log(retrieval exit 0): Julia 1.12.6, ReverseDiff 1.17.0, ArrayInterface 7.28.1;Rosenbrock Convergence Tests | 192 192, thenTesting OrdinaryDiffEqRosenbrock tests passed. The test entry point includes the new analytic gradient check. Passing Core job.gh run view 30757654811 --repo SciML/OrdinaryDiffEq.jl --log-failed(retrieval exit 0): Julia 1.11.9, ReverseDiff 1.16.0, ArrayInterface 7.28.0; the newOOP Rosenbrock preserves ReverseDiff tracked statestest errors,Rosenbrock Convergence Tests | 191 1 192(Pass/Error/Total), and the test process exits 1. Failing downgrade job.30757654870(QA),30757654928(AD/GPU),30757654833(docs), and30757654638(integration), usinggh run view <run> --repo SciML/OrdinaryDiffEq.jl --log-failed(retrieval exit 0). They include public-API QA, AD callback, GPU DAE, docs cross-reference, and downstream compatibility/AD failures. These are not used to infer the cause of the concrete new-regression failure above. Sublibrary CI, CI, docs, integration.gh run list --repo SciML/OrdinaryDiffEq.jl --branch master --event push --limit 5. Default CI run41058796553fails AutoZygote callback and GPU warning tests, whereas the historical PR CI has different failures. Default downgrade run41058798190reports success. No identical master failure of this PR's new ReverseDiff regression was independently established. Default CI log, default downgrade.What I did not verify
No reviewer Julia process was run for this PR. The author-reported failing-before baseline and the minimal dependency version responsible for the downgrade difference were not independently reproduced. Inspected CI, not a local rerun, provides the passing and failing head evidence. Full GPU/AD/downstream equivalence to the current default branch remains unverified.
🤖 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 9b01e0c)
Require ArrayInterface 7.29, which includes its tracked-array restructure fix, and retain the analytic ReverseDiff regression. Rosenbrock stage reconstruction now uses the same implementation as current default. A normal merge of current default preserves the original branch history and incorporates its differentiation and CI fixes, including the required FiniteDiff 2.33 / DifferentiationInterface 0.7.21 floors.
Regression evidence
The original PR with ArrayInterface 7.28.0, ReverseDiff 1.16.0, FiniteDiff 2.27.0 and DifferentiationInterface 0.7.18 errors assigning a vector of tracked scalars to
cached_dT::TrackedArray. Raising only ArrayInterface on that old base still fails. Clean current default with ArrayInterface 7.28.0 also fails the tracked stage assignment.Before, on the original PR minimum stack:
After, on this branch with ArrayInterface 7.29.0, ReverseDiff 1.16.0 and current default's differentiation floors:
Local validation
GROUP=Core julia +1.11 --project=lib/OrdinaryDiffEqRosenbrock -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'GROUP=QA timeout 7200 julia +1.13.3 --project=lib/OrdinaryDiffEqRosenbrock -e 'using Pkg; Pkg.resolve(); Pkg.test(; julia_args=["--compiled-modules=existing"])'GROUP=AD timeout 7200 julia +1.13.3 --project -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'GROUP=Interface timeout 7200 julia +1.13.3 --project=lib/DelayDiffEq -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'Both exit 0; spelling produces no output. The tracked worktree matches the validated index and the diff against default passes whitespace checks.
Pre-existing docs dependency failure
Fresh resolution on both this branch and a clean default checkout fails before
makedocs, loading TaylorDiff, withTypeError(func=:if, expected=Bool, got::Symbolics.Num). The original August failed-log downloads now return HTTP 410, so current executions and the review's preserved error were used instead.An unchanged standalone probe importing only ChainRules, ChainRulesCore, Symbolics and InteractiveUtils isolates the transition on Julia 1.13.3: ChainRules 1.74.11 errors in
frule((NoTangent(), true), tanh, z)for symbolicz; 1.74.10 passes an analytic derivative check, returning0.7864477329659274atz=0.5. The introducing commit is in the linked ChainRules change. No dependency pin or workaround is committed.The full docs build passes with the ChainRules version from the last passing default CI, using only an ignored local manifest setting. Commands:
julia +1.13.3 --project=docs -e 'using Pkg; Pkg.pin(PackageSpec(name="ChainRules",uuid="082447d4-558c-5d27-93f4-14fc19e9eca2",version="1.74.10"))' julia +1.13.3 --compiled-modules=existing --project=docs docs/make.jlExit 0; deployment is skipped outside CI. Latest-resolution docs remains an upstream ChainRules/TaylorDiff interoperability failure. No upstream issue was filed outside this job's repository grant.
Not run locally: GPU, integration/downstream, full Everything, AD LTS, or the complete sublibrary downgrade matrix. Existing default CI passed the two named downgrade jobs and DelayDiffEq Interface; its unrelated AD LTS/GPU failures were audited separately. No assertions, tolerances or validation settings were weakened.
Links
Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).
🤖 Posted by an AI agent — harness: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4101 (no session URL)
Fix by Muse CLI Code muse-wonder-full-1.0 (head fa8fe2f)
Merged the current default branch (3 commits, including the TaylorDiff 0.3.6 compat floors) into this branch with a normal merge, then fixed the one remaining non-pre-existing failure: the Rosenbrock Core job on Julia LTS (1.10), where this PR's ReverseDiff regression errored. The Documentation and TaylorSeries downgrade jobs are green on the default branch and this branch is now identical to the default branch for those paths.
Root cause on LTS: the broadcasted stage right-hand side of an out-of-place Rosenbrock step widens to
TrackedArray{Real, ...}for ReverseDiff tracked states on Julia 1.10, and the generic factorization solve then converts the LU factors to an integer element type (InexactError: Int64(-6.358470930209569e6)). The stage solves now copy the right-hand side into the factorization element type when they differ (_rosenbrock_lsolve, used at all out-of-place stage and dense-output solves); when the element types already match the solve is unchanged.Regression evidence (Julia 1.10, focused new testset)
Before, on both the previous head and a clean default-branch checkout:
After:
The same focused test also passes on Julia 1.11.
Local validation
GROUP=Core julia +1.10 --project=lib/OrdinaryDiffEqRosenbrock -e 'using Pkg; Pkg.test()'GROUP=QA julia +1.11 --project=lib/OrdinaryDiffEqRosenbrock -e 'using Pkg; Pkg.test()'The single Aqua failure is the persistent-tasks check: package precompilation did not exit within its 60 s bound while the machine load average was above 50. A fresh
using OrdinaryDiffEqRosenbrockloads and exits in 3 s, and every other Aqua check (ambiguities, piracy, stale deps, compat, ExplicitImports, public API) passes.All exit 0, no output.
Pre-existing failures on the default branch, unchanged by this head (deterministic CI comparison): both GPU jobs, AD on Julia LTS, SciMLSensitivity Core2 downstream, and ProbNumDiffEq downstream (the TaylorDiff
Symbolics.Numprecompile error that the merged TaylorDiff 0.3.6 floors address). No assertions, tolerances or test settings were weakened.Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).
🤖 Posted by an AI agent — harness: Muse CLI Code · model: muse-wonder-full-1.0
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4101 (no session URL)