-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Cache lookup of matching methods between inference and inlining #34339
Merged
JeffBezanson
merged 1 commit into
JuliaLang:master
from
yhls:yhls/cache-matching-methods
Mar 10, 2020
Merged
Cache lookup of matching methods between inference and inlining #34339
JeffBezanson
merged 1 commit into
JuliaLang:master
from
yhls:yhls/cache-matching-methods
Mar 10, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yhls
force-pushed
the
yhls/cache-matching-methods
branch
from
January 15, 2020 19:59
1400c1e
to
e67b3e5
Compare
yhls
force-pushed
the
yhls/cache-matching-methods
branch
2 times, most recently
from
February 26, 2020 22:28
1610660
to
5b97352
Compare
base/compiler/inferencestate.jl
Outdated
@@ -41,6 +41,10 @@ mutable struct InferenceState | |||
inferred::Bool | |||
dont_work_on_me::Bool | |||
|
|||
# cached results of calling `_methods_by_ftype`, including `min_valid` and | |||
# `max_valid`, to be used in inlining | |||
matching_methods_cache::IdDict{DataType, Tuple{Any, UInt, UInt}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
matching_methods_cache::IdDict{DataType, Tuple{Any, UInt, UInt}} | |
matching_methods_cache::IdDict{Any, Tuple{Any, UInt, UInt}} |
@vtjnash what do you think?
The results of calling `_methods_by_ftype` in inference are now kept in `InferenceState` objects, forwarded to `OptimizationState`s, and used in inlining.
yhls
force-pushed
the
yhls/cache-matching-methods
branch
from
March 6, 2020 18:43
5b97352
to
2253e6f
Compare
JeffBezanson
approved these changes
Mar 6, 2020
By latest measurements, we save about 8% of the time for |
ravibitsgoa
pushed a commit
to ravibitsgoa/julia
that referenced
this pull request
Apr 9, 2020
…aLang#34339) The results of calling `_methods_by_ftype` in inference are now kept in `InferenceState` objects, forwarded to `OptimizationState`s, and used in inlining.
KristofferC
pushed a commit
that referenced
this pull request
Apr 11, 2020
The results of calling `_methods_by_ftype` in inference are now kept in `InferenceState` objects, forwarded to `OptimizationState`s, and used in inlining.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reduces time spent in
METHOD_MATCH
by roughly 40%, as measured with#define ENABLE_TIMINGS
in options.h. I found that, during inference, attempting to look up methods in the cache gave slightly better performance than only adding to it then.We save ~2% of the time in compiling the sysimage, for which
METHOD_MATCH
currently takes ~5% of the time. We save about 7% of the time forjulia -e "using Plots; using DataFrames; display(plot(rand(10), rand(10)))"
, which currently spends ~20% of the time inINFERENCE
(which includes inlining) and ~15% inMETHOD_MATCH
.