Skip to content

[ad-21] add forward boundary sensitivity helpers#55

Open
krystophny wants to merge 30 commits into
developfrom
ad-21-forward-boundary-sensitivities
Open

[ad-21] add forward boundary sensitivity helpers#55
krystophny wants to merge 30 commits into
developfrom
ad-21-forward-boundary-sensitivities

Conversation

@krystophny

@krystophny krystophny commented Jul 9, 2026

Copy link
Copy Markdown
Member

Adds forward fixed-boundary sensitivity helpers for the public pyGVEC AD surface.

  • Selects fixed-boundary design DOFs and excludes LA coefficients.
  • Solves the interior response system with State.raw_residual_jvp as the linear operator (exact when the build provides it, FD otherwise); the residual-JVP naming keeps the raw-residual sign explicit.
  • Applies the forward chain rule for scalar objective gradients.
  • Checks sampled sensitivities against finite-difference boundary perturbations with an interior re-solve that preserves the current interior raw residual.

Closes #22.

Verification

Test fails before

$ bash -lc 'test -f test-CI/unit-pygvec/test_ad_boundary.py || { echo "missing boundary sensitivity test before AD-21"; exit 2; }'
missing boundary sensitivity test before AD-21

Test passes after

Enzyme-off isolated build (FD path):

$ pytest test-CI/unit-pygvec/test_ad_boundary.py -q --require-pygvec
6 passed in 3.51s

Enzyme-on isolated build (exact path, fixed RZ, LLVM/Flang 22.1.6):

$ pytest test-CI/unit-pygvec/test_ad_boundary.py -q --require-pygvec
6 passed in 1.03s

Full stack AD suite at this tip: 31 passed on both builds.

@krystophny

Copy link
Copy Markdown
Member Author

Implemented AD-21 here.

  • Added python/examples/gvec_adjoint.py for fixed-boundary forward sensitivity solves with the public HVP operator.
  • Added test-CI/unit-pygvec/test_ad_boundary.py covering design DOF selection, interior response solves, scalar forward gradients, and sampled finite-difference re-solves.

Verification: focused boundary pytest passed (4 passed), adjacent AD API/HVP/transpose/boundary pytest passed (19 passed).

@krystophny krystophny force-pushed the ad-21-forward-boundary-sensitivities branch from ffe3a12 to a115037 Compare July 9, 2026 20:01
@krystophny krystophny force-pushed the ad-21-forward-boundary-sensitivities branch from a115037 to 88de094 Compare July 9, 2026 22:09
@krystophny krystophny force-pushed the ad-21-forward-boundary-sensitivities branch from 88de094 to 80bd301 Compare July 9, 2026 22:22
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.

1 participant