forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#82127 - tgnottingham:tune-ahead-of-time-codeg…
…en, r=varkor 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.
- Loading branch information
Showing
3 changed files
with
64 additions
and
11 deletions.
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