Skip to content

Profile on M1 mac fails with Bounds error #202

@gbaraldi

Description

@gbaraldi

Testing latest master on an m1 mac gives an error while using ProfileView, while normal profiling works fine.

Profile:

@profile plot(sin)
Profile.print()
Overhead ╎ [+additional indent] Count File:Line; Function
=========================================================
  ╎2  @Base/client.jl:518; _start()
  ╎ 2  @Base/client.jl:318; exec_options(opts::Base.JLOptions)
  ╎  2  @Base/client.jl:404; run_main_repl(interactive::Bool,...2  @Base/essentials.jl:794; invokelatest
  ╎    2  @Base/essentials.jl:796; #invokelatest#22  @Base/client.jl:419; (::Base.var"#961#963"{Bool, Bo...
  ╎    ╎ 2  @REPL/src/REPL.jl:355; run_repl(repl::REPL.AbstractRE...
  ╎    ╎  2  @REPL/src/REPL.jl:368; run_repl(repl::REPL.AbstractR...
  ╎    ╎   2  @REPL/src/REPL.jl:231; start_repl_backend(backend::...
  ╎    ╎    2  @REPL/src/REPL.jl:246; repl_backend_loop(backend::R...
  ╎    ╎     2  @REPL/src/REPL.jl:151; eval_user_input(ast::Any, b...
  ╎    ╎    ╎ 2  @Base/boot.jl:370; eval
  ╎    ╎    ╎  2  @Plots/src/plot.jl:85; plot(args::Any)
  ╎    ╎    ╎   2  @Plots/src/plot.jl:91; plot(args::Any; kw::Base.P...
  ╎    ╎    ╎    2  @Plots/src/plot.jl:208; _plot!(plt::Plots.Plot, p...
  ╎    ╎    ╎     2  ...ipesPipeline.jl:70; recipe_pipeline!(plt::Any...
  ╎    ╎    ╎    ╎ 2  .../user_recipe.jl:36; _process_userrecipes!(pl...
  ╎    ╎    ╎    ╎  2  ...RecipesBase.jl:289; apply_recipe(plotattrib...
  ╎    ╎    ╎    ╎   1  ...user_recipe.jl:253; macro expansion
  ╎    ╎    ╎    ╎    1  .../broadcast.jl:860; materialize
  ╎    ╎    ╎    ╎     1  .../broadcast.jl:882; copy
 1╎    ╎    ╎    ╎    ╎ 1  .../broadcast.jl:717; combine_eltypes(f::Fu...
  ╎    ╎    ╎    ╎   1  ...user_recipe.jl:293; macro expansion
  ╎    ╎    ╎    ╎    1  ...ser_recipe.jl:353; _scaled_adapted_grid(f...
  ╎    ╎    ╎    ╎     1  ...apted_grid.jl:21; adapted_grid(f::Any, m...
 1╎    ╎    ╎    ╎    ╎ 1  ...apted_grid.jl:75; adapted_grid(f::Any, ...
Total snapshots: 20. Utilization: 25% across all threads and tasks. Use the `groupby` kwarg to break down by thread and/or task

ProfileView:

@profview plot(sin)
Gtk.GtkWindowLeaf(name="", parent, width-request=-1, height-request=-1, visible=TRUE, sensitive=TRUE, app-paintable=FALSE, can-focus=FALSE, has-focus=FALSE, is-focus=FALSE, focus-on-click=TRUE, can-default=FALSE, has-default=FALSE, receives-default=FALSE, composite-child=FALSE, style, events=0, no-show-all=FALSE, has-tooltip=FALSE, tooltip-markup=NULL, tooltip-text=NULL, window, opacity=1.000000, double-buffered, halign=GTK_ALIGN_FILL, valign=GTK_ALIGN_FILL, margin-left, margin-right, margin-start=0, margin-end=0, margin-top=0, margin-bottom=0, margin=0, hexpand=FALSE, vexpand=FALSE, hexpand-set=FALSE, vexpand-set=FALSE, expand=FALSE, scale-factor=2, border-width=0, resize-mode, child, type=GTK_WINDOW_TOPLEVEL, title="Profile", role=NULL, resizable=TRUE, modal=FALSE, window-position=GTK_WIN_POS_NONE, default-width=800, default-height=600, destroy-with-parent=FALSE, hide-titlebar-when-maximized=FALSE, icon, icon-name=NULL, screen, type-hint=GDK_WINDOW_TYPE_HINT_NORMAL, skip-taskbar-hint=FALSE, skip-pager-hint=FALSE, urgency-hint=FALSE, accept-focus=TRUE, focus-on-map=TRUE, decorated=TRUE, deletable=TRUE, gravity=GDK_GRAVITY_NORTH_WEST, transient-for, attached-to, has-resize-grip, resize-grip-visible, application, is-active=FALSE, has-toplevel-focus=FALSE, startup-id, mnemonics-visible=FALSE, focus-visible=FALSE, is-maximized=FALSE)

julia> FATAL ERROR: Gtk state corrupted by error thrown in a callback:
ERROR: BoundsError: attempt to access 12×0 Matrix{Int64} at index [12, 0]
Stacktrace:
  [1] throw_boundserror(A::Matrix{Int64}, I::Tuple{Int64, Int64})
    @ Base ./abstractarray.jl:703
  [2] checkbounds
    @ ./abstractarray.jl:668 [inlined]
  [3] getindex
    @ ~/.julia/packages/IndirectArrays/BUQO3/src/IndirectArrays.jl:69 [inlined]
  [4] (::ProfileView.var"#gettag#31")(tagimg::IndirectArrays.IndirectArray{Base.StackTraces.StackFrame, 2, Int64, Matrix{Int64}, Vector{Base.StackTraces.StackFrame}}, xu::GtkObservables.UserUnit, yu::GtkObservables.UserUnit)
    @ ProfileView ~/.julia/packages/ProfileView/6ayqy/src/ProfileView.jl:319
  [5] (::ProfileView.var"#29#34"{FlameGraphs.FlameColors, GtkObservables.Canvas{GtkObservables.UserUnit}, Int64, Cairo.CairoSurfaceImage{RGB24}, Observables.Observable{GtkObservables.ZoomRegion{Float64}}, ProfileView.var"#device_bb#32"{Symbol}, ProfileView.var"#gettag#31", Gtk.GtkEntryLeaf, Base.RefValue{Graphics.BoundingBox}, IndirectArrays.IndirectArray{Base.StackTraces.StackFrame, 2, Int64, Matrix{Int64}, Vector{Base.StackTraces.StackFrame}}})(btn::GtkObservables.MouseButton{GtkObservables.UserUnit})
    @ ProfileView ~/.julia/packages/ProfileView/6ayqy/src/ProfileView.jl:373
  [6] #invokelatest#2
    @ ./essentials.jl:796 [inlined]
  [7] invokelatest
    @ ./essentials.jl:794 [inlined]
  [8] notify
    @ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:88 [inlined]
  [9] setindex!
    @ ~/.julia/packages/Observables/OFj0u/src/Observables.jl:248 [inlined]
 [10] mousemove_cb(ptr::Ptr{Gtk.GLib.GObject}, eventp::Ptr{Gtk.GdkEventMotion}, handler::GtkObservables.MouseHandler{GtkObservables.UserUnit})
    @ GtkObservables ~/.julia/packages/GtkObservables/oJrqY/src/graphics_interaction.jl:665
 [11] notify_motion(p::Ptr{Gtk.GLib.GObject}, eventp::Ptr{Gtk.GdkEventMotion}, closure::Gtk.Gtk_signal_motion{GtkObservables.MouseHandler{GtkObservables.UserUnit}})
    @ Gtk ~/.julia/packages/Gtk/B6LVT/src/events.jl:46
 [12] (::Gtk.var"#253#254")()
    @ Gtk ~/.julia/packages/Gtk/B6LVT/src/events.jl:2
 [13] g_sigatom(f::Any)
    @ Gtk.GLib ~/.julia/packages/Gtk/B6LVT/src/GLib/signals.jl:176
 [14] gtk_main()
    @ Gtk ~/.julia/packages/Gtk/B6LVT/src/events.jl:1

ProfileView version: 1.5.0

versioninfo()
Julia Version 1.9.0-DEV.406
Commit 6f8662b2c2 (2022-04-18 15:08 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 4 on 4 virtual cores
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 4
  JULIA_NUM_THREADS = 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions