Skip to content

Update parallel-rustc.md #1926

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

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Slightly update parallel front end overview, backlink to tracking issue
Co-authored-by: SparrowLii <liyuan179@huawei.com>
  • Loading branch information
jieyouxu and SparrowLii committed Nov 8, 2024
commit 98199758b8c7e2049de9e1428fe725027ccce7e8
37 changes: 24 additions & 13 deletions src/parallel-rustc.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
# Parallel Compilation

As of <!-- date-check --> August 2022, the only stage of the compiler that is
parallel is [code generation stage][codegen] (codegen). Some parts of the
compiler have parallel implementations, such as query evaluation, type check
and [monomorphization][monomorphization], but the general version of the
compiler does not include parallelization functions. **To try out the current
parallel compiler**, install `rustc` from source code with `parallel-compiler =
true` in the `Config.toml`.

The lack of parallelism at other stages (for example, macro expansion) also
represents an opportunity for improving compiler performance.

These next few sections describe where and how parallelism is currently used,
and the current status of making parallel compilation the default in `rustc`.
<div class="warning">
Parallel front-end is currently (as of 2024 November) undergoing significant
changes, this page contains quite a bit of outdated information.

Tracking issue: <https://github.com/rust-lang/rust/issues/113349>
</div>

As of <!-- date-check --> November 2024, most of the rust compiler is now
parallelized.

- The codegen part is executed concurrently by default. You can use the `-C
codegen-units=n` option to control the number of concurrent tasks.
- The parts after HIR lowering to codegen such as type checking, borrowing
checking, and mir optimization are parallelized in the nightly version.
Currently, they are executed in serial by default, and parallelization is
manually enabled by the user using the `-Z threads = n` option.
- Other parts, such as lexical parsing, HIR lowering, and macro expansion, are
still executed in serial mode.

<div class="warning">
The follow sections are kept for now but are quite outdated.
</div>

---

[codegen]: backend/codegen.md

Expand Down