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

Always use RevealAll for const eval queries #119821

Merged
merged 1 commit into from Jan 20, 2024

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 10, 2024

implements what is described in #116803 (comment)

Using UserFacing for const eval does not make sense anymore, unless we significantly change things like avoiding revealing opaque types.

New tests are copied from #101478

@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 2024

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 10, 2024

@bors try @rust-timer queue

@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 10, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 2024

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

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

bors commented Jan 10, 2024

⌛ Trying commit e673a9e with merge 488c25a...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 10, 2024
Always use RevealAll for const eval queries

implements what is described in rust-lang#116803 (comment)
@lcnr
Copy link
Contributor

lcnr commented Jan 10, 2024

r? @lcnr

@rustbot rustbot assigned lcnr and unassigned b-naber Jan 10, 2024
@bors
Copy link
Contributor

bors commented Jan 10, 2024

☀️ Try build successful - checks-actions
Build commit: 488c25a (488c25aafb88817229f076187a7820b2cd70ac6d)

1 similar comment
@bors
Copy link
Contributor

bors commented Jan 10, 2024

☀️ Try build successful - checks-actions
Build commit: 488c25a (488c25aafb88817229f076187a7820b2cd70ac6d)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (488c25a): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@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)
3.0% [3.0%, 3.0%] 1
Improvements ✅
(primary)
-0.2% [-0.3%, -0.2%] 3
Improvements ✅
(secondary)
-1.4% [-1.9%, -0.9%] 8
All ❌✅ (primary) -0.2% [-0.3%, -0.2%] 3

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.5% [0.4%, 0.7%] 3
Regressions ❌
(secondary)
1.2% [1.2%, 1.2%] 1
Improvements ✅
(primary)
-2.6% [-5.1%, -0.5%] 3
Improvements ✅
(secondary)
-4.6% [-6.8%, -2.3%] 3
All ❌✅ (primary) -1.0% [-5.1%, 0.7%] 6

Cycles

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)
7.7% [2.1%, 11.7%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 666.26s -> 665.975s (-0.04%)
Artifact size: 308.39 MiB -> 308.41 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jan 10, 2024
@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 10, 2024

yay free const eval performance improvement.

@@ -226,16 +226,7 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
) -> ::rustc_middle::mir::interpret::EvalToConstValueResult<'tcx> {
// see comment in eval_to_allocation_raw_provider for what we're doing here
Copy link
Member

Choose a reason for hiding this comment

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

That comment now probably needs updating?

The assertion error or the comment should explain what a rustc dev should do when they hit this panic.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

This removes a bunch of code that I never understood and improves performance (except, strangely, in one benchmark). I'm all for it :)

@rustbot
Copy link
Collaborator

rustbot commented Jan 12, 2024

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 12, 2024

fixed test comments

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

please update comments and add this test 😁 r=me after that

trait MyTrait: Copy {
    const ASSOC: usize;
}

impl MyTrait for u8 {
    const ASSOC: usize = 32;
}

const fn yeet() -> impl MyTrait {
    0u8
}

const fn output<T: MyTrait>(_: T) -> usize {
    <T as MyTrait>::ASSOC
}

struct Foo<'a>(&'a ())
const NEED_REVEAL_ALL: usize = output(yeet());

fn promote_div() -> &'static usize {
    &(10 / NEED_REVEAL_ALL)
}
fn main() {}

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 19, 2024

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jan 19, 2024

📌 Commit 867831a has been approved by lcnr

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

bors commented Jan 20, 2024

⌛ Testing commit 867831a with merge 5378c1c...

@bors
Copy link
Contributor

bors commented Jan 20, 2024

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 5378c1c to master...

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

Finished benchmarking commit (5378c1c): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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.3% [-0.3%, -0.3%] 3
Improvements ✅
(secondary)
-1.4% [-1.8%, -1.2%] 7
All ❌✅ (primary) -0.3% [-0.3%, -0.3%] 3

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)
1.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
3.2% [1.9%, 4.5%] 2
Improvements ✅
(primary)
-4.4% [-4.4%, -4.4%] 1
Improvements ✅
(secondary)
-1.6% [-2.4%, -1.2%] 7
All ❌✅ (primary) -1.4% [-4.4%, 1.5%] 2

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

Bootstrap: 665.078s -> 663.642s (-0.22%)
Artifact size: 308.34 MiB -> 308.33 MiB (-0.01%)

@rustbot rustbot removed the perf-regression Performance regression. label Jan 20, 2024
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.

None yet

9 participants