Repository navigation
Cache non-isbits ForwardDiff workspaces - #209
Merged
ChrisRackauckas merged 1 commit intoAug 26, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Claude-Session: https://chatgpt.com/codex/tasks/01a03a04-70ae-77a0-ba1b-ec7a1ed9ef47
ChrisRackauckas
marked this pull request as ready for review
August 26, 2026 19:51
ChrisRackauckas
added a commit
that referenced
this pull request
Aug 26, 2026
Releases the unreleased changes on `master` since 1.6.0: - #209 — `Cache non-isbits ForwardDiff workspaces`. ForwardDiff `Dual` values whose scalar storage is not `isbits` previously received a newly zeroed workspace on every `DiffCache` lookup; both cache variants now cache correctly typed workspaces, and same-shaped array workspaces are returned directly so the warmed vector lookup is allocation-free. - #208 — compat: drop stale majors. **Minor**, matching this repo's convention (1.5.0 -> 1.6.0 carried the #206 batch). No exported or `public` name is added or removed, but downstreams need a floor to depend on the new allocation behaviour - JuliaSymbolics/Symbolics.jl#1968 is waiting on exactly this. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R
ChrisRackauckas
added a commit
that referenced
this pull request
Aug 26, 2026
Releases the unreleased changes on `master` since 1.6.0: - #209 — `Cache non-isbits ForwardDiff workspaces`. ForwardDiff `Dual` values whose scalar storage is not `isbits` previously received a newly zeroed workspace on every `DiffCache` lookup; both cache variants now cache correctly typed workspaces, and same-shaped array workspaces are returned directly so the warmed vector lookup is allocation-free. - #208 — compat: drop stale majors. **Minor**, matching this repo's convention (1.5.0 -> 1.6.0 carried the #206 batch). No exported or `public` name is added or removed, but downstreams need a floor to depend on the new allocation behaviour - JuliaSymbolics/Symbolics.jl#1968 is waiting on exactly this. Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R Co-authored-by: Claude <[email protected]>
This was referenced Aug 26, 2026
ChrisRackauckas-Claude
pushed a commit
to JuliaSymbolics/Symbolics.jl
that referenced
this pull request
Aug 27, 2026
Drops the SymbolicsPreallocationToolsExt workaround now that PreallocationTools 1.7.0 caches non-isbits ForwardDiff workspaces itself (SciML/PreallocationTools.jl#209), and raises the PreallocationTools compat floor to 1.7 so the workaround cannot be removed while an older PreallocationTools is resolvable. Supersedes #1968, which dropped the workaround without the floor. Symbolics runs no Downgrade lane, so that gap would not have been caught by CI. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R
ChrisRackauckas
added a commit
to JuliaSymbolics/Symbolics.jl
that referenced
this pull request
Aug 27, 2026
* Simplify symbolic PreallocationTools cache dispatch Drops the SymbolicsPreallocationToolsExt workaround now that PreallocationTools 1.7.0 caches non-isbits ForwardDiff workspaces itself (SciML/PreallocationTools.jl#209), and raises the PreallocationTools compat floor to 1.7 so the workaround cannot be removed while an older PreallocationTools is resolvable. Supersedes #1968, which dropped the workaround without the floor. Symbolics runs no Downgrade lane, so that gap would not have been caught by CI. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R * Remove the PreallocationTools extension Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Claude-Session: https://chatgpt.com/codex/tasks/01a03a04-70ae-77a0-ba1b-ec7a1ed9ef47 --------- Co-authored-by: Claude <[email protected]>
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.
What changed and why
ForwardDiff Dual values whose scalar storage is not an isbits type could not use FixedSizeDiffCache and received a newly zeroed workspace on every DiffCache lookup. This caches correctly typed workspaces for both cache variants while retaining the existing reinterpret path for isbits Duals. Same-shaped array workspaces are returned directly so the warmed vector lookup used by Symbolics is allocation-free.
This makes the workaround discussed in JuliaSymbolics/Symbolics.jl#1968 unnecessary once Symbolics can require a PreallocationTools release containing this change.
Verification
Failing before the implementation, with only the regression test applied:
The three failures showed that DiffCache returned fresh zeroed workspaces instead of retaining writes. FixedSizeDiffCache errored while trying to reinterpret a non-isbits Dual:
Passing after the implementation:
The new regression test covers Dual value, Dual type, and Dual array dispatch for DiffCache and FixedSizeDiffCache. Every warmed vector lookup reports 0 allocated bytes.
Not verified
Docs were not built because this changes no public API, docstring, or documentation. GPU and downstream jobs were not run locally.
Review note
The same-shape fast path in _restructure is what removes the final array-header allocation for vector typed buffers. Non-vector reshaping can still allocate only the reshape wrapper; the backing workspace remains cached. The existing isbits reinterpret behavior is unchanged.
Please ignore this PR until it has been reviewed by @ChrisRackauckas.
🤖 Generated with Claude Code
https://chatgpt.com/codex/tasks/01a03a04-70ae-77a0-ba1b-ec7a1ed9ef47