Skip to content

promote_op inference bypasses max_methods #49409

Open

Description

When we look at latency issues during loading, we see that one of the culprits is that we won't apply any sort of limiting during inference of Core.Compiler.return_type, and that makes the answer more likely to be wrong by the time it gets to runtime. This is also for a code path (empty arrays) that really shouldn't matter at runtime, so that is very unfortunate. I think preferably here we would limit how much inference is done, as normal, by respecting the max_methods parameter, and return no information from this tfunc (so that it falls back to runtime lookup, in the rare case this is needed at runtime). For example, SnoopCompile reported:

inserting (::Type{T})(x::Static.StaticInteger) where T<:Real @ Static ~/.julia/packages/Static/tQ45Q/src/Static.jl:415 invalidated:
   mt_backedges: 1: signature Tuple{Type{Int64}, Any} triggered MethodInstance for Base.Broadcast.combine_eltypes(::Type{Int64}, ::Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(+), Tuple{Vector{Any}, Vector{Int64}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions