-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
self-profiling: Add events for everything except trait selection. #65208
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,10 +134,15 @@ pub fn partition<'tcx, I>( | |
where | ||
I: Iterator<Item = MonoItem<'tcx>>, | ||
{ | ||
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning"); | ||
|
||
// In the first step, we place all regular monomorphizations into their | ||
// respective 'home' codegen unit. Regular monomorphizations are all | ||
// functions and statics defined in the local crate. | ||
let mut initial_partitioning = place_root_mono_items(tcx, mono_items); | ||
let mut initial_partitioning = { | ||
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_place_roots"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
place_root_mono_items(tcx, mono_items) | ||
}; | ||
|
||
initial_partitioning.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(tcx)); | ||
|
||
|
@@ -146,17 +151,20 @@ where | |
// If the partitioning should produce a fixed count of codegen units, merge | ||
// until that count is reached. | ||
if let PartitioningStrategy::FixedUnitCount(count) = strategy { | ||
let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_merge_cgus"); | ||
merge_codegen_units(tcx, &mut initial_partitioning, count); | ||
|
||
debug_dump(tcx, "POST MERGING:", initial_partitioning.codegen_units.iter()); | ||
} | ||
|
||
// In the next step, we use the inlining map to determine which additional | ||
// monomorphizations have to go into each codegen unit. These additional | ||
// monomorphizations can be drop-glue, functions from external crates, and | ||
// local functions the definition of which is marked with `#[inline]`. | ||
let mut post_inlining = place_inlined_mono_items(initial_partitioning, | ||
inlining_map); | ||
let mut post_inlining = { | ||
let _prof_timer = | ||
tcx.prof.generic_activity("cgu_partitioning_place_inline_items"); | ||
place_inlined_mono_items(initial_partitioning, inlining_map) | ||
}; | ||
|
||
post_inlining.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(tcx)); | ||
|
||
|
@@ -165,6 +173,8 @@ where | |
// Next we try to make as many symbols "internal" as possible, so LLVM has | ||
// more freedom to optimize. | ||
if !tcx.sess.opts.cg.link_dead_code { | ||
let _prof_timer = | ||
tcx.prof.generic_activity("cgu_partitioning_internalize_symbols"); | ||
internalize_symbols(tcx, &mut post_inlining, inlining_map); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I could be wrong -- but I think we already have events with spaces in them, in which case this can probably be nicer if we just use spaces directly (both in this event and generally).
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.
Yeah, we do. Unless there's a strong reason to use underscores (for instance, if this activity was just the name of the enclosing function), I'd recommend using spaces as well.
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.
I'm not sure. In my opinion it's more like: unless there is a strong reason for doing otherwise, it's better to keep any kind of identifiers as simple as possible (e.g. allowing only things that would also make valid Rust identifiers). Otherwise one might end up with headaches down the road, like having to weirdly escape things in commandline strings, or not knowing if trailing whitespace is significant or not. The identifiers emitted here will go through various processing tools (many of which we don't now about yet). I'd rather keep things simple.
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.
Seems reasonable to me.