-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add invalidations script #673
Conversation
e365242
to
3a4cc19
Compare
cc @jakebolewski / @simonbyrne, this could be affecting ClimaCore, too, since we have many overlapping deps. |
3a4cc19
to
12dfd39
Compare
bors r+ |
I'm not sure what we can do if it is caused by a dependency? |
There are some patched diffeq support functions that are no longer necessary now that we support |
Build succeeded: |
674: Add explicit show to last tree element r=charleskawczynski a=charleskawczynski Missed in #673. I'm not sure how to suppress the output in the `SnoopCompile.invalidation_trees(invalidations)` call. Co-authored-by: Charles Kawczynski <[email protected]>
This was fixed by DiiffEqBase.jl's 723 🎉 |
How did you get the number of invalidations to see the priority? I want to run that on all of DiffEq and just do a bunch of quick PRs like this. |
@ChrisRackauckas, Everything is actually in this PR, here's a short pseudo-code summary: # From: https://timholy.github.io/SnoopCompile.jl/stable/snoopr/
using SnoopCompileCore
invalidations = @snoopr begin
# load packages & do representative work
end;
import SnoopCompile
trees = SnoopCompile.invalidation_trees(invalidations);
@show length(SnoopCompile.uinvalidated(invalidations)) # show total invalidations
show(trees[end]) # show the most invalidated method
# Count number of children (number of invalidations per invalidated method)
n_invalidations = map(trees) do methinvs
SnoopCompile.countchildren(methinvs)
end
import Plots
Plots.plot(
1:length(trees),
n_invalidations;
markershape = :circle,
xlabel = "i-th method invalidation",
label = "Number of children per method invalidations",
) |
12: Add script for tabulating method invalidations r=charleskawczynski a=charleskawczynski This is to replace [these plots](CliMA/TurbulenceConvection.jl#673 (comment)). Co-authored-by: Charles Kawczynski <[email protected]>
For now, this script grabs invalidations and plots the number (and percentage) of children per method invalidation.
It seems that DiffEq.jl's
Base.mapreduce_empty
is triggering ~1k invalidations (almost 50% of all invalidations). It is recommended to tackle expensive invalidations before moving on to improving inferrability / profile-guided despecialization to improve latency.