Repository navigation
Description
The NoAdjoint twin of the registry scenario "Convolution lag contributions of a table cut at a report day", added in #1030, fails its rule check under Mooncake reverse.
The gradient is correct; the check that no rule fires does not hold.
Where
test/ad/scenarios.jl, item "Mooncake reverse gradients, and every scenario fires its rule and no twin does (slice 4 of 4)":
NoAdjoint Convolution lag contributions of a table cut at a report day: no rule fires
Expression: fired == rule
Evaluated: true == false
On Julia 1.12.7: slice 4 gives 1,471 pass and 1 fail; every other scenario in slices 1 to 4 passes.
Cause
A twin calls the scenario function with w = NoAdjoint (test/ADFixtures/src/registry.jl, _TWINS), and the scenario is expected to pass its operator through w.
_table_cut(w, θ) (registry.jl:683) never uses w: it calls contributions(K; stop = T - 2) directly, so the twin runs the same rule as the scenario and _PULLBACK_CALLS rises for both.
Reproducer
Run with julia +1.12 --project=test/ad:
using ADFixtures, ComposableRecurrences, DifferentiationInterface, Mooncake
const CR = ComposableRecurrences
name = "Convolution lag contributions of a table cut at a report day"
backend = only(b.backend for b in ADFixtures.backends() if b.name == "Mooncake reverse")
scens = ADFixtures.scenarios(; category = :marginal, precision = :double,
backend = "Mooncake reverse", dynamic = true, with_reference = true)
for n in (name, "NoAdjoint " * name)
s = only(filter(s -> s.name == n, scens))
before = CR._PULLBACK_CALLS[]
g = gradient(s.f, backend, s.x)
println(n, ": fired = ", CR._PULLBACK_CALLS[] > before,
", gradient matches = ", isapprox(g, s.res1; rtol = 1e-8))
endOutput on main at fdd8b04 and on #1033 at 7ebe77f, the same on both:
Convolution lag contributions of a table cut at a report day: fired = true, gradient matches = true
NoAdjoint Convolution lag contributions of a table cut at a report day: fired = true, gradient matches = true
The Mooncake reverse job on main at fdd8b04 was cancelled, so CI has not shown this yet.
Enzyme reverse runs the same twin check and is likely affected in the same way; I have not run it.
What it needs
A decision on how the twin of a table-only contributions call should differ from the scenario: route the table method through w, or record that this scenario has no twin.
Changing the check or the expected result to make it pass would hide the gap, so neither is done here.
Generated by Claude Code
Activity