Commit 8cf2552
DiffEqBaseEnzymeExt: tighten sensealg inner type to exclude SensitivityADPassThrough (#3681)
PR #3678 loosened the `augmented_primal`/`reverse` rules from
`Const{Nothing}|Const{<:AbstractSensitivityAlgorithm}` to a plain
`Enzyme.Annotation` and added a runtime check throwing on anything
other than `nothing`/`AbstractSensitivityAlgorithm`. That broke the
existing `Direct Differentiation of Explicit ODE Solve` AD test
(test/ad/ad_tests.jl:583), which passes
`sensealg = SensitivityADPassThrough()` to deliberately bypass adjoint
machinery and do direct AD through `solve_up`. Pre-#3678 the rule
simply did not dispatch for `Const{SensitivityADPassThrough}` (since
`SensitivityADPassThrough <: AbstractDEAlgorithm`, not
`<: AbstractSensitivityAlgorithm`), so Enzyme fell through to direct
AD. Post-#3678 the rule swallowed it and immediately raised.
Restore the original dispatch behavior while keeping #3678's wider
outer-annotation match: constrain the *inner* sensealg value type to
`Union{Nothing, AbstractSensitivityAlgorithm}` and drop the redundant
runtime ArgumentError check. The outer `Enzyme.Annotation` (Const,
Duplicated, MixedDuplicated, Active) is still freely accepted, which
preserves the original motivation of #3678 (tolerate
`set_runtime_activity(Reverse)` promoting a sensealg const to
`Duplicated{GaussAdjoint{...}}` before the rule matches).
Bumps DiffEqBase to 7.5.3.
Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>1 parent 66b4561 commit 8cf2552
2 files changed
Lines changed: 9 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | | - | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| |||
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
80 | | - | |
| 79 | + | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
| |||
0 commit comments