Skip to content
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

Misattributed profile information #31921

Closed
vchuravy opened this issue May 3, 2019 · 2 comments · Fixed by #32712
Closed

Misattributed profile information #31921

vchuravy opened this issue May 3, 2019 · 2 comments · Fixed by #32712
Labels
upstream The issue is with an upstream dependency, e.g. LLVM

Comments

@vchuravy
Copy link
Member

vchuravy commented May 3, 2019

Reproducer:

using Base.Cartesian
using Profile

data = zeros(10_000, 10_000);

@generated function ohmy(data, op::Op, ::Val{N}) where {Op, N}
  return quote
    Base.@_propagate_inbounds_meta
      @nloops $N i n -> 1:size(data, n) begin
         I = CartesianIndex(@ntuple $N i)
         data[I] = op(data[I])
       end
    end
end

N=1000; @profile for i in 1:N; ohmy(data, +, Val(2)) end

Produces something like:

julia> Profile.print()
27160 ./task.jl:268; (::getfield(REPL, Symbol("##26#27")){REPL.REPLBackend})()
 27160 ...churavy/builds/julia/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:118; macro expansion
  27160 ...churavy/builds/julia/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:86; eval_user_input(::Any, ::REPL.REPLBackend)
   27160 ./boot.jl:330; eval(::Module, ::Any)
    27160 ...y/builds/julia/usr/share/julia/stdlib/v1.3/Profile/src/Profile.jl:25; top-level scope
     27159 ./REPL[25]:1; macro expansion
      2553  ./REPL[4]:2; ohmy(::Array{Float64,2}, ::typeof(+), ::Val{2})
       2553 ./REPL[4]:4; macro expansion
        26   ./array.jl:729; macro expansion
        2348 ./cartesian.jl:64; macro expansion
         2348 ./REPL[4]:6; macro expansion
          2348 ./multidimensional.jl:486; getindex
           2348 ./array.jl:729; getindex
        177  ./cartesian.jl:65; macro expansion
         1   ./range.jl:595; iterate
          1 ./promotion.jl:403; ==
         176 ./range.jl:596; iterate
          176 ./int.jl:53; +
        2    ./int.jl:53; macro expansion
      3159  ./array.jl:0; ohmy(::Array{Float64,2}, ::typeof(+), ::Val{2})
      21428 ./cartesian.jl:65; ohmy(::Array{Float64,2}, ::typeof(+), ::Val{2})

The last line is attributed ./cartesian.jl instead of [REPL]. So the nesting of the information got broken and so the ticks are missattributed.

cc: @peterahrens

@vtjnash
Copy link
Member

vtjnash commented May 3, 2019

Do you know if the DWARF info (@code_native) is correct? I’ve seen LLVM 6 do some crazy things. For instance, look at how many files setup_stdio and link_pipe gets splatted across in: code_native(Base.setup_stdio, (Base.PipeEndpoint, Bool)). It looks like my LLVM 7 build is better on it.

@vchuravy
Copy link
Member Author

vchuravy commented May 3, 2019

I see what your saying. I checked @code_typed, but yeah @code_llvm looks okay, but @code_native looks wrong.

@vtjnash vtjnash added the upstream The issue is with an upstream dependency, e.g. LLVM label Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream The issue is with an upstream dependency, e.g. LLVM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants