Skip to content

Box Enzyme solve_up tape closure#1013

Draft
ChrisRackauckas-Claude wants to merge 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/enzyme-box-solve-up-tape
Draft

Box Enzyme solve_up tape closure#1013
ChrisRackauckas-Claude wants to merge 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/enzyme-box-solve-up-tape

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

This PR should be ignored until reviewed by @ChrisRackauckas.

Summary

  • Box the solve_up Enzyme custom-rule tape in Any[...] so the SciMLSensitivity pullback closure does not become part of the concrete Enzyme tape type.
  • Keep the same primal, shadow, and reverse pullback behavior; this only reduces compiler/tape type pressure on the macOS Julia 1.10 Enzyme reverse-mode path.

Context

The latest master root CI failed intermittently in tests / Adjoint (julia lts, macos-latest) with a Julia signal 11 in test/Adjoint/adjoint_tests__item3.jl. Recent runs show the same job/file/line can pass with identical Enzyme/SciMLSensitivity versions, so this targets robustness rather than changing the tested behavior.

Validation

  • timeout 3600 env NONLINEARSOLVE_TEST_GROUP=Adjoint ~/.juliaup/bin/julia +1.10 --project=. -e 'using Pkg; Pkg.test(; julia_args=["--check-bounds=auto"])'\n- timeout 3600 ~/.juliaup/bin/julia +1 --project=. -e 'using Pkg; Pkg.test(; julia_args=["--check-bounds=auto"])' from lib/NonlinearSolveBase\n- git diff --check\n- Runic.format_file(...; inplace=true) on the changed file from a temporary Julia environment with Runic v1.7.0\n

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Scratchpad update: the NonlinearSolve root matrix and NonlinearSolveBase sublibrary checks are green for this Enzyme tape fix. The remaining red checks are ModelingToolkit downstream jobs; local/log investigation traced these to SciML/.github#110 (downstream.yml@v1 not exporting the requested group input as GROUP), not to this branch.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI update: SciML/.github v1 now points at v1.21.0 / 12371ec79ba3, which includes the downstream GROUP export fix. I pushed empty commit 65f5c53d5 to trigger fresh CI on this PR because direct rerun failed with HTTP 403 for this token. Fresh downstream run started as https://github.com/SciML/NonlinearSolve.jl/actions/runs/29000408648.

@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/enzyme-box-solve-up-tape branch from 65f5c53 to 73f1a10 Compare July 10, 2026 06:55
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Rebased this branch on current upstream/master and force-pushed with lease; new head is 73f1a10675eec10ba6d3d09deab306dfe5c506ba.

Local verification on the rebased branch:

  • timeout 3600 env GROUP=Adjoint /home/crackauc/.juliaup/bin/julia +1 --project=. -e 'using Pkg; Pkg.test(; coverage=false)' passed.
    • Adjoint Tests: 3/3 pass
    • maybe_wrap_nonlinear_f skips wrapping inside Enzyme.autodiff (#939): 3/3 pass
    • Enzyme reverse-mode over IIP NonlinearProblem (#939): 1/1 pass
    • log ended with Testing NonlinearSolve tests passed
  • git diff --check upstream/master...HEAD passed.
  • Runic check on lib/NonlinearSolveBase/ext/NonlinearSolveBaseEnzymeExt.jl passed.

The stale OrdinaryDiffEq.jl/Interface downstream failure was from SciMLBase.constructorof in OrdinaryDiffEq. Current OrdinaryDiffEq master includes SciML/OrdinaryDiffEq.jl#3846, and I locally ran GROUP=InterfaceI there; it passed, including Interpolation and Cache Stripping Tests 16/16.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/enzyme-box-solve-up-tape branch from 73f1a10 to 6ea947c Compare July 10, 2026 14:01
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Rebased onto current master (c22bc9482); new head is 6ea947c37.

Local verification on the rebased head:

  • GROUP=Adjoint julia +1 --project=. -e 'using Pkg; Pkg.test(; coverage=false)': passed (Adjoint Tests 3/3, Enzyme wrapping 3/3, Enzyme reverse-mode IIP 1/1).
  • Runic check on lib/NonlinearSolveBase/ext/NonlinearSolveBaseEnzymeExt.jl: passed.
  • git diff --check upstream/master...HEAD: passed.

The prior ModelingToolkit InterfaceII failure is reproduced on unmodified NonlinearSolve master and is unrelated to this diff: registered OrdinaryDiffEqFIRK v2.3.2 with OrdinaryDiffEqNonlinearSolve v2.1.0 raises UndefVarError: FastConvergence. OrdinaryDiffEq source FIRK v2.4.0 fixes it, and ModelingToolkit's full fractional_to_ordinary.jl test passes locally with that source. The remaining ecosystem blocker is stale General registration PR JuliaRegistries/General#160479, which points at an unreachable pre-squash commit and needs re-registration from a reachable OrdinaryDiffEq commit.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

The inherited solf spellcheck regression is addressed separately in draft PR #1031. It bisects to master commit 611cdf895, and #1031 passes exact typos v1.48.0, full Runic, git diff --check, and the full GROUP=Core test (Testing NonlinearSolve tests passed). This PR remains scoped to the Enzyme tape fix.

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