Repository navigation
Mark the Symmetric sparse named container broken under Enzyme on Julia 1.12 - #1052
Merged
Merged
Conversation
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.
Part of #1038 (the doubled Enzyme gradient; the table-cut part is #1034, in #1049).
The doubled gradient is an Enzyme fault on Julia 1.12, not the package's, so that one case is marked broken for Enzyme reverse before Julia 1.13.
Claude Opus 5.5 [medium]
Finding
The "named container 2" case in
test/ad/adjoints.jldifferentiatesRecurrence(g; coupling = Symmetric(sparse([θ[1] 0.1; 0.1 θ[2]])))with plain Enzyme reverse.The plain route reads the coupling one entry at a time (
_mix_floats!).A reproducer without the package gives the same fault (posted on #931: #931 (comment)):
Enzyme.gradient(Reverse, θ -> sum(Symmetric(sparse([θ[1] 0.1; 0.1 θ[2]]))), [0.4, 0.7])gives[1.0, 2.0]on Julia 1.12.7; ForwardDiff gives[1.0, 1.0].q[a] += C[a, b] * p[b]over the same matrix gives exactly twice ForwardDiff, as in CI.SparseMatrixCSCis right.So it is not #964 (a repeated
mul!on a plain sparse matrix): one read is enough, theSymmetricwrapper is needed, and it is specific to 1.12.The package case itself, run locally with Enzyme 0.13.221:
Symmetric(sparse(...))sparse(...)Symmetric([...])Change
test/ad/adjoints.jl: the gradient check of named container 2 isbrokenwhen the backend isAutoEnzymeandVERSION < v"1.13", with a comment linking the reproducer.The notice and the "no rule fires" checks of that case still run.
Mooncake reverse and Julia 1.13 still check the gradient.
Checks
"Lazy host arrays take the rule; other containers are named once" on Julia 1.12.7, both backends: 70 pass, 1 broken.
On 1.13 the condition is false and the gradient matched ForwardDiff locally.
The managed Enzyme reverse job on 1.13 may hit its time limit as it does on
main.main(with #1049) is merged in, and AD versions (Julia 1.12) was dispatched on this branch: https://github.com/EpiAware/ComposableRecurrences.jl/actions/runs/47331375902This was opened by a bot. Please ping @seabbs for any questions.