FlameGraph ProfileView not showing matrix operations

Hi, I am using FlameGraphs.jl and ProfileView.jl to profile my code with matrix operations. I am fairly new to these profiling tools.

On MacOS M1 the matrix operations are not showing up in the flame graph. Here is a MWE:

using Profile, ProfileView, FlameGraphs

function do_blas_work(N, n1, n2)
    A = rand(n1, n2)
    b = rand(n2)
    c = rand(n1)
    for _ in 1:N
        x = A * b .+ c

@profview do_blas_work(10, 10_000, 7000)  # compile
@profview do_blas_work(10, 10_000, 7000)  # compile again

@profview do_blas_work(100, 10_000, 7000)

The result shows only the time spent on drawing the random samples:

How can I show the matrix operations as well?

julia> versioninfo()
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Max
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 8 virtual cores

julia> using LinearAlgebra; BLAS.get_config()
└ [ILP64] libopenblas64_.dylib

This is a known upstream (libunwind) bug.

1 Like

Thanks for the answer, I think for the purposes of this forum, the reference to the bug is the “solution”.

However, the only bug I could find is this closed one: Profiling on MacOS suffering a lot of detached samples · Issue #38350 · JuliaLang/julia · GitHub. The summary is that it is fixed for x86, but maybe not for M1, and there is no bug for the M1 version of the bug?