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

Type inference profiling #16

Merged
merged 9 commits into from
Jan 5, 2023
Merged

Type inference profiling #16

merged 9 commits into from
Jan 5, 2023

Conversation

vilterp
Copy link
Collaborator

@vilterp vilterp commented Dec 23, 2022

TODO:

  • make it work with new API that returns an array instead of a single tree
  • figure out why the profiles I'm getting in test are empty
  • add tests

src/ProfileEndpoints.jl Outdated Show resolved Hide resolved
@vilterp vilterp requested a review from NHDaly December 23, 2022 03:03
@vilterp
Copy link
Collaborator Author

vilterp commented Dec 23, 2022

Error in CI:

│    InexactError: trunc(Int64, 1.8446663302938247e19)
│    Stacktrace:
│      [1] trunc
│        @ ./float.jl:781 [inlined]
│      [2] round
│        @ ./float.jl:359 [inlined]
│      [3] _flamegraph_frame(io::IOBuffer, node::SnoopCompileCore.InferenceTimingNode, start_secs::Float64, check_precompilable::Bool, excluded_modules::Set{Module}, mode::Nothing; toplevel::Bool)
│        @ SnoopCompile ~/.julia/packages/SnoopCompile/Q8zUg/src/parcel_snoopi_deep.jl:1863
│      [4] flamegraph(tinf::SnoopCompileCore.InferenceTimingNode; tmin::Float64, excluded_modules::Set{Module}, mode::Nothing)
│        @ SnoopCompile ~/.julia/packages/SnoopCompile/Q8zUg/src/parcel_snoopi_deep.jl:1792
│      [5] flamegraph
│        @ ~/.julia/packages/SnoopCompile/Q8zUg/src/parcel_snoopi_deep.jl:1788 [inlined]
│      [6] typeinf_stop_endpoint(req::HTTP.Messages.Request)
│        @ ProfileEndpoints ~/work/ProfileEndpoints.jl/ProfileEndpoints.jl/src/ProfileEndpoints.jl:265

In some Julia versions but not others? Wut? 🤔

src/ProfileEndpoints.jl Outdated Show resolved Hide resolved
src/ProfileEndpoints.jl Outdated Show resolved Hide resolved
Project.toml Show resolved Hide resolved
Comment on lines 313 to 315

precompile(typeinf_start_endpoint, (HTTP.Request,)) || error("precompilation of package functions is not supposed to fail")
precompile(typeinf_stop_endpoint, (HTTP.Request,)) || error("precompilation of package functions is not supposed to fail")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't know why we did all of these this way, but it seems a bit silly now...

Can we maybe switch them all to @assert precompile(...) instead of precompile(...) || error(...)? It's shorter, easier to read, and easier to copy/paste. If you don't want to do that change in this PR tho, we can do it later 👍

test/runtests.jl Outdated Show resolved Hide resolved
Copy link
Member

@NHDaly NHDaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vilterp: This is such a good idea! I'm really glad you thought of this - we should have started with this from the beginning! 💡

It'll make it so much easier to grab profiles, and it'll let us farm out the work to anyone interested, and it can unblock the work we did so that at least we have something enabled. Great idea. :)

I'd love to also do it for LLVM opt profiling - maybe we can do that in a followup once this one is merged. Thanks again, great idea 😊

@NHDaly
Copy link
Member

NHDaly commented Dec 31, 2022

Huh yeah i'm not sure how to explain the CI failure.. :/ it should go away if we move the flamegraph conversion out of this package and then we can maybe restrict our client code to a working version of the SnoopCompile package if that's the problem

@NHDaly
Copy link
Member

NHDaly commented Jan 5, 2023

Ah okay actually, i think the test failure was because you weren't finishing the cleanup on the ROOT timing node in your version. It's fixed now, because we switched to just calling the functions directly from SnoopCompile. I think this is good to go then!

Copy link
Member

@NHDaly NHDaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vilterp! LGTM

@NHDaly NHDaly marked this pull request as ready for review January 5, 2023 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants