-
-
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
inference: accelerate type-limits under wide-recursion #31734
Merged
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
JeffBezanson
added
bugfix
This change fixes an existing bug
compiler:inference
Type inference
backport 1.2
labels
Apr 16, 2019
@@ -63,6 +63,7 @@ function abstract_call_gf_by_type(@nospecialize(f), argtypes::Vector{Any}, @nosp | |||
nonbot = 0 # the index of the only non-Bottom inference result if > 0 | |||
seen = 0 # number of signatures actually inferred | |||
istoplevel = sv.linfo.def isa Module | |||
any_splitunions = napplicable > 1 |
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.
How about multiple_matches
?
JeffBezanson
approved these changes
Apr 18, 2019
when we hit union-splitting, we need to ensure type limits are very aggressive and preferably also independent of the height of the recursion chain fix #31572
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan |
KristofferC
pushed a commit
that referenced
this pull request
Apr 20, 2019
Keno
added a commit
that referenced
this pull request
Jul 17, 2023
Ordinarily our recursion heuristic looks for recursion of edges, widening types to force convergence if a a recursion of edges is detected. However, under some circumstances (currently - as of #31734 when there are multiple applicable methods), we fall back to simple recursion of methods. This can be quite limiting for packages that have a big central dispatch method (e.g. Diffractor). This attempts to find a middle ground by applying the hardlimit fallback only if the split signatures are not concrete. The kind of case that we want to catch here often arise from signatures with unresolved Vararg (where there's a lot of destructuring methods, but since the size of the vararg is not known, we never terminate) or overly abstract types. I'm hoping this provides a better middle ground tradeoff by still prohibiting those kinds of cases while allowing otherwise very concretely inferred code that just happens to dispatch through a central higher-order method.
Keno
added a commit
that referenced
this pull request
Jul 17, 2023
Ordinarily our recursion heuristic looks for recursion of edges, widening types to force convergence if a a recursion of edges is detected. However, under some circumstances (currently - as of #31734 when there are multiple applicable methods), we fall back to simple recursion of methods. This can be quite limiting for packages that have a big central dispatch method (e.g. Diffractor). This attempts to find a middle ground by applying the hardlimit fallback only if the split signatures are not concrete. The kind of case that we want to catch here often arise from signatures with unresolved Vararg (where there's a lot of destructuring methods, but since the size of the vararg is not known, we never terminate) or overly abstract types. I'm hoping this provides a better middle ground tradeoff by still prohibiting those kinds of cases while allowing otherwise very concretely inferred code that just happens to dispatch through a central higher-order method.
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.
when we hit union-splitting, we need to ensure type limits are very aggressive
and preferably also independent of the height of the recursion chain
fix #31572
(ps. diff looks strange, use ignore white-space for better context)