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 "Rust codegen" as a new compilation section #1864
base: master
Are you sure you want to change the base?
Conversation
frontend_end = event.payload.timestamp().map(|t| t.end()); | ||
if event.label == "collect_and_partition_mono_items" { | ||
// We mark this query as "Rust codegen", where monomorphization and MIR-to-backend | ||
// conversion happens. |
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.
collect_and_partition_mono_items happens before the translation from MIR to llvm ir. It is the step which determines which instances to actually codegen and into which codegen unit. I believe it also implicitly loads the MIR for 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.
Aah, you're right, thanks. The MIR-to-IR translation happens in codegen_module
, right? That explains the staircase shape:
Hmm, then this becomes quite tricky, as the MIR-to-IR computation is overlaid with LLVM, and we can no longer render it as a separate part.
I still think that the mono collector is a reasonably self-contained part and it could be useful to visualize it (with a more accurate description, of course). What do you 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.
The MIR-to-IR translation happens in codegen_module, right?
Yes
Hmm, then this becomes quite tricky, as the MIR-to-IR computation is overlaid with LLVM, and we can no longer render it as a separate part.
If you make the graph represent cpu-clock (time spent on each individual thread added together) rather than task-clock or wall-time you can add all codegen_module
queries together to form "Rust codegen" time and all codegen_module_optimize
queries to form "backend" time.
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.
cpu-clock
is not supported by self-profile
, and also if we added time of multiple threads together, it would no longer make sense to show this in the same chart as a fraction of the whole compilation time (it could be another chart, but that's probably overkill).
Inspired by discussions about my recent blog post, I thought that it would be nice if we split the "Backend" section into the actual backend (e.g. LLVM) and the Rust part that monomorphizes stuff and generates LLVM IR from MIR. This PR does that:
Based on #1858.