Repository navigation
Inline the Recurrence keyword constructor so Enzyme static activity holds under coverage - #1066
Merged
Merged
Conversation
Under code coverage the compiler stopped inlining it, so a loss that built a recurrence from its constant data got the operator back from a call. Enzyme's static activity analysis rejects the constant kernel stored in that returned operator, which failed the six static activity items on the Enzyme reverse job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 5, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the six static activity errors on the Enzyme reverse AD job, first seen on #1063's sharded run.
The cause is code coverage: under coverage, Julia stopped inlining the
Recurrencekeyword constructor.Enzyme then rejected the constant kernel inside the operator the constructor returned.
The fix marks that constructor
@inline.Claude Opus 5.5 [high]
Cause
test/ad/static_activity.jlwithEnzymeRuntimeActivityError. The error is "Constant memory is stored ... to a differentiable variable", invar"#Recurrence#432", the body of the keyword constructor, withkernel::Arraystored intosret.Recurrence(g; ...)from a constantgcaptured by aConstclosure.--code-coverage=@., and the coverage counters stop the compiler inlining the constructor body. The operator then comes back from a call throughsret, and Enzyme's static activity analysis refuses the constant kernel stored in it.@.Recurrence(g)with no coupling included@.@.test/ad/static_activity.jlpassAll runs use Enzyme 0.13.221, the version CI resolved.
Fix
@inlineonRecurrence(kernel; coupling, modifiers, lags, width), with a comment on why.Nothing else changes. Without coverage the constructor was already inlined.
Evidence
The local runs in the table, which use the reproducer of the failing cases and
TestItemRunnerfiltered totest/ad/static_activity.jl.The Enzyme reverse job on this PR runs the item under coverage.
This was opened by a bot. Please ping @seabbs for any questions.