@@ -21,6 +21,20 @@ import NonlinearSolveBase: wrapfun_iip, standardize_forwarddiff_tag
2121
2222const DI = DifferentiationInterface
2323
24+ _cache_storage_type (
25+ :: FunctionWrappersWrappers.FunctionWrappersWrapper{FW, P, CS}
26+ ) where {FW, P, CS} = CS
27+
28+ # The concrete storage types are intentionally not public. Derive the type selected by the
29+ # public cache-mode API, then use the documented explicit-parameter constructor below.
30+ const FWW_SINGLE_CACHE_STORAGE_TYPE = _cache_storage_type (
31+ FunctionWrappersWrappers. FunctionWrappersWrapper (
32+ identity, (Tuple{Float64},), (Float64,);
33+ cache = FunctionWrappersWrappers. SingleCache (),
34+ policy = FunctionWrappersWrappers. AllowNonIsBits (),
35+ )
36+ )
37+
2438# --- AutoSpecialize / norecompile infrastructure for ForwardDiff ---
2539
2640const dualT = ForwardDiff. Dual{
@@ -78,19 +92,13 @@ function _make_fww_iip(
7892 @nospecialize (vff), :: Type{A1} , :: Type{A2} , :: Type{A3} , :: Type{A4}
7993 ) where {A1, A2, A3, A4}
8094 FW = FunctionWrappers. FunctionWrapper
81- fwt = (
82- FW {Nothing, A1} (vff), FW {Nothing, A2} (vff),
83- FW {Nothing, A3} (vff), FW {Nothing, A4} (vff),
84- )
85- cache_prototype = FunctionWrappersWrappers. FunctionWrappersWrapper (
86- vff, (A1,), (Nothing,);
87- cache = FunctionWrappersWrappers. SingleCache (),
88- policy = FunctionWrappersWrappers. AllowNonIsBits (),
89- )
90- cs = cache_prototype. cache_storage
95+ FWT = Tuple{
96+ FW{Nothing, A1}, FW{Nothing, A2},
97+ FW{Nothing, A3}, FW{Nothing, A4},
98+ }
9199 return FunctionWrappersWrappers. FunctionWrappersWrapper{
92- typeof (fwt) , FunctionWrappersWrappers. AllowNonIsBits, typeof (cs) ,
93- }(fwt, cs )
100+ FWT , FunctionWrappersWrappers. AllowNonIsBits, FWW_SINGLE_CACHE_STORAGE_TYPE ,
101+ }(vff )
94102end
95103
96104# IIP wrapfun: wraps f(du, u, p) with dual-aware type combinations.
0 commit comments