Skip to content

Support DiffCache for nonzeroable element types#179

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-diffcache-nonzeroable-elements
Jul 8, 2026
Merged

Support DiffCache for nonzeroable element types#179
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-diffcache-nonzeroable-elements

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Summary

  • allow DiffCache backing storage to fall back to uninitialized storage when zero(T) is unavailable
  • preserve zero-filled backing storage for element types that still support zero(T)
  • add a regression test for an isbits named-tuple element with nested tuple fields under ForwardDiff dual replacement

Motivation

DiffCache(ar_alloc) in #71 failed in the constructor because zeros(T, ...) requires zero(::Type{T}). Named tuples do not provide that method even when they are isbits and usable as cache elements.

Validation

  • Reproducer for a Vector of named tuples now constructs DiffCache and prints the expected cache length and element type.
  • timeout 3600 /home/crackauc/.juliaup/bin/julia +1.10 --project=. -e ... Pkg.test() passed.
  • Runic.main(["--check", "."]) on Julia 1.10 passed.

This PR should be ignored until reviewed by @ChrisRackauckas.

Fixes #71.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review July 8, 2026 16:44
@ChrisRackauckas ChrisRackauckas merged commit 4ef725b into SciML:master Jul 8, 2026
17 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.

DiffCache/GeneralLazyBufferCache for an array with mixed types

2 participants