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

Make MIR pass name a compile-time constant. #120161

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Jan 20, 2024

Post-processing a compile-time string at runtime is a bit silly. This PR makes CTFE do it all.

@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 Jan 20, 2024
@cjgillot
Copy link
Contributor Author

@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 Jan 20, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 20, 2024
Make MIR pass name a compile-time constant.

r? `@ghost`
@bors
Copy link
Contributor

bors commented Jan 20, 2024

⌛ Trying commit 498ef48 with merge db13a70...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 20, 2024

☀️ Try build successful - checks-actions
Build commit: db13a70 (db13a70d2c956bc803a39df8c042d4c661fadbe0)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (db13a70): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.6% [-1.6%, -1.6%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

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)
-3.2% [-3.2%, -3.2%] 1
Improvements ✅
(secondary)
-1.8% [-2.6%, -1.3%] 4
All ❌✅ (primary) -3.2% [-3.2%, -3.2%] 1

Cycles

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

Binary size

Results

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.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Bootstrap: 665.464s -> 664.961s (-0.08%)
Artifact size: 308.33 MiB -> 308.34 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 20, 2024
@cjgillot cjgillot marked this pull request as ready for review January 20, 2024 18:11
@rustbot
Copy link
Collaborator

rustbot commented Jan 20, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@cjgillot
Copy link
Contributor Author

r? compiler

@rust-log-analyzer

This comment has been minimized.

@Noratrieb
Copy link
Member

Given that this is perf neutral, I don't think it makes sense to merge, as the runtime code is a lot nicer.

@cjgillot
Copy link
Contributor Author

I agree the code is much uglier than the runtime implementation. I'd be glad to use the exact same code, but I had to wrestle the compiler into accepting this mess.

Perf-wise, the improvement is tiny (<1%) but measurable. See the unfiltered results.

@tmiasko
Copy link
Contributor

tmiasko commented Jan 21, 2024

I recall trying to change this as well to avoid all those calls to memrchr, but at the time API available from const context was even smaller. This implementation seems reasonable to me.

@bors r+

@bors
Copy link
Contributor

bors commented Jan 21, 2024

📌 Commit ad25f0e has been approved by tmiasko

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 Jan 21, 2024
@bors
Copy link
Contributor

bors commented Jan 22, 2024

⌛ Testing commit ad25f0e with merge a58ec8f...

@bors
Copy link
Contributor

bors commented Jan 22, 2024

☀️ Test successful - checks-actions
Approved by: tmiasko
Pushing a58ec8f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 22, 2024
@bors bors merged commit a58ec8f into rust-lang:master Jan 22, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 22, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a58ec8f): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

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

Cycles

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

Binary size

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

Bootstrap: 663.041s -> 664.028s (0.15%)
Artifact size: 308.37 MiB -> 308.38 MiB (0.00%)

@cjgillot cjgillot deleted the static-pass-name branch January 22, 2024 10:17
Nadrieril added a commit to Nadrieril/rust that referenced this pull request Feb 7, 2024
MirPass: make name more const

Continues rust-lang#120161, this time applied to `MirPass` instead of `MirLint`, locally shaves few (very few) instructions off.

r? `@cjgillot`
Nadrieril added a commit to Nadrieril/rust that referenced this pull request Feb 7, 2024
MirPass: make name more const

Continues rust-lang#120161, this time applied to `MirPass` instead of `MirLint`, locally shaves few (very few) instructions off.

r? ``@cjgillot``
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 7, 2024
Rollup merge of rust-lang#120733 - klensy:trait-const-fn, r=oli-obk

MirPass: make name more const

Continues rust-lang#120161, this time applied to `MirPass` instead of `MirLint`, locally shaves few (very few) instructions off.

r? ``@cjgillot``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

9 participants