-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Add ccalls to enable dumping LLVM_OPT time per method instance. #37136
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
Add ccalls to enable dumping LLVM_OPT time per method instance. #37136
Conversation
7dd40b8
to
d51dd2d
Compare
164f712
to
3b70a4a
Compare
(I've opened this branch which just applies these same changes back to julia 1.5, so we can test our codebase which currently doesn't support 1.6 because of some of our package dependencies): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, @vtjnash! Sorry for my delay in responding.
As a short-term bandaid, -O1
on julia 1.5 made a big improvement, so we stopped looking at this. But now that we're working through the inference timings, we'd like to go back to -O2
, so we'll pick up this investigation again soon.
I'm sorry I let this languish for a bit, but do you think we'll be able to get this merged into 1.6? It would be really great to have this there so that our engineers don't need a custom build of julia to debug compilation times.
And, similarly, I'm going to try to wrap up the per-method-instance inference timings PR as well: #37749. Ideally we'll be able to merge both of these this week so that they can make it into the v1.6 release! 😊 Does that seem possible to you? Sorry to be coming in so last-minute! ❤️ thanks for your help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch looks great! Thanks @NHDaly! :)
It looks like one comment from Jameson remains outstanding (rewriting a conditional in terms of isDeclaration
and startsWith
), which I noted applies to similar code later in the patch as well. (Perhaps the duplicated code snippet should be factored into a little helper function? (It's sufficiently little duplication that I don't mind either way.) Otherwise this patch looks ready to go! :)
471adb7
to
b01bb5e
Compare
Thanks @Sacha0! Addressed comments, rebased on top of master, and pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks @NHDaly! :)
PR needs squashing. |
Adds these functions to toggle the output: - ccall(:jl_dump_emitted_mi_name, Nothing, (Ptr{Nothing},), e_io.handle) - ccall(:jl_dump_llvm_opt, Nothing, (Ptr{Nothing},), l_io.handle) This will then be controlled from SnoopCompileCore, via timholy/SnoopCompile.jl#135. This logs a CSV file with mappings from C function name to Julia MethodInstance name, and a YAML file with timings statistics about the LLVM module being optimized, including: - Total time to optimize the llvm module - The `optlevel` used for the llvm module - The name of each function in the module, before and after - Number of instructions for each function, before and after - Number of basic blocks for each function, before and after Co-Authored-By: Sacha Verweij <[email protected]> Co-Authored-By: Valentin Churavy <[email protected]>
b01bb5e
to
1178f57
Compare
Done. Thanks! :) |
Adds these functions to toggle the output:
ccall(:jl_dump_emitted_mi_name, Nothing, (Ptr{Nothing},), e_io.handle)
ccall(:jl_dump_llvm_opt, Nothing, (Ptr{Nothing},), l_io.handle)
This will then be controlled from
SnoopCompileCore
, via timholy/SnoopCompile.jl#135.This logs a CSV file with mappings from C function name to Julia
MethodInstance name, and a YAML file with timings statistics about the
LLVM module being optimized, including:
optlevel
used for the llvm moduleCo-Authored-By: @Sacha0 @vchuravy
Fixes #31616