Add VF64-specialized LinearCache for shorter stack traces#896
Open
ChrisRackauckas-Claude wants to merge 1 commit intoSciML:mainfrom
Open
Add VF64-specialized LinearCache for shorter stack traces#896ChrisRackauckas-Claude wants to merge 1 commit intoSciML:mainfrom
ChrisRackauckas-Claude wants to merge 1 commit intoSciML:mainfrom
Conversation
Implement the VF64 pattern for LinearCache and DefaultLinearSolverInit
to reduce type string lengths in stack traces from ~1500 chars to ~500 chars
per instance. This addresses the LinearSolve.jl component of
DifferentialEquations.jl#1128.
New types:
- LinearCacheVF64{Tp, Tc, Tlv, S}: 4 type params vs 12 in LinearCache,
hardcodes A::Matrix{Float64}, b/u::Vector{Float64}, Pl/Pr::IdentityOperator,
abstol/reltol::Float64, assumptions::OperatorAssumptions{Bool}
- DefaultLinearSolverInitVF64{TA}: 1 type param vs 25 in DefaultLinearSolverInit,
hardcodes all 24 factorization cache slot types for Matrix{Float64}
- LinearCacheType = Union{LinearCache, LinearCacheVF64} for dispatch
The VF64 cache is automatically constructed when init() detects
Matrix{Float64} + Vector{Float64} + DefaultLinearSolver. All existing
dispatch is preserved through the Union type.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Implements the VF64 pattern for
LinearCacheandDefaultLinearSolverInitto reduce type string lengths in stack traces from ~1500 chars to ~500 chars per instance. This addresses the LinearSolve.jl component of SciML/DifferentialEquations.jl#1128.Before:
LinearCachehad 12 type parameters andDefaultLinearSolverInithad 25 type parameters, producing ~1500 character type strings in stack traces.After:
LinearCacheVF64has 4 type parameters andDefaultLinearSolverInitVF64has 1 type parameter, producing ~500 character type strings. This is a 67% reduction.New types
LinearCacheVF64{Tp, Tc, Tlv, S}— hardcodesA::Matrix{Float64},b/u::Vector{Float64},Pl/Pr::IdentityOperator,abstol/reltol::Float64,assumptions::OperatorAssumptions{Bool}DefaultLinearSolverInitVF64{TA}— hardcodes all 24 factorization cache slot types forMatrix{Float64}at module load time vialet/@evalLinearCacheType = Union{LinearCache, LinearCacheVF64}— for backward-compatible dispatchDefaultLinearSolverInitType = Union{DefaultLinearSolverInit, DefaultLinearSolverInitVF64}How it works
init()detectsMatrix{Float64}+Vector{Float64}+DefaultLinearSolver, it automatically constructs aLinearCacheVF64instead ofLinearCachecache::LinearCachetocache::LinearCacheType(Union-based dispatch)LinearCacheFiles changed
src/vf64_types.jl(new) — VF64 type definitions, conversion, and constructorsrc/common.jl—LinearCacheVF64struct, Union type, VF64 branch in__initsrc/LinearSolve.jl— include, exports, moveddefaultalg_symbolgeneric method earlier (fixes world age issue with@generatedfunctions)src/factorization.jl— dispatch updates, moved specializeddefaultalg_symboloverloadssrc/default.jl— dispatch updatessrc/*.jlsolver files — dispatch updatesTest plan
Pkg.test()tests pass (no regressions)A\bcomparison)cache isa LinearCacheVF64)Aandb)🤖 Generated with Claude Code