add descend string macro
This allows for users to take a stacktrace like:
julia> wait(kernel!(a, b, c, ndrange=size(c)))ERROR: TaskFailedException:MethodError: no method matching __index_Global_Cartesian(::CartesianIndex{2})Stacktrace:
[1] __index_Global_NTuple at /home/vchuravy/src/KernelAbstractions/src/KernelAbstractions.jl:291 [inlined]
[2] cpu_matmul_kernel! at /home/vchuravy/src/KernelAbstractions/src/macros.jl:229 [inlined]
[3] __thread_run(::Int64, ::Int64, ::Int64, ::KernelAbstractions.Kernel{CPU,KernelAbstractions.NDIteration.StaticSize{(4,)},KernelAbstractions.NDIteratio
n.DynamicSize,typeof(cpu_matmul_kernel!)}, ::Tuple{Int64,Int64}, ::KernelAbstractions.NDIteration.NDRange{2,KernelAbstractions.NDIteration.DynamicSize,Ker
nelAbstractions.NDIteration.StaticSize{(4, 1)},CartesianIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}},Nothing}, ::Tuple{Array{Float64,2},Array{Flo
at64,2},Array{Float64,2}}, ::KernelAbstractions.NDIteration.NoDynamicCheck) at /home/vchuravy/src/KernelAbstractions/src/backends/cpu.jl:148
[4] __run(::KernelAbstractions.Kernel{CPU,KernelAbstractions.NDIteration.StaticSize{(4,)},KernelAbstractions.NDIteration.DynamicSize,typeof(cpu_matmul_ke
rnel!)}, ::Tuple{Int64,Int64}, ::KernelAbstractions.NDIteration.NDRange{2,KernelAbstractions.NDIteration.DynamicSize,KernelAbstractions.NDIteration.Static
Size{(4, 1)},CartesianIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}},Nothing}, ::Tuple{Array{Float64,2},Array{Float64,2},Array{Float64,2}}, ::Kerne
lAbstractions.NDIteration.NoDynamicCheck) at /home/vchuravy/src/KernelAbstractions/src/backends/cpu.jl:121
[5] (::KernelAbstractions.var"#30#31"{Nothing,Nothing,typeof(KernelAbstractions.__run),Tuple{KernelAbstractions.Kernel{CPU,KernelAbstractions.NDIteration.StaticSize{(4,)},KernelAbstractions.NDIteration.DynamicSize,typeof(cpu_matmul_kernel!)},Tuple{Int64,Int64},KernelAbstractions.NDIteration.NDRange{2,KernelAbstractions.NDIteration.DynamicSize,KernelAbstractions.NDIteration.StaticSize{(4, 1)},CartesianIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}},Nothing},Tuple{Array{Float64,2},Array{Float64,2},Array{Float64,2}},KernelAbstractions.NDIteration.NoDynamicCheck}})() at /home/vchuravy/src/KernelAbstractions/src/backends/cpu.jl:20
Stacktrace:
[1] wait at ./task.jl:267 [inlined]
[2] wait at /home/vchuravy/src/KernelAbstractions/src/backends/cpu.jl:63 [inlined]
[3] wait at /home/vchuravy/src/KernelAbstractions/src/backends/cpu.jl:27 [inlined] (repeats 2 times)
[4] top-level scope at REPL[30]:1
And invoke:
descend"KernelAbstractions.__thread_run(::Int64, ::Int64, ::Int64, ::KernelAbstractions.Kernel{CPU,KernelAbstractions.NDIteration.StaticSize{(4,)},KernelAbstractions.NDIteratio
n.DynamicSize,typeof(cpu_matmul_kernel!)}, ::Tuple{Int64,Int64}, ::KernelAbstractions.NDIteration.NDRange{2,KernelAbstractions.NDIteration.DynamicSize,Ker
nelAbstractions.NDIteration.StaticSize{(4, 1)},CartesianIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}},Nothing}, ::Tuple{Array{Float64,2},Array{Flo
at64,2},Array{Float64,2}}, ::KernelAbstractions.NDIteration.NoDynamicCheck)"
Idea: make decend(3) work to do the same thing.
I.e. to decend into the method mentioned on the 3rd item in the last stacktrace.
Somewhere (in the REPL?) is stored the last numbered thing.
with makes julia> 3 then ctrl+q work with methods(...) and stacktraces.
@kristofferc set it up, i think?
@KristofferC set it up, i think?
Yep,
https://github.com/JuliaLang/julia/blob/ba5cafba6a777be24846b1fdd4be4bd20e3551b5/base/errorshow.jl#L616-L619
https://github.com/JuliaLang/julia/blob/ba5cafba6a777be24846b1fdd4be4bd20e3551b5/stdlib/REPL/src/REPL.jl#L1095-L1109
How does that work with exception stacks?
In the above I have two stacked exceptions.
How does that work with exception stacks?
No idea :D (probably the latest printed)
Yeah and the location is not enough information for Cthulhu, so we would need to store the stackframe itself.
Yeah and the location is not enough information for Cthulhu, so we would need to store the stackframe itself.
You can resolve locations into methods via CodeTracking.jl, which is already a dependency of Cthulu
Methods are not sufficient I need MethodInstances.
ah, trackign that down is much more annoying