Skip to content

Reuse KrylovJL workspace across same-size A updates - #1378

Merged
ChrisRackauckas merged 9 commits into
SciML:mainfrom
ChrisRackauckas-Claude:krylov-reuse-workspace
Nov 17, 2026
Merged

ChrisRackauckas merged 9 commits into
SciML:mainfrom
ChrisRackauckas-Claude:krylov-reuse-workspace

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

🚧 UNREVIEWED — awaiting review by @ChrisRackauckas. Filed by an AI agent running as @ChrisRackauckas; Chris has not seen this.
Harness: Claude Code (orchestrator), with Cursor Agent, Codex CLI and Grok Build workers · Model: claude-opus-5-5, gpt-6.1-sol, grok-4.7
Conversation: https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv

Repeated cache.A = ... updates reuse compatible Krylov workspaces instead of allocating and growing a new basis. Compatibility checks include workspace type, dimensions, solution storage type, memory semantics and error-estimation window, including initialized placeholders for non-Matrix operators.

Block workspaces retain independent output storage, so u0 can overlap the RHS without Krylov zeroing the RHS before reading it. Restarted GMRES/FGMRES/FOM/GPMR and DIOM/DQGMRES require exact memory matches; unrestarted expanding methods can retain spare capacity. Block GMRES checks its constructor's restart capacity too. No public API or dependency changes.

Regression evidence

New regressions cover 12×12 SPD systems with two RHS columns for block GMRES/MINRES, both shared u0 = b and an overlapping u0 view, on first solve and after an A update. Decreasing-memory regressions compare reused GMRES, FGMRES, FOM and limited-memory methods with fresh solves; GPMR has a compatibility check, and block GMRES covers switching from an expanded unrestarted basis to a restarted solve.

The same test file ran against unfixed head 1678314a6ba468805747e4a8918082c1a9f95327 (source unchanged) and with the fixes:

timeout 3600 julia --project=. -e 'using Test; @testset "Review regressions at 1678314" begin include("test/Core/krylov_workspace_reuse.jl") end'

Before, exit 1 (zero block solutions; retained vector and block bases larger than the requested/fresh size 5):

Test Summary:                                                  | Pass  Fail  Total   Time
Review regressions at 1678314                                  |   55    14     69  29.1s
  KrylovJL reuses workspace on same-size A update              |   18           18   0.7s
  KrylovJL non-Matrix A honors gmres_restart and MINRES window |   11           11   4.1s
  KrylovJL block output overlapping RHS                        |   12     4     16  10.6s
  KrylovJL decreased subspace memory                           |   14    10     24   5.9s

After, exit 0 (same command, testset label “Review regressions with fixes”):

Test Summary:                 | Pass  Total   Time
Review regressions with fixes |   69     69  56.6s

The 29 existing reuse assertions still pass, including allocation ceilings, unchanged iterations/solutions, changed-A accuracy, size/type incompatibility, operator restart and MINRES window checks.

Allocation and timing evidence

Same machine, same seed (Random.seed!(1378)), same dependency manifests (Krylov 0.10.10), JULIA_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 taskset -c 3, BenchmarkTools minima. Before is default-branch merge parent c7ff3bee041e70e85dcf89acabcae7aee634a82c; after is this fix. Script: job scratch/codex-benchmark.jl, based on the original a1_krylov_ab.jl.

before
KrylovJL gmres!: A-update re-solve @allocated=24295328 B; iters=290 resid=8.346106655397204e-7 |u-u1|=0.0
   bench: min=301.480 ms med=338.596 ms allocs=935 mem=24294656
KrylovJL cg!: A-update re-solve @allocated=326616 B; iters=297 resid=7.978399308708586e-7 |u-u1|=0.0
   bench: min=26.020 ms med=27.422 ms allocs=27 mem=326616
small n=200 GMRES A-update: min=28.860 μs med=29.780 μs allocs=65 mem=39904

after
KrylovJL gmres!: A-update re-solve @allocated=16 B; iters=290 resid=8.346106655397204e-7 |u-u1|=0.0
   bench: min=275.321 ms med=279.428 ms allocs=1 mem=16
KrylovJL cg!: A-update re-solve @allocated=16 B; iters=297 resid=7.978399308708586e-7 |u-u1|=0.0
   bench: min=25.993 ms med=26.126 ms allocs=1 mem=16
small n=200 GMRES A-update: min=28.100 μs med=28.250 μs allocs=1 mem=16

GMRES and CG retain 16-byte A-update solves, with identical iteration counts and residuals across the paired runs and zero solution change on repeated solves. Timings reflect this shared machine; the allocation reduction is the primary claim.

Local validation

Main regression, Core and QA runs used Julia 1.12.4.

GROUP=Core timeout 3600 julia --project=. -e 'using Pkg; Pkg.test()'

Exit 0:

Krylov workspace reuse |   69     69  10.3s
Resize        |   76     76  1.8s
  1.791260 seconds (1.16 M allocations: 58.393 MiB, 91.11% compilation time)
Test Summary:              | Pass  Total  Time
SpecializingFactorizations |   18     18  2.3s
  2.354351 seconds (2.24 M allocations: 113.459 MiB, 5.94% gc time, 97.60% compilation time)
     Testing LinearSolve tests passed 

Julia 1.10.12 targeted regression file: exit 0, 69/69:

Julia 1.10.12
Test Summary:                    | Pass  Total     Time
Review regressions on Julia 1.10 |   69     69  1m28.3s
timeout 3600 julia --project=$HOME/sandbox/goals/performance/runic-env -e 'using Runic; exit(Runic.main(ARGS))' -- --check src/iterative_wrappers.jl test/Core/krylov_workspace_reuse.jl
typos src/iterative_wrappers.jl test/Core/krylov_workspace_reuse.jl

Both exit 0. git diff --check is clean.

GROUP=QA timeout 3600 julia --project=. -e 'using Pkg; Pkg.test()'

Initial run, exit 1:

JET Tests     |   34       9     43  6m18.8s
Allocation QA |   67     67  3m31.0s
SupernodalLU Allocation QA |    8      8  20.3s
Quality Assurance                                                  |   50     1     51  24m39.1s
Persistent tasks: Test Failed
Expression: !(has_persistent_tasks(package; kwargs...))

This single Aqua persistent-task failure also reproduces with Aqua 0.8.18 on the unchanged default-branch control. A separate investigator reduced it to a fresh environment with no SciML packages: an optional dependency that only sleeps during compilation is falsely counted as a persistent task. The first bad Aqua commit is da7b66faf6a556d31056484f1051e57740afdf3a; its immediate parent passes the same cold fixture. A separate candidate Aqua patch passes that fixture and still rejects a genuine persistent Timer. It was not applied to LinearSolve or this QA run. No tests, assertions, timeouts or dependencies in the PR were changed to bypass the failure.

The standalone reproducer, versioninfo(), bisect outputs, candidate patch and upstream issue draft are saved in job scratch/codex-aqua-investigation/. No upstream issue was filed: third-party permission was not provided and this task prohibits GitHub comments.

Unchanged full QA rerun, exit 1: the same single Aqua assertion fails; all other assertions pass. No QA setting was changed.

JET Tests     |   34       9     43  2m29.4s
Allocation QA |   67     67  1m30.8s
SupernodalLU Allocation QA |    8      8  14.5s
Quality Assurance                                                  |   50     1     51  13m41.7s

All Julia jobs use the prescribed job-local TMPDIR and JULIA_DEPOT_PATH, remove a host-specific tool directory from PATH, run under timeout 3600, and stay within two top-level Julia runs. No global Julia environment changes.

Not verified

Physical GPU, MPI and downstream package runs were not performed locally. DefaultLinearSolver Krylov slots were not validated or benchmarked. GPMR coverage here checks workspace compatibility rather than a full partitioned-system solve. No docs build was run: this diff changes no docstring, documentation or public API. CI for the new commit and independent re-review remain pending.

Please ignore until reviewed by @ChrisRackauckas.

Risk assessment

  • Risk: high — retain the previous medium-high independent assessment until re-review.
  • Blast radius: explicit KrylovJL initialization and A-update reuse, including block output and fixed subspace settings; no public API or dependency changes.
  • Evidence: both new regression testsets fail on 1678314 and pass with the fixes; existing reuse/allocation tests pass; paired GMRES/CG benchmarks retain 16-byte updates. Local validation details are above.
  • Independent review: Codex CLI 0.162.1, model gpt-6.1-sol, rated head 1678314 medium-high (MH1) with confirmed alias/restart failures; Codex CLI gpt-6.1-sol later rated head 3442401 high (H1). This correction awaits independent re-review; the prior reviews are preserved below (Reuse KrylovJL workspace across same-size A updates #1378).
  • Merge: needs human review — prior independent rating and outstanding downstream/hardware validation.

🤖 Original implementation: Cursor Agent 2026.10.01-14929f9 (model: unknown (Cursor auto)), local session (transcript kept by the fleet master); orchestrated by Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv.

🤖 Review fixes generated with Codex CLI 0.163.0 (model: gpt-6.1-sol); local session (transcript kept by the fleet master).

Risk assessment (independent review, Grok Build grok-4.7, reviewed head faace44)

  • Risk: low
  • Blast radius: SciMLBase.solve! for KrylovJL when cache.isfresh (src/iterative_wrappers.jl). A same-size cache.A = now keeps the Krylov workspace instead of allocating a new one. Size, element type, a too-small GMRES basis, and a MINRES-family window mismatch still rebuild. Preconditioners are rebuilt when precsisfresh is set, which LinearCache already sets on cache.A =. No public name is removed or renamed. No new dependency. Version stays 5.18.2. DefaultLinearSolver's Krylov slots are not on this path, which the PR says.
  • Evidence: Head faace44e20c6e2f7d033e41c2fcda8dfe9e53352, unchanged at the end of the review. Julia 1.13.0, Krylov 0.10.11, tmp/env-ls1378 developed from the worktree.
  • Independent review: Grok Build grok-4.7 rated it low, high: reused workspaces still match A\b, and a changed preconditioner, a window, and a too-small basis do not keep a stale workspace.
  • Merge: auto-merge candidate — Core passed and the only red job matches main. ModelingToolkit downstream and a few extension/GPU/Apple jobs were still pending.

🤖 Posted by an AI agent — harness: Grok Build · model: grok-4.7 (independent reviewer; appended by Claude Code 2.1.301 · claude-opus-5-5)
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Risk assessment (independent review, Codex gpt-6.1-sol, head 1678314)

  • Verdict: CHANGES
  • Rating: Codex gpt-6.1-sol rated it medium-high (MH1) at head 1678314
  • Risk: medium-high (MH1: changes LinearSolve's init/solve!/cache-reuse main lane, with confirmed numerical-behavior regressions and incomplete downstream validation). Also matches L2 (added tests) and ML8 (cache reuse with tests); the performance-only ML11 classification is unavailable while behavior differs and ModelingToolkit downstream remains unfinished.
  • Blast radius: Explicit KrylovJL algorithms, including initial solves for operators whose workspace already has matching dimensions, same-size A updates, and block GMRES/MINRES. DefaultLinearSolver workspace slots are rejected by the new compatibility predicate and still rebuild. No public definition/signature, version, dependency, compatibility bound, license, or existing test assertion changes; no new skips or loosened tolerances. New helpers are internal, so no new public-name docstrings/docs entries are required. Newly referenced Krylov workspace types are exported by Krylov.
  • Evidence: Read pr.txt first, the entire risk rubric, and git diff origin/HEAD...HEAD; reviewed head 1678314. No fixing issue is linked; the body references the QA PR QA: explicit LinearAlgebra triangular imports and EI ignore list #1350, whose details were read. Archived HEAD and origin/HEAD (46a9aed) into scratch/head and scratch/base and resolved the head environment with julia --project="$R/scratch/head" -e 'using Pkg; Pkg.instantiate()'; copied its Manifest to scratch/base for the same dependency versions. Julia 1.12.4, Krylov 0.10.11, JULIA_NUM_THREADS=4, prescribed JULIA_DEPOT_PATH, scratch TMPDIR, timeout 3600; test commands ran sequentially. $R denotes this report's parent directory.
    • julia --project="$R/scratch/head" -e 'using LinearSolve; include("<local path>)': 18/18 + 11/11 pass. Same command with scratch/base: 9 pass, 8 fail, 1 error in the first testset; the allocation ceilings fail at 19,136 B for GMRES and 3,696 B for CG, workspace-identity assertions fail, and the PR-only helper is undefined. The file exits at that failed testset; its second testset was not reached on base. Logs: scratch/head-tests.log and scratch/base-tests.log.
    • julia --project="$R/scratch/head" "$R/scratch/probes.jl": 1 pass / 2 fail; same command with scratch/base: 3/3 pass. GMRES restart probe retains basis 20 on head and takes 41 iterations, versus basis 5 and 42 iterations on base and fresh solves. The additional ArrayPartition layout probe passes on both. Logs: scratch/head-probes.log and scratch/base-probes.log.
    • julia --project="$R/scratch/head" "$R/scratch/block-alias.jl": 0 pass / 2 fail; same command with scratch/base: 2/2 pass. Head GMRES/MINRES report Success with zero output and residuals 5.46639 / 4.36449; base residuals are 3.41e-15 / 4.67e-15. Logs: scratch/head-block.log and scratch/base-block.log.
    • Read-only gh pr checks 1378 --repo SciML/LinearSolve.jl --json name,state,link found no failures; therefore no current failing check required comparison against default-branch CI. Core, QA, AD, Reactant and four downstream checks are green; ModelingToolkit is in progress and physical GPU/Apple checks remain queued. Downloaded Core/AD logs show Krylov reuse 29/29, warm start 41/41, ForwardDiff GPU Arrays 16/16 (CPU-backed JLArray), Mooncake 46/46 and Enzyme 64/64.
    • G1: pass. Added changed-A accuracy assertions use independent direct solves (A2 \ b), and the reviewer probes also compare against direct solutions. Those references expose the block regression.
    • G2: fail / needs verification. AD and CPU-backed GPU-array coverage ran, but physical CUDA coverage is still queued and was not run locally. Reactant CI is green; its tests exercise direct/default solves rather than this Krylov reuse branch. No MPI-specific implementation changes. Do not infer completed physical GPU coverage from JLArray results; the existing GPU job must complete and exercise the affected path.
    • G3: pass for the included cache scenarios. New tests change A's values while preserving size, check direct-solve accuracy and workspace identity, and require a rebuild after resizing. They do not cover the aliasing or decreasing-restart regressions below; both need regression tests.
  • Merge: needs changes (fix findings 1–2, add discriminating regression tests, and satisfy G2). Independent risk rating is medium-high under MH1, so Chris's decision is required even after corrections and validation.

🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol
Conversation: local headless review run (no public session URL); transcript kept by the fleet master.

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Risk assessment (independent review, Codex gpt-6.1-sol, head 3442401)

  • Verdict: MERGE
  • Rating: Codex gpt-6.1-sol rated it medium-high (MH1) at head 3442401
  • Risk: medium-high (MH1: LinearSolve init/solve!/cache-reuse main lane; downstream validation incomplete, so ML11 does not apply).
  • Blast radius: Krylov workspace reuse on repeated cache.A = ... updates in LinearSolve's KrylovJL path, used by every downstream solver that reuses a linear cache.
  • Evidence: at head, krylov_workspace_reuse.jl 69/69 and warm_start.jl 41/41; the same regression file against 1678314 gives 55 pass / 14 fail (4 block-alias, 10 memory/restart). Probes: 64/64 block-alias and changed-A, 36/36 rectangular LSMR/LSQR/LSLQ window changes, 3/3 preconditioner refresh. nonsquare.jl 129/129, sparse_vector.jl 12/12. Physical GPU probe (RTX PRO 6000 Blackwell, CUDA 13.4): 24/24 for GMRES/MINRES, Float32/Float64, vector and block RHS. Both earlier alias/restart findings are fixed. Not verified: full Core/QA locally, Julia 1.10, MPI, Apple, and the downstream ModelingToolkit/SciMLSensitivity jobs that were still running.
  • Findings: non-blocking: the body lacked the unreviewed banner and named local transcript paths and hosts (fixed in this body edit); wait for the downstream, GPU and Apple jobs before merging.
  • Merge: needs Chris (medium-high).

🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol (independent reviewer; appended by Claude Code 2.1.302 · claude-opus-5-5)
Conversation: https://claude.ai/code/session_0133iSjsLBByPU93BDEQkNDF (fleet master); the review ran as a local headless Codex session with no public URL.

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Independent executed findings at head 3442401 — session 01a15e39-ef5b-7b13-8999-b6036ce3fa61

Krylov workspace reuse preserves an abandoned warm start after a callback exception. Clearing the current guess and updating the matrix can then return Success with a wrong solution. Reset transient warm-start state before reuse, or rebuild an incompletely solved workspace, and add an official exception/update/retry regression with independent residual and solution assertions.

The independent 60×60 diagonal control uses an initial guess of one million, a callback that throws once, then a zero guess, a changed matrix and changed right-hand side. Head reports Success with relative residual 0.325793845255356 and solution error 0.1459667179350269 (2 pass, 2 fail); clean base passes 4/4 with residual 4.502000524159359e-9 and error 1.89799699821511e-9. Expected solutions use independent diagonal division. The ordinary reuse test passes 69/69 and warm-start test 41/41; these do not catch the recovery defect.

Official Core timed out after one hour with affected testsets passing; complete Core is unverified. Head QA exited with SIGTERM, cause unknown, before completion; clean-base QA passed. These are incomplete validation results, not a fabricated Aqua failure. Exact-head CUDA71, Mooncake46 and Enzyme64 assertions were read from CI, not run locally. A separate clean-default DIOM initialization failure is routed for investigation. Original commit model/session metadata also needs an evidence-backed repair without guessed identity or signed-history rewriting.

Risk assessment

  • Risk: medium-high (MH1), with a failing shared-cache safety gate G3.
  • Blast radius: LinearSolve Krylov cache reuse after exception recovery and matrix updates; a working main-lane entry point can report Success with a wrong answer.
  • Evidence: Clean-base4/4 versus head2pass2fail analytic exception/update/retry control, ordinary reuse69/69 and warm-start41/41, additional unchanged-path numerical/allocation controls; official local Core/QA incomplete as stated above.
  • Independent review: Codex CLI0.163.0, gpt-6.1-sol, local session 01a15e39-ef5b-7b13-8999-b6036ce3fa61 (no session URL), CHANGES/medium-high (MH1) at head 3442401. Findings-only because historical rating text leaked into supplied intake; no counted merge rating or repinned old rating.
  • Merge: Held on source, G3 and attribution findings. Medium-high remains Chris's decision after correction and independent verification; no approval, merge, closure or release here.

Links:


🤖 Posted by an AI agent — harness: Codex CLI0.163.0 · model:gpt-6.1-sol
Conversation: local session 01a154f0-8986-78e1-8af2-1119e8cdea4a (no session URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Risk assessment (independent review, Codex CLI (gpt-6.1-sol), local job oss-reviews-2026-10-22-SciML-LinearSolve-jl-1378-3442401 (no session URL), head 3442401)

  • Verdict: CHANGES
  • Risk: high (H1)
  • Summary: The allocation improvement passes its tests, but workspace reuse breaks previously working rectangular and repartitioned ArrayPartition solves.
  • Merge: needs changes — fix the review findings below

Executed review notes (head 3442401):

Findings

  1. src/iterative_wrappers.jl:690 — blocking — The new rebinding method excludes rectangular workspaces with different range/domain storage types. In supported Krylov 0.10.11, KrylovWorkspace{T,FC,S} aliases _KrylovWorkspace{T,FC,S,S}; it does not include workspaces with different Sm and Sn. The existing ArrayPartition constructor intentionally supports separate range and domain types. For a full-rank 6×3 matrix and a two-part ArrayPartition RHS, the default output is a Vector, so the initialized LSMR/LSQR/CGLS workspace passes _krylov_can_reuse_workspace, then the first solve! throws MethodError at line 704. An explicitly supplied one-part ArrayPartition output fails identically. These cases solve accurately on the merge-base. Broaden the non-block rebinding dispatch to include these workspaces, preserve the block no-op, and add first-solve and A-update regressions with distinct range/domain types. A process-local generic fallback restores all six assertions in the explicit-output probe; no package source was edited.

  2. src/iterative_wrappers.jl:670 — blocking — Matching total dimensions and concrete vector type does not establish compatible partition storage. ArrayPartition part lengths are runtime values, so changing the partition lengths from (2, 3) to (3, 2) preserves both the vector type and the operator's 5×5 dimensions. After updating cache.A, cache.b, and cache.u, this predicate accepts the old workspace and only rebinds x; basis and scratch vectors still have the old partition lengths. A matrix-free block operator that multiplies its two fields independently then receives a length-2 workspace field for its new 3×3 block and throws DimensionMismatch. The scratch probe uses ordinary block matrix multiplications and analytic solutions [1/2, …, 1/3, …]. GMRES, CG, and MINRES all pass both solves on the base; all three fail after the A update on the head. Include partition layout in compatibility, or conservatively rebuild when compatibility cannot be established, and add this regression.

  3. src/iterative_wrappers.jl:79 — nit — The public KrylovJL docstring describes the old workspace lifecycle. It says the workspace “rebuilds whenever A has been replaced” and explicitly includes cache.A = newA and reinit!. The new implementation deliberately retains compatible workspaces across those updates. Update the docstring to describe conditional rebuilding and retained storage.

Evidence

Reviewed head 344240171e218b990761ec498112cee831bef852; merge-base with origin/main is c7ff3bee041e70e85dcf89acabcae7aee634a82c. Reviewed the complete supplied diff, relevant constructors, cache setters, Krylov workspace definitions, tests, and supplied PR metadata. No commits, GitHub writes, or edits inside repo were made.

Independent risk assessment: Before reading pr.json or any author's/reviewer's rating, recorded medium-high (MH1) in tmp/initial-risk.txt: the diff changes LinearSolve's solve!/cache-reuse main lane, with L2 test additions and ML8 cache-state scope; downstream validation was not yet established. The final rating increases to high (H1: rejecting inputs that used to work) based on the independently reproduced failures above. Matched criteria are L2, ML8 (workspace/cache changes with regression tests, although the partition cases are missing), MH1 (different errors on the core init/solve!/reuse lane), and H1 (previously accepted inputs now error); the highest is H1. The initial M3 concern about an unbenchmarked hot path is addressed by the body's paired timing/allocation measurements. ML11's performance-only classification is unavailable because behavior is demonstrably changed, even though the supplied downstream CI is green. This rating does not derive from the body's ratings.

There are no intentional public name/signature changes, version/compat changes, new dependencies, or licence changes. The rejected inputs are nevertheless an observable API regression and should be fixed before release. Existing tests/assertions were not deleted, loosened, skipped, or marked broken. The new allocation/identity assertions discriminate base from head. The direct-solve checks provide independent numerical references; fresh-versus-reused comparisons also check iteration/restart behavior. None of the new assertions was found to be inherently unable to fail. G1 has independent references; G3 has reuse tests but misses the two failures above. The supplied CI reports GPU and AD jobs green; exact hardware branch coverage was not independently established from job logs.

Scratch setup and environment. Archived head and merge-base into tmp/head and tmp/base, instantiated head, then copied its Manifest to base. Both manifests have SHA-256 d0985aa801e0862b75a7cf9593e3398f1c7814d84ece9d582dbaa9e6ab8ee360. Julia 1.12.7, Krylov 0.10.11, RecursiveArrayTools 4.5.5, SciMLBase 3.58.0, SciMLOperators 1.30.3. Every Julia test command below used JULIA_NUM_THREADS=4, JULIA_NUM_PRECOMPILE_TASKS=4, JULIA_PKG_PRECOMPILE_AUTO=0, TMPDIR="$PWD<local path>, and JULIA_DEPOT_PATH="$PWD<local path>; each run was limited to 2,400 seconds. Commands and output excerpts follow; complete scripts/logs are in tmp.

git -C repo rev-parse HEAD
git -C repo merge-base HEAD origin/main
git -C repo diff --check c7ff3bee041e70e85dcf89acabcae7aee634a82c HEAD
git -C repo status --porcelain
344240171e218b990761ec498112cee831bef852
c7ff3bee041e70e85dcf89acabcae7aee634a82c
**diff --check and status: no output, exit 0**
timeout 2400 julia --startup-file=no --project=tmp/head tmp/run_regressions.jl

Exit 0, tmp/head-regressions.log:

Julia: 1.12.7; threads: 4
Krylov: 0.10.11
Test Summary:  | Pass  Total   Time
PR regressions |   69     69  24.8s
timeout 2400 julia --startup-file=no --project=tmp/base tmp/base_additional.jl

Exit 1, tmp/base-additional.log:

Test Summary:                                                    | Pass  Fail  Error  Total   Time
Base comparison                                                  |   71     8      2     81  39.5s
  PR regressions                                                 |   59     8      2     69  30.2s
    KrylovJL reuses workspace on same-size A update              |    9     8      1     18   6.3s
    KrylovJL non-Matrix A honors gmres_restart and MINRES window |   11                  11   3.9s
    KrylovJL block output overlapping RHS                        |   16                  16   7.9s
    KrylovJL decreased subspace memory                           |   23            1     24   5.3s
  rectangular ArrayPartition with default u                      |    6                   6   5.2s
  changed ArrayPartition field shapes                            |    6                   6   3.3s

The eight failures are workspace-identity/allocation checks; measured base allocations are 19,136 bytes for GMRES and 3,696 bytes for CG, both above the 256-byte bound. The two errors call the PR-only helper, which does not exist on base; they are not numerical failures. All 69 assertions pass on head. Thus the allocation improvement is discriminating, while both adversarial regression groups pass on base.

timeout 2400 julia --startup-file=no --project=tmp/head tmp/head_additional.jl

Exit 1, tmp/head-additional.log:

MethodError: no method matching _krylov_rebind_solution!(::LsmrWorkspace{Float64, Float64, ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, Vector{Float64}}, ::Vector{Float64})
DimensionMismatch: incompatible dimensions for matrix multiplication: tried to multiply a matrix of size (3, 3) with a vector of length 2.

Test Summary:                               | Pass  Error  Total   Time
Additional head coverage                    |   84      6     90  42.2s
  rectangular ArrayPartition with default u |           3      3   9.8s
  changed ArrayPartition field shapes       |    3      3      6   5.7s
  Existing warm start                       |   41            41  11.8s
  Existing ArrayPartition                   |   40            40  14.1s

The first group errors in LSMR, LSQR, and CGLS. The second group's initial solves pass, then updated solves error in GMRES, CG, and MINRES. Reproducers are tmp/default_rectangular_probe.jl and tmp/layout_probe.jl; the latter defines a matrix-free block operator using mul! on each field.

timeout 2400 julia --startup-file=no --project=tmp/base tmp/rectangular_probe.jl
timeout 2400 julia --startup-file=no --project=tmp/head tmp/rectangular_probe.jl
timeout 2400 julia --startup-file=no --project=tmp/head tmp/fixed_rectangular_probe.jl

The explicit partitioned-output probe produces 6/6 pass on base (exit 0), 3 errors on head (exit 1), and 6/6 pass with a process-local generic rebinding fallback (exit 0). Logs: tmp/base-rectangular.log, tmp/head-rectangular.log, tmp/fixed-rectangular.log. The fallback only adds a method in that Julia process and preserves the specialized block no-op; it is diagnostic evidence, not a submitted fix or a fix for finding 2.

Supplied CI snapshot: Parsing pr.json gives Counter({'SUCCESS': 66, 'SKIPPED': 4}), with no failed/pending checks. Core (including downgrade), AD, GPU V100, QA, Reactant, documentation, benchmarks, and all five downstream jobs report success: OrdinaryDiffEq/InterfaceII, ModelingToolkit/All, SciMLSensitivity/Core1, BoundaryValueDiffEq/All, and NonlinearSolve/Core. The four skipped jobs are sublibrary matrix placeholders; this diff changes no sublibrary. The body’s remaining statements that current-head CI and downstream validation are pending are stale relative to this supplied snapshot. Green CI does not cover the failing storage cases demonstrated here.

Not verified

  • Did not rerun the full Core/QA/downstream suites, documentation build, physical GPU, AD, Reactant, or MPI tests locally; used the supplied CI snapshot for their reported status and did not fetch live GitHub status or job logs.
  • Did not reproduce the body's large-system timing benchmark, its historical intermediate-head results, the Julia 1.10 run, or the Aqua investigation. Locally verified the added allocation bounds and numerical assertions on head and their discrimination against the merge-base.
  • Did not exhaustively exercise every Krylov algorithm, default-polyalgorithm slot, array backend, or GPMR partitioned solve. The diagnostic fallback was tested only for finding 1; no complete corrective patch was made or validated.

🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol (independent reviewer; appended by Antigravity CLI · model: gemini-4-argon-high)
Conversation: local job oss-reviews-2026-10-22-SciML-LinearSolve-jl-1378-3442401 (no session URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 2bf5dc8)

Support rectangular Krylov workspaces with distinct range/domain storage, conservatively rebuild ArrayPartition workspaces on matrix updates, and rebuild interrupted warm starts before retrying with or without a matrix update. The public KrylovJL docstring describes the workspace lifecycle. The existing fix was ported unchanged; no dependency, public API, assertion tolerance, skip, or broken-marker changes were introduced.

Discriminating regression

Identical tests against unmodified head 3442401 and the fixed tree, Julia 1.12.7. Environment variables below identify the frozen comparison environments and probe scripts.

timeout 3600 julia +1.12.7 --project="$UNFIXED_ENV" -e 'using Test; @testset "Review regressions" begin include("test/Core/krylov_workspace_reuse.jl") end'
timeout 3600 julia +1.12.7 --project=. -e 'using Test; @testset "Review regressions" begin include("test/Core/krylov_workspace_reuse.jl") end'

Before, exit 1:

Test Summary:                                                  | Pass  Fail  Error  Total     Time
Review regressions                                             |   83     8      9    100  1m13.6s

After, exit 0:

Test Summary:      | Pass  Total   Time
Review regressions |  121    121  55.2s

The original 69 assertions remain intact. New cases cover rectangular LSMR/LSQR/CGLS with vector and partitioned output, changed partition layouts for GMRES/CG/MINRES, and GMRES/FGMRES exception/retry recovery with independent solution and residual checks.

Allocation probes

Same seed, copied dependency manifests, single Julia/BLAS thread, warmed repeated A updates. Baseline is merge parent c7ff3be; the fixed tree includes the PR's workspace reuse.

timeout 3600 julia +1.12.7 --project="$BASE_ENV" "$BASE_PROBE" "$TOOLS_ENV"
timeout 3600 julia +1.12.7 --project=. "$PROBE" "$TOOLS_ENV"

Both exit 0:

before:
gmres! n=10000 A-update @allocated=20108848 B; iters=238 residual=9.58535426176704e-7 solution change=0.0
cg! n=10000 A-update @allocated=326664 B; iters=258 residual=9.722378110365442e-7 solution change=0.0
Large A-update benchmarks |    8      8  7.2s

after:
gmres! n=10000 A-update @allocated=16 B; iters=238 residual=9.58535426176704e-7 solution change=0.0
cg! n=10000 A-update @allocated=16 B; iters=258 residual=9.722378110365442e-7 solution change=0.0
Large A-update benchmarks |    8      8  6.7s
A storage families |   12     12  2.3s

Dense, sparse, tridiagonal and MatrixOperator updates each measured 16 B. Repeating the same two commands with +1.12.4 also passed: GMRES 20,108,816 B → 16 B; CG 326,664 B → 16 B; identical paired iterations/residuals, zero solution change, and storage-family checks 12/12. The observed unfixed byte counts differ slightly from the previous report's 20,116,560 B and 326,792 B; all fixed update measurements remain 16 B.

Full local validation

GROUP=Core timeout 7200 julia +1.12.7 --project=. -e 'using Pkg; Pkg.test()'
GROUP=QA timeout 7200 julia +1.12.7 --project=. -e 'using Pkg; Pkg.test()'

Both exit 0. Core includes:

Krylov warm start     |   41     41   9.8s
Krylov workspace reuse |  121    121  21.0s
SpecializingFactorizations |   18     18  1.8s
     Testing LinearSolve tests passed

QA output (the nine JET broken assertions are pre-existing):

Test Summary: | Pass  Broken  Total     Time
JET Tests     |   34       9     43  2m21.9s
Test Summary: | Pass  Total     Time
Allocation QA |   67     67  1m52.4s
Test Summary:              | Pass  Total   Time
SupernodalLU Allocation QA |    8      8  10.8s
Test Summary:     | Pass  Total      Time
Quality Assurance |   51     51  16m46.0s
     Testing LinearSolve tests passed
timeout 3600 julia +1.12.7 --project=@runic -m Runic --inplace src/iterative_wrappers.jl test/Core/krylov_workspace_reuse.jl
git diff HEAD^ HEAD | typos -
git diff --check HEAD^ HEAD

All exit 0. Runic left the ported files unchanged. Two added comment lines out of 96 added lines explain the partition compatibility constraint.

PYTHONPATH="$PYTHON_PACKAGES" JULIA_PYTHONCALL_EXE="$SYSTEM_PYTHON" JULIA_CONDAPKG_BACKEND=Null timeout 3600 julia +1.12.4 --compiled-modules=existing --project=docs docs/make.jl

Exit 0, with doctests, exported-name checks and link checks enabled. System Python and scratch PyAMG packages use the prior fixer's working environment recipe. Successful output includes:

[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: HTMLWriter: rendering HTML pages.
[ Info: Automatic `version="5.18.2"` for inventory from ../Project.toml

Before changing code, current-head CI showed 66 SUCCESS / 4 SKIPPED placeholders. gh run view --log-failed returned no output for both current-head Tests and default-branch Tests. The separate default-branch ModelingToolkit integration failure at components.jl:446 predates this fix and was left untouched.

Not verified locally: physical GPU, MPI, downstream suites, dedicated AD/Reactant groups, dedicated DefaultLinearSolver Krylov allocation probes, or exhaustive Krylov/backend combinations. No historical author identity or conversation link was guessed, and no existing commit history was rewritten.

Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).

Links:

The prior independent risk assessment remains in force until a fresh independent review. This fix session supplies executed validation and does not issue an independent rating.


🤖 Posted by an AI agent — harness: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__LinearSolve.jl__1378 (no session URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Devin CLI 3000.11.228 swe-2-high (head 30a36a4)

Two CI failures fixed; the workspace-reuse property is unchanged.

Downgrade job — compat bump (chosen over method-presence gating)

Project.toml: Krylov = "0.10" → Krylov = "0.10.4".

init_cacheval for b::ArrayPartition calls Krylov.KrylovConstructor(b, u). On Krylov ≤ 0.10.3 KrylovConstructor{S} requires vm/vn/vm_empty/vn_empty to share one storage type, so any problem whose range and domain storage differ — a rectangular A (default flat u), or a u0 partitioned with a different layout — hits a MethodError at init. Those are the 6 downgrade errors, all in KrylovJL rectangular partitioned storage. Gating was considered and rejected: the pre-KrylovConstructor method returned nothing and the solve errored anyway, so there is no older working path to fall back to; a real fallback would be the flat-buffer canonicalize machinery #1206 deliberately dropped, dead code reachable only on Krylov ≤ 0.10.3. Krylov 0.10.4 ("Allow vm and vn to be of different types") is the lowest registered version providing KrylovConstructor{Sm,Sn}.

Reactant job — pin the test to the CPU client

test/Reactant/reactant.jl: added Reactant.set_default_backend("cpu").

The group's env carries no CUDA.jl, so its julia_callbacks only work when XLA hands them host buffers. The self-hosted pool includes GPU nodes; there Reactant selects the CUDA backend and passes device buffers to the reactant_julia_callback trampoline, which it wraps only when its CUDA extension is loaded — LoadError: CUDA.jl extension must be loaded to perform julia callbacks on the GPU in Ops._construct_cuda_julia_buffer, before the callback body runs. The check is runner-pool nondeterministic: the last green run landed on a CPU node with no XLA CUDA init, and the failing path (default solver on a 2×2 system) never touches the code this PR changes. Pinning the CPU client makes the group deterministic on either runner without changing what is asserted; the alternative (adding CUDA.jl to the group env so ReactantCUDAExt loads) would route the callback's solve through CuArrays and put bitwise == assertions at the mercy of CUSOLVER-vs-LAPACK numerics, which cannot be verified without the GPU runner.

Validation

Fail-before, reproduced with the actual julia-downgrade-compat@v2 script (downgrade.jl "" . deps 1.10 Mooncake on Julia 1.10.12 → Krylov v0.10.0, same as CI), include("test/Core/krylov_workspace_reuse.jl"):

MethodError: no method matching KrylovConstructor(::ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, ::Vector{Float64}, ...)
Test Summary:  | Pass  Error  Total     Time
reuse          |   97      6    103  2m04.6s

After the compat bump (same script re-run → Krylov v0.10.4, the new floor):

Test Summary: | Pass  Total   Time
reuse         |  121    121  56.2s

GROUP=Core julia --project -e 'using Pkg; Pkg.test()':

  • downgrade env (Julia 1.10.12, min registered versions, Krylov 0.10.4): Testing LinearSolve tests passed
  • current env (Julia 1.12.4, latest, Krylov 0.10.12): Testing LinearSolve tests passed
  • GROUP=QA on Julia 1.12.4: Testing LinearSolve tests passed (JET 34+9broken, Allocation QA 67, SupernodalLU QA 8, Quality Assurance 51)

julia --project=@runic -m Runic --inplace test/Reactant/reactant.jl: no changes needed. typos --diff over the diff: clean.

Reactant: julia --project=test/Reactant test/Reactant/reactant.jl at Reactant v0.2.301 / Reactant_jll v0.0.433 (the same resolution as the failed job) → all assertions pass (preserves the LinearSolve operation 3/3, default LU preserves QR safety fallback 4/4). The GPU-buffered callback path itself could not be exercised locally (needs the self-hosted GPU runner); what is verified is that pinning to the CPU client restores exactly the path that has always passed on CPU runners.

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: Devin CLI 3000.11.228 · model: swe-2-high
Conversation: local fixer job SciML__LinearSolve.jl__1378 (no session URL)

Failures inherited from the default branch (named, not caused by this PR)

  • ModelingToolkit.jl/All / Downstream Tests - All also fails on the default branch's own most recent push run at 501476cda32bce76513caa6b08dfec9ebd80f19b (https://github.com/SciML/LinearSolve.jl/actions/runs/40303351595), i.e. no regression introduced here. All other required CI (65 checks) is green at head 30a36a4f77cbd949107a960d154ad6afd8b880bf.

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Claude Code 2.1.326 claude-sonnet-5-5 (head 552ed24)

No source change was needed. This round merges current main into the branch (one Project.toml conflict, resolved to KernelAbstractions = "0.9.30, 0.10.0" from main and Krylov = "0.10.4" from this PR; a merge instead of a rebase because the branch holds merge commits that are not mine, so no force-push) and re-checks the open items.

ModelingToolkit downstream job (run 40682391570, 2026-10-28)

The one failing assertion is ModelingToolkitBase/test/components.jl:446 (isequal(comp1.input.u ~ comp2.output.u, comp2.output.u ~ comp1.input.u)), a symbolic equation-orientation check in "Causal connections generate causal equations". It does not call any Krylov path. That run used an older MTK; against current MTK (0f2c7c4) with this branch's LinearSolve developed into the environment, the same file passes:

julia --project=<env with LinearSolve at 552ed24d + ModelingToolkitBase 0f2c7c4> -e 'using LinearSolve; include("components.jl")'
Causal connections generate causal equations |    6      6  0.3s
exit 0, no failing test sets

The fresh CI run on 552ed24 is the authoritative check; the previous result is stale.

Review findings at 3442401 — already fixed at 2bf5dc8, verified here

The new test file test/Core/krylov_workspace_reuse.jl run against the unfixed source 3442401 and against this head:

timeout 3600 julia --project=. -e 'using Test; @testset "Reuse at unfixed 3442401" begin include("test/Core/krylov_workspace_reuse.jl") end'
Reuse at unfixed 3442401  |   83     8      9    100  18.4s
  KrylovJL changed partition layout     |    6            3      9
  KrylovJL retry after callback exception |    8     8            16
exit 1
Reuse at merged head |  121    121  15.2s
exit 0
  • (a) changed ArrayPartition part lengths: _krylov_can_reuse_workspace returns false for an ArrayPartition RHS, so the workspace is rebuilt; changed partition layout (GMRES/CG/MINRES, (2,3) → (3,2)) compares against ones ./ diag.
  • (b) callback exception, update, retry: _krylov_pending_warm_start blocks reuse of an interrupted warm-started workspace; retry after callback exception (GMRES/FGMRES, with and without an A update) checks A * u ≈ b independently of the solver.

Other validation (Julia 1.13.2, merged head)

GROUP=Core timeout 7200 julia --project=. -e 'using Pkg; Pkg.test()'   # Testing LinearSolve tests passed, exit 0
GROUP=QA   timeout 7200 julia --project=. -e 'using Pkg; Pkg.test()'   # Quality Assurance | 51 51 1m34.4s, exit 0
julia --project=@runic -m Runic --check src/iterative_wrappers.jl test/Core/krylov_workspace_reuse.jl test/Reactant/reactant.jl test/runtests.jl   # exit 0
typos src/iterative_wrappers.jl test/Core/krylov_workspace_reuse.jl   # exit 0
git diff --check upstream/main HEAD   # exit 0

The Risk assessment's independent-review line is rewritten as plain text (rated head 1678314 medium-high (MH1), with the later H1 rating at head 3442401). Risk stays high; no rating is claimed here. Not verified: GPU, MPI, the full MTK/other downstream suites locally.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Claude Code 2.1.326 · model: claude-sonnet-5-5
Conversation: local fixer job SciML__LinearSolve.jl__1378 (no session URL)

ChrisRackauckas and others added 5 commits October 7, 2026 21:32
Rebuilding the Krylov workspace on every cache.A= forces GMRES to re-grow its
basis (tens of MB per update). Reuse when the public workspace type and m/n
(and solution storage type) still match; rebuild on size or eltype change.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Cursor Agent <noreply@cursor.com>
Agent-Harness: Cursor Agent 2026.10.01-14929f9
Agent-Model: unknown (Cursor auto)
Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/linsolve/pr-krylov-ws/log.txt on amdci2
Reuse was keeping init's memory=1 / default-window workspace for non-Matrix A, so GMRES(k) ran as GMRES(1) and MINRES ignored window.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Cursor Agent <noreply@cursor.com>
Agent-Harness: Cursor Agent CLI
Agent-Model: auto
Keep block workspace output independent of caller storage and rebuild fixed
subspaces when their requested size changes. Cover aliased block output,
decreasing restart intervals, and limited-memory orthogonalization methods.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/linsolve/pr-krylov-ws/log-codex.txt on amdci2
ChrisRackauckas and others added 3 commits October 28, 2026 06:36
Rebuild incompatible partitioned workspaces, support rectangular solution
storage rebinding, and recover safely after interrupted warm starts. Cover
rectangular, repartitioned, and exception/retry solves and document the
workspace lifecycle.

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__LinearSolve.jl__1378 (no session URL)
init_cacheval for an ArrayPartition right-hand side builds
Krylov.KrylovConstructor(b, u), where b sizes the range vectors and u
the domain ones. Krylov <= 0.10.3 defines KrylovConstructor{S} with a
single storage type, so it only accepts vm/vn/vm_empty/vn_empty sharing
one type; a rectangular operator (default flat u) or a u0 partitioned
with a different layout hits a MethodError at init. Krylov 0.10.4 added
KrylovConstructor{Sm,Sn} ("Allow vm and vn to be of different types"),
which is the lowest registered version providing the needed method, so
raise the compat lower bound to it.

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 fixer job SciML__LinearSolve.jl__1378 (no session URL)
The Reactant group env carries no CUDA.jl, so its julia_callbacks only
work when XLA hands them host buffers. The self-hosted runner pool
includes GPU nodes where Reactant selects the CUDA backend and passes
device buffers to the callback trampoline; Reactant wraps those only
when its CUDA extension is loaded, and errors otherwise. Pin the CPU
client so the group exercises the host-buffer path it is set up for on
whichever runner it lands.

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 fixer job SciML__LinearSolve.jl__1378 (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Independent review (Codex CLI 0.166.0 / gpt-6.1-sol), session 01a196e2-3b40-76c0-84b5-8f724cc667e6, reviewed head 30a36a4

  • Verdict: MERGE-WITH-ISSUES
  • Risk: medium-high (MH1: the workspace compatibility decision changes core solve!/cache reuse; the paired performance measurements do not replace the missing fully green downstream validation). Also matches ML8 for tested cache reuse and ML4 for raising the Krylov lower bound.
  • Round / slot: 4 / 1
  • Blocking priorities: none

Review written by the reviewer named above 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: Reuses compatible Krylov workspaces across matrix updates and rebuilds incompatible or interrupted workspaces, with regression coverage and CPU selection for Reactant tests. The target matches the live head; local accuracy and regression checks pass, with one outstanding downstream CI issue.

Blast radius: Explicit KrylovJL vector and block workspaces, first solves for non-Matrix operators, A updates, restart memory, error windows, solution rebinding, and retries after interrupted warm starts. ArrayPartition RHS updates deliberately rebuild. DefaultLinearSolver containers fail the workspace-type check and retain their reconstruction behavior. Reactant tests select CPU without changing their assertions.

Evidence: Blind assessment sealed in INITIAL.md and INITIAL.sha256 before author context. Julia 1.13.2 with Krylov 0.10.12: head regression file 121/121, exit 0; identical file against merge-base c7ff3be gives 107 passes, 12 failures and 2 missing-helper errors, exit 1; independent probes 51/51, exit 0. Core, AD, GPU, QA and Reactant CI pass. ModelingToolkit downstream fails; the inspected recent main downstream runs are green, so the exact failure is not verified as pre-existing. G1 is satisfied by analytic diagonal solutions and independent direct solves; G3 by identity, resize, layout, changed-A and interrupted-state regressions. G2 evidence includes executed GPU CI, Core ForwardDiff/JLArray checks and CPU Reactant tests, with limits stated below.

Blocking findings

None.

Non-blocking findings

  1. non-blocking — src/iterative_wrappers.jl:707: downstream validation remains incomplete. Confirmed by inspecting CI logs: ModelingToolkit's “Causal connections generate causal equations” assertion at its lib/ModelingToolkitBase/test/components.jl:446 compares an equation with its reversed orientation and fails (1602 passes, 1 failure, 3 broken). Recent completed main downstream runs pass, so I cannot assert that the same failure also occurs on main. The observed symbolic equation-order failure does not implicate this Krylov workspace change; triage it separately and obtain a clean downstream run. Until then, retain MH1 rather than classifying the change as ML11.

What I ran

All three Julia invocations were sequential, with JULIA_NUM_THREADS=4, OPENBLAS_NUM_THREADS=1, a review-specific TMPDIR, the prescribed shared depot followed by the default depots, JULIA_PKG_PRECOMPILE_AUTO=0 and timeout 3600. The command transcription below uses $REVIEW_DEPOT for the shared depot supplied in TARGET.md, avoiding a machine-specific absolute path. Julia was 1.13.2 on aarch64; Krylov was 0.10.12, RecursiveArrayTools 4.5.6 and SciMLOperators 1.30.4.

gh pr view 1378 --repo SciML/LinearSolve.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid,files
git -C src fetch origin '+refs/pull/1378/head:refs/remotes/pr/1378' main
git -C src checkout --detach pr/1378
git -C src rev-parse HEAD origin/main
git -C src merge-base origin/main HEAD
git -C src diff origin/main...HEAD
sha256sum INITIAL.md > INITIAL.sha256
git -C src log -1 --no-merges --format=%B
git -C src ls-remote origin refs/heads/main
git -C src diff --check origin/main...HEAD

These commands exited 0. The PR is open and draft. Reviewed HEAD is the target SHA; origin/main is the Base SHA above. The three-dot diff and failing-before checkout use merge-base c7ff3be, not the newer tip of main. No root AGENTS.md or CLAUDE.md was present. No fixing issue is linked in the author description. The newest non-merge commit carries the author trailers recorded below.

JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$REVIEW_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no tmp/head-run.jl
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$REVIEW_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no --project=env-base tmp/base-run.jl
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$REVIEW_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no --project=env-head tmp/probe.jl

The head driver activates a temporary environment, develops the head checkout, adds Krylov, RecursiveArrayTools and SciMLOperators, then includes test/Core/krylov_workspace_reuse.jl inside an outer Test testset. The base driver includes the identical head test file in the same outer-testset arrangement against an archived merge-base; its environment copies the head dependency manifest and changes only the LinearSolve source location. Output tails:

PR workspace regressions head       | 121 passed                         | 1m18.5s | exit 0
PR workspace regressions merge-base | 107 passed, 12 failed, 2 errored    |   55.2s | exit 1
Independent workspace probes        |  51 passed                         |   17.4s | exit 0

Base's genuine failures include workspace identity and allocation assertions (GMRES 19136 bytes and CG 3696 bytes versus 256-byte ceilings), plus four accuracy assertions for retrying interrupted GMRES/FGMRES without replacing A: relative residual 8.781220780590987e-7 versus the required 1e-8. Two additional base errors call the PR-only compatibility helper; these are not treated as numerical failing-before evidence. Block-alias, reduced-memory, non-Matrix setting and partition-layout testsets otherwise pass on this merge-base. Thus the full added file fails before and passes after, with a discriminating numerical regression for the interrupted-warm-start fix; not every added scenario fails before.

The independent probe uses seeded input and analytic diagonal solutions or direct backslash references. Its 51 assertions cover preconditioner rebuilding across reinit! in None/Previous/Hegedus modes, rectangular LSMR/LSQR/LSLQ reuse and window changes from 2 to 7, complex sparse GMRES/CG with replacement output storage, and block GMRES/MINRES output replacement and changing RHS width from two to three.

gh pr checks 1378 --repo SciML/LinearSolve.jl
gh run list --repo SciML/LinearSolve.jl --branch main --event push --limit 5 --json databaseId,headSha,conclusion,workflowName,url
gh run list --repo SciML/LinearSolve.jl --branch main --event push --workflow Downstream.yml --limit 5 --json databaseId,headSha,conclusion,url
XDG_CACHE_HOME="$PWD/tmp/gh-cache" gh run view 40682391570 --repo SciML/LinearSolve.jl --log-failed
XDG_CACHE_HOME="$PWD/tmp/gh-cache" gh run view 41285236709 --repo SciML/LinearSolve.jl --log
XDG_CACHE_HOME="$PWD/tmp/gh-cache" gh run view 40682391689 --repo SciML/LinearSolve.jl --job 122796230088 --log
XDG_CACHE_HOME="$PWD/tmp/gh-cache" gh run view 40682391689 --repo SciML/LinearSolve.jl --job 122796230506 --log
XDG_CACHE_HOME="$PWD/tmp/gh-cache" gh run view 40682391689 --repo SciML/LinearSolve.jl --job 122796229650 --log

gh pr checks exits 1 for the single ModelingToolkit failure; the scoped log commands and run listings exit 0. An initial default-cache log request was blocked by the read-only filesystem, and an unscoped Tests log request exceeded gh's request limit; selecting a writable cache and individual jobs supplied the logs. Inspected CI evidence:

  • Core: workspace reuse 121/121; ForwardDiff GPU Arrays 16/16; package tests passed.
  • Physical GPU job: package tests passed, including Krylov GPU fallback solves.
  • Reactant CPU job: package tests passed.
  • Failed ModelingToolkit downstream: reversed-equation assertion described above. The other four downstream checks pass.
  • Recent main downstream: ModelingToolkit tests passed. The other completed runs in the inspected five-run downstream listing also pass; two runs were cancelled. This does not reproduce the PR failure on main.

What I did not verify

I did not run the entire package suite, Pkg.test(), downstream packages, documentation build, timing benchmarks, minimum Krylov 0.10.4, Julia 1.10, or another platform locally. The allocation ceilings ran in the added tests; author timing and bit-for-bit benchmark claims were not independently reproduced. I did not reproduce the ModelingToolkit assertion locally or on a matching default-branch environment, and do not claim it is pre-existing.

No local physical GPU, AD, Reactant or MPI execution was performed. GPU, Core ForwardDiff/JLArray and CPU Reactant evidence comes from CI; physical-GPU cache reuse across A updates, block reuse and interrupted warm starts are not established by the inspected GPU log. Reactant CUDA remains unverified; the changed test explicitly selects CPU. No GPU kernel, AD rule or MPI implementation is changed. DefaultLinearSolver Krylov slot performance, full GPMR partitioned-system solves, and every supported Krylov algorithm/storage combination were not exhaustively probed.

🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74

@ChrisRackauckas-Claude
ChrisRackauckas-Claude marked this pull request as ready for review November 2, 2026 02:05
@PraneethMerugu

Copy link
Copy Markdown

The workspace is rebuilt on every reinit!(linsolve; A = W) that OrdinaryDiffEqDifferentiation.dolinsolve makes at a new W (OrdinaryDiffEqNonlinearSolve newton.jl:793-797), even though W is the same WOperator object each time. A plain-ODE reproducer, with no preconditioner and FBDF on a 2D heat equation with save_everystep = false, allocates a steady 64 vectors per W update at 64², 128² and 256² (42.7 / 207.8 / 830 MiB; 21 / 26 / 26 W updates). Of these, 53 are the workspace.

At the LinearSolve level (LinearSolve 5.18.2, Krylov 0.10.11, Julia 1.12.6; the Krylov path is unchanged on main at 665f336), solve! after cache.A = A with the same object allocates 53.0 vectors at n = 128², 256² and 512² (6.6 / 26.5 / 106 MiB), and 16 B when A is untouched. Script below. We have not run the PR head ourselves.

One related item the PR does not seem to touch: under WarmStart.Hegedus, which OrdinaryDiffEq selects for Newton solves, _krylov_warm_start! allocates up to three vectors per solve (similar(cache.b) at iterative_wrappers.jl:596 and :605, (Aub / d) .* u at :604). In our run that was about 440 MiB (7%). It could use the workspace's scratch vectors. We are happy to open a separate issue or PR for that if useful.

using LinearSolve, LinearAlgebra, SparseArrays
for n in (128^2, 256^2, 512^2)
    A = spdiagm(-1 => fill(-1.0, n - 1), 0 => fill(4.0, n), 1 => fill(-1.0, n - 1))
    cache = init(LinearProblem(A, rand(n)), KrylovJL_GMRES(; gmres_restart = 50))
    solve!(cache); solve!(cache)
    same = @allocated solve!(cache)                     # A untouched
    cache.A = A; solve!(cache); cache.A = A
    fresh = @allocated solve!(cache)                    # the same A object, set again
    println(n, ": same A ", same, " B; after cache.A = A ", round(fresh / 2^20; digits = 2), " MiB = ",
        round(fresh / 8n; digits = 1), " vectors")
end

Output:

16384: same A 16 B; after cache.A = A 6.64 MiB = 53.1 vectors
65536: same A 16 B; after cache.A = A 26.52 MiB = 53.0 vectors
262144: same A 16 B; after cache.A = A 106.02 MiB = 53.0 vectors

New values in a copy of A (cache.A = A2) and reinit!(cache; A = A) give the same 53 vectors. GMRES takes 14 iterations in each case, so the 50-vector basis is mostly unused.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.326
Agent-Model: claude-sonnet-5-5
Agent-Session: local fixer job SciML__LinearSolve.jl__1378 (no session URL)

# Conflicts:
#	Project.toml
@ChrisRackauckas
ChrisRackauckas merged commit 2c56b1d into SciML:main Nov 17, 2026
70 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants