-
Notifications
You must be signed in to change notification settings - Fork 515
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
Document the usage of cargo-llvm-lines and -Ztimings. #905
Conversation
57cfb7b
to
63f0782
Compare
src/profiling.md
Outdated
``` | ||
|
||
What I'm still not sure about is if inlining in MIR optimizations affect llvm-lines. | ||
The output with `-Zmir-opt-level=0` and `-Zmir-opt-level=1` is the same, |
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.
Did you try -Zmir-opt-level=2
? This might also be related to optimize=false
.
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.
Tried it now and the difference is -0.2GB, but it doesn't seem to inline anything. This discussion says MIR inlining doesn't work yet.
src/profiling.md
Outdated
# A debug build takes _a fourth_ as long on my machine, | ||
# but compiling more than stage0 rustc becomes unbearably slow. | ||
optimize = false |
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.
Nice trick. Does this affect llvm-lines at all? Maybe it's a good thing if it does since it reflects how much LLVM IR is getting sent in the first place, not how small LLVM can make it with optimizations.
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.
Apparently yes.
I did some more experimenting and the interactions between the different flags are more complicated than I thought. I'll rewrite the last paragraph.
Lines Copies Function name | ||
----- ------ ------------- | ||
11802479 (100%) 52848 (100%) (TOTAL) | ||
1663902 (14.1%) 400 (0.8%) rustc_query_system::query::plumbing::get_query_impl::{{closure}} |
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 seems like another good place to use dyn
or just separate out most of the function. That's a lot of LLVM lines for only 400 instantiations.
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.
Probably. I haven't had much time yet to look into it, but it's tricky because the relevant traits aren't dyn safe.
That PR was merged! |
optimize, codegen-units and mir-opt do, but debug-assertions doesn't.
Error: The feature Please let |
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 looks great. Thank you so much for working on this!
Here I document what I learned while making rust-lang/rust#76680:
CARGOFLAGS="-Ztimings" ./x.py whatever
to get a nice timing chart.This is blocked on dtolnay/cargo-llvm-lines#32.