Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ADTypes to v1 #295

Merged
merged 9 commits into from
Apr 22, 2024
Merged

Upgrade ADTypes to v1 #295

merged 9 commits into from
Apr 22, 2024

Conversation

gdalle
Copy link
Member

@gdalle gdalle commented Apr 22, 2024

Upgrade ADTypes to v1.0 for the sparse backend types only (nothing yet about the coloring and sparsity detection infrastructure).

Supersedes #294

Main changes

  • Bump Julia compat to v1.10, adjust CI
  • Remove everything "1.9-specific" in tests
  • Replace every AutoSparseForwardDiff(...) (construction) with AutoSparse(AutoForwardDiff(...))
  • Replace every AutoSparseForwardDiff (dispatch) with AutoSparse{<:AutoForwardDiff} (be careful with type parameters like {C})
  • No need to define AutoSparseEnzyme anymore
  • Use manual trait for dispatch on mode in sparse_jacobian_cache(ad, args...; kwargs...) = sparse_jacobian_cache_aux(mode(ad), ad, args...; kwargs...). Add implem for ForwardOrReverseMode which checks if we're dealing with Diffractor or Enzyme (not hit by tests for some reason 🤔)
  • Replace _get_colorvec(alg, ad) with _get_colorvec(alg, mode(ad))

Questions

  • I bumped the version to 2.19 because ColPrac says dependency compat upgrade is not breaking. However, the ADTypes API did leak into the SparseDiffTools API through the docs, so I'm not sure if this deserves a 3.0?
  • In the update process for ADTypes v1.0, we should go from the roots of the dependency tree to the leaves. However, that means downstream integration tests are bound to fail at first. Is that okay?
  • This PR does nothing to integrate the coloring and detection infrastructure of SparseDiffTools inside the generic framework introduced by ADTypes v1.0. I think this would be a breaking change, so I suggest doing it separately

Copy link

codecov bot commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 57 lines in your changes are missing coverage. Please review.

Project coverage is 0.06%. Comparing base (a96de04) to head (1365d5e).
Report is 2 commits behind head on master.

❗ Current head 1365d5e differs from pull request most recent head 6f001e2. Consider uploading reports for the commit 6f001e2 to get more accurate results

Files Patch % Lines
src/highlevel/forward_or_reverse_mode.jl 0.00% 12 Missing ⚠️
src/highlevel/common.jl 0.00% 11 Missing ⚠️
src/highlevel/coloring.jl 0.00% 9 Missing ⚠️
ext/SparseDiffToolsEnzymeExt.jl 0.00% 6 Missing ⚠️
ext/SparseDiffToolsZygoteExt.jl 0.00% 5 Missing ⚠️
src/highlevel/forward_mode.jl 0.00% 4 Missing ⚠️
ext/SparseDiffToolsPolyesterForwardDiffExt.jl 0.00% 2 Missing ⚠️
ext/SparseDiffToolsSymbolicsExt.jl 0.00% 2 Missing ⚠️
src/SparseDiffTools.jl 0.00% 2 Missing ⚠️
src/highlevel/finite_diff.jl 0.00% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff            @@
##           master    #295      +/-   ##
=========================================
+ Coverage    0.00%   0.06%   +0.06%     
=========================================
  Files          24      25       +1     
  Lines        1366    1463      +97     
=========================================
+ Hits            0       1       +1     
- Misses       1366    1462      +96     

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

@gdalle
Copy link
Member Author

gdalle commented Apr 22, 2024

@ChrisRackauckas this is ready for a first pass. Not sure if the missed lines in Codecov are my fault or not.

@ChrisRackauckas
Copy link
Member

Looks good!

@ChrisRackauckas ChrisRackauckas merged commit 0a42304 into JuliaDiff:master Apr 22, 2024
13 of 16 checks passed
@gdalle gdalle deleted the adtypes_v1 branch April 22, 2024 13:03
"Pankaj Mishra <[email protected]>",
"Chris Rackauckas <[email protected]>",
]
version = "2.19.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do a major version bump here for safety since we are dropping ADTypes pre-1.0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know ColPrac doesn't require it, but NonlinearSolve is very tightly coupled rn with sparsedifftools..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering whether to include more changes to SparseDiffTools first. Basically I only did the backend part, but the new ADTypes also has infrastructure (supertypes and functions) for sparsity detection + coloring, which SparseDiffTools could extend. On the other hand that would be super super breaking, which is why I didn't do it in the current PR (my priority was getting things to work)

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.

3 participants