Skip to content

Fix type instabilities, add QA test group, improve per-step allocations#80

Merged
ChrisRackauckas merged 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:pr-79
Mar 20, 2026
Merged

Fix type instabilities, add QA test group, improve per-step allocations#80
ChrisRackauckas merged 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:pr-79

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Summary

  • Fix type instabilities: dassl struct fields maxorder::Any and factorize_jacobian::Anymaxorder::Int and factorize_jacobian::Bool. DASSLCache.jac_factorized::Any → concrete LU{T,Matrix{T}} type via new facType type parameter.
  • Add QA test group: Tests reorganized with GROUP="QA" containing explicit imports, type stability checks, and allocation tests — excludable from downstream testing via GROUP="core".
  • Reduce per-step allocations: Pre-allocated work buffers (t_work, y_work, errors_work) in cache eliminate history vector allocations. New get_history_t!/get_history_y! return views into buffers. New errorEstimates_cache! and newStepOrderContinuous_cache! for zero-allocation order selection.

Changes

File Change
src/common.jl Type dassl struct fields (AnyInt/Bool)
src/cache.jl Add facType type param, work buffers, get_history_t!/get_history_y!
src/inplace.jl Use lu(;check=false) for type-stable factorization, add errorEstimates_cache!/newStepOrderContinuous_cache!, use in-place history access
src/DASSL.jl Add I, lu to LinearAlgebra imports
test/runtests.jl Reorganize with QA test group, add type stability tests
test/alloc_tests.jl Add zero-allocation history access tests, tighten thresholds

Test plan

  • All existing tests pass (core + QA)
  • Type stability verified: maxorder::Int, factorize_jacobian::Bool, jac_factorized is concrete LU type
  • Zero-allocation get_history_t!/get_history_y! verified
  • Per-step stepper! allocations < 1 KB (was unconstrained Any field)
  • QA group excludable via GROUP="core"

🤖 Generated with Claude Code

- Type `dassl` struct fields: `maxorder::Int`, `factorize_jacobian::Bool`
  (were `Any`, causing type instability)
- Add `facType` type parameter to `DASSLCache` for type-stable
  `jac_factorized` field (was `Any`, now concrete `LU{T,Matrix{T}}`)
- Add pre-allocated work buffers (`t_work`, `y_work`, `errors_work`) to
  cache for zero-allocation history access and error estimation
- Add `get_history_t!`/`get_history_y!` that write to work buffers and
  return views instead of allocating new vectors each step
- Add `errorEstimates_cache!` and `newStepOrderContinuous_cache!` for
  zero-allocation order selection using cache buffers
- Replace `factorize()` with `lu(; check=false)` in in-place path for
  consistent concrete return type
- Reorganize tests with QA group (GROUP="QA") containing explicit
  imports, type stability, and allocation tests - excludable from
  downstream testing
- Add type stability tests and zero-allocation history access tests

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 7dbe45c into SciML:master Mar 20, 2026
9 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.

2 participants