-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Print CGU reuse statistics in -Zprint-mono-items
#144899
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
Conversation
Some changes occurred in compiler/rustc_codegen_ssa |
Rerolling a codegen reviewer for vibes on the approach; even though this is an perma-unstable flag. |
Will be nice to name it |
@@ -735,6 +735,11 @@ pub fn codegen_crate<B: ExtraBackendMethods>( | |||
crate::assert_module_sources::assert_module_sources(tcx, &|cgu_reuse_tracker| { | |||
for (i, cgu) in codegen_units.iter().enumerate() { | |||
let cgu_reuse = cgu_reuse[i]; | |||
|
|||
if tcx.sess.opts.unstable_opts.print_mono_items { | |||
println!("CGU_REUSE {} {cgu_reuse}", cgu.name()); |
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.
Maybe do this inside the cgu_reuse_tracker instead? The current changes in this PR don't apply to cg_clif.
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.
Good point, moved it to assert_module_sources
.
@bors r+ rollup |
Print CGU reuse statistics in `-Zprint-mono-items` I'm trying to expose more information about incremental profiling from rustc (https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Profiling.2Fanalysis.20of.20incremental.20builds/with/531383501). One of the things that would be quite useful to expose is the CGU reuse state, so that when you do a rebuild, you can see all the CGUs (and all the functions) that had to be recompiled. Currently, we have (AFAIK) two ways of outputting monomorphization statistics: 1) `-Zdump-mono-stats` outputs statistics about number of instantiations and expected compilation cost of individual functions in the local crate being compiled. It can be outputted either as Markdown or JSON. 2) `-Zprint-mono-items` outputs a pair (item, CGU) for each monomorphized item. I was thinking about recording CGU statistics in the self-profile output, but I realized that as a simpler step, we could just add CGU reuse data to `-Zprint-mono-items`, as an additional output. That is what this PR does.
Rollup of 19 pull requests Successful merges: - #144400 (`tests/ui/issues/`: The Issues Strike Back [3/N]) - #144764 ([codegen] assume the tag, not the relative discriminant) - #144807 (Streamline config in bootstrap) - #144899 (Print CGU reuse statistics in `-Zprint-mono-items`) - #144909 (Add new `test::print_merged_doctests_times` used by rustdoc to display more detailed time information) - #144912 (Resolver: introduce a conditionally mutable Resolver for (non-)speculative resolution.) - #144914 (Add support for `ty::Instance` path shortening in diagnostics) - #144931 ([win][arm64ec] Fix msvc-wholearchive for Arm64EC) - #144999 (coverage: Remove all unstable support for MC/DC instrumentation) - #145009 (A couple small changes for rust-analyzer next-solver work) - #145030 (GVN: Do not flatten derefs with ProjectionElem::Index. ) - #145042 (stdarch subtree update) - #145047 (move `type_check` out of `compute_regions`) - #145051 (Prevent name collisions with internal implementation details) - #145053 (Add a lot of NLL `known-bug` tests) - #145055 (Move metadata symbol export from exported_non_generic_symbols to exported_symbols) - #145057 (Clean up some resolved test regressions of const trait removals in std) - #145068 (Readd myself to review queue) - #145070 (Add minimal `armv7a-vex-v5` tier three target) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #144899 - Kobzol:cgu-reuse, r=saethlin Print CGU reuse statistics in `-Zprint-mono-items` I'm trying to expose more information about incremental profiling from rustc (https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Profiling.2Fanalysis.20of.20incremental.20builds/with/531383501). One of the things that would be quite useful to expose is the CGU reuse state, so that when you do a rebuild, you can see all the CGUs (and all the functions) that had to be recompiled. Currently, we have (AFAIK) two ways of outputting monomorphization statistics: 1) `-Zdump-mono-stats` outputs statistics about number of instantiations and expected compilation cost of individual functions in the local crate being compiled. It can be outputted either as Markdown or JSON. 2) `-Zprint-mono-items` outputs a pair (item, CGU) for each monomorphized item. I was thinking about recording CGU statistics in the self-profile output, but I realized that as a simpler step, we could just add CGU reuse data to `-Zprint-mono-items`, as an additional output. That is what this PR does.
I'm trying to expose more information about incremental profiling from rustc (https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Profiling.2Fanalysis.20of.20incremental.20builds/with/531383501). One of the things that would be quite useful to expose is the CGU reuse state, so that when you do a rebuild, you can see all the CGUs (and all the functions) that had to be recompiled.
Currently, we have (AFAIK) two ways of outputting monomorphization statistics:
-Zdump-mono-stats
outputs statistics about number of instantiations and expected compilation cost of individual functions in the local crate being compiled. It can be outputted either as Markdown or JSON.-Zprint-mono-items
outputs a pair (item, CGU) for each monomorphized item.I was thinking about recording CGU statistics in the self-profile output, but I realized that as a simpler step, we could just add CGU reuse data to
-Zprint-mono-items
, as an additional output. That is what this PR does.