Skip to content

Profile: make @Compiler test robust #58002

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

Merged

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Apr 3, 2025

Fixes https://buildkite.com/julialang/julia-master/builds/46446#0195f712-1844-4e81-8b16-27b953fedcd3/899-1778

  | Error in testset Profile:
  | Test Failed at /cache/build/tester-amdci5-10/julialang/julia-master/julia-7c9af464cc/share/julia/stdlib/v1.13/Profile/test/runtests.jl:231
  | Expression: occursin("@Compiler" * slash, str)
  | Evaluated: occursin("@Compiler/", "Overhead ╎ [+additional indent] Count File:Line  Function\n=========================================================\n   ╎9   @juliasrc/task.c:1249  start_task\n   ╎ 9   @juliasrc/julia.h:2353  jl_apply\n   ╎  9   @juliasrc/gf.c:3693  ijl_apply_generic\n   ╎   9   @juliasrc/gf.c:3493  _jl_invoke\n   ╎    9   [unknown stackframe]\n   ╎     9   @Distributed/src/process_messages.jl:287  (::Distributed.var\"#handle_msg##2#handle_msg##3\"{Distributed.CallMsg{:call_fetch}, Distributed.MsgHeader, Sockets.TCPSocket})()\n   ╎    ╎ 9   @Distributed/src/process_messages.jl:70  run_work_thunk(thunk::Distributed.var\"#handle_msg##4#handle_msg##5\"{Distributed.CallMsg{:call_fetch}}, print_error::Bool)\n   ╎    ╎  9   @Distributed/src/process_messages.jl:287  (::Distributed.var\"#handle_msg##4#handle_msg##5\"{Distributed.CallMsg{:call_fetch}})()\n   ╎    ╎   9   @juliasrc/builtins.c:841  jl_f__apply_iterate\n   ╎    ╎    9   @juliasrc/julia.h:2353  jl_apply\n   ╎    ╎     9   @juliasrc/gf.c:3693  ijl_apply_generic\n   ╎    ╎    ╎ 9   @juliasrc/gf.c:3493  _jl_invoke\n   ╎    ╎    ╎  9   @Base/Base_compiler.jl:223  kwcall(::@NamedTuple{seed::UInt128}, ::typeof(invokelatest), ::Function, ::String, ::Vararg{String})\n   ╎    ╎    ╎   9   @juliasrc/builtins.c:841  jl_f__apply_iterate\n   ╎    ╎    ╎    9   @juliasrc/julia.h:2353  jl_apply\n   ╎    ╎    ╎     9   @juliasrc/gf.c:3693  ijl_apply_generic\n   ╎    ╎    ╎    ╎ 9   @juliasrc/gf.c:3493  _jl_invoke\n   ╎    ╎    ╎    ╎  9   @juliasrc/builtins.c:853  jl_f_invokelatest\n   ╎    ╎    ╎    ╎   9   @juliasrc/julia.h:2353  jl_apply\n   ╎    ╎    ╎    ╎    9   @juliasrc/gf.c:3693  ijl_apply_generic\n   ╎    ╎    ╎    ╎     9   @juliasrc/gf.c:3493  _jl_invoke\n   ╎    ╎    ╎    ╎    ╎ 9   [unknown stackframe]\n   ╎    ╎    ╎    ╎    ╎  9   /cache/build/tester-amdci5-10/julialang/julia-master/julia-7c9af464cc/share/julia/test/testdefs.jl:7  kwcall(::@NamedTuple{seed::UInt128}, ::typeof(runtests), name::String, path::String)\n   ╎    ╎    ╎    ╎    ╎   9   /cache/build/tester-amdci5-10/julialang/julia-master/julia-7c9af464cc/share/julia/test/testdefs.jl:7  runtests\n   ╎    ╎    ╎    ╎    ╎    9   /cache/build/tester-amdci5-10/julialang/julia-master/julia-7c9af464cc/share/julia/test/testdefs.jl:13  runtests(name::String, path::String, isolate::Bool; seed::UInt128)\n   ╎    ╎    ╎    ╎    ╎     9   @Base/env.jl:265  withenv(f::var\"#4#5\"{UInt128, String, String, Bool, Bool}, keyvals::Pair{String, Bool})\n   ╎    ╎    ╎    ╎    ╎    ╎ 9   /cache/build/tester-amdci5-10/julialang/julia-master/julia-7c9af464cc/share/julia/test/testdefs.jl:27  (::var\"#4#5\"{UInt128, String, String, Bool, Bool})()\n   ╎    ╎    ╎    ╎    ╎    ╎  9   @Base/timing.jl:621  macro expansion\n   ╎    ╎    ╎    ╎    ╎    ╎   9   /cache/build/tester-amdci5-10/julialang/julia-master/julia-7c9af464cc/share/julia/test/testdefs.jl:29  macro expansion\n   ╎    ╎    ╎    ╎    ╎    ╎    9   @Test/src/Test.jl:1835  macro expansion\n   ╎    ╎    ╎    ╎    ╎    ╎     9   /cache/build/tester-amdci5-10/julialang/julia-master/julia-7c9af464cc/share/julia/test/testdefs.jl:37  macro expansion\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎ 9   @Base/Base.jl:303  include(mod::Module, _path::String)\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎  9   @Base/loading.jl:2925  _include(mapexpr::Function, mod::Module, _path::String)\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎   9   @juliasrc/gf.c:3693  ijl_apply_generic\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    9   @juliasrc/gf.c:3493  _jl_invoke\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎     9   @Base/loading.jl:2865  include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ 9   @Base/boot.jl:489  eval(m::Module, e::Any)\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎  9   @juliasrc/toplevel.c:1095  ijl_toplevel_eval_in\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎   9   @juliasrc/toplevel.c:1050  ijl_toplevel_eval\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    9   @juliasrc/toplevel.c:978  jl_toplevel_eval_flex\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎     9   @juliasrc/toplevel.c:1038  jl_toplevel_eval_flex\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ 9   @juliasrc/interpreter.c:897  jl_interpret_toplevel_thunk\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎  9   @juliasrc/interpreter.c:557  eval_body\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎   9   @juliasrc/interpreter.c:557  eval_body\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    9   @juliasrc/interpreter.c:557  eval_body\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎     9   @juliasrc/interpreter.c:692  eval_body\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎ 9   @juliasrc/interpreter.c:193  eval_stmt_value\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎  9   @juliasrc/interpreter.c:242  eval_value\n   ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎    ╎   9   @juliasrc/interpreter.c:124  do_call\n   ╎    ╎    ╎    ╎
...

@nsajko nsajko added test This change adds or pertains to unit tests ci Continuous integration profiler labels Apr 4, 2025
@IanButterworth
Copy link
Member Author

Just to illustrate, this is the trace for that function

julia> Profile.print()
Overhead ╎ [+additional indent] Count File:Line  Function
=========================================================
   ╎739  @Base/client.jl:571  _start()
   ╎ 739  @Base/client.jl:596  repl_main
   ╎  739  @Base/client.jl:509  run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_file::Bool)
   ╎   739  @Base/client.jl:488  run_std_repl(REPL::Module, quiet::Bool, banner::Symbol, history_file::Bool)
   ╎    739  @REPL/src/REPL.jl:637  run_repl(repl::REPL.AbstractREPL, consumer::Any)
   ╎     739  @REPL/src/REPL.jl:651  run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
   ╎    ╎ 739  @REPL/src/REPL.jl:424  start_repl_backend
   ╎    ╎  739  @REPL/src/REPL.jl:427  start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
   ╎    ╎   739  @REPL/src/REPL.jl:452  repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
   ╎    ╎    739  @REPL/src/REPL.jl:330  eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
   ╎    ╎     739  @REPL/src/REPL.jl:305  toplevel_eval_with_hooks
   ╎    ╎    ╎ 739  @REPL/src/REPL.jl:312  toplevel_eval_with_hooks(mod::Module, ast::Any, toplevel_file::Any, toplevel_line::Any)
   ╎    ╎    ╎  739  @REPL/src/REPL.jl:308  toplevel_eval_with_hooks(mod::Module, ast::Any, toplevel_file::Any, toplevel_line::Any)
  3╎    ╎    ╎   739  @REPL/src/REPL.jl:301  __repl_entry_eval_expanded_with_loc(mod::Module, ast::Any, toplevel_file::Ref{Ptr{UInt8}}, toplevel_line::Ref{Int32})
   ╎    ╎    ╎    736  @Compiler/src/typeinfer.jl:1319  typeinf_ext_toplevel(mi::Core.MethodInstance, world::UInt64, source_mode::UInt8)
   ╎    ╎    ╎     736  @Compiler/src/typeinfer.jl:1311  typeinf_ext_toplevel
   ╎    ╎    ╎    ╎ 736  @Compiler/src/typeinfer.jl:1213  typeinf_ext(interp::Compiler.NativeInterpreter, mi::Core.MethodInstance, source_mode::UInt8)
   ╎    ╎    ╎    ╎  736  @Compiler/src/inferencestate.jl:605  InferenceState
   ╎    ╎    ╎    ╎   736  @Compiler/src/inferencestate.jl:600  InferenceState
   ╎    ╎    ╎    ╎    736  @Compiler/src/utilities.jl:121  retrieve_code_info(mi::Core.MethodInstance, world::UInt64)
   ╎    ╎    ╎    ╎     736  @Compiler/src/utilities.jl:88  get_staged(mi::Core.MethodInstance, world::UInt64)
   ╎    ╎    ╎    ╎    ╎ 736  @Compiler/src/utilities.jl:103  call_get_staged
  3╎    ╎    ╎    ╎    ╎  736  @Base/expr.jl:1689  (::Core.GeneratedFunctionStub)(::UInt64, ::Method, ::Any, ::Vararg{Any})
   ╎    ╎    ╎    ╎    ╎   1    @Compiler/src/typeinfer.jl:1319  typeinf_ext_toplevel(mi::Core.MethodInstance, world::UInt64, source_mode::UInt8)
   ╎    ╎    ╎    ╎    ╎    1    @Compiler/src/typeinfer.jl:1312  typeinf_ext_toplevel
   ╎    ╎    ╎    ╎    ╎     1    @Compiler/src/typeinfer.jl:1305  add_codeinsts_to_jit!(interp::Compiler.NativeInterpreter, ci::Core.CodeInstance, source_mode::UInt8)
   ╎    ╎    ╎    ╎    ╎   732  none:0  var"#s2#1"(::Any, x::Any)
   ╎    ╎    ╎    ╎    ╎    732  REPL[3]:3  #s2#1
730╎    ╎    ╎    ╎    ╎     730  @Base/Base_compiler.jl:167  time_ns
   ╎    ╎    ╎    ╎    ╎     1    @Base/float.jl:666  <
  1╎    ╎    ╎    ╎    ╎    ╎ 1    @Base/float.jl:251  Float64
   ╎    ╎    ╎    ╎    ╎     1    @Base/float.jl:667  <
  1╎    ╎    ╎    ╎    ╎    ╎ 1    @Base/float.jl:621  ==
Total snapshots: 1502. Utilization: 50% across all threads and tasks. Use the `groupby` kwarg to break down by thread and/or task.

@IanButterworth IanButterworth merged commit 2634a66 into JuliaLang:master Apr 4, 2025
11 checks passed
@IanButterworth IanButterworth deleted the ib/profile_comp_fix branch April 4, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration profiler test This change adds or pertains to unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants