Skip to content

Parallelize AST -> HIR lowering - #163495

Open
aerooneqq wants to merge 2 commits into
rust-lang:mainfrom
aerooneqq:parallel-ast-hir-lowering
Open

aerooneqq wants to merge 2 commits into
rust-lang:mainfrom
aerooneqq:parallel-ast-hir-lowering

Conversation

@aerooneqq

@aerooneqq aerooneqq commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

Parallelize AST -> HIR lowering.

r? @petrochenkov

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 29, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 29, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 29, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 79a91eb (79a91eb0736d9f47b5af3d4282e49ada6baa01ca)
Base parent: ea6bb45 (ea6bb45b74c24a026dab4187b1550e97b6985c8a)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (79a91eb): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.9% [0.2%, 9.2%] 88
Regressions ❌
(secondary)
1.3% [0.1%, 7.4%] 172
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 1
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) 0.9% [-0.2%, 9.2%] 89

Max RSS (memory usage)

Results (primary 1.2%, secondary 0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.8% [1.1%, 2.8%] 4
Regressions ❌
(secondary)
3.3% [1.7%, 7.2%] 10
Improvements ✅
(primary)
-0.9% [-0.9%, -0.9%] 1
Improvements ✅
(secondary)
-4.5% [-5.9%, -2.7%] 6
All ❌✅ (primary) 1.2% [-0.9%, 2.8%] 5

Cycles

Results (primary 11.0%, secondary 2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
11.0% [2.2%, 28.4%] 13
Regressions ❌
(secondary)
4.8% [2.2%, 9.7%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-3.5%, -3.5%] 1
All ❌✅ (primary) 11.0% [2.2%, 28.4%] 13

Binary size

Results (primary -0.1%, secondary -0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.2%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.3%, -0.3%] 4
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 4
All ❌✅ (primary) -0.1% [-0.3%, 0.2%] 8

Bootstrap: 489.575s -> 491.192s (0.33%)
Artifact size: 406.37 MiB -> 407.23 MiB (0.21%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 29, 2026
@Kobzol

Kobzol commented Sep 30, 2026

Copy link
Copy Markdown
Member

Pretty nice results!

@rust-log-analyzer

This comment has been minimized.

@aerooneqq

aerooneqq commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Parallelization of AST -> HIR lowering broke deterministic encoding of syntax contexts 🤣 (#161450).
UPD: not that sure about that, maybe some other parts of metadata causing it, will research it.

@petrochenkov

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 30, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 30, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 335f660 (335f660f9c0a0a3b69b6e32858af6d7f3af36c51)
Base parent: 7d2cd0f (7d2cd0fbc092625ea371da704f15f80216d2220e)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (335f660): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.7% [0.2%, 1.1%] 9
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-0.8%, -0.7%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-0.8%, 1.1%] 11

Max RSS (memory usage)

Results (primary -3.1%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.8% [1.8%, 1.8%] 1
Regressions ❌
(secondary)
2.1% [2.0%, 2.2%] 2
Improvements ✅
(primary)
-3.1% [-7.8%, -1.2%] 118
Improvements ✅
(secondary)
-3.1% [-5.2%, -1.4%] 23
All ❌✅ (primary) -3.1% [-7.8%, 1.8%] 119

Cycles

Results (primary 14.6%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
14.6% [4.4%, 27.7%] 9
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-3.0%, -2.5%] 3
All ❌✅ (primary) 14.6% [4.4%, 27.7%] 9

Binary size

Results (primary -0.0%, secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.1%, -0.0%] 9
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 5
All ❌✅ (primary) -0.0% [-0.1%, -0.0%] 9

Bootstrap: 489.84s -> 488.516s (-0.27%)
Artifact size: 406.54 MiB -> 406.46 MiB (-0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 30, 2026
@oli-obk oli-obk self-assigned this Oct 2, 2026
@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 16, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 5813730 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors r-

@rust-bors

rust-bors Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@aerooneqq

aerooneqq commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Most likely the issue with syntax contexts that are allocated during different kinds of desugarings during AST -> HIR lowering (i.e., try trait, mark_span_with_reason), this makes HIR hash non-deterministic and metadata bytes seems to be affected also, and after that we load the same crate twice as their hashes are different.

@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in coverage instrumentation.

cc @Zalathar

rustc_errors::emitter was changed

cc @Muscraft

@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

@aerooneqq

Copy link
Copy Markdown
Contributor Author

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: b50a887 (b50a887c80a429bdae17c65968db18e87bfa73be)
Base parent: 0259d5e (0259d5e9a81c6af08e40f8c204f2c0c41dca1647)

@aerooneqq

Copy link
Copy Markdown
Contributor Author

Maybe worth running all jobs before next merge attempt. Details in the comment for ExpnKind::Desugaring. Added run-make test is verified to fail locally if owner id is not supplied to ExpnKind::Desugaring, the test is inspired by a real code that caused this.

@rustbot ready

@oli-obk oli-obk left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting situation with the expn data disambiguators. It's annoying how hard it is to harden them (and other disambiguators) against future changes that could make them nondeterministic.

@bors r+ rollup=never

gonna let CI do the full checks of all targets instead of playing with bors try and still missing sth :)

View changes since this review

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 11f9ba8 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors

This comment has been minimized.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-armhf-gnu failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 0caaa88 failed: CI. Failed job:

@aerooneqq

Copy link
Copy Markdown
Contributor Author

Managed to reproduce this failure locally through citool, HIR hashes are identical, however overall crate hashes differ, seems like the problem is in metadata, will continue investigating.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants