Commit 5796679
committed
Unwrap AutoSpecializeCallable for Enzyme at __init entry points
Instead of fixing individual call sites (trust_region.jl VecJac/JacVec,
jacobian.jl construct_jacobian_cache), create _ad_prob with unwrapped
function early in __init for both FirstOrder and QuasiNewton. This
ensures ALL downstream AD consumers (Jacobian cache, trust region,
linesearch, forcing) receive the unwrapped problem when Enzyme is used.
- Add maybe_unwrap_prob_for_enzyme helper in NonlinearSolveBase
- FirstOrder: create _ad_prob from alg.autodiff/jvp_autodiff/vjp_autodiff
- QuasiNewton: detect Enzyme from kwargs and alg.linesearch/trustregion
- Revert trust_region.jl inline fix (now handled upstream in solve.jl)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>1 parent 7554ef9 commit 5796679
4 files changed
Lines changed: 50 additions & 17 deletions
File tree
- lib
- NonlinearSolveBase/src
- NonlinearSolveFirstOrder/src
- NonlinearSolveQuasiNewton/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
95 | 113 | | |
96 | 114 | | |
97 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
179 | 185 | | |
180 | 186 | | |
181 | 187 | | |
| |||
191 | 197 | | |
192 | 198 | | |
193 | 199 | | |
194 | | - | |
| 200 | + | |
195 | 201 | | |
196 | 202 | | |
197 | 203 | | |
| |||
219 | 225 | | |
220 | 226 | | |
221 | 227 | | |
222 | | - | |
| 228 | + | |
223 | 229 | | |
224 | 230 | | |
225 | 231 | | |
| |||
229 | 235 | | |
230 | 236 | | |
231 | 237 | | |
232 | | - | |
| 238 | + | |
233 | 239 | | |
234 | 240 | | |
235 | 241 | | |
| |||
240 | 246 | | |
241 | 247 | | |
242 | 248 | | |
243 | | - | |
| 249 | + | |
244 | 250 | | |
245 | 251 | | |
246 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | 226 | | |
236 | | - | |
| 227 | + | |
237 | 228 | | |
238 | 229 | | |
239 | | - | |
| 230 | + | |
240 | 231 | | |
241 | 232 | | |
242 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
163 | 181 | | |
164 | 182 | | |
165 | 183 | | |
| |||
222 | 240 | | |
223 | 241 | | |
224 | 242 | | |
225 | | - | |
| 243 | + | |
226 | 244 | | |
227 | 245 | | |
228 | 246 | | |
| |||
231 | 249 | | |
232 | 250 | | |
233 | 251 | | |
234 | | - | |
| 252 | + | |
235 | 253 | | |
236 | 254 | | |
237 | 255 | | |
| |||
0 commit comments