|
1 | 1 | # Parallel Compilation |
2 | 2 |
|
3 | | -As of <!-- date-check --> August 2022, the only stage of the compiler that is |
4 | | -parallel is [code generation stage][codegen] (codegen). Some parts of the |
5 | | -compiler have parallel implementations, such as query evaluation, type check |
6 | | -and [monomorphization][monomorphization], but the general version of the |
7 | | -compiler does not include parallelization functions. **To try out the current |
8 | | -parallel compiler**, install `rustc` from source code with `parallel-compiler = |
9 | | -true` in the `Config.toml`. |
10 | | - |
11 | | -The lack of parallelism at other stages (for example, macro expansion) also |
12 | | -represents an opportunity for improving compiler performance. |
13 | | - |
14 | | -These next few sections describe where and how parallelism is currently used, |
15 | | -and the current status of making parallel compilation the default in `rustc`. |
| 3 | +<div class="warning"> |
| 4 | +Parallel front-end is currently (as of 2024 November) undergoing significant |
| 5 | +changes, this page contains quite a bit of outdated information. |
| 6 | + |
| 7 | +Tracking issue: <https://github.com/rust-lang/rust/issues/113349> |
| 8 | +</div> |
| 9 | + |
| 10 | +As of <!-- date-check --> November 2024, most of the rust compiler is now |
| 11 | +parallelized. |
| 12 | + |
| 13 | +- The codegen part is executed concurrently by default. You can use the `-C |
| 14 | + codegen-units=n` option to control the number of concurrent tasks. |
| 15 | +- The parts after HIR lowering to codegen such as type checking, borrowing |
| 16 | + checking, and mir optimization are parallelized in the nightly version. |
| 17 | + Currently, they are executed in serial by default, and parallelization is |
| 18 | + manually enabled by the user using the `-Z threads = n` option. |
| 19 | +- Other parts, such as lexical parsing, HIR lowering, and macro expansion, are |
| 20 | + still executed in serial mode. |
| 21 | + |
| 22 | +<div class="warning"> |
| 23 | +The follow sections are kept for now but are quite outdated. |
| 24 | +</div> |
| 25 | + |
| 26 | +--- |
16 | 27 |
|
17 | 28 | [codegen]: backend/codegen.md |
18 | 29 |
|
|
0 commit comments