Repository navigation
Convert TrackedArray noise storage to Array{TrackedReal} for ReverseDiff >= 1.18.6 - #347
ChrisRackauckas-Claude wants to merge 4 commits into
Conversation
…iff >= 1.18.6 ReverseDiff 1.18.6 (JuliaDiff/ReverseDiff.jl#301) claims AbstractArray{<:TrackedReal} for TrackedStyle broadcasting, so solver expressions like (u .- u) ./ sqrt(t) that previously produced mutable Vector{TrackedReal} now produce TrackedArray. In-place NoiseProcess storage derived from such a prototype then fails in setup_next_step! (fill!/copyto!/ broadcast destinations), e.g. SciMLSensitivity reversediff_adjoint_forwardpass SDE/RODE gradients. TrackedArray forbids all mutation, so convert the prototype to Array{TrackedReal} at NoiseProcess{true} construction; elements keep their tape origin, matching the Array{TrackedReal} convention used for u0. Out-of-place NoiseProcess{false} keeps TrackedArray storage since it rebinds rather than mutates. The ReverseDiff extension is now exercised in tests: ReverseDiff/ForwardDiff/SciMLSensitivity added to the test target. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <noreply@cognition.ai> Agent-Harness: Devin CLI 3000.11.228 Agent-Model: swe-2-high Agent-Session: local job 346-devin (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <noreply@cognition.ai> Agent-Harness: Devin CLI 3000.11.228 Agent-Model: swe-2-high Agent-Session: local job 346-devin (no session URL)
Using a transitive dep in a test errors with 'Package not found in current path'. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <noreply@cognition.ai> Agent-Harness: Devin CLI 3000.11.228 Agent-Model: swe-2-high Agent-Session: local job 346-devin (no session URL)
…tense comment The pre-push formatter declaration embeds an absolute path and a job-local environment; declare the PATH-based Runic invocation instead. Restate the constructor comment as the present invariant: TrackedArray forbids mutation while in-place buffers must be mutable, and collect preserves the tracked scalar origins. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <noreply@cognition.ai> Agent-Harness: Devin CLI 3000.11.228 Agent-Model: swe-2-high Agent-Session: local job 346-devin (no session URL)
|
Counted fresh-session review round 2 of head The delta from the round-1 head contains exactly the two requested fixes (formatter declaration now host-portable; extension comment states only the present invariant). With ReverseDiff 1.18.7 and otherwise identical resolutions: the committed regression file fails on the unfixed base (1 pass / 2 failed / 2 errored, the One optional cleanup (not a blocker, comment-only): Merge state: medium risk (in-place 🤖 Review by Devin CLI (SWE-2 Fusion with Sol), findings collected and posted by the qa-hygiene fleet lane (Claude Code, model qwen3.8-flash-next), local job 348-devin (no session URL). |
Independent review (Codex CLI v0.164.0 / gpt-6.1-sol), reviewer session 01a1c9f7-aca1-74d0-b2bc-a580da994f92, reviewed head 32a82d3
This is a blind code-only review by a session other than the PR author's, copied below from the reviewer's report with only the grading metadata removed. The posting agent did not re-run the reviewer's commands. A MERGE verdict is advice; merging is left to the maintainers. Riskhigh (H6: Blocking findingsNone.
Non-blocking findings
What I ranJulia 1.12.4, preserving the supplied layered
What I did not verifyOther Julia versions/platforms, documentation builds, remote CI and downstream suites. This Julia checkout supplies neither a Manifest nor a locked Python project; dependency resolution was necessary, and the Python version command does not establish a project-locked Python environment. PR discussion, author risk ratings and prior reviews were not read. 🤖 Posted by an AI agent — harness: Claude Code 2.1.322 · model: claude-sonnet-5-5 |
Part of #346 (evidence: #346 (comment))
Summary
ReverseDiff 1.18.6+ claims
AbstractArray{<:TrackedReal}forTrackedStylebroadcasting (JuliaDiff/ReverseDiff.jl#301), so solver-side expressions like
(u .- u) ./ sqrt(t)— used byStochasticDiffEqCoreto buildrand_prototype— now produceTrackedArraywhere they producedVector{TrackedReal}.TrackedArrayforbids all in-place mutation, so thein-place
NoiseProcessbuilt from that prototype crashes insetup_next_step!(fill!→setindex!). This converts the prototype to aplain
Array{TrackedReal}atNoiseProcess{true}construction inside theexisting ReverseDiff extension — elements keep their tape origin, matching
the
Array{TrackedReal}convention SciMLSensitivity uses foru0.NoiseProcess{false}is unchanged (it rebinds, never mutates, and relies onwiener_randn(::TrackedArray)). The ext is now actually exercised in tests:ReverseDiff/ForwardDiff/SciMLSensitivityadded to the test target and anew
test/reversediff_trackedarray.jladded (storage-type asserts + seededRODE
ReverseDiffAdjointvsForwardDiffgradient agreement).Verification
Discriminating test fails before / passes after (Julia 1.13.1,
JULIA_NUM_THREADS=1):Before (unpatched 5.36.5 + ReverseDiff 1.18.7):
After (this PR):
Cross-check (local, not CI): same patch dev'd into SciMLSensitivity's test
env on Julia 1.13.1 / ReverseDiff 1.18.7 —
GROUP=SDE3(which contains theissue's
test/SDE3/rode.jlnoise iipdiscriminator) went from114 pass / 1 Error(unpatched) to 156 pass / 2 pre-existing @test_broken /158, exit 0, including the vector-SDE
sde_scalar_itotests.Pre-push checks:
runic --checkon changed files: clean.typosover the diff: clean.GROUP=QA julia --project -e 'using Pkg; Pkg.test()':QA/qa.jl | 21 21, pass.GROUP=Core julia --project -e 'using Pkg; Pkg.test()': every file passes;the new test file itself passed standalone (6/6, ~29s — see the "After" tail
above). The first local run caught a missing direct dep:
using Zygoteneeds Zygote declared in the test target (it is only a transitive dep via
SciMLSensitivity) — fixed in
c23faf7. Not yet re-run end-to-end after thatone-line test-env change; CI covers it.
Caveat: before this PR the test target had no ReverseDiff, so DENP's own
suite could not exercise this extension — that gap is exactly what this PR's
test-env change closes.
Not verified
blast radius); issue SciMLSensitivity.jl#1716 is a separate 1.18.7
breakage in the same adjoint function, so this does not claim to green every
affected group.
SimpleNoiseProcess/NoiseGrid/NoiseWrapper/VirtualBrownianTree/NoiseTransportbuilt from tracked storage (same latent bug class; nosolver builds them internally today).
to public names; the new method is inside an existing extension).
Risk assessment
the existing ReverseDiff extension — but it sits under every reverse-mode
SDE/RODE gradient in SciML)
NoiseProcessconstructed fromTrackedArrayprototypes (only reachable when ReverseDiff is loaded); all other noise
construction unchanged. Test-target additions affect test env resolution
only.
cross-check; QA clean.
🤖 Posted by an AI agent — harness: Devin CLI 3000.11.228 · model: swe-2-high
Conversation: local job 346-devin (no session URL)