-
-
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
Invalidation regressions on release-1.6 #39030
Comments
StaticArrays also invalidates the corresponding julia> using SnoopCompileCore
julia> invs = @snoopr using StaticArrays;
julia> using SnoopCompile
julia> length(uinvalidated(invs))
425
julia> trees = invalidation_trees(invs)
6-element Vector{SnoopCompile.MethodInvalidations}:
inserting getproperty(::SOneTo{n}, s::Symbol) where n in StaticArrays at /home/tim/.julia/packages/StaticArrays/LJQEe/src/SOneTo.jl:57 invalidated:
backedges: 1: superseding getproperty(x, f::Symbol) in Base at Base.jl:33 with MethodInstance for getproperty(::AbstractUnitRange, ::Symbol) (1 children)
2 mt_cache
inserting (::Type{SA})(a::AbstractArray) where SA<:StaticArray in StaticArrays at /home/tim/.julia/packages/StaticArrays/LJQEe/src/convert.jl:7 invalidated:
backedges: 1: superseding Union{}(a...) in Core at boot.jl:247 with MethodInstance for Union{}(::Vector{var"#s120"} where var"#s120"<:Union{Float32, Float64}) (2 children)
inserting similar(A::AbstractArray, ::Type{T}, shape::Tuple{Union{Integer, Base.OneTo, SOneTo}, Vararg{Union{Integer, Base.OneTo, SOneTo}, N} where N}) where T in StaticArrays at /home/tim/.julia/packages/StaticArrays/LJQEe/src/abstractarray.jl:152 invalidated:
mt_backedges: 1: signature Tuple{typeof(similar), Vector{T} where T, Type, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Vector{T} where T, ::Type{T}, ::Union{Integer, AbstractUnitRange}) where T (0 children)
2: signature Tuple{typeof(similar), Vector{T} where T, DataType, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Vector{T} where T, ::DataType, ::Union{Integer, AbstractUnitRange}) (0 children)
3: signature Tuple{typeof(similar), Vector{T} where T, Type, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Vector{T} where T, ::Type{T}, ::Tuple{Union{Integer, Base.OneTo}}) where T (2 children)
4: signature Tuple{typeof(similar), Vector{T} where T, DataType, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Vector{T} where T, ::DataType, ::Tuple{Union{Integer, Base.OneTo}}) (2 children)
inserting similar(::Type{A}, shape::Tuple{Union{Integer, Base.OneTo, SOneTo}, Vararg{Union{Integer, Base.OneTo, SOneTo}, N} where N}) where A<:AbstractArray in StaticArrays at /home/tim/.julia/packages/StaticArrays/LJQEe/src/abstractarray.jl:153 invalidated:
mt_backedges: 1: signature Tuple{typeof(similar), Type{Array{Any, _A}} where _A, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Type{Array{Any, _A}}, ::Union{Integer, AbstractUnitRange}) where _A (0 children)
2: signature Tuple{typeof(similar), Type{Array{_A, _B}} where _B where _A, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Type{Array{_A, _B}}, ::Union{Integer, AbstractUnitRange}) where {_A, _B} (0 children)
3: signature Tuple{typeof(similar), Type{Array{String, _A}} where _A, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Type{Array{String, _A}}, ::Union{Integer, AbstractUnitRange}) where _A (0 children)
4: signature Tuple{typeof(similar), Type{Array{Expr, _A}} where _A, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Type{Array{Expr, _A}}, ::Union{Integer, AbstractUnitRange}) where _A (0 children)
5: signature Tuple{typeof(similar), Type{Array{Any, _A}} where _A, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Type{Array{Any, _A}}, ::Tuple{Union{Integer, Base.OneTo}}) where _A (2 children)
6: signature Tuple{typeof(similar), Type{Array{_A, _B}} where _B where _A, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Type{Array{_A, _B}}, ::Tuple{Union{Integer, Base.OneTo}}) where {_A, _B} (2 children)
7: signature Tuple{typeof(similar), Type{Array{String, _A}} where _A, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Type{Array{String, _A}}, ::Tuple{Union{Integer, Base.OneTo}}) where _A (2 children)
8: signature Tuple{typeof(similar), Type{Array{Expr, _A}} where _A, Tuple{Union{Integer, AbstractUnitRange}}} triggered MethodInstance for similar(::Type{Array{Expr, _A}}, ::Tuple{Union{Integer, Base.OneTo}}) where _A (2 children)
4 mt_cache
inserting isassigned(a::StaticArray, i::Int64...) in StaticArrays at /home/tim/.julia/packages/StaticArrays/LJQEe/src/abstractarray.jl:28 invalidated:
backedges: 1: superseding isassigned(a::AbstractArray, i::Integer...) in Base at abstractarray.jl:505 with MethodInstance for isassigned(::AbstractVecOrMat{T} where T, ::Int64, ::Int64) (20 children)
inserting (::Type{SA})(a::StaticArray) where SA<:SizedArray in StaticArrays at /home/tim/.julia/packages/StaticArrays/LJQEe/src/convert.jl:6 invalidated:
backedges: 1: superseding Union{}(a...) in Core at boot.jl:247 with MethodInstance for Union{}(::AbstractArray) (623 children) |
Can anyone else replicate this? I've now tried this on other machines besides my laptop and I am not getting the same result. |
I have no clue what happened (git assured me I had no local modifications), but a |
I can personally reproduce this with CEnum.jl on master: julia> using SnoopCompileCore
julia> invs = @snoopr using CEnum;
julia> using SnoopCompile
julia> length(uinvalidated(invs))
1830
julia> trees = invalidation_trees(invs)
1-element Vector{SnoopCompile.MethodInvalidations}:
inserting convert(::Type{T1}, x::CEnum.Cenum{T2}) where {T1<:Integer, T2<:Integer} in CEnum at /home/belmant/.julia/dev/CEnum.jl/src/operators.jl:25 invalidated:
backedges: 1: superseding convert(::Type{Union{}}, x) in Base at essentials.jl:280 with MethodInstance for convert(::Core.TypeofBottom, ::Any) (2612 children)
julia> versioninfo()
Julia Version 1.9.0-DEV.667
Commit 762561c3057 (2022-05-27 04:05 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
Threads: 1 on 8 virtual cores EDIT: I see this issue has already been re-reported elsewhere, sorry for the noise. |
This makes me sad:
That's quite a large number. But it gets worse when you see what gets invalidated:
This immediately hits
parse(::Base.TOML.Parser)
, and thus we're back to invalidating the code that Julia uses to load other packages. Henceusing
is slower than it was earlier in the 1.6 dev cycle. I thought I'd felt some of that just in ordinary usage, but not until I looked were my vague suspicions confirmed.That ColorTypes signature,
convert(::Type{C}, c::Colorant) where C<:Colorant
, is remiscent of the kind of work @vtjnash did on ambiguities and invalidation in #36863 and #36733, and the signatures seem ambiguous to me (Union{}
is more specialized thanC<:Colorant
, whereasAny
is less specialized thanColorant
.) Does this need a fresh look?The text was updated successfully, but these errors were encountered: