Skip to content

Improve Jacobian and Hessian preparation#535

Merged
gdalle merged 8 commits intomainfrom
gd/alloc_jac
Oct 3, 2024
Merged

Improve Jacobian and Hessian preparation#535
gdalle merged 8 commits intomainfrom
gd/alloc_jac

Conversation

@gdalle
Copy link
Copy Markdown
Member

@gdalle gdalle commented Oct 3, 2024

Versions

  • Bump DI to v0.6.5

DI source

  • Encode batch size from pick_batchsize with Val(B) instead of B
  • Pass Val(B) to the Jacobian and Hessian preparators with a function barrier. Do the same for sparse Jacobians and Hessians.
  • Avoid slicing the whole Jacobian/Hessian when the last block is too big, only slice the last block

DI extensions

  • Enzyme: set batch size to Val(16)
  • ForwardDiff: set batch size to Val(C) if pre-selected in AutoForwardDiff. I tried to do the same for Chunk{C} but it is forbidden to have chunks larger than the input size.

DIT source

  • Add a secret option preparation_type_stability to DIT.test_differentiation which runs JET.@test_opt on the preparation operator

DI and DIT tests

  • Test preparation_type_stability for trivial dense and sparse backends

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.63%. Comparing base (973676a) to head (09c206d).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #535      +/-   ##
==========================================
- Coverage   98.64%   98.63%   -0.02%     
==========================================
  Files         106      106              
  Lines        4572     4606      +34     
==========================================
+ Hits         4510     4543      +33     
- Misses         62       63       +1     
Flag Coverage Δ
DI 98.76% <100.00%> (-0.03%) ⬇️
DIT 98.34% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gdalle gdalle changed the title Avoid slicing the whole Jacobian if batch size does not divide total size Improve Jacobian and Hessian preparation Oct 3, 2024
@gdalle gdalle linked an issue Oct 3, 2024 that may be closed by this pull request
Comment thread DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/utils.jl Outdated
@gdalle gdalle marked this pull request as ready for review October 3, 2024 14:43
@gdalle gdalle merged commit 1208b44 into main Oct 3, 2024
@gdalle gdalle deleted the gd/alloc_jac branch October 3, 2024 17:36
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.

Type stability of preparation

2 participants