rust/compiler/rustc_codegen_ssa/src
Tyson Nottingham 5f243d3c2b rustc_codegen_ssa: tune codegen according to available concurrency
This change tunes ahead-of-time codegening according to the amount of
concurrency available, rather than according to the number of CPUs on
the system. This can lower memory usage by reducing the number of
compiled LLVM modules in memory at once, particularly across several
rustc instances.

Previously, each rustc instance would assume that it should codegen
ahead of time to meet the demand of number-of-CPUs workers. But often, a
rustc instance doesn't have nearly that much concurrency available to
it, because the concurrency availability is split, via the jobserver,
across all active rustc instances spawned by the driving cargo process,
and is further limited by the `-j` flag argument. Therefore, each rustc
might have had several times the number of LLVM modules in memory than
it really needed to meet demand. If the modules were large, the effect
on memory usage would be noticeable.

With this change, the required amount of ahead-of-time codegen scales up
with the actual number of workers running within a rustc instance. Note
that the number of workers running can be less than the actual
concurrency available to a rustc instance. However, if more concurrency
is actually available, workers are spun up quickly as job tokens are
acquired, and the ahead-of-time codegen scales up quickly as well.
2021-02-15 13:02:49 -08:00
..
back rustc_codegen_ssa: tune codegen according to available concurrency 2021-02-15 13:02:49 -08:00
coverageinfo remove redundant closures (clippy::redundant_closure) 2021-01-03 13:34:24 +01:00
debuginfo Stop adding '*' at the end of type names for Ref and Slice when computing debug info for MSVC debuggers 2020-11-30 14:31:34 -08:00
mir Auto merge of #81327 - RalfJung:codegen-no-const-fail, r=oli-obk 2021-01-31 07:03:09 +00:00
traits cg_ssa: introduce `TargetMachineFactoryFn` alias 2020-12-16 10:33:43 +00:00
base.rs rustc_codegen_ssa: tune codegen scheduling to reduce memory usage 2021-02-03 18:55:05 -08:00
common.rs Remove unused #[allow(...)] statements from compiler/ 2020-09-26 01:25:55 +02:00
glue.rs Change ty.kind to a method 2020-09-04 17:47:51 +02:00
lib.rs Don't provide backend_optimization_level query for extern crates 2021-01-23 11:11:51 +01:00
meth.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
mono_item.rs ty: remove obsolete printer 2020-08-30 18:59:07 +01:00
target_features.rs Rollup merge of #78361 - DevJPM:master, r=workingjubilee 2020-11-18 15:46:19 +01:00