Repository navigation
Convert Krylov Vector seeds to SVector for Enzyme VJP in SciMLJacobianOperators - #1356
Merged
ChrisRackauckas merged 5 commits intoOct 5, 2026
Conversation
KrylovJL workspaces pass dense Vector seeds into SciMLJacobianOperators pullbacks prepared on SVector state; convert seeds to the primal type so Enzyme reverse no longer TypeErrors under downgrade floors. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI Agent-Model: auto Agent-Session: ~/sandbox/goals/ci-green/work/cig-nls-firstorder-downgrade/log.txt (local transcript, amdci2)
Coerce AD seeds/output tangents only when the primal type differs (mutable similar+copyto!, convert with reshape fallback) so ArrayPartition and iip MVector paths keep working; add JO regression tests and ignore the non-public RobustTrustRegionLinsolve import in FirstOrder QA. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI Agent-Model: auto Agent-Session: ~/sandbox/goals/ci-green/work/cig-nls-firstorder-downgrade/log.txt (local transcript, amdci2)
Remove the RobustTrustRegionLinsolve ExplicitImports ignore (pre-existing non-public access belongs in a separate public-API PR). Replace the bare catch in `_coerce_like` with `applicable(convert, …)`, bump SciMLJacobianOperators to 0.1.20, and raise FirstOrder/NonlinearSolveBase compat floors so released users cannot resolve the buggy JO. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI Agent-Model: auto Agent-Session: ~/sandbox/goals/ci-green/work/cig-nls-firstorder-downgrade/log.txt (local transcript, amdci2)
ForwardDiff/Zygote keep a reshape so Float32 static state with Float64 or Dual seeds is not narrowed. Enzyme still matches SVector/MVector containers when eltypes agree. Add mixed-precision and nested-jacobian regression tests. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI Agent-Model: auto Agent-Session: ~/sandbox/goals/ci-green/work/cig-nls-firstorder-downgrade/log.txt (local transcript, amdci2)
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Agent-Harness: Claude Code Agent-Model: claude-opus-5-5[1m] Agent-Session: https://claude.ai/code/session_011aK5Xvp9NpdkzKuEwtiMGd
ChrisRackauckas
marked this pull request as ready for review
October 5, 2026 05:02
This was referenced Oct 7, 2026
ChrisRackauckas
referenced
this pull request
Oct 13, 2026
Agent-Harness: Devin CLI 3000.11.3 Agent-Model: Fusion (Claude Opus 5.5 Medium + SWE-2 Medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/flash-hour.json Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
Downgrade Sublibraries for
lib/NonlinearSolveFirstOrderfails on TrustRegion OOP withSVector{2,Float64}when reverse AD is AutoEnzyme: KrylovJL workspaces feed denseVector{Float64}seeds into a SciMLJacobianOperators VJP prepared onSVectorstate, and Enzyme's reverse thunk TypeErrors (expected SVector, got Vector). Raising Enzyme/DifferentiationInterface alone does not fix this on Julia 1.10 LTS.Fix in SciMLJacobianOperators 0.1.20: Enzyme-only, reshape Krylov seeds into the primal container while keeping the seed eltype (so Float32 state + Float64/Dual seeds are not narrowed). ForwardDiff, Zygote, and other backends keep a plain
reshape, matching master. iip Enzyme output tangents use a same-eltype typed temp andcopyto!back. FirstOrder and NonlinearSolveBase compat floors areSciMLJacobianOperators = "0.1.20".Ignore until reviewed by @ChrisRackauckas
Evidence
Fail at old floor (Julia 1.10.12, Enzyme v0.13.100, DI v0.7.3, unpatched JO):
Pass at new code + same floor:
Local Core after review round 3 (
b6f99a3):Static / partitioned … | 15 15,exit=0Static / partitioned … | 15 15,exit=0TrustRegion | 1596 1596 61m31.8s,exit=0JO
core_tests__item7.jl: SVector OOP Enzyme, MVector iip Enzyme, ArrayPartition ForwardDiff, Vector←Vector shared reshape, plus Float32/1e40/2^-30andForwardDiff.jacobian(v -> sop*v, …)(reviewer mixed-precision / nested-AD reproducers).Follow-up (out of scope here)
Pre-existing FirstOrder QA ExplicitImports failure for non-public
RobustTrustRegionLinsolveis #1357.Why non-downgrade FirstOrder CI looked green on master
On the failing SHA, normal SublibraryCI often never ran FirstOrder's LTS AutoEnzyme path: affected-only selection skipped FirstOrder unless it changed, and transitively-affected libs run Julia
"1"(≥1.12) where tests dropAutoEnzyme. Downgrade always exercises FirstOrder on LTS with Enzyme.What was not verified
Risk assessment
🤖 Generated with Cursor Agent CLI (model: auto) — session: local transcript ~/sandbox/goals/ci-green/work/cig-nls-firstorder-downgrade/log.txt on amdci2
Risk assessment (independent review, head b6f99a3)
AutoEnzyme/AutoSparse(AutoEnzyme). Non-Enzyme backends get the samereshapeas master.ForwardDiff.jacobianthroughsop*v) were rerun on base, da36c42 and head. Head matches base exactly; da36c42 failed. The original Enzyme SVector/Krylov failure errors on base and passes on head, both in the unit test and end to end (TrustRegion and NewtonRaphson with KrylovJL_GMRES). Red checks: Core (lts) inference and SCCNonlinearSolve Core also fail on master 61f721b. FirstOrder QA is theRobustTrustRegionLinsolveissue fixed by Declare RobustTrustRegionLinsolve public in NonlinearSolveBase #1357.benchmark (lts)stays Unsatisfiable until SciMLJacobianOperators 0.1.20 is registered._shaped_likeis a dead helper with a trivial test; the EnzymeArrayPartitionpath is untested; comments are about 16% of addedsrclines.🤖 Risk assessment posted by an AI agent (fleet master) — harness: Devin CLI 3000.11.3 (Mac) / fusion-claude-opus-5-5-high-sidekick-swe-2-medium (adversarial review.sh run); dispatched by Devin CLI 3000.11.3 (Mac) fleet-master caretaker
Conversation: local transcript ~/.local/share/devin/cli/transcripts/speckle-whale.json (Chris's Mac)