Fix Core/Downgrade SuperLUDIST resolve skip and StaticArrays.LU init_cacheval regression#1053
Merged
ChrisRackauckas merged 2 commits intoJun 22, 2026
Conversation
The resolve test iterates over all subtypes of AbstractSparseFactorization and calls `alg()` on each that is not explicitly skipped. SuperLUDIST support (SciML#1046) added SuperLUDISTFactorization as a subtype, but its constructor errors unless the LinearSolveSuperLUDISTExt extension is loaded (which requires `using MPI, SuperLUDIST, SparseArrays` and an initialized MPI process grid). The Core resolve test never loads those, so construction errored and broke the Core and Downgrade test groups across all Julia versions. SuperLUDIST has its own dedicated test group (test/LinearSolveSuperLUDIST), so skip it in the generic resolve loop like the other extension/hardware-gated factorizations. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR SciML#1038 changed the `GenericLUFactorization` and `RFLUFactorization` `init_cacheval` to rebuild the cached factorization instance via `LinearAlgebra.LU(luinst.factors, ipiv, luinst.info)` so the cacheval slot type would match the `Vector{BlasInt}` pivot used by `solve!` for non-`Array` dense containers (e.g. `FixedSizeArray`). That rebuild assumes `ArrayInterface.lu_instance(A)` returns a `LinearAlgebra.LU`. For static arrays (e.g. `SizedMatrix`) it returns a `StaticArrays.LU`, whose fields are `L`, `U`, `p` — there is no `factors` or `info` field, so the access threw `type StaticArrays.LU has no field factors`. This broke the OrdinaryDiffEq downstream "Sized Matrix Tests" (Rodas4 over a `SizedMatrix` state routes through the default solver -> RFLU init_cacheval). Fix: keep the rebuild when `lu_instance` returns a `LinearAlgebra.LU`; otherwise build the matching `LinearAlgebra.LU` directly from the converted matrix and the `Vector{BlasInt}` pivot — which is exactly what `solve!` stores for static-array inputs (`generic_lufact!` / `RecursiveFactorization.lu!` return `LU{T, typeof(A), Vector{BlasInt}}`). Verified locally on Julia 1.12 + StaticArrays 1.9.18: `GenericLUFactorization` and the default-solver (RFLU) paths now solve a `SizedMatrix` LinearProblem; the Core `fixedsizearrays` (47/47) and `resolve` (123/123) tests still pass. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
22e4686 to
077af4a
Compare
This was referenced Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR drives the LinearSolve.jl
mainCI to green by fixing two distinct repo-owned regressions, both introduced by recent HEAD commits.Fix 1 — Core / Downgrade: skip
SuperLUDISTFactorizationin the resolve testThe
tests / Core(Julia 1, lts, pre) andDowngrade / Corechecks share one root cause.test/Core/resolve.jliterates over every subtype ofAbstractSparseFactorizationand callsalg()on each that is not explicitly skipped. PR #1046 ("Add SuperLUDIST sparse factorization support", current HEAD) addedSuperLUDISTFactorizationas a new subtype, but its constructor callserror(...)unless theLinearSolveSuperLUDISTExtextension is loaded — which requiresusing MPI, SuperLUDIST, SparseArraysplus an initialized MPI process grid.The Core resolve test never loads those, so
SuperLUDISTFactorization()errored:Fix: add
SuperLUDISTFactorizationto the resolve-loop skip list, exactly like the other extension/hardware-gated factorizations (CudaOffload*,AMDGPUOffload*,MetalLU,BLISLU,CliqueTrees, etc.). SuperLUDIST has its own dedicated test group attest/LinearSolveSuperLUDIST/superludist.jlthat exercises the real solve with MPI set up, so it does not belong in the generic single-process resolve loop.Fix 2 — OrdinaryDiffEq downstream:
type StaticArrays.LU has no field factorsThe
Downstream Tests - InterfaceII(OrdinaryDiffEq) check failed in "Sized Matrix Tests" with:Root cause: PR #1038 ("Handle dense, contiguous non-
Arraymatrices") changed theGenericLUFactorizationandRFLUFactorizationinit_cachevalto rebuild the cached instance viaLinearAlgebra.LU(luinst.factors, ipiv, luinst.info)so the cacheval slot type matches theVector{BlasInt}pivot used bysolve!for non-Arraydense containers (e.g.FixedSizeArray). That rebuild assumesArrayInterface.lu_instance(A)returns aLinearAlgebra.LU. For static arrays (SizedMatrix) it returns aStaticArrays.LU, whose fields areL,U,p— nofactors/info— so the access threw. ARodas4ODE over aSizedMatrixstate routes through the default solver → RFLUinit_cacheval, hitting this.Fix: keep the rebuild when
lu_instancereturns aLinearAlgebra.LU; otherwise build the matchingLinearAlgebra.LUdirectly from the converted matrix and theVector{BlasInt}pivot — which is exactly whatsolve!stores for static-array inputs (generic_lufact!/RecursiveFactorization.lu!returnLU{T, typeof(A), Vector{BlasInt}}).Verification
All run locally on Julia 1.12.6 (the CI runner version), StaticArrays 1.9.18, with
RecursiveFactorization/Sparspak/CliqueTrees/FixedSizeArraysloaded to mirror the CI extension environment:test/Core/resolve.jl: 123/123 pass; the loop now iterates and correctly skipsSuperLUDISTFactorization.GenericLUFactorizationand the default-solver (RFLU) paths both solve aSizedMatrixLinearProblem(residuals ~1e-16 and ~1e-9) — previously errored with thefactorsFieldError, reproduced before the fix.test/Core/fixedsizearrays.jl: 47/47 pass (confirms theLinearAlgebra.LUbranch forFixedSizeArrayis preserved).Remaining downstream reds (out of scope — to be fixed in those packages)
bigfloat_test.jl:68:Expression evaluated to non-Booleanon@test sol4 = solve(prob, MIRKN4(), dt = 0.01)— a BVDE-internal test-writing bug, no LinearSolve involvement.structural_transformation/utils.jl:182/192:length(mapping) == 5evaluating to6 == 5— an MTK-internal structural-transformation assertion, no LinearSolve involvement.Please ignore until reviewed by @ChrisRackauckas