Skip to content
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

Remove polymorphization #133883

Merged
merged 1 commit into from
Dec 7, 2024
Merged

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Dec 5, 2024

This PR removes the flag -Zpolymorphize and all the infrastructure in the compiler that exists only to support it, per rust-lang/compiler-team#810.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 5, 2024
@saethlin
Copy link
Member Author

saethlin commented Dec 5, 2024

r? compiler-errors

@saethlin saethlin force-pushed the remove-polymorphization branch from f70a014 to 2c6e802 Compare December 5, 2024 03:52
@saethlin saethlin marked this pull request as ready for review December 5, 2024 03:52
@rustbot
Copy link
Collaborator

rustbot commented Dec 5, 2024

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@compiler-errors
Copy link
Member

r=me after it's green

@bors rollup=never

(since it likely has a net-positive perf result, but let's not block this PR on perf.)

@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

looks like you've got an unnecessary import for TypeVisitableExt

@saethlin saethlin force-pushed the remove-polymorphization branch from 2c6e802 to 7337610 Compare December 5, 2024 04:13
@saethlin saethlin force-pushed the remove-polymorphization branch 2 times, most recently from a879158 to eb4a656 Compare December 5, 2024 16:16
@rustbot
Copy link
Collaborator

rustbot commented Dec 5, 2024

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

cc @rust-lang/rust-analyzer

@saethlin
Copy link
Member Author

saethlin commented Dec 5, 2024

@compiler-errors I'm not 100% sure I rebased properly over the change in compiler/rustc_ty_utils/src/abi.rs.

I also expanded my search a bit and found a few more mentions of polymorphization to delete. Can you take a look?

@compiler-errors
Copy link
Member

lgtm, r=me

@saethlin
Copy link
Member Author

saethlin commented Dec 5, 2024

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Dec 5, 2024

📌 Commit eb4a656 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2024
@jieyouxu jieyouxu added the relnotes Marks issues that should be documented in the release notes of the next release. label Dec 5, 2024
@bors
Copy link
Contributor

bors commented Dec 6, 2024

☔ The latest upstream changes (presumably #133089) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Dec 6, 2024
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 6, 2024
@saethlin saethlin force-pushed the remove-polymorphization branch from eb4a656 to 711c8cc Compare December 6, 2024 21:42
@saethlin
Copy link
Member Author

saethlin commented Dec 6, 2024

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Dec 6, 2024

📌 Commit 711c8cc has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 6, 2024
@bors
Copy link
Contributor

bors commented Dec 7, 2024

⌛ Testing commit 711c8cc with merge ca13e91...

@bors
Copy link
Contributor

bors commented Dec 7, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing ca13e91 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 7, 2024
@bors bors merged commit ca13e91 into rust-lang:master Dec 7, 2024
7 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 7, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ca13e91): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.5% [0.3%, 0.7%] 6
Improvements ✅
(primary)
-0.5% [-1.3%, -0.1%] 91
Improvements ✅
(secondary)
-0.7% [-1.7%, -0.3%] 21
All ❌✅ (primary) -0.5% [-1.3%, -0.1%] 91

Max RSS (memory usage)

Results (primary -0.9%, secondary -0.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.5% [3.5%, 3.5%] 1
Improvements ✅
(primary)
-0.9% [-1.1%, -0.6%] 6
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 2
All ❌✅ (primary) -0.9% [-1.1%, -0.6%] 6

Cycles

Results (primary -2.0%, secondary -3.8%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.0% [-2.5%, -1.5%] 5
Improvements ✅
(secondary)
-3.8% [-6.1%, -1.1%] 10
All ❌✅ (primary) -2.0% [-2.5%, -1.5%] 5

Binary size

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

Bootstrap: 768.721s -> 769.879s (0.15%)
Artifact size: 330.95 MiB -> 330.83 MiB (-0.04%)

@rustbot rustbot added the perf-regression Performance regression. label Dec 7, 2024
@lqd
Copy link
Member

lqd commented Dec 7, 2024

Massively positive results, regressions are small and in stress tests only, marking as triaged.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Dec 7, 2024
@nnethercote
Copy link
Contributor

Is it possible to briefly summarize the source of the performance improvements? I'm just curious.

@saethlin saethlin deleted the remove-polymorphization branch December 7, 2024 13:15
@saethlin
Copy link
Member Author

saethlin commented Dec 7, 2024

This PR deletes an often-called query and its associated table. I believe most of the improvement is caused by having less nodes in the query dep graph. Even though all those queries are effectively no-ops. (I would call this query overhead)

@nnethercote
Copy link
Contributor

Was it an oversight that the query was being called despite not doing anything useful? Or was it more complicated than that?

@bjorn3
Copy link
Member

bjorn3 commented Dec 7, 2024

The result of the unused_generic_params query was previously encoded in the crate metadata in case a crate that depends on the local crate uses -Zpolymorphize.

@compiler-errors
Copy link
Member

I feel like the code perhaps couldve been written to not touch the polymorphization codepaths unless the feature was enabled, though not totally certain given polymorphization's interaction with codegen 🤔

not certain if the unused parameters query couldve been pushed onto the crates that actually needed it (ie the ones build with Zpolymorphize)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

10 participants