Skip to content

Fix parallel rustc not being reproducible due to unstable sorts of items #144886

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ywxt
Copy link
Contributor

@ywxt ywxt commented Aug 4, 2025

Currently, A tuple (DefId, SymbolName) is used to determine the order of items in the final binary. However DefId is expected as non-deterministic, which leads to some not reproducible issues under parallel compilation.

Here we use (Span, SymbolName) to replace (DefId, SymbolName) and make them sorted.

This PR is purposed to fix #140425, but seemly works on #140413 too.

This behavior hasn't added into any test until we have a test suit for the parallel frontend. (See #143953)

Related discussion: Zulip #144576

Update #113349

r? @SparrowLii

@rustbot
Copy link
Collaborator

rustbot commented Aug 4, 2025

r? @saethlin

rustbot has assigned @saethlin.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 4, 2025
@rustbot rustbot assigned SparrowLii and unassigned saethlin Aug 4, 2025
@SparrowLii
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Aug 4, 2025

⌛ Trying commit 7f73e8b with merge 8bf70d1

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Aug 4, 2025
Fix parallel rustc not being reproducible due to unstable sorts of items
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 4, 2025
@rust-bors
Copy link

rust-bors bot commented Aug 4, 2025

☀️ Try build successful (CI)
Build commit: 8bf70d1 (8bf70d10cec2c1fed04744fed1d432536ca5f957, parent: e1b9081e699065badfc1a9419ec9566e5c8615c4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8bf70d1): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@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)
1.9% [0.1%, 61.1%] 44
Regressions ❌
(secondary)
0.3% [0.1%, 1.2%] 24
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.8% [-0.2%, 61.1%] 45

Max RSS (memory usage)

Results (primary 3.4%, secondary 1.5%)

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

mean range count
Regressions ❌
(primary)
3.4% [0.8%, 6.4%] 3
Regressions ❌
(secondary)
3.1% [3.1%, 3.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.8% [-1.8%, -1.8%] 1
All ❌✅ (primary) 3.4% [0.8%, 6.4%] 3

Cycles

Results (primary 24.6%, secondary -0.8%)

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

mean range count
Regressions ❌
(primary)
24.6% [2.0%, 58.6%] 3
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-3.8%, -3.8%] 1
All ❌✅ (primary) 24.6% [2.0%, 58.6%] 3

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 468.82s -> 467.885s (-0.20%)
Artifact size: 376.96 MiB -> 377.02 MiB (0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

parallel rustc: async closures not reproducible
5 participants