Repository navigation
Re-enable end-to-end Enzyme reverse-mode IIP NonlinearProblem adjoint test (#939) - #985
Merged
ChrisRackauckas merged 1 commit intoJun 26, 2026
Conversation
…djoint (SciML#939) Restores the full `Enzyme.autodiff(Reverse, simple_loss, Active, Duplicated(p, dp))` over `solve(::NonlinearProblem, NewtonRaphson())` on the IIP path as a dedicated Adjoint test item (`adjoint_tests__item3.jl`). This is the path whose `solve_up` augmented_primal tape aborted the macOS LTS worker with "GC error (probable corruption)" under Enzyme v0.13.150 (EnzymeAD/Enzyme.jl#3130); it was previously downgraded to a `maybe_wrap_nonlinear_f` probe (item2) to keep CI green. The Adjoint group runs lts × macos-latest in test/test_groups.toml, so the re-enabled item exercises the exact macOS-LTS combination that crashed, per the Enzyme maintainer's request to confirm the GC fix. Verified locally on Linux Julia 1.10.11 with Enzyme 0.13.169: returns `dp ≈ [1.0, -1.0]`, no GC error. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
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.
Note
Please ignore until reviewed by @ChrisRackauckas.
Summary
Re-enables the full end-to-end Enzyme reverse-mode adjoint test over
solve(::NonlinearProblem, NewtonRaphson())on the in-place (IIP) path, as requested by @wsmoses in EnzymeAD/Enzyme.jl#3130 (comment):Background
In #940 the regression test for #939 was originally the full
Enzyme.autodiff(Reverse, simple_loss, Active, Duplicated(p, dp))over an IIPNonlinearProblem. That path aborted the worker withGC error (probable corruption)on macOS LTS (Julia 1.10) under Enzyme v0.13.150 — tracked asEnzymeAD/Enzyme.jl#3130. To keep CI green at the time, #940 downgraded the test
to a lightweight probe of
maybe_wrap_nonlinear_f'sEnzymeCore.within_autodiff()short-circuit (
adjoint_tests__item2.jl), which never exercises the heavysolve_upaugmented_primal tape.Enzyme has since advanced (v0.13.150 → v0.13.169) and the GC abort no longer
reproduces. This PR restores the actual end-to-end gradient test so CI verifies
the fix and guards against regression.
Change
test/Adjoint/adjoint_tests__item3.jl: the fullEnzyme.autodiff(Reverse, simple_loss, ...)oversolve(::NonlinearProblem)asserting
dp ≈ [1.0, -1.0].Adjointgroup intest/runtests.jl.adjoint_tests__item2.jlto point at item3.The
Adjointgroup is configuredversions = ["lts", "1"],os = ["ubuntu-latest", "macos-latest"]intest/test_groups.toml, so thelts × macos-latestcell re-exercises the exact macOS-LTS combination that originally crashed.Verification
Ran locally on Linux, Julia 1.10.11 (LTS) with the current released stack (Enzyme v0.13.169, NonlinearSolve v4.20.0, NonlinearSolveBase v2.31.1, SciMLSensitivity v7.112.1):
No GC error. macOS LTS itself is unavailable to me locally — confirming the GC fix on that platform is precisely what this PR hands to CI.
Related
NonlinearSolveBase.maybe_wrap_nonlinear_f— autospecialize FunctionWrappers defeats activity analysis (Julia 1.11) #939, Skip FunctionWrappersWrapper in maybe_wrap_nonlinear_f under Enzyme AD #940🤖 Generated with Claude Code