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

inference: accelerate type-limits under wide-recursion #31734

Merged
merged 1 commit into from
Apr 19, 2019
Merged

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Apr 15, 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

(ps. diff looks strange, use ignore white-space for better context)

@vtjnash vtjnash requested a review from Keno April 15, 2019 21:57
@JeffBezanson 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
Copy link
Member

Choose a reason for hiding this comment

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

How about multiple_matches?

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
@vtjnash
Copy link
Member Author

vtjnash commented Apr 18, 2019

@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

@vtjnash vtjnash merged commit 32b091b into master Apr 19, 2019
@vtjnash vtjnash deleted the jn/31572 branch April 19, 2019 03:28
@KristofferC KristofferC mentioned this pull request Apr 20, 2019
58 tasks
KristofferC pushed a commit that referenced this pull request Apr 20, 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

(cherry picked from commit 32b091b)
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
Labels
bugfix This change fixes an existing bug compiler:inference Type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Julia gets stuck on recursive function
4 participants