-
-
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
inlining: add missing late special handling for UnionAll
method call
#43479
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
aviatesk
added
the
compiler:optimizer
Optimization passes (mostly in base/compiler/ssair/)
label
Dec 19, 2021
aviatesk
commented
Dec 19, 2021
Looking at the result of <#43452 (comment)>, I found that currently the inlinear sometimes fails to handle `UnionAll` call (e.g. runtime dispatch detected: Core.UnionAll(%28::TypeVar, %29::Any)). This commit adds a missing late special handling for `UnionAll` calls: > before ```julia julia> code_typed((TypeVar,)) do tv UnionAll(tv, Type{tv}) end 1-element Vector{Any}: CodeInfo( 1 ─ %1 = Core.apply_type(Main.Type, tv)::Type{Type{_A}} where _A │ %2 = Main.UnionAll(tv, %1)::Any └── return %2 ) => Any ``` > after ```julia julia> code_typed((TypeVar,)) do tv UnionAll(tv, Type{tv}) end 1-element Vector{Any}: CodeInfo( 1 ─ %1 = Core.apply_type(Main.Type, tv)::Type{Type{_A}} where _A │ %2 = $(Expr(:foreigncall, :(:jl_type_unionall), Any, svec(Any, Any), 0, :(:ccall), Core.Argument(2), :(%1)))::Any └── return %2 ) => Any ```
aviatesk
force-pushed
the
avi/specialcase-unionall
branch
4 times, most recently
from
December 19, 2021 15:51
0b93f07
to
f8316f3
Compare
aviatesk
force-pushed
the
avi/specialcase-unionall
branch
from
December 20, 2021 06:10
f8316f3
to
e2810a0
Compare
aviatesk
added a commit
that referenced
this pull request
Jan 5, 2022
vtjnash
reviewed
Jan 5, 2022
Comment on lines
+444
to
+447
newargexprs = Any[] | ||
for i in 1:(nargs_def-1) | ||
push!(newargexprs, argexprs[i]) | ||
end |
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.
why use such an awkward way to slice this array?
Suggested change
newargexprs = Any[] | |
for i in 1:(nargs_def-1) | |
push!(newargexprs, argexprs[i]) | |
end | |
newargexprs = argexprs[1:(nargs_def-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.
lgtm |
LilithHafner
pushed a commit
to LilithHafner/julia
that referenced
this pull request
Feb 22, 2022
JuliaLang#43479) Looking at the result of <JuliaLang#43452 (comment)>, I found that currently the inlinear sometimes fails to handle `UnionAll` call (e.g. runtime dispatch detected: Core.UnionAll(%28::TypeVar, %29::Any)). This commit adds a missing late special handling for `UnionAll` calls: > before ```julia julia> code_typed((TypeVar,)) do tv UnionAll(tv, Type{tv}) end 1-element Vector{Any}: CodeInfo( 1 ─ %1 = Core.apply_type(Main.Type, tv)::Type{Type{_A}} where _A │ %2 = Main.UnionAll(tv, %1)::Any └── return %2 ) => Any ``` > after ```julia julia> code_typed((TypeVar,)) do tv UnionAll(tv, Type{tv}) end 1-element Vector{Any}: CodeInfo( 1 ─ %1 = Core.apply_type(Main.Type, tv)::Type{Type{_A}} where _A │ %2 = $(Expr(:foreigncall, :(:jl_type_unionall), Any, svec(Any, Any), 0, :(:ccall), Core.Argument(2), :(%1)))::Any └── return %2 ) => Any ```
LilithHafner
pushed a commit
to LilithHafner/julia
that referenced
this pull request
Mar 8, 2022
JuliaLang#43479) Looking at the result of <JuliaLang#43452 (comment)>, I found that currently the inlinear sometimes fails to handle `UnionAll` call (e.g. runtime dispatch detected: Core.UnionAll(%28::TypeVar, %29::Any)). This commit adds a missing late special handling for `UnionAll` calls: > before ```julia julia> code_typed((TypeVar,)) do tv UnionAll(tv, Type{tv}) end 1-element Vector{Any}: CodeInfo( 1 ─ %1 = Core.apply_type(Main.Type, tv)::Type{Type{_A}} where _A │ %2 = Main.UnionAll(tv, %1)::Any └── return %2 ) => Any ``` > after ```julia julia> code_typed((TypeVar,)) do tv UnionAll(tv, Type{tv}) end 1-element Vector{Any}: CodeInfo( 1 ─ %1 = Core.apply_type(Main.Type, tv)::Type{Type{_A}} where _A │ %2 = $(Expr(:foreigncall, :(:jl_type_unionall), Any, svec(Any, Any), 0, :(:ccall), Core.Argument(2), :(%1)))::Any └── return %2 ) => Any ```
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.
Looking at the result of #43452 (comment),
I found that currently the inlinear sometimes fails to handle
UnionAll
call (e.g.
runtime dispatch detected: Core.UnionAll(%28::TypeVar, %29::Any)
).This commit adds a missing late special handling for
UnionAll
calls: