#1988·warp

Uneven batched linear solvers default to too few iterations

Author: dvasquezlopezCreated Sep 23, 2026Updated Sep 28, 2026

Specula found this at commit 2a0e3ff5ec6231813f7a9ecc9aec511870b545fe. The shared solver base defaults maxiter to total scalar degrees divided by batch count. This is the average batch length, so CG, CR, BiCGSTAB, and GMRES can stop before the largest subproblem receives its documented system-size budget.

Current sequence

T0: The caller builds a batch with subproblem sizes 1 and 9.
T1: The caller omits maxiter, so the solver selects the average length of 5.
T2: The nine-dimensional subproblem receives only five iterations.
T3: The solver stops before that subproblem converges.

Proposed sequence

T0: The caller builds a batch with subproblem sizes 1 and 9.
T1: The caller omits maxiter, so the solver derives the largest length of 9.
T2: The nine-dimensional subproblem can receive nine iterations.
T3: The larger system converges within its system-size budget.

A public float64 CPU witness uses a diagonal SPD system. Five iterations stop at residual 0.151281871698; nine iterations reach 4.57756679852e-16 and the exact solution. CUDA was not exercised.

The proposed fix uses A.max_batch_length when available. Without it, total scalar degrees are a safe bound, or the largest offset difference can be derived once. Regression coverage should omit maxiter for uneven batches.

@gdaviet was detected as the most likely owner from the linear-algebra CODEOWNERS rule and the introducing commit. Please feel free to assign this to someone else if another owner is closer to the code.