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

Mooncake Upgrades #645

Merged
merged 7 commits into from
Nov 29, 2024
Merged

Mooncake Upgrades #645

merged 7 commits into from
Nov 29, 2024

Conversation

willtebbutt
Copy link
Member

In response to a couple of things, I've decided to add much better tools for caching various things in Mooncake. As a result, we can substantially simplify Mooncake's implementation in DifferentiationInterface.

I've tested this locally, so I'm hoping it still works...

@willtebbutt willtebbutt requested a review from gdalle as a code owner November 28, 2024 17:15
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.52%. Comparing base (cc8818a) to head (9369bd5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../ext/DifferentiationInterfaceMooncakeExt/twoarg.jl 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #645      +/-   ##
==========================================
- Coverage   97.53%   97.52%   -0.01%     
==========================================
  Files         111      111              
  Lines        5550     5536      -14     
==========================================
- Hits         5413     5399      -14     
  Misses        137      137              
Flag Coverage Δ
DI 98.65% <95.23%> (-0.01%) ⬇️
DIT 95.35% <ø> (ø)

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.

@willtebbutt
Copy link
Member Author

(failures because the right version of Mooncake is not yet available, because I messed up doing releases)

@willtebbutt willtebbutt reopened this Nov 28, 2024
@willtebbutt
Copy link
Member Author

(codecov is lying -- the line it says is uncovered is definitely covered)

Copy link
Member

@gdalle gdalle left a comment

Choose a reason for hiding this comment

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

Thanks! This new cache thingy isn't documented anywhere in Mooncake.jl, is it the new name for rules? Is it an internal or part of the API?

y_copy = copy(y)
dx_righttype = zero_tangent(x)
dy_righttype = zero_tangent(y)
target_function = function (f!, y, x, contexts...)
Copy link
Member

Choose a reason for hiding this comment

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

will this new closure slow things down?

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 don't believe so -- Mooncake generally has no problems with closures.

@willtebbutt
Copy link
Member Author

This new cache thingy isn't documented anywhere in Mooncake.jl, is it the new name for rules?

It's a wrapper around a rule, and all of the various tangents that you need in order to avoid allocations. Unlike build_rrule, which just used static information, the cache makes use of dynamic information (e.g. array sizes) which it uses to make life easier.

Is it an internal or part of the API?

It's internal for now. I plan to make it available publicly in short order, but want to make sure it's doing everything as I intend it before telling users about it.

@gdalle gdalle merged commit fd3dc14 into main Nov 29, 2024
46 of 47 checks passed
@willtebbutt willtebbutt deleted the wct/mooncake-upgrades branch November 29, 2024 21:20
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