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

Type inference takes forever in GenericLinearAlgebra.jl #31974

Closed
Keno opened this issue May 9, 2019 · 2 comments · Fixed by #31996
Closed

Type inference takes forever in GenericLinearAlgebra.jl #31974

Keno opened this issue May 9, 2019 · 2 comments · Fixed by #31996
Assignees
Labels
compiler:inference Type inference regression Regression in behavior compared to a previous version

Comments

@Keno
Copy link
Member

Keno commented May 9, 2019

Looking through PkgEval logs, I see a timeout in GenericLinearAlgebra.jl and indeed

using GenericLinearAlgebra
code_typed(GenericLinearAlgebra.cholUnblocked!, Tuple{Array{Base.Complex{Float32}, 2}, Type{Base.Val{:L}}})
# hangs

This is on master (looking into 1.2 now). If I let it running for close to an hour, it eventually ends up with a StackOverflowError at:

 [120] abstract_call(::Any, ::Nothing, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState, ::Int64) at ./compiler/abstractinterpretation.jl:815
 [121] abstract_apply(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState, ::Int64) at ./compiler/abstractinterpretation.jl:558
 [122] abstract_call(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState, ::Int64) at ./compiler/abstractinterpretation.jl:606
 [123] abstract_call(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:605
 [124] abstract_eval_call(::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:844
 [125] abstract_eval(::Any, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:914
 [126] typeinf_local(::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:1171
 [127] typeinf_nocycle(::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:1227
 [128] typeinf(::Core.Compiler.InferenceState) at ./compiler/typeinfer.jl:12
 [129] abstract_call_method_with_const_args(::Any, ::Any, ::Array{Any,1}, ::Core.SimpleVector, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:223
 [130] abstract_call_gf_by_type(::Any, ::Array{Any,1}, ::Any, ::Core.Compiler.InferenceState, ::Int64) at ./compiler/abstractinterpretation.jl:116
 [131] abstract_call(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState, ::Int64) at ./compiler/abstractinterpretation.jl:815
 [132] abstract_call(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:605
 [133] abstract_eval_call(::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:844
 [134] abstract_eval(::Any, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:914
 [135] typeinf_local(::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:1157
 [136] typeinf_nocycle(::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:1227
 [137] typeinf(::Core.Compiler.InferenceState) at ./compiler/typeinfer.jl:12
 [138] abstract_call_method_with_const_args(::Any, ::Any, ::Array{Any,1}, ::Core.SimpleVector, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:223
 [139] abstract_call_gf_by_type(::Any, ::Array{Any,1}, ::Any, ::Core.Compiler.InferenceState, ::Int64) at ./compiler/abstractinterpretation.jl:116
 [140] abstract_call(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState, ::Int64) at ./compiler/abstractinterpretation.jl:815
 [141] abstract_call(::Any, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:605
 [142] abstract_eval_call(::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:844
 [143] abstract_eval(::Any, ::Array{Any,1}, ::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:914
 [144] typeinf_local(::Core.Compiler.InferenceState) at ./compiler/abstractinterpretation.jl:1171
 ... (the last 9 lines are repeated 1122 more times)
@Keno
Copy link
Member Author

Keno commented May 9, 2019

Also happens in 1.2, adding to the milestone.

@Keno Keno added this to the 1.2 milestone May 9, 2019
@Keno Keno added the compiler:inference Type inference label May 9, 2019
@JeffBezanson JeffBezanson added the regression Regression in behavior compared to a previous version label May 9, 2019
@Keno Keno self-assigned this May 10, 2019
@Keno
Copy link
Member Author

Keno commented May 10, 2019

Reduced:

julia> function foo(a::UnitRange)
           foo(first(a)+1:last(a))
           a
       end

julia> foo(n::Int) = foo(1:n)
foo (generic function with 2 methods)

julia> code_typed(foo, Tuple{Int})
# Hangs

Keno added a commit that referenced this issue May 10, 2019
Even if the result is unused. Fixes #31974.
Keno added a commit that referenced this issue May 10, 2019
Even if the result is unused. Fixes #31974.
Keno added a commit that referenced this issue May 11, 2019
Even if the result is unused. Fixes #31974.
KristofferC pushed a commit that referenced this issue May 13, 2019
Even if the result is unused. Fixes #31974.

(cherry picked from commit 40296fb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants