-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add support for per-module max_methods. #43370
Conversation
What's the implication of |
This is what the 3 represents: julia> f(x::Int) = 1;
julia> g(x) = f(x)
g (generic function with 1 method)
julia> code_warntype(g, Tuple{Any})
MethodInstance for g(::Any)
from g(x) in Main at REPL[2]:1
Arguments
#self#::Core.Const(g)
x::Any
Body::Int64
1 ─ %1 = Main.f(x)::Core.Const(1)
└── return %1
julia> f(x::Float64) = 2.0;
julia> code_warntype(g, Tuple{Any})
MethodInstance for g(::Any)
from g(x) in Main at REPL[2]:1
Arguments
#self#::Core.Const(g)
x::Any
Body::Union{Float64, Int64}
1 ─ %1 = Main.f(x)::Union{Float64, Int64}
└── return %1
julia> f(x::Float32) = 3.0f0;
julia> code_warntype(g, Tuple{Any})
MethodInstance for g(::Any)
from g(x) in Main at REPL[2]:1
Arguments
#self#::Core.Const(g)
x::Any
Body::Union{Float32, Float64, Int64}
1 ─ %1 = Main.f(x)::Union{Float32, Float64, Int64}
└── return %1
julia> f(x::String) = "4"
f (generic function with 4 methods)
julia> code_warntype(g, Tuple{Any})
MethodInstance for g(::Any)
from g(x) in Main at REPL[2]:1
Arguments
#self#::Core.Const(g)
x::Any
Body::Any
1 ─ %1 = Main.f(x)::Any
└── return %1 |
It will not cause problems for/is not applicable to the valuestate = iterate(iter, state)
valuestate === nothing || break
value, state = valuestate Union splits should (likewise) generally be fine. |
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.
This LGTM, but it would be ideal if someone who spends more time hacking on inference than me took a look.
Overall, I agree there are very good reasons to target this parameter, and I suspect many packages should set it.
Co-authored-by: Tim Holy <[email protected]>
Co-authored-by: Shuhei Kadowaki <[email protected]>
Co-authored-by: Shuhei Kadowaki <[email protected]>
Co-authored-by: Shuhei Kadowaki <[email protected]>
Co-authored-by: Shuhei Kadowaki <[email protected]>
Co-authored-by: Tim Holy <[email protected]> Co-authored-by: Shuhei Kadowaki <[email protected]>
Co-authored-by: Tim Holy <[email protected]> Co-authored-by: Shuhei Kadowaki <[email protected]>
Shouldn't this have any tests? |
What should tests look like? I should probably add it to LoopVectorization, too. |
Like using the functionality |
Okay, this PR did less than I thought and I didn't find the tests of the original |
I think those tests are for #44426 |
Yes, but I didn't find any tests at all :p |
Adding
to
Plots.jl
:Master:
This PR:
Adding
@max_methods 1
toOrindaryDiffEq
,DiffEqBase
,DifferentialEquations
,VectorizationBase
,LoopVectorization
,TriangularSolve
, andRecursiveFactorization
, I get:Master:
This PR:
We'll have to look which type instabilities that appear here are causing the performance regression before adding the option to these packages, but the possible latency improvements here are enticing.