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

add const_panic macro to make it easier to fall back to non-formatting panic in const #132542

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Nov 2, 2024

Suggested by @tgross35

r? @tgross35

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 2, 2024
@rust-log-analyzer

This comment has been minimized.

library/core/src/panic.rs Outdated Show resolved Hide resolved
library/core/src/panic.rs Outdated Show resolved Hide resolved
@tgross35
Copy link
Contributor

tgross35 commented Nov 3, 2024

I am mildly amused about how similar this is to the patch I had but never finished up. Even down to both of us calling the const string "boring" in the example 😆

/// const_panic!("boring message", "flavored message {a} {b:?}", a: u32 = foo.len(), b: Something = bar);

https://github.com/tgross35/rust/blob/92e6632422a568500bcd49b03943e4ea9e6bb0ca/library/core/src/macros/mod.rs#L931-L932

@RalfJung
Copy link
Member Author

RalfJung commented Nov 3, 2024

I am mildly amused about how similar this is to the patch I had but never finished up. Even down to both of us calling the const string "boring" in the example

I copied that example from you ;)

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

I copied that example from you ;)

Oh, well I guess that explains where I got it too 😄

r=me with green CI

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member Author

RalfJung commented Nov 3, 2024 via email

@tgross35
Copy link
Contributor

tgross35 commented Nov 3, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Nov 3, 2024

📌 Commit bc757f9 has been approved by tgross35

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

bors commented Nov 3, 2024

⌛ Testing commit bc757f9 with merge e3a918e...

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, maybe I shouldn't put them in this file, since this is generally for macros that are stable / intended to be stabilized?

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you have it in core::panic before? I guess that could make sense, considering most of the macros in core::panic are doc(hidden) and meant for internal use.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, I've moved them in #132571.

@bors
Copy link
Contributor

bors commented Nov 3, 2024

☀️ Test successful - checks-actions
Approved by: tgross35
Pushing e3a918e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 3, 2024
@bors bors merged commit e3a918e into rust-lang:master Nov 3, 2024
7 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 3, 2024
@RalfJung RalfJung deleted the const_panic branch November 3, 2024 20:45
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e3a918e): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This 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.

mean range count
Regressions ❌
(primary)
0.8% [0.2%, 1.8%] 6
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.9%, -0.1%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [-0.9%, 1.8%] 11

Max RSS (memory usage)

Results (primary 3.9%, secondary 3.2%)

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)
5.1% [2.4%, 11.9%] 6
Regressions ❌
(secondary)
3.2% [2.7%, 3.8%] 2
Improvements ✅
(primary)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.9% [-3.4%, 11.9%] 7

Cycles

Results (primary 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.

mean range count
Regressions ❌
(primary)
1.7% [1.5%, 1.8%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-3.2%, -1.1%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-3.2%, 1.8%] 7

Binary size

Results (primary 0.3%, secondary -0.0%)

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.4% [0.0%, 5.2%] 46
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 3
Improvements ✅
(primary)
-0.2% [-0.5%, -0.0%] 11
Improvements ✅
(secondary)
-0.0% [-0.2%, -0.0%] 37
All ❌✅ (primary) 0.3% [-0.5%, 5.2%] 57

Bootstrap: 780.556s -> 780.261s (-0.04%)
Artifact size: 335.29 MiB -> 335.33 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Nov 3, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Nov 4, 2024
…r=oli-obk

add const_eval_select macro to reduce redundancy

I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think?

I didn't apply this everywhere yet because I wanted to gather feedback first.

The second commit moves the macros from rust-lang#132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately.

Cc `@oli-obk` `@saethlin` `@tgross35`
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2024
…<try>

add const_eval_select macro to reduce redundancy

I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think?

I didn't apply this everywhere yet because I wanted to gather feedback first.

The second commit moves the macros from rust-lang#132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately.

Cc `@oli-obk` `@saethlin` `@tgross35`

try-job: dist-aarch64-msvc
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2024
…<try>

add const_eval_select macro to reduce redundancy

I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think?

I didn't apply this everywhere yet because I wanted to gather feedback first.

The second commit moves the macros from rust-lang#132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately.

Cc `@oli-obk` `@saethlin` `@tgross35`

try-job: dist-aarch64-msvc
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2024
…<try>

add const_eval_select macro to reduce redundancy

I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think?

I didn't apply this everywhere yet because I wanted to gather feedback first.

The second commit moves the macros from rust-lang#132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately.

Cc `@oli-obk` `@saethlin` `@tgross35`

try-job: dist-aarch64-msvc
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 5, 2024
…r=oli-obk

add const_eval_select macro to reduce redundancy

I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think?

I didn't apply this everywhere yet because I wanted to gather feedback first.

The second commit moves the macros from rust-lang#132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately.

Cc `@oli-obk` `@saethlin` `@tgross35`

try-job: dist-aarch64-msvc
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 5, 2024
…r=oli-obk

add const_eval_select macro to reduce redundancy

I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think?

I didn't apply this everywhere yet because I wanted to gather feedback first.

The second commit moves the macros from rust-lang#132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately.

Cc ``@oli-obk`` ``@saethlin`` ``@tgross35``

try-job: dist-aarch64-msvc
@rylev
Copy link
Member

rylev commented Nov 5, 2024

@RalfJung looks like most of the regressions are taking longer in LLVM related queries (e.g., LLVM_module_codegen_emit_obj) which doesn't make a ton of sense to me. Any ideas? The regressions are small enough that it could be argued we could just let this go, but I wanted to ask before marking as triaged.

@RalfJung
Copy link
Member Author

RalfJung commented Nov 5, 2024

Looking at just the first two benchmarks, this seems to have immediately gone back to the old state in the next PR.

@lqd
Copy link
Member

lqd commented Nov 5, 2024

Which graph are you looking at? Here are the first 2 benchmarks:
image
image

@RalfJung
Copy link
Member Author

RalfJung commented Nov 5, 2024

I looked at the first things it lists when clicking the "instruction count" link. But apparently I just can't read the graph. ;)

So, this PR does change the inline attributes for some of these functions. I can try tweaking them to see if that helps... but it'd be unfortunate if we have to custom-tweak them differently for different panic sites.

@RalfJung
Copy link
Member Author

RalfJung commented Nov 5, 2024

I'll do some experiments in #132662.

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2024
tweak attributes for const panic macro

Let's do some random mutations of this macro to see if that can re-gain the perf lost in rust-lang#132542.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 6, 2024
Rollup merge of rust-lang#132571 - RalfJung:const_eval_select_macro, r=oli-obk

add const_eval_select macro to reduce redundancy

I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think?

I didn't apply this everywhere yet because I wanted to gather feedback first.

The second commit moves the macros from rust-lang#132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately.

Cc ``@oli-obk`` ``@saethlin`` ``@tgross35``

try-job: dist-aarch64-msvc
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 6, 2024
tweak attributes for const panic macro

Let's do some random mutations of this macro to see if that can re-gain the perf lost in rust-lang#132542.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 6, 2024
tweak attributes for const panic macro

Let's do some random mutations of this macro to see if that can re-gain the perf lost in rust-lang#132542.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 6, 2024
tweak attributes for const panic macro

Let's do some random mutations of this macro to see if that can re-gain the perf lost in rust-lang#132542.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 6, 2024
tweak attributes for const panic macro

Let's do some random mutations of this macro to see if that can re-gain the perf lost in rust-lang#132542.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 13, 2024
…oss35

tweak attributes for const panic macro

Let's do some random mutations of this macro to see if that can re-gain the perf lost in rust-lang#132542.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 15, 2024
tweak attributes for const panic macro

Let's do some random mutations of this macro to see if that can re-gain the perf lost in rust-lang/rust#132542.
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. perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants