Repository navigation
Trace the nonlinear solver loops under Reactant - #1197
ChrisRackauckas-Claude wants to merge 43 commits into
Conversation
|
Rework plan for this draft:
QA currently fails during environment resolution on unchanged upstream master because the QA environment requires NLsolve 4.x while NonlinearSolve requires NLsolve 5.x; that baseline regression is being bisected separately. |
f55f873 to
a0b0c02
Compare
3541207 to
29bc671
Compare
6088b1c to
be5c212
Compare
be5c212 to
42d2b70
Compare
|
CI triage: the only red lanes so far are the three 🤖 Posted by an AI agent (Claude Code, model claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE |
42d2b70 to
90ccb42
Compare
|
Rebuilt on current 🤖 Posted by an AI agent (Claude Code, model claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE |
90ccb42 to
d06e095
Compare
d06e095 to
1b188d9
Compare
|
Rebased onto 🤖 Posted by an AI agent (Claude Code, model claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE |
|
CI triage: the red 🤖 Posted by an AI agent (Claude Code, model claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE |
53b9e7d to
cbfafa3
Compare
Run every algorithm's ordinary `solve` dispatch under `Reactant.@compile`. The shared solver loop is a `ReactantCore.@trace while` over `CommonSolve.step!`, return codes are traced enums (EnzymeAD/Reactant.jl#3232, SciMLBase#1563) so the solution is built by `SciMLBase.NonlinearSolution` on every path, and the loop-carried cache state is refreshed by one reflective `dealias_traced!` instead of per-cache field lists. Trust-region, Levenberg-Marquardt, geodesic and dogleg updates are written once with `ifelse`; polyalgorithms are traced as a chain of their members. Forward-mode `AutoEnzyme` is preferred during compilation. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.251 Agent-Model: claude-fable-5 Agent-Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE
cbfafa3 to
bfffd5d
Compare
@trace if expands to closures that box locals for JET/Trim; keep host step! on ordinary branches and isolate the traced success gate. Return got_step from @static_timeit and finalize the Reactant Moré path in a helper so host solve! stays unboxed. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Under Reactant, gn_ok is TracedRNumber{Bool}; leading with it in `||`
TypeErrors during compile. Put within_compile() first so host Trim
behavior is unchanged and tracing can enter the fallthrough.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Cursor Agent <noreply@cursor.com>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Append traced Bool carriers after Extras so downstream dispatch on the historical third parameter still matches NamedTuple extras. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Replace short-circuit Bool tests with ifelse so initial Jacobian scaling and DFSane spectral bounds work under Reactant with runtime inputs. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Drop the separate __solve traced entry; compile falls through inside __generated_polysolve and preserves store_original (rejecting multi-member store_original under compile with ArgumentError). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Restore in-place J_damped updates outside Reactant compilation and add warmed active-step allocation checks for TrustRegion and LM. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
New maybe_traced/dealias helpers require Base 2.55 so mixed installs with master Base 2.54 cannot load QuasiNewton/SpectralMethods/FirstOrder. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Runtime-input compiled solves compared against host; polyalgorithm store_original=Val(true) must keep a non-nothing original under @jit. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Trace-safe safe_inv and identity invert, Diagonal in-place Klement updates, and DFSane unit-step under compile so runtime-input @jit solves match the host root. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Mutate the diagonal in place only when setindex is available so Reactant keeps the wrapper while SVector hosts still reconstruct Diagonal. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Avoid @trace if around member __solve (Reactant forwarded Nothing) and gate Klement in-place diagonal updates to compile-only. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Host-side remake/alias branches inside the traced member ladder made Reactant forward a Nothing problem into __solve; reset aliased u0 outside. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Reactant cannot set_mlir_data! on NonlinearSolution inside @trace if; mirror the pre-rewrite helper that selects u/resid/retcode only. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Skip the @trace-if Jacobian reinit for BroydenLowRankJacobian (no set_mlir_data!), carry a maybe_traced idx, zero-fill unused low-rank columns, and select columns with ifelse under compile so the shared LimitedMemoryBroyden path matches the host √2 solve. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Require a finite residual under compile so Reactant reductions that drop NaN cannot report Success; trace QN reinit_rule/max_resets with in-place Jacobian reinit; reject DFSane under compile instead of a silent unit step; document AbsNorm-not-SafeBest and unsupported Broyden AD linesearch. Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI Agent-Model: auto
…emantics Reinstate traced first-step Jacobian install/inversion for dense and Diagonal Broyden under Reactant, gate NaN Unstable and Diagonal ill-conditioning to within_compile(), drop the closed DI fork pin in favor of AutoForwardFromPrimitive, and add regression tests plus docs for compiled-vs-host reset/linsolve drift. Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI Agent-Model: auto
Keep NonlinearSolveBase 2.55.0 and the branch's ConstructionBase/ReactantCore deps; master's Bracketing/SimpleNonlinearSolve fixes come through cleanly. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Signed-off-by: auto <auto@cursor.com>
Throw ArgumentError before DifferentiationInterface prepare under Reactant compile when a concrete Jacobian is needed without analytic jac (DI#1067). Raise SciMLBase to 3.57 for the ConcreteEnum retcode carrier and drop the Reactant test pin. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Signed-off-by: auto <auto@cursor.com>
Compiled Newton paths now reject AD Jacobians before tracing; the NaN residual retcode case must use NonlinearFunction(...; jac) like the other analytic Newton compiles. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Signed-off-by: auto <auto@cursor.com>
Drop Julia-1.12-only LM byte bounds (keep Moré 0-byte). Correct ArgumentError/docs to name analytic jac and identity/diagonal QN; state Krylov is unsupported under compile. Allow scalar AD under Reactant (DI.derivative works); keep AutoForwardFromPrimitive and raise DI to 0.7.4. Present-tense comments only. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: c1431384-7d7b-4422-930d-5a27d9d0a0c0, transcript at /home/crackauc/.cursor/projects/home-crackauc-sandbox-agent-jobs-NonlinearSolve-jl-jobs-1197-cursor-repo/agent-transcripts/c1431384-7d7b-4422-930d-5a27d9d0a0c0/c1431384-7d7b-4422-930d-5a27d9d0a0c0.jsonl on amdci2.julia.csail.mit.edu
Give the GPU Reactant Newton example an analytic jac so it matches the compile contract, and cover that fence in the Reactant tests. Qualify the scalar AutoEnzyme wording: AutoForwardFromPrimitive stays the default, while raw AutoEnzyme can succeed on some scalar paths. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: c1431384-7d7b-4422-930d-5a27d9d0a0c0, transcript at /home/crackauc/.cursor/projects/home-crackauc-sandbox-agent-jobs-NonlinearSolve-jl-jobs-1197-cursor-repo/agent-transcripts/c1431384-7d7b-4422-930d-5a27d9d0a0c0/c1431384-7d7b-4422-930d-5a27d9d0a0c0.jsonl on amdci2.julia.csail.mit.edu
Conflicts resolved: - lib/NonlinearSolveBase/Project.toml: keep SciMLBase 3.57 (PR bump) and SciMLJacobianOperators 0.1.20 (master bump). - lib/NonlinearSolveFirstOrder/Project.toml: same pair. - lib/NonlinearSolveBase/test/qa/qa.jl: master's updated non-public list (adds implicit_sensitivity_solve) plus the PR's ReactantCore is_traced note. Every package Project.toml version bumped above master's where the merge did not already provide a higher version. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <devin@cognition.ai> Agent-Harness: Devin CLI 3000.11.3 Agent-Model: swe-2-high Agent-Session: local Devin CLI session "evening-bath" (no shareable URL; lock file ~/.local/share/devin/cli/session_locks/evening-bath.lock)
Resolve the SCCNonlinearSolve version conflict and move the PR's version bumps above the master releases NonlinearSolveBase 2.55.0 and SCCNonlinearSolve 1.16.0: NonlinearSolveBase 2.56.0 (with the sublibrary lower bounds raised from 2.55 to 2.56) and SCCNonlinearSolve 1.16.1. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Agent-Session: local session ID 97e6aedd-09fb-48d4-baf1-1648f690f988 (headless claude -p, no URL)
Under Reactant compilation `linsolve_identity!!` took elementwise reciprocals of the matrix, which is only the inverse of a diagonal matrix; Broyden with `init_jacobian = Val(:true_jacobian)` and a coupled analytic Jacobian took a wrong first step. Solve `A X = I` through `LinearProblem` instead, which LinearSolve's Reactant overlay runs with the default host algorithm (same singular rescue as the workspace path). `_more_update_λ`'s safeguarded fallback multiplied by a `Float64` literal, promoting a `Float32` λ. Under Reactant λ is carried by the traced Moré loop, so the type change made `@compile` of `TrustRegion()` fail with "Types do not match between function arguments and results". Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Agent-Session: local session ID 97e6aedd-09fb-48d4-baf1-1648f690f988 (headless claude -p, no URL)
Import the Julia 1.10 polyalgorithm inference correction and retain upstream's accepted-residual forcing updates in the traced step helper. Preserve scalar and array types when copying traced values so Boolean cache fields remain Boolean. Keep opaque SCC callbacks compatible with ten-parameter solution views, with regression coverage for forwarding adapters. 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__NonlinearSolve.jl__1197 (no session URL)
TaylorDiff 0.3.5 fails to precompile with current ChainRules: its codegen evaluates the ChainRules tanh frule on a Symbolics variable, and that rule now branches on the input value. TaylorDiff 0.3.6 takes its derivative expressions from DiffRules instead. 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__NonlinearSolve.jl__1197 (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Agent-Harness: Codex CLI 0.170.0 Agent-Model: gpt-6.2-astra Agent-Job: SciML__NonlinearSolve.jl__1197--20261122T125333Z-codex-gpt-6.2-astra Agent-Session: local session 01a20351-c92f-7a63-9f2c-190beb8b0e01 (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Agent-Harness: Codex CLI 0.170.0 Agent-Model: gpt-6.2-astra Agent-Job: SciML__NonlinearSolve.jl__1197--20261122T125333Z-codex-gpt-6.2-astra Agent-Session: local session 01a20351-c92f-7a63-9f2c-190beb8b0e01 (no session URL)
Summary
Makes Moré TrustRegion / first-order paths Reactant-traceable with one host implementation (
within_compilegates,maybe_traced/select/ifelse,@traceloops). Compiled solves match host retcodes or throw explicitly; store-inverse QN first-step invert restored under compile; host AbsNorm / Diagonal ill-conditioning semantics unchanged.SciMLBase ≥ 3.57 (ConcreteEnum retcode carrier). NonlinearSolveBase 2.55.0 (above master 2.54.1). DifferentiationInterface ≥ 0.7.4 (public
AutoForwardFromPrimitive). Reactant SciMLBase pin removed.Array AD Jacobians under
@jit:ArgumentErrorbefore DI prepare when a concrete AD Jacobian is needed without analyticjac(DI#1067). Scalar AD derivatives work under compile; default backend isAutoForwardFromPrimitive(AutoEnzyme Forward)(explicit rawAutoEnzymealso works for some scalar solves). Krylov / Jacobian-operator linear solves are not supported under compile.SCC note:
sols_buffer_eltypein this PR overlaps #1332; leave until #1332 merges, then resolve the next master merge to master's version.Round-5 follow-up (
8cf0e5f4)jac; covered by Reactant testset named afterdocs/tutorials/nonlinear_solve_gpus.md.AutoForwardFromPrimitiveby default; raw AutoEnzyme is not claimed unusable on scalar paths.Limitations
@jitblocked until DI#1067; analyticjacrequired.CI triage
Master merged at
1caff340(master0055e314, includes #1344, #1352, #1321, #1357, #1356). Master's fixes for the earlier master-also failures (Base QAimplicit_sensitivity_solve, FO QARobustTrustRegionLinsolve, FO Core Enzyme/SVector) are now in this branch; CI on1caff340has not been read yet.solve!inference, also on master's LTS jobsMaster merge
1caff340(conflict resolutions)lib/NonlinearSolveBase/Project.toml,lib/NonlinearSolveFirstOrder/Project.toml: kept the PR'sSciMLBase = "3.57", took master'sSciMLJacobianOperators = "0.1.20".lib/NonlinearSolveBase/test/qa/qa.jl: union of both ignore lists (master'simplicit_sensitivity_solve+ the PR's ReactantCoreis_traced).SciMLJacobianOperatorsbumped 0.1.20 → 0.1.21, since the PR changes its source (T <: Number) and master already took 0.1.20.autodiff.jl,NonlinearSolveBase.jl,SCCNonlinearSolve.jl,SciMLJacobianOperators.jl, bothruntests.jl, devdocs) are present unchanged. Every package version stays above master's. Polyalgorithm solve!: assert retcode type for Julia 1.10 inference #1347 and Fix polyalgorithm init+solve! for Simple*/NoInitCache sub-caches (#1348) #1349 are not on master yet.Verification (head
1caff340)Not run locally, left to CI: FirstOrder Core, QA groups, docs build, the full suites, LTS/downgrade.
Risk assessment
pending independent review
🤖 Generated with Cursor Agent CLI 2026.10.01-14929f9 (model: auto), session c1431384-7d7b-4422-930d-5a27d9d0a0c0
Master merge validated by Claude Code 2.1.292 (model: opus); transcript at /log.txt
Master merge
a6944361Master (
dd8a550b, incl. #1371, #1373, #1329) registered NonlinearSolveBase 2.55.0 and SCCNonlinearSolve 1.16.0, so the PR's versions move above them:lib/SCCNonlinearSolve/Project.toml(only conflict): 1.15.5 vs master 1.16.0 → 1.16.1.NonlinearSolveBase = "2.55"lower bounds (root, FirstOrder, QuasiNewton, SpectralMethods) →"2.56". The Benchmark LTS item above now needs 2.56.0 registered.sols_buffer_eltypestays.Verification on
a6944361(Julia 1.13.0): NonlinearSolveBaseGROUP=Core→ 548/548, "tests passed"; SCCNonlinearSolveGROUP=Core→ "tests passed"; rootPkg.resolve()picks NonlinearSolveBase 2.56.0 from the path source;typosclean on changed files. Not rerun: Reactant, FirstOrder/QuasiNewton Core, QA, docs.🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 97e6aedd-09fb-48d4-baf1-1648f690f988 (headless, no URL)
Re-review round 2 fixes (
247d608f)These are the two P1 findings from the Codex Sol re-review of
a6944361. Both reproduced locally first: Julia 1.13.0, Reactant 0.2.293, ReactantCore 0.1.26, Enzyme 0.13.216, SciMLBase 3.58.0, LinearSolve 5.18.2.linsolve_identity!!now solvesA X = IwithSciMLBase.solve(LinearProblem(A, I)). LinearSolve's Reactant overlay runs that as a host callback with the default algorithm, so the result, including the singular-matrix rescue, matches the host workspace path. I tried Reactant's nativeinv(::TracedRArray)andA \ Bwith a matrix RHS first. On a 2×2Float32matrix both hung for more than 15 minutes in the MLIRConcatViewCSErewrite pass, so the branch does not use them.A = [2 1; 1 3],maxiters = 1): compiled[-2.0, -1.6666667]before the fix,[0.19999993, 0.6]Success after, the same as the host result.A*u + u.^3/10 - p, analyticjac,maxiters ∈ (1, 50), compared against host). It fails on the unfixed code:Evaluated: Float32[-2.0130434, -1.7363636] ≈ Float32[0.26707137, 0.585736] (rtol=0.001). It passes with the fix: 2/2 + 2/2.Reactant.@compileofTrustRegion()failed with "Types do not match between function arguments and results". The cause is in_more_update_λ: its safeguarded fallbackl + 0.01 * (u - l)uses aFloat64literal. Reactant 0.2.293 promotesTracedRNumber{Float32} * Float64toFloat64, so the loop-carried λ changed type inside the traced Moré loop. I found this by printing the carried types before and after one iteration of_more_generic_λloop!: only λ changed,TracedRNumber{Float32}→TracedRNumber{Float64}. The literal now takes λ's type (oftype(λ, 0.01)).Float32λ no longer becomesFloat64on that fallback branch.Float64results are bit-identical.Evaluated: 0.01 isa Float32,Evaluated: 0.01 == 0.01f0) and passes with the fix (10/10). The existing Reactant assertion attest/Reactant/reactant_tests.jl:80(compilesolve_trust_region) is the end-to-end fail-before. With the fix the compiled solve returns[1.4142135, 1.4142135]Success.New limitation: under compile, the store-inverse initial inverse runs on the host through LinearSolve's Reactant callback. It needs LinearSolve loaded, which
NonlinearSolvedoes, and it is a host round-trip on device backends. This happens once per Jacobian (re)initialization.Verification (head
247d608f, Julia 1.13.0,JULIA_NUM_THREADS=4)Not run locally: QA groups (no public API, exports, or deps changed in this commit), docs build, LTS/downgrade, GPU, downstream.
Breaking change
No public API is removed, renamed, or changed in signature or behavior. The bumps this PR requires are already on the branch:
No major bump is required.
🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 97e6aedd-09fb-48d4-baf1-1648f690f988 (headless, no URL)
Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 6363472)
Merged current upstream normally, including the Julia 1.10 polyalgorithm retcode-inference correction. The first-order conflict resolution retains tracing and applies upstream's forcing update after the accepted residual is available. Opaque SCC callbacks receive adapter-compatible solution views, while explicit concrete wrapper signatures retain concrete buffers. Traced scalar and array copies preserve their input types, preventing Boolean cache fields from becoming integers.
Failing-before / passing-after
solve()8/8, then errored insolve!()with an incompletely inferred retcode carrier. After the merge, both testsets pass 8/8. They also pass with the declared minimum SciMLBase 3.57.0.Both cases pass in the completed 184/184 Reactant matrix after the fix.
Local verification
All runs used
JULIA_NUM_THREADS=4,OPENBLAS_NUM_THREADS=1, andJULIA_PKG_PRECOMPILE_AUTO=0. Environment locations are represented by variables below.$LTS_ENVdevelops the checkout and its in-tree dependencies;$validation_envselects each package's native project.The Julia 1.13 Core command covered FirstOrder and Base; the QA command covered root, SCC, FirstOrder, and Base. Core counts below sum the printed top-level test summaries.
Selected tails of the real outputs:
Formatting and spelling:
These ran before committing. Runic checked all 37 changed Julia files; all four checks exited 0 with empty output. The initial FirstOrder scratch-context attempt stopped before tests because of relative
[sources]resolution; the native-project retry above passed.Remaining blockers and limits
ReactantCore.is_tracedremains non-public; an upstream public interface is still required. The PR's hard dependencies ReactantCore and ConstructionBase both have MIT licenses.The docs build fails during TaylorDiff loading with
TypeError: non-boolean (Symbolics.Num) used in boolean context. A separate clean-master investigation reproduced it and isolated ChainRules 1.74.10 (standalone import passes) versus 1.74.11 (fails), with manifests differing only in ChainRules. The introducing commit is linked below. The Julia 1.13 docs attempt entered recursive exception rendering and was stopped; Julia 1.12.7 exposed the underlying baseline error. No baseline dependency workaround was added.Not verified: macOS execution, the full all-dependency downgrade environment, benchmarks, GPU, downstream packages, or Everything. The minimum SciMLBase inference case was verified. CI completion is not claimed.
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__NonlinearSolve.jl__1197 (no session URL)
Fix by Muse CLI Code muse-wonder-full-1.0 (head bdb22e4)
The two base-green failures (
lib/NonlinearSolveHomotopyContinuationCore and QA on Julia 1, plus the same failure on LTS and in downgrade-sublibraries) were a TaylorDiff precompile failure, not a solver test failure:Root cause: ChainRules (1.74.13 in the failing runs, 1.74.8 in the last passing HomotopyContinuation run) changed its
tanhscalar rule to branch on the input (abs(real(x)) < 1 ? 1 - Ω^2 : sech(x)^2). TaylorDiff 0.3.5 evaluates that frule on aSymbolics.Numduring its own precompilation, which now throws. This reproduces with no NonlinearSolve code involved: a scratch environment containing only TaylorDiff 0.3.5 + ChainRules 1.74.13 + Symbolics 7.48.0 fails to load TaylorDiff, and the same environment at TaylorDiff 0.3.6 loads. TaylorDiff 0.3.6 takes its derivative expressions from DiffRules instead of evaluating ChainRules rules symbolically.Change:
lib/NonlinearSolveHomotopyContinuation/Project.tomlcompat floorTaylorDiff = "0.3.1"→"0.3.6", so no resolver (including downgrade runs, which resolved TaylorDiff 0.3.5 in the failing CI) can select the broken combination. The HomotopyContinuation sublibrary version on this branch (0.1.14) is already above master's, so no further bump was needed. No solver code changed; no test was added because the existing HomotopyContinuation Core/QA suites are the failing-before/passing-after check for a compat floor.Failing-before / passing-after evidence (Julia 1.13.2,
JULIA_NUM_THREADS=4):Validation commands and real output tails:
Not verified locally: Julia LTS and the downgrade-sublibraries lane (left to CI; TaylorDiff 0.3.6 declares
julia = "1.10"compat), the rest of the PR's test groups (unchanged by this commit), and the checksrack ci compareclasses as pre-existing or no-base (CUDA, Documentation, benchmark LTS, downgrade-sublibraries signature on the base run).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__NonlinearSolve.jl__1197 (no session URL)
Fix by Codex CLI 0.170.0 gpt-6.2-astra (head 8e7e5d5)
Merged current master, preserving the published branch history. The LTS benchmark now resolves each checkout's runtime path dependencies in one Pkg operation. The project that AirspeedVelocity copies into the runner shares that resolution. A regression test checks that Base, QuasiNewton and the transitive SciMLJacobianOperators dependency come from the checkout.
Verification
On Julia 1.10.12 the unmodified master benchmark dependency setup resolved NonlinearSolveBase 2.55.1 and NonlinearSolveQuasiNewton 1.15.3. The following command used the same PR source revision with the two benchmark drivers. Environment and output locations are represented by variables.
Before, the process exited 1.
After, the same benchmark revision resolved Base 2.56.0 and wrote 17 results, including package load time. Exit 0.
From a clean checkout of the final commit, the full LTS workflow compared master and the fix, wrote timing and memory tables, and produced identical sets of 17 benchmark cases. The SCC Core suite also passed on both Julia versions where the master push failed. The SCC environments used the checkout's sublibraries and its declared test dependencies.
The documentation build exited 0 in a clean checkout. Documenter produced the HTML index.
CI comparison and scope
The preceding head's Sublibrary CI completed with 47 successful jobs and three matrix skips. The LTS benchmark was the non-GPU failure. The PR CUDA job and master CUDA job both ran on GPU hardware. Each recorded 21 passes and one failure when CUDACore accessed the deprecated GPUCompiler.compile_hook binding. The default-branch CUDA and SCC failures have existing tracking.
No local GPU, macOS, downgrade, or Everything run in this fix session. The earlier review item for a public ReactantCore.is_traced API still depends on upstream exposing that predicate.
Next counted review must come from a smart model in a fresh session, not this fix session.
CI triage (CUDA check, pre-existing on master)
The failing
tests / CUDA (julia 1, self-hosted Linux X64 gpu) / Tests - CUDA (Julia 1)check is not introduced by this PR: the same job fails onmasteritself (workflow run for masterCI (NonlinearSolve), conclusion failure at 2026-11-22; the master run id observed: 44568335433). The failing test is theGeneralizedFirstOrderAlgorithmwarning-capture assertion (1 failed of 22 CUDA tests), which fails identically on the pre-rebase head.Non-GPU checks on this head are green or in progress. This note is evidence for the merge gate, per the repo's practice of naming failures that also fail on the default branch.
🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a20351-c92f-7a63-9f2c-190beb8b0e01 (no session URL)