Skip to content

Re-enable end-to-end Enzyme reverse-mode IIP NonlinearProblem adjoint test (#939) - #985

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:cr-claude/reenable-enzyme-iip-adjoint-test
Jun 26, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:cr-claude/reenable-enzyme-iip-adjoint-test

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

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):

can you try to re-enable the ci test which otherwise was failing linked here?

Background

In #940 the regression test for #939 was originally the full
Enzyme.autodiff(Reverse, simple_loss, Active, Duplicated(p, dp)) over an IIP
NonlinearProblem. That path aborted the worker with GC error (probable corruption) on macOS LTS (Julia 1.10) under Enzyme v0.13.150 — tracked as
EnzymeAD/Enzyme.jl#3130. To keep CI green at the time, #940 downgraded the test
to a lightweight probe of maybe_wrap_nonlinear_f's EnzymeCore.within_autodiff()
short-circuit (adjoint_tests__item2.jl), which never exercises the heavy
solve_up augmented_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

  • Add test/Adjoint/adjoint_tests__item3.jl: the full
    Enzyme.autodiff(Reverse, simple_loss, ...) over solve(::NonlinearProblem)
    asserting dp ≈ [1.0, -1.0].
  • Register it in the Adjoint group in test/runtests.jl.
  • Update the now-stale note in adjoint_tests__item2.jl to point at item3.

The Adjoint group is configured versions = ["lts", "1"], os = ["ubuntu-latest", "macos-latest"] in test/test_groups.toml, so the lts × macos-latest cell 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):

dp = [1.0, -1.0]
END-TO-END OK

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

🤖 Generated with Claude Code

…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>
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review June 26, 2026 18:53
@ChrisRackauckas
ChrisRackauckas merged commit fe96ba3 into SciML:master Jun 26, 2026
59 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants