-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
test - simulate default discriminant start at 1 #88984
Conversation
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
|
This comment has been minimized.
This comment has been minimized.
bbc83a5
to
e682240
Compare
Wouldn't it be simpler to adjust the compiler logic that determines the implicit discriminants when no explicit ones are given? That'll also catch those in external crates. |
This comment has been minimized.
This comment has been minimized.
There are a couple of enums in the compiler that expects to have discriminant zero, without it being explicit. My first try to change the logic for default discriminant didn't work either. Can't remember if it was because of before mentioned reason or not Should have another go at it now. |
This comment has been minimized.
This comment has been minimized.
30cb873
to
d1114f3
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit d1114f32699b93b71f26be21450fe73a1e5950bc with merge b5182a3a0771fd7758d02a252cd70807f9e268d3... |
☀️ Try build successful - checks-actions |
Queued b5182a3a0771fd7758d02a252cd70807f9e268d3 with parent 2c7bc5e, future comparison URL. |
Finished benchmarking commit (b5182a3a0771fd7758d02a252cd70807f9e268d3): comparison url. Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. 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 led 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 |
Thanks for the perf-run. I tried to change Get a lot of coredumps instead. |
What does this mean? I would have assumed we'd need to remove the -1 in rust/compiler/rustc_middle/src/ty/util.rs Line 71 in cdeba02
rust/compiler/rustc_middle/src/ty/util.rs Line 80 in cdeba02
|
Thanks! But I don't want to forbid zero as discriminant. I think your change would make it so that we can only fit 255 variants in an Anyhow the change still seem to result in same problem: Lot of coredumps |
right, I misunderstood the intention. Just wrapping around normally is good then. Can you push your changes somewhere so we can be sure to be talking about the same things? |
Pushed my best guess. Intention: For I get a lot of coredumps for this. |
my recommendation for debugging it is putting it behind a feature gate and then creating a very simple test. compile the test once with the feature and once without, but with explicit discriminants that should be equal and compare various tracing dumps between the two runs to see how things differ. |
What is motivation behind an additional optimize argument to I would also look at codegen / interpreter of niche encoding, if I recall correctly it assumes that discriminants start at 0. |
6706274
to
e9b129c
Compare
Thanks to both of you. I have pushed a new version that only has one test failing for |
This comment has been minimized.
This comment has been minimized.
Good catch. |
e9b129c
to
71fc538
Compare
@tmiasko I looked at codegen / interpreter of niche encoding, but didn't find anything apparent about discriminant zero. |
The most recent implementation excludes enums with variants containing fields from optimization, so this should eliminate the niche encoding from consideration, shouldn't it? You could additionally verify that with an assertion that Regarding the errors from the CI, the |
You are right about niche encoding. |
triage: |
Been stuck on this for a while, will try and look at it again |
WIP/TEST
Trying to gauge the general performance impact of enums not starting with zero.
This is only for
repr(rust)
Please sate my curiosity with a perf-run
Edit: sorry - didn't mean to set of all the sirens...