Repository navigation
Fix AutoEnzyme Hessian invalidating Hessian-vector products - #1431
Draft
ChrisRackauckas wants to merge 1 commit into
Draft
ChrisRackauckas wants to merge 1 commit into
ChrisRackauckas wants to merge 1 commit into
Conversation
Prevent hess from rebinding the vector captured by hv. Exercise repeated interleaved Hessian and Hessian-vector products against analytic references. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Agent-Harness: Codex CLI 0.162.1 Agent-Model: gpt-6.1-sol Agent-Session: 01a14ba9-e60c-7e90-b8e6-bb5d66b41098
This branch has not been deployed
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.
Keep the out-of-place AutoEnzyme Hessian matrix local to the
hessclosure. Assigning it to the enclosingHoverwrites the vector captured byhv, so callinghvafterhessthrowsMethodError: no method matching Duplicated(::Vector{Float64}, ::Matrix{Float64}).The regression interleaves
hv,hess, andfghon the same instantiated function at two points and two directions, checking against the analytic Rosenbrock Hessian and its products. Public signatures and the Hessian values are unchanged. Please ignore this draft until maintainer review.Fixes #1427
Reproduction and verification
Reproduced on default-branch commit 902ed1f (OptimizationBase 5.10.0) and the latest registered OptimizationBase 5.9.0, in separate local environments. Both used Julia 1.12.7, Enzyme 0.13.216, SciMLBase 3.58.0, and ChainRulesCore 1.26.2. The checkout was installed with
Pkg.developfor the default-branch run.Commands below use
PROBE_ENVfor the environment containing the checkout, Enzyme, ChainRulesCore, SciMLBase, and SciMLTesting; all runs useJULIA_NUM_THREADS=4,JULIA_NUM_PRECOMPILE_TASKS=4, and--startup-file=no.Focused regression, before applying the source fix:
julia --startup-file=no --project="$PROBE_ENV" lib/OptimizationBase/test/AD/enzyme_oop_hessian_products.jlSame regression with the fix:
Runic on all three changed Julia files: passed (
julia --startup-file=no --project=@runic -m Runic --inplace <changed files>).typoson the complete diff, andgit diff --check: passed.Full AD group:
GROUP=AD OPTIMIZATION_TEST_GROUP=AD julia --startup-file=no --project="$PROBE_ENV" lib/OptimizationBase/test/runtests.jl:QA:
GROUP=QA OPTIMIZATION_TEST_GROUP=QA julia --startup-file=no --project="$PROBE_ENV" -e 'using Pkg; Pkg.test("OptimizationBase")':The broken QA check is the existing
no_implicit_importsmarking; this PR does not change it. Invoking QA directly throughtest/runtests.jlstopped before running checks becauseSafeTestsetswas unavailable after environment activation; the standardPkg.testinvocation above passes.Not verified: GPU execution and downstream packages. No docs build was run because no docs, docstrings, or public API change. CI and independent review are pending.
Risk assessment
🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol
Conversation: Codex exec session 01a14ba9-e60c-7e90-b8e6-bb5d66b41098 (no session URL)