JuliaLang / AllocCheck.jl

AllocCheck
Other
221 stars 8 forks source link

Error from within AllocCheck when calling @check_allocs function #53

Closed tecosaur closed 10 months ago

tecosaur commented 10 months ago

I really like the idea of this package, and my first thought was to give it a whirl with my KangarooTwelve package (v1.0.0), since that has a few methods that should never allocate. However, it looks like I've run into a bug within AllocCheck? I'm using Julia 1.10-rc1 for reference.

julia> using KangarooTwelve

julia> using AllocCheck

julia> @check_allocs k12s(a, b) = KangarooTwelve.k12_singlethreaded(a, b)
k12s (generic function with 1 method)

julia> k12s(UInt8[], UInt8[])
ERROR: type DynamicDispatch has no field name
Stacktrace:
  [1] getproperty
    @ ./Base.jl:37 [inlined]
  [2] ==(self::AllocCheck.DynamicDispatch, other::AllocCheck.DynamicDispatch)
    @ AllocCheck ~/.julia/packages/AllocCheck/xTVrb/src/types.jl:38
  [3] isequal(x::AllocCheck.DynamicDispatch, y::AllocCheck.DynamicDispatch)
    @ Base ./operators.jl:133
  [4] ht_keyindex(h::Dict{Any, Nothing}, key::AllocCheck.DynamicDispatch)
    @ Base ./dict.jl:275
  [5] haskey
    @ Base ./dict.jl:569 [inlined]
  [6] in
    @ Base ./set.jl:92 [inlined]
  [7] ∉(x::AllocCheck.DynamicDispatch, itr::Set{Any})
    @ Base ./operators.jl:1304
  [8] _unique!(f::typeof(identity), A::Vector{Any}, seen::Set{Any}, current::Int64, i::Int64)
    @ Base ./set.jl:338
  [9] _unique!(f::typeof(identity), A::Vector{Any}, seen::Set{AllocCheck.DynamicDispatch}, current::Int64, i::Int64)
    @ Base ./set.jl:346
 [10] unique!(f::typeof(identity), A::Vector{Any}; seen::Nothing)
    @ Base ./set.jl:331
 [11] unique!
    @ ./set.jl:319 [inlined]
 [12] _unique!
    @ ./set.jl:357 [inlined]
 [13] unique!
    @ ./set.jl:423 [inlined]
 [14] find_allocs!(mod::LLVM.Module, meta::@NamedTuple{entry::LLVM.Function, compiled::Dict{Any, Any}}; ignore_throw::Bool)
    @ AllocCheck ~/.julia/packages/AllocCheck/xTVrb/src/AllocCheck.jl:165
 [15] (::AllocCheck.var"#22#26"{GPUCompiler.CompilerJob{…}, Bool})(ctx::LLVM.Context)
    @ AllocCheck ~/.julia/packages/AllocCheck/xTVrb/src/compiler.jl:118
 [16] JuliaContext(f::AllocCheck.var"#22#26"{GPUCompiler.CompilerJob{…}, Bool})
    @ GPUCompiler ~/.julia/packages/GPUCompiler/2mJjc/src/driver.jl:47
 [17] compile
    @ ~/.julia/packages/AllocCheck/xTVrb/src/compiler.jl:113 [inlined]
 [18] actual_compilation(cache::Dict{…}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{…}, compiler::AllocCheck.var"#compile#25"{…}, linker::AllocCheck.var"#link#27"{…})
    @ GPUCompiler ~/.julia/packages/GPUCompiler/2mJjc/src/execution.jl:125
 [19] cached_compilation(cache::Dict{…}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{…}, compiler::Function, linker::Function)
    @ GPUCompiler ~/.julia/packages/GPUCompiler/2mJjc/src/execution.jl:103
 [20] macro expansion
    @ ~/.julia/packages/AllocCheck/xTVrb/src/compiler.jl:145 [inlined]
 [21] macro expansion
    @ ./lock.jl:267 [inlined]
 [22] compile_callable(f::var"###k12s#233", tt::Type{Tuple{Vector{UInt8}, Vector{UInt8}}}; ignore_throw::Bool)
    @ AllocCheck ~/.julia/packages/AllocCheck/xTVrb/src/compiler.jl:106
 [23] compile_callable
    @ ~/.julia/packages/AllocCheck/xTVrb/src/compiler.jl:103 [inlined]
 [24] k12s(a::Vector{UInt8}, b::Vector{UInt8})
    @ Main ./REPL[3]:140
 [25] top-level scope
    @ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.
topolarity commented 10 months ago

Fixed in https://github.com/JuliaLang/AllocCheck.jl/pull/51 - you can expect this in a patch release soon :+1: