julia icon indicating copy to clipboard operation
julia copied to clipboard

snoop_inference is broken on latest after stackless inference change

Open NHDaly opened this issue 1 year ago • 1 comments

We should be able to restore basically the old behavior with the new stack.

I wasn't certain how to maintain the old code, since it was working with incomplete and inaccurate information available. Now all required information is available in function typeinf(interp::AbstractInterpreter, frame::InferenceState), so this could be reimplemented there in some form.

Originally posted by @vtjnash in https://github.com/JuliaLang/julia/pull/55575#discussion_r1795702974

NHDaly avatar Oct 11 '24 17:10 NHDaly

CC: @timholy

NHDaly avatar Oct 18 '24 19:10 NHDaly

FWIW, this also affects PrecompileTools.jl.

maleadt avatar Nov 27 '24 14:11 maleadt

In particular https://github.com/JuliaLang/PrecompileTools.jl/blob/61138b566718652a4033f528ff2dcabcf4cff2cb/src/workloads.jl#L88-L100

vchuravy avatar Nov 27 '24 14:11 vchuravy

Can we confirm that PrecompileTools and SnoopCompile works properly brute closing this?

KristofferC avatar Mar 17 '25 03:03 KristofferC

Attempts to validate this:

  • Checked PrecompileTools CI on nightly. Errors, not sure if related https://github.com/JuliaLang/PrecompileTools.jl/pull/46
  • Checked GPUCompiler CI on nightly. The error reported doesn't show up (the ptx/precompile tests pass), but not sure if it's just hitting other errors earlier https://github.com/JuliaGPU/GPUCompiler.jl/pull/676
  • Tried pkg> status locally with --trace-compile=stderr and still see some precompile statements
% ./julia --trace-compile=stderr --trace-compile-timing --start=no -q
julia> #=   17.3 ms =# precompile(Tuple{Base.var"#readcb_specialized#uv_readcb##0", Base.TTY, Int64, UInt64})
#=   16.5 ms =# precompile(Tuple{typeof(Base.peek), Base.TTY, Type{UInt8}})
#=    6.8 ms =# precompile(Tuple{typeof(Base.get), Base.Dict{Char, Any}, Char, Nothing})
#=   11.2 ms =# precompile(Tuple{typeof(Base.Compiler.scan_specified_partitions), Base.Compiler.var"#global_assignment_rt_exct##0#global_assignment_rt_exct##1"{Type{Float64}}, Base.Compiler.var"#scan_partitions##0#scan_partitions##1", Base.Compiler.NativeInterpreter, GlobalRef, Base.Compiler.WorldWithRange})
#=   16.6 ms =# precompile(Tuple{typeof(REPL.Pkg_promptf)})
#=    1.4 ms =# precompile(Tuple{typeof(Base.Unicode.textwidth), String})
(@v1.13) pkg> #=    3.2 ms =# precompile(Tuple{REPL.var"#setup_interface##26#setup_interface##27"{REPL.LineEdit.MIState, REPL.LineEditREPL, REPL.LineEdit.Prompt}})
#=    5.4 ms =# precompile(Tuple{REPL.var"#setup_interface##28#setup_interface##29"{Module, REPL.LineEditREPL, REPL.LineEdit.Prompt}, REPL.LineEdit.MIState})
#=    2.9 ms =# precompile(Tuple{REPL.var"#setup_interface##30#setup_interface##31"{REPL.LineEdit.MIState, REPL.LineEdit.Prompt}})
(@v1.13) pkg> s#=   20.2 ms =# precompile(Tuple{typeof(Core.kwcall), NamedTuple{names, T} where T<:Tuple where names, typeof(REPL.LineEdit.complete_line), REPL.LineEdit.CompletionProvider, Any, Module})
#=    9.5 ms =# precompile(Tuple{typeof(Base.filter), REPLExt.var"#47#48", Array{String, 1}})
(@v1.13) pkg> sta#=   67.9 ms =# precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:color,), Tuple{Symbol}}, typeof(Base.printstyled), REPL.Terminals.TTYTerminal, String})
tus#=    1.6 ms =# precompile(Tuple{typeof(REPL.Terminals.cmove_left), REPL.Terminals.TTYTerminal, Int64})
(@v1.13) pkg> status
#=    6.0 ms =# precompile(Tuple{Base.Returns{Symbol}, Any})
#=    5.7 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Base.GenericIOBuffer{Memory{UInt8}}, Bool, Bool}, Int64})
#=    5.3 ms =# precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Base.GenericIOBuffer{Memory{UInt8}}, Bool, Bool}, Int64, Int64})
#=    4.0 ms =# precompile(Tuple{REPLExt.var"#create_mode##0#create_mode##1"{REPL.LineEditREPL}, REPL.LineEdit.MIState, Base.GenericIOBuffer{Memory{UInt8}}, Bool})
#=    2.7 ms =# precompile(Tuple{typeof(Base.length), Array{Pkg.Types.PackageSpec, 1}})
#=   12.9 ms =# precompile(Tuple{Pkg.API.var"##status#108", Base.IOContext{IO}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Pkg.API.status), Array{Pkg.Types.PackageSpec, 1}})
#=    2.9 ms =# precompile(Tuple{Base.var"#698#699"{Base.Process}})
#=    3.0 ms =# precompile(Tuple{Type{Array{Dates.DateTime, 1}}, UndefInitializer, Tuple{Int64}})
#=    1.5 ms =# precompile(Tuple{Type{Pair{A, B} where B where A}, String, Dates.DateTime})
#=    2.5 ms =# precompile(Tuple{typeof(Base.similar), Array{Any, 1}})
#=    2.2 ms =# precompile(Tuple{typeof(Base.similar), Array{String, 1}})
#=    1.3 ms =# precompile(Tuple{typeof(Base.Iterators.enumerate), Array{String, 1}})
#=    1.7 ms =# precompile(Tuple{typeof(Base.setindex!), Array{String, 1}, String, Int64})
#=    1.9 ms =# precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:io,), Tuple{Base.IOContext{IO}}}, typeof(Pkg.API.status), Pkg.Types.Context, Array{Pkg.Types.PackageSpec, 1}})
#=    1.1 ms =# precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Memory{UInt8}}}, Char})
Status#=    2.1 ms =# precompile(Tuple{typeof(Base.lock), Base.TTY})
 `~/.julia/environments/v1.13/Project.toml`
#=    2.4 ms =# precompile(Tuple{typeof(Base.unlock), Base.TTY})
#=    1.3 ms =# precompile(Tuple{typeof(Base.values), Base.Dict{String, Any}})
#=   10.2 ms =# precompile(Tuple{typeof(Base.Broadcast.broadcasted), Type{Base.UUID}, Base.ValueIterator{Base.Dict{String, Any}}})
#=    9.8 ms =# precompile(Tuple{typeof(Base.Broadcast.materialize), Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, Type{Base.UUID}, Tuple{Array{Any, 1}}}})

IanButterworth avatar Mar 17 '25 14:03 IanButterworth

Looks like it's still broken https://github.com/JuliaGPU/GPUCompiler.jl/pull/676#issuecomment-2729792994

IanButterworth avatar Mar 17 '25 14:03 IanButterworth

Closed by accident?

nsajko avatar May 01 '25 21:05 nsajko

Indeed, looks like a GitHub bug, thanks for undoing it.

serenity4 avatar May 01 '25 21:05 serenity4

Anyone know what the status is here?

KristofferC avatar Jul 03 '25 19:07 KristofferC

I was waiting for #58346, but now that it's done I'll get back to fixing SnoopCompile after the holiday weekend. I had almost everything ready to go but tests were failing (the fix for #58346 should fix that), so I don't think it will take very long.

timholy avatar Jul 03 '25 22:07 timholy

If this is on the SnoopCompile side now I'll remove the milestone from here

KristofferC avatar Jul 04 '25 08:07 KristofferC

There's a chance there will be some additional Julia changes...the two have typically gone hand-in-hand. I'll try to get to this soon so there's no issue with the 1.12 release.

timholy avatar Jul 04 '25 14:07 timholy

xref https://github.com/JuliaLang/julia/pull/58124 (which is on the 1.12 milestone)

timholy avatar Jul 29 '25 08:07 timholy