Uh oh!
There was an error while loading. Please reload this page.
Add some track_caller info to precondition panics - #129658
Conversation
This comment has been minimized.
This comment has been minimized.
saethlin
commented
Aug 27, 2024
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
Aug 27, 2024
Add some track_caller info to precondition panics r? `@ghost` Thought of this while looking at rust-lang#129642 (comment)
Uh oh!
There was an error while loading. Please reload this page.
bors
commented
Aug 27, 2024
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Aug 27, 2024
Finished benchmarking commit (7798f9b): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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 Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary -2.7%)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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResults (primary 0.1%, secondary 0.1%)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.
Bootstrap: 749.925s -> 752.783s (0.38%) |
saethlin
commented
Aug 27, 2024
That looks possibly acceptable. Let's just see how bad this becomes? @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
Aug 27, 2024
Add some track_caller info to precondition panics r? `@ghost` Thought of this while looking at rust-lang#129642 (comment)
This comment has been minimized.
This comment has been minimized.
bors
commented
Aug 27, 2024
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Aug 27, 2024
Finished benchmarking commit (0e77a71): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking 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 @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResults (primary 0.3%, secondary 0.1%)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.
Bootstrap: 749.925s -> 751.312s (0.18%) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bors
commented
May 20, 2025
☔ The latest upstream changes (presumably #139916) made this pull request unmergeable. Please resolve the merge conflicts. |
saethlin
commented
May 21, 2025
@rustbot label: +perf-regression-triaged r? libs |
rustbot
commented
May 21, 2025
saethlin
commented
May 21, 2025
To re-run on the new benchmarks: |
This comment has been minimized.
This comment has been minimized.
bors
commented
May 21, 2025
bors
commented
May 21, 2025
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
May 21, 2025
Finished benchmarking commit (695a306): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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 @bors rollup=never Instruction countThis 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.
Max RSS (memory usage)Results (primary -0.6%, secondary -2.1%)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.
CyclesResults (primary 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.
Binary sizeResults (primary 0.6%, secondary 1.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.
Bootstrap: 775.543s -> 775.151s (-0.05%) |
jhpratt
commented
May 24, 2025
@bors r+ rollup=never |
bors
commented
May 24, 2025
bors
commented
May 25, 2025
This comment has been minimized.
This comment has been minimized.
bors
commented
May 25, 2025
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
saethlin
commented
May 27, 2025
@bors try |
bors
commented
May 27, 2025
bors
commented
May 27, 2025
☀️ Try build successful - checks-actions |
saethlin
commented
May 27, 2025
@bors r=jhpratt |
bors
commented
May 27, 2025
bors
commented
May 27, 2025
bors
commented
May 28, 2025
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 45f256d (parent) -> be42293 (this PR) Test differencesShow 2448 test diffs2448 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard be422939446d7c5b27ba98debb6b4b8d6a261f1a --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
rust-timer
commented
May 28, 2025
Finished benchmarking commit (be42293): comparison URL. Overall result: ❌ regressions - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countThis 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.
Max RSS (memory usage)Results (primary 1.0%, secondary 3.6%)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.
CyclesResults (primary 5.7%)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.
Binary sizeResults (primary 0.6%, secondary 1.3%)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.
Bootstrap: 779.523s -> 779.377s (-0.02%) |
| ::core::panicking::panic_nounwind(concat!("unsafe precondition(s) violated: ", $message, | ||
| let msg = concat!("unsafe precondition(s) violated: ", $message, | ||
| "\n\nThis indicates a bug in the program. \ | ||
| This Undefined Behavior check is optional, and cannot be relied on for safety.")); | ||
| This Undefined Behavior check is optional, and cannot be relied on for safety."); | ||
| ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::new_const(&[msg]), false); |
There was a problem hiding this comment.
This might be a slight (unoptimized?) codegen regression, for things as simple as (godbolt):
#[unsafe(no_mangle)]pubfnr_next(mutr: std::ops::Range<usize>) -> Option<usize>{
r.next()}Before:
@alloc_3e1ebac14318b612ab4efabc52799932 = privateunnamed_addrconstant [186 x i8] c"unsafe precondition(s) violated: usize::unchecked_add cannot overflow\0A\0AThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.", align1; <usize>::unchecked_add::precondition_checkdefineinternalvoid@_RNvNvMs9_NtCs1p5UDGgVI4d_4core3numj13unchecked_add18precondition_checkCsb8r2Xq4BFYL_7example(i64%lhs, i64%rhs) unnamed_addr #0 {
; … (elided) …
bb1: ; preds = %start; call core::panicking::panic_nounwindcallvoid@_ZN4core9panicking14panic_nounwind17h0c59dc9f7f043eadE(ptralign1@alloc_3e1ebac14318b612ab4efabc52799932, i64186) #6After:
@alloc_3e1ebac14318b612ab4efabc52799932 = privateunnamed_addrconstant [186 x i8] c"unsafe precondition(s) violated: usize::unchecked_add cannot overflow\0A\0AThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.", align1; … (elided) …; <usize>::unchecked_add::precondition_check; Function Attrs: inlinehint nounwind nonlazybind uwtabledefineinternalvoid@_RNvNvMs9_NtCs25W7cjsTkyH_4core3numj13unchecked_add18precondition_checkCsgRHkggJuglA_7example(i64%lhs, i64%rhs, ptralign8%0) unnamed_addr #0 {
; … (elided) …
bb1: ; preds = %start%2 = getelementptrinboundsnuw { ptr, i64 }, ptr%_6, i640storeptr@alloc_3e1ebac14318b612ab4efabc52799932, ptr%2, align8; … (elided) …; call core::panicking::panic_nounwind_fmtcallvoid@_ZN4core9panicking18panic_nounwind_fmt17h42ee446b0f35d307E(ptralign8%_4, i1zeroextfalse, ptralign8%0) #6Notably, even if we ignore the extra IR needed to implement fmt::Arguments::new_const, the fact that &[msg]is pointing to a stack array (as opposed to e.g. const { &[concat!(...)] }) results in the constant string being stored on the stack at runtime.
(and unlike even &[concat!(...)], the let msg blocks even incidental promotion)
That all aside, I am a bit surprised there isn't "just" a copy of panic_nounwind that has #[track_caller], to avoid invoking panic_nounwind_fmt and have this extra codegen (assuming it matters at all, ofc, I just noticed this in passing for unrelated reasons).
There was a problem hiding this comment.
(To be clear, this is not that important or any kind of a blocker, I just found it slightly notable that runtime code is being unnecessarily generated, and arguably by mistake, even)
Currently, when you encounter a precondition check, you'll always get the caller location of the implementation of the precondition checks. But with this PR, you'll be told the location of the invalid call. Which is useful.
I thought of this while looking at #129642 (comment).
The changes to
tests/ui/const*happen because the const-eval interpreter skips#[track_caller]frames in its backtraces.The perf implications of this are: