-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix recent CI compile time perf regression #22912
Conversation
Avoid doing some redundant work/copying. Cleanup formatting.
My misrememberance of how the C++ STL works caused us to insert way too many stores here. This fixes the recent compile time performance regressions observed on CI.
@@ -191,6 +193,7 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp) | |||
{ "check-bounds", required_argument, 0, opt_check_bounds }, | |||
{ "output-bc", required_argument, 0, opt_output_bc }, | |||
{ "output-unopt-bc", required_argument, 0, opt_output_unopt_bc }, | |||
{ "output-jit-bc", required_argument, 0, opt_output_jit_bc }, |
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.
// NOTE: This set of required arguments need to be kept in sync
// with the required arguments defined in base/client.jl `process_options()`
and the man page and command-line flags docs
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.
Since this and the --output-unopt-bc
are for developer debugging purposes only, I think I'll remove it from the help text and document it in the devdocs.
@@ -947,7 +947,7 @@ void* jl_get_globalvar(GlobalVariable *gv) | |||
void jl_add_to_shadow(Module *m) | |||
{ | |||
#ifndef KEEP_BODIES | |||
if (!imaging_mode) | |||
if (!imaging_mode && !jl_options.outputjitbc) |
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.
Do/can we also have this as an option to code llvm?
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.
Not sure what you're asking for
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.
an code_llvm option that does not run optimization passes on it?
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.
Ah, we do have that, but you need to call _dump_function directly I think.
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.
Ah, I thought I saw it being added but couldn't find it in code_llvm
.
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.
Read the devdocs ;) - It's actually documented in the llvm ones.
This option is useful for tracing all the llvm IR generating during JITting and running it through opt, e.g. to track down compile time performance regressions.
ce4912b
to
2d6a589
Compare
Great, the sparse/cholmod test is back under a minute like it should be. |
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.
lgtm
# This runs early in the sysimage != is not defined yet | ||
if sizeof(JLOptions) === ccall(:jl_sizeof_jl_options, Int, ()) | ||
else | ||
ccall(:jl_throw, Void, (Any,), "Option structure mismatch") |
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.
throw
is a builtin function. you could ccall jl_error
here to get the right Exception type, or just call throw
Ready to merge? |
Yes, I'll do the cleanup suggested by Jameson in a separate PR to avoid holding up this fix. |
The second commit here fixes the actual regression. The first addresses some of the low hanging fruits that were suggested on the review of the original PR. The third adds a helpful command line option to dump the IR that the frontend generated while running some code. Together with
opt -time-passes
that's very useful for tracking down perf problems.