julia> kernel() = 0
kernel (generic function with 1 method)
julia> GPUCompiler.@override method_table kernel() = 1
julia> native_code_llvm(kernel, Tuple{})
; @ REPL[1]:1 within `kernel`
; Function Attrs: alwaysinline
define i64 @julia_kernel_683() local_unnamed_addr #0 {
top:
ret i64 0
}
The reason for this is that we implement Core.Compiler.method_table(interp::GPUInterpreter, sv::InferenceState), whereas for the outermost function Core.Compiler.method_table(interp::GPUInterpreter) seem to be called. But we can't implement that method, because that breaks InferenceState construction:
ERROR: LoadError: MethodError: no method matching convert(::Type{Core.Compiler.CachedMethodTable{Core.Compiler.InternalMethodTable}}, ::Core.Compiler.CachedMethodTable{Core.Compiler.OverlayMethodTable})
Closest candidates are:
convert(::Type{Union{}}, ::Any) at essentials.jl:216
convert(::Type{Any}, ::Any) at essentials.jl:217
convert(::Type{T}, ::T) where T at essentials.jl:218
Stacktrace:
[1] Core.Compiler.InferenceState(result::Core.Compiler.InferenceResult, src::Core.CodeInfo, cached::Bool, interp::GPUCompiler.GPUInterpreter)
@ Core.Compiler ./compiler/inferencestate.jl:106
The reason for this is that we implement
Core.Compiler.method_table(interp::GPUInterpreter, sv::InferenceState)
, whereas for the outermost functionCore.Compiler.method_table(interp::GPUInterpreter)
seem to be called. But we can't implement that method, because that breaks InferenceState construction: