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

Improve inference SCC '[limited]' code computation #39116

Merged
merged 1 commit into from
Jan 20, 2021

Conversation

vtjnash
Copy link
Sponsor Member

@vtjnash vtjnash commented Jan 6, 2021

This implements the idea described in #38517, with other substantial additional refinements.

@vtjnash vtjnash added compiler:inference Type inference compiler:latency Compiler latency backport 1.6 Change should be backported to release-1.6 labels Jan 6, 2021
@vtjnash vtjnash requested review from Keno and NHDaly January 6, 2021 03:58
@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jan 6, 2021

I'm not sure why the status didn't update when those finished. I suppose it got confused. The only one waiting on is https://build.julialang.org/#/builders/39/builds/6682

@@ -56,6 +56,7 @@ end

# Wraps a type and represents that the value may also be undef at this point.
# (only used in optimize, not abstractinterpret)
# N.B. in the lattice, this is epsilon bigger than `typ` (even Any)
Copy link
Member

Choose a reason for hiding this comment

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

What does N.B. expand to? :)

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

nota bene (tr. note well!)

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jan 11, 2021

Don't know what the doctest machine segfaults because of this, since I can't reproduce and this otherwise is done.

elseif typeb.causes ⊆ typea.causes
causes = typea.causes
else
causes = union!(copy(typea.causes), typeb.causes)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Any reason not to use plain union here?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Yeah, it doesn’t make an IdDict. We should perhaps change that

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Ah, wait, that is a holdover from when this was a Dict and used merge, for union on IdSet, it would be okay.

julia> merge(IdDict(), IdDict())
Dict{Any, Any}()

This helps refine our knowledge of the `[limited]` flag setting, which
previously would always exclude a result from the cache when hitting a
cycle. However, we really only need to exclude a result if the result
might be dependent on that flag setting. That makes this formally part
of the lattice, though can be annoying to work with yet another wrapper,
so we try to add/remove it late/early to propagate it when necessary.
@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jan 14, 2021

Running doctest with FORCE_ASSERTIONS, it seems to have turned out to be fixed by #39246. Let's see how this does now.

@KristofferC
Copy link
Sponsor Member

Probably needs a rebase to catch #39263 to make doctests pass.

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jan 15, 2021

That is acceptable, we know this would have passed. @JeffBezanson GTG?

@@ -443,7 +454,8 @@ function abstract_call_method(interp::AbstractInterpreter, method::Method, @nosp
# (non-typically, this means that we lose the ability to detect a guaranteed StackOverflow in some cases)
return Any, true, nothing
end
poison_callstack(sv, topmost::InferenceState, true)
topmost = topmost::InferenceState
poison_callstack(sv, topmost.parent === nothing ? topmost : topmost.parent)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

nit pick;

Suggested change
poison_callstack(sv, topmost.parent === nothing ? topmost : topmost.parent)
parent = topmost.parent
poison_callstack(sv, parent === nothing ? topmost : parent)

@NHDaly
Copy link
Member

NHDaly commented Jan 16, 2021

This is great, thanks Jameson! :)

@KristofferC KristofferC mentioned this pull request Jan 19, 2021
60 tasks
@Sacha0
Copy link
Member

Sacha0 commented Jan 20, 2021

Hm, the doctest failure looks real. Perhaps Kristoffer's comment

Probably needs a rebase to catch #39263 to make doctests pass.

is relevant, given it looks like the last rebase was before 39263?

@vtjnash vtjnash merged commit 5f10eb9 into master Jan 20, 2021
@vtjnash vtjnash deleted the jn/inference-nolimited branch January 20, 2021 17:04
KristofferC pushed a commit that referenced this pull request Jan 21, 2021
This helps refine our knowledge of the `[limited]` flag setting, which
previously would always exclude a result from the cache when hitting a
cycle. However, we really only need to exclude a result if the result
might be dependent on that flag setting. That makes this formally part
of the lattice, though can be annoying to work with yet another wrapper,
so we try to add/remove it late/early to propagate it when necessary.

(cherry picked from commit 5f10eb9)
vtjnash added a commit that referenced this pull request Jan 21, 2021
This helps refine our knowledge of the `[limited]` flag setting, which
previously would always exclude a result from the cache when hitting a
cycle. However, we really only need to exclude a result if the result
might be dependent on that flag setting. That makes this formally part
of the lattice, though can be annoying to work with yet another wrapper,
so we try to add/remove it late/early to propagate it when necessary.

(cherry picked from commit 5f10eb9)
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Feb 1, 2021
KristofferC pushed a commit that referenced this pull request Feb 1, 2021
This helps refine our knowledge of the `[limited]` flag setting, which
previously would always exclude a result from the cache when hitting a
cycle. However, we really only need to exclude a result if the result
might be dependent on that flag setting. That makes this formally part
of the lattice, though can be annoying to work with yet another wrapper,
so we try to add/remove it late/early to propagate it when necessary.

(cherry picked from commit 5f10eb9)
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
…39116)

This helps refine our knowledge of the `[limited]` flag setting, which
previously would always exclude a result from the cache when hitting a
cycle. However, we really only need to exclude a result if the result
might be dependent on that flag setting. That makes this formally part
of the lattice, though can be annoying to work with yet another wrapper,
so we try to add/remove it late/early to propagate it when necessary.
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
…39116)

This helps refine our knowledge of the `[limited]` flag setting, which
previously would always exclude a result from the cache when hitting a
cycle. However, we really only need to exclude a result if the result
might be dependent on that flag setting. That makes this formally part
of the lattice, though can be annoying to work with yet another wrapper,
so we try to add/remove it late/early to propagate it when necessary.
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
This helps refine our knowledge of the `[limited]` flag setting, which
previously would always exclude a result from the cache when hitting a
cycle. However, we really only need to exclude a result if the result
might be dependent on that flag setting. That makes this formally part
of the lattice, though can be annoying to work with yet another wrapper,
so we try to add/remove it late/early to propagate it when necessary.

(cherry picked from commit 5f10eb9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference compiler:latency Compiler latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants