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

interpret: ensure that Place is never used for a different frame #122243

Merged
merged 5 commits into from
Mar 14, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Mar 9, 2024

We store the address where the stack frame stores its locals. The idea is that even if we pop and push, or switch to a different thread with a larger number of frames, then the locals address will most likely change so we'll notice that problem. This is made possible by some recent changes by @WaffleLapkin, where we no longer use Place across things that change the number of stack frames.

I made these debug assertions for now, just to make sure this can't cost us any perf.

The first commit is unrelated but it's a one-line comment change so it didn't warrant a separate PR...

r? @oli-obk

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

rustbot commented Mar 9, 2024

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@RalfJung
Copy link
Member Author

RalfJung commented Mar 9, 2024

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

bors commented Mar 9, 2024

⌛ Trying commit 141ebf8 with merge dae6eba...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 9, 2024
…=<try>

interpret: ensure that Place is never used for a different frame

We store the address where the stack frame stores its `locals`. The idea is that even if we pop and push, or switch to a different thread with a larger number of frames, then the `locals` address will most likely change so we'll notice that problem. This is made possible by some recent changes by `@WaffleLapkin,` where we no longer use `Place` across things that change the number of stack frames.

I made these debug assertions for now, just to make sure this can't cost us any perf.

The first commit is unrelated but it's a one-line comment change so it didn't warrant a separate PR...

r? `@oli-obk`
@bors
Copy link
Contributor

bors commented Mar 9, 2024

☀️ Try build successful - checks-actions
Build commit: dae6eba (dae6eba43a658f72e2e5d69563db21182125db32)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (dae6eba): 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)
-0.3% [-0.3%, -0.3%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

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

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

Binary size

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

Bootstrap: 649.076s -> 649.815s (0.11%)
Artifact size: 172.58 MiB -> 310.37 MiB (79.84%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 10, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Mar 10, 2024

Since you're getting the address of the locals Vec, and not the address of where its locals are stored, popping then pushing will pass the assert, as the stack frame Vec doesn't reallocate.

@RalfJung
Copy link
Member Author

Ah, damn, yes I should get the buffer address of course. Good thing I made this a helper function :D

@RalfJung
Copy link
Member Author

Checking if enabling the assertions in release builds makes a perf difference.

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

bors commented Mar 10, 2024

⌛ Trying commit a566f90 with merge cde8b4d...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2024
…=<try>

interpret: ensure that Place is never used for a different frame

We store the address where the stack frame stores its `locals`. The idea is that even if we pop and push, or switch to a different thread with a larger number of frames, then the `locals` address will most likely change so we'll notice that problem. This is made possible by some recent changes by `@WaffleLapkin,` where we no longer use `Place` across things that change the number of stack frames.

I made these debug assertions for now, just to make sure this can't cost us any perf.

The first commit is unrelated but it's a one-line comment change so it didn't warrant a separate PR...

r? `@oli-obk`
@bors
Copy link
Contributor

bors commented Mar 10, 2024

☀️ Try build successful - checks-actions
Build commit: cde8b4d (cde8b4d6972edd365d89d64f52dea5abc94df774)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (cde8b4d): comparison URL.

Overall result: ❌ regressions - 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.8% [0.8%, 0.9%] 4
Regressions ❌
(secondary)
0.7% [0.6%, 0.8%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.8% [0.8%, 0.9%] 4

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)
3.1% [1.7%, 4.7%] 7
Regressions ❌
(secondary)
2.4% [0.8%, 4.1%] 32
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-4.0%, -3.0%] 2
All ❌✅ (primary) 3.1% [1.7%, 4.7%] 7

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)
1.9% [1.3%, 2.5%] 6
Regressions ❌
(secondary)
0.9% [0.9%, 0.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.9% [1.3%, 2.5%] 6

Binary size

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

Bootstrap: 648.949s -> 647.618s (-0.21%)
Artifact size: 310.01 MiB -> 309.97 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Mar 10, 2024
@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 10, 2024
@RalfJung
Copy link
Member Author

Okay, the assertions can definitely be measured, so let's keep them as debug assertions.

@RalfJung RalfJung removed the perf-regression Performance regression. label Mar 10, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Mar 10, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Mar 10, 2024

📌 Commit c3342b4 has been approved by oli-obk

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 Mar 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 13, 2024
…=oli-obk

interpret: ensure that Place is never used for a different frame

We store the address where the stack frame stores its `locals`. The idea is that even if we pop and push, or switch to a different thread with a larger number of frames, then the `locals` address will most likely change so we'll notice that problem. This is made possible by some recent changes by `@WaffleLapkin,` where we no longer use `Place` across things that change the number of stack frames.

I made these debug assertions for now, just to make sure this can't cost us any perf.

The first commit is unrelated but it's a one-line comment change so it didn't warrant a separate PR...

r? `@oli-obk`
@bors
Copy link
Contributor

bors commented Mar 13, 2024

⌛ Testing commit c3342b4 with merge b9d2b00...

@bors
Copy link
Contributor

bors commented Mar 13, 2024

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 13, 2024
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

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

@RalfJung
Copy link
Member Author

@bors retry timeout

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

bors commented Mar 14, 2024

⌛ Testing commit c3342b4 with merge cb580ff...

@bors
Copy link
Contributor

bors commented Mar 14, 2024

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing cb580ff to master...

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

Finished benchmarking commit (cb580ff): 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)

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)
4.3% [2.7%, 5.8%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.3% [2.7%, 5.8%] 2

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: 670.21s -> 669.949s (-0.04%)
Artifact size: 310.75 MiB -> 310.79 MiB (0.01%)

@RalfJung RalfJung deleted the local-place-sanity-check branch March 15, 2024 10:04
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.

6 participants