File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name = " FunctionWrappersWrappers"
22uuid = " 77dc65aa-8811-40c2-897b-53d922fa7daf"
33authors = [" Chris Elrod <elrodc@gmail.com> and contributors" ]
4- version = " 1.9.0 "
4+ version = " 1.9.1 "
55
66[deps ]
77FunctionWrappers = " 069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
Original file line number Diff line number Diff line change 11module FunctionWrappersWrappersEnzymeExt
22
33using FunctionWrappersWrappers
4+ using FunctionWrappersWrappers: SingleCacheStorage, DictCacheStorage, NoCacheStorage
45using Enzyme
56using EnzymeCore
67using EnzymeCore. EnzymeRules
78
9+ # =============================================================================
10+ # Mark cache-storage types as inactive
11+ # =============================================================================
12+ # `SingleCacheStorage` and `DictCacheStorage` are mutable / contain a `Dict`,
13+ # and their cache-miss branches write to that storage. Without these
14+ # declarations Enzyme conservatively treats any closure that *might* touch a
15+ # `FunctionWrappersWrapper` (e.g. via `remake(prob; p = …)` capturing the
16+ # problem in scope) as potentially writing to the wrapper's cache, and
17+ # refuses to prove the captured argument read-only. The cache values are
18+ # `FunctionWrapper`s used purely for dispatch / dynamic call speedup; they
19+ # never hold derivative data.
20+ EnzymeCore. EnzymeRules. inactive_type (:: Type{<:SingleCacheStorage} ) = true
21+ EnzymeCore. EnzymeRules. inactive_type (:: Type{<:DictCacheStorage} ) = true
22+ EnzymeCore. EnzymeRules. inactive_type (:: Type{NoCacheStorage} ) = true
23+
824# =============================================================================
925# Helper: build a Forward mode from FwdConfig flags
1026# =============================================================================
You can’t perform that action at this time.
0 commit comments