Skip to content

Preallocate GenericLU packing workspace - #1195

Merged
ChrisRackauckas merged 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:codex/avoid-small-generic-lu-pack-allocation
Aug 10, 2026
Merged

Preallocate GenericLU packing workspace#1195
ChrisRackauckas merged 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:codex/avoid-small-generic-lu-pack-allocation

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

What changed

GenericLUFactorization now allocates its pivot and blocked-LU packing workspaces during cache initialization, resize, or matrix-shape update and reuses them in solve!. The blocked Schur kernels no longer resize scratch storage during factorization, and the existing private cache consumers were updated for the new private cache representation.

The QA allocation suite now uses AllocCheck.jl on the GenericLU refactor-and-solve kernel and checks the public solve!(cache) path at runtime with a matrix large enough to exercise the packed blocked-LU path.

Regression evidence

The finalized QA regression test on an unfixed clean upstream main checkout failed at its first allocation assertion:

GenericLUFactorization solve! is allocation-free: Test Failed
Evaluated: 5960 == 0

The same test with this change passed:

Test Summary:                                      | Pass  Total
GenericLUFactorization solve! is allocation-free  |    4      4

The original NonlinearSolve reproduction on clean master failed with:

Evaluated: 61.76 < 48

With this LinearSolve checkout developed into that environment, the same sweep measured:

sweep_per_step=0.0

Verification

  • GROUP=QA julialauncher +1.12 --project -e 'using Pkg; Pkg.test()'
    • JET Tests: 34 passed, 8 pre-existing broken
    • Allocation QA: 64/64 passed
    • SupernodalLU Allocation QA: 8/8 passed
    • Quality Assurance: 48/48 passed
    • Testing LinearSolve tests passed
  • GROUP=Core julialauncher +1.12 --project -e 'using Pkg; Pkg.test()'
    • Testing LinearSolve tests passed
    • This ran before rebasing over the unrelated upstream MINRES test fix; the feature patch was unchanged by that rebase. The final rebased commit was then covered by the complete QA group and the focused tests below.
  • Focused Julia 1.12 blocked-LU, GenericLU, and resize tests:
    • blocked kernel: 525/525 passed
    • blocked GenericLU: 72/72 passed
    • resize: 70/70 passed
    • GenericLU back-solve test sets: 120/120, 12/12, 21/21, 1/1, 6/6, 15/15, 322/322, 4/4, and 3/3 passed
  • Focused Julia 1.10 allocation tests: 55/55 passed
  • julialauncher +1.12 -m Runic --check over every changed Julia file: clean
  • typos over every changed file: clean
  • git diff --check upstream/main...HEAD: clean

Not verified

  • Documentation was not built because this changes no public API, docstring, or documentation file.
  • Hardware GPU jobs and downstream CI were not run locally.

Review note

The private GenericLU cache changes from a tuple to a mutable struct so the factorization handle can be updated without replacing initialization-owned scratch buffers. This changes no public API and adds no dependency.

Links

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI note: the NonlinearSolve downstream Core failure occurs during Julia 1.10 dependency resolution, before any tests or code from this PR execute. It reproduces unchanged on LinearSolve main at https://github.com/SciML/LinearSolve.jl/actions/runs/31361291552/job/93370530227. A clean reproduction and git bisect identified NonlinearSolve commit 9f593a8d0c978a9e6c02a6d35b2cb065898ccebe, which requires currently unregistered NonlinearSolveBase 2.43 and NonlinearSolveQuasiNewton 1.15.2. The upstream resolver issue and exact reproducer are tracked at SciML/NonlinearSolve.jl#1154.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Additional CI note: the ModelingToolkit downstream failure is also unrelated to this PR. It is an UndefVarError for generate_DAENLStepData while current ModelingToolkit master precompiles, and it reproduces on unmodified LinearSolve main at https://github.com/SciML/LinearSolve.jl/actions/runs/31361291552/job/93370530272. A separate clean-main reproduction and bisect is in progress per the repository instructions.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Core CI note: both Julia 1.12 and Julia 1.13 pre failed the same unchanged randomized bitwise discriminator at test/Core/genericlu_naive_ldiv.jl:122; the direct path-selection assertion and the other 503 assertions passed. The same jobs passed immediately beforehand on main at https://github.com/SciML/LinearSolve.jl/actions/runs/31355849634/job/93355313404 and https://github.com/SciML/LinearSolve.jl/actions/runs/31355849634/job/93355313769. I ran the exact file locally on this commit with Julia 1.12.6 and 1.13.0-rc1 and observed 504/504 pass both times; 32 additional Julia 1.12 trials at each affected size also produced zero failures. The authenticated token cannot rerun Actions jobs because GitHub requires repository admin permission for that endpoint. No assertion was weakened or skipped.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Additional CI note: the SciMLSensitivity downstream failure exactly matches current LinearSolve main: 251 tests pass, then the BouncingBall ReverseDiff/Tracker/Zygote cases error while converting Vector{ReverseDiff.TrackedReal} to ReverseDiff.TrackedArray in OrdinaryDiffEqRosenbrock. Main comparison: https://github.com/SciML/LinearSolve.jl/actions/runs/31361291552/job/93370530266. PR job: https://github.com/SciML/LinearSolve.jl/actions/runs/31363806735/job/93377835795. A separate clean-main reproduction and bisect is in progress per repository policy.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

The ModelingToolkit main failure is bisected and has a separate validated fix: SciML/ModelingToolkit.jl#4920 bumps ModelingToolkitBase from 1.62.0 to 1.63.0 so Julia 1.10 can resolve the newly added public hook. The exact failing checkout loads with the bump, and ModelingToolkitBase InterfaceI passed 1,501 tests with five existing broken tests.

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 10, 2026 08:28
@ChrisRackauckas
ChrisRackauckas merged commit e623b1c into SciML:main Aug 10, 2026
56 of 62 checks passed
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

SciMLSensitivity investigation complete: the failure bisects to OrdinaryDiffEq commit 100fe2369ce04be7a78084eb1d599254454f7ef3 exposing an ArrayInterface.restructure bug with ReverseDiff. Released ArrayInterface 7.28.1 fails both a standalone no-SciML reproducer and the Rosenbrock MWE; ArrayInterface master passes both. The owner fix is already merged at JuliaArrays/ArrayInterface.jl#498 and needs a release. Full clean Julia 1.10 Core1 with ArrayInterface master passed: 254 passed, 5 existing broken, 259 total; Testing SciMLSensitivity tests 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.

2 participants