-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
miri: prune some atomic operation and raw pointer details from stacktrace #98674
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
(rust-highfive has picked a reviewer for you, use r? to override) |
The new trace is definitely nicer. I'm not sure how I feel about cfg'ing these purely for miri - I think we can panic in some of these in practice, so it might be useful regardless? On the other hand, for low-level primitives like this the extra register usage might be a real pain. I'm going to nominate for the libs team to answer the broader question ("This is also testing the waters for whether the libs team is okay with having these attributes in their code, or whether you'd prefer if we find some other way to do this. If you are fine with this, we will probably want to add it to a lot more functions (all the other atomic operations, to start)."). I personally feel like these attributes are OK -- where possible, we should avoid divergence between miri and non-miri, but for performance reasons I'm OK with miri being special cased. It may make sense to make that cfg something other than miri in the future (e.g., slower_but_nicer_std) or something -- we have similar things around for example RefCell reporting the location of the 'other' borrow when panicking -- but that's a broader question and can easily wait until there's a good story around users specifying that kind of option. |
I don't want to sidetrack this issue, but your response touches on something broader and I'm not entirely sure where to discuss.
There is a similar question around |
I don't think we necessarily need build-std; we could ship precompiled std/core for a small set of configurations if we wanted to. It's just something someone would need to propose a way to access (through Cargo and/or rustup). But yes, I agree that there's a number of similar assertions that might be nice to give users access to. |
This was discussed in a recent libs team meeting, and we're fine with these |
2f636ef
to
13877a9
Compare
Awesome! I added all the @Mark-Simulacrum this is ready for review. |
@bors r+ rollup=iffy |
@bors r- |
@bors r=Mark-Simulacrum |
☀️ Test successful - checks-actions |
Tested on commit rust-lang/rust@35a0617. Direct link to PR: <rust-lang/rust#98674> 💔 miri on windows: test-pass → test-fail (cc @RalfJung @oli-obk). 💔 miri on linux: test-pass → test-fail (cc @RalfJung @oli-obk).
Finished benchmarking commit (35a0617): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
…Simulacrum add miri-track-caller to more intrinsic-exposing methods Follow-up to rust-lang#98674: I went through the Miri test suite to find more functions that would benefit from Miri backtrace pruning, and this is what I found. Basically anything that just exposes a potentially-UB intrinsic to the user should get this treatment.
add miri-track-caller to more intrinsic-exposing methods Follow-up to rust-lang/rust#98674: I went through the Miri test suite to find more functions that would benefit from Miri backtrace pruning, and this is what I found. Basically anything that just exposes a potentially-UB intrinsic to the user should get this treatment.
Since Miri removes
track_caller
frames from the stacktrace, adding that attribute can help make backtraces more readable (similar to how it makes panic locations better). I made them only show up withcfg(miri)
to make sure the extra arguments induced bytrack_caller
do not cause any runtime performance trouble.This is also testing the waters for whether the libs team is okay with having these attributes in their code, or whether you'd prefer if we find some other way to do this. If you are fine with this, we will probably want to add it to a lot more functions (all the other atomic operations, to start).
Before:
After: