-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Implement a first version of RFC 3525: struct target features #127537
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jieyouxu (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
Rerolling because this touches metadata encoding and codegen attributes that I'm not familiar with. r? compiler |
I know it is early but just as a heads up, you will need to add tests, probably at Also a test at |
Yup, I will add these tests when the time comes :-) probably makes sense to test codegen too - the easiest way I can think of relies on inliner behaviour to some extent, which IMO is not great, but I am not sure there's a better option. I will ask for pointers later though ;-) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ab6ad4d
to
454520b
Compare
☔ The latest upstream changes (presumably #128298) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #125443) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for patience 😅
This comment has been minimized.
This comment has been minimized.
d898105
to
7aba3ad
Compare
☀️ Test successful - checks-actions |
Finished benchmarking commit (acb4e8b): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression 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)Results (primary 0.9%, secondary 2.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.
CyclesResults (primary -2.3%, secondary -2.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.
Binary sizeResults (primary 0.5%, secondary 1.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.
Bootstrap: 753.9s -> 791.393s (4.97%) |
Perf results: significant instruction count and binary size regressions. (Also some walltime improvements, but they look like they might be reverting from a bad previous run and probably aren't meaningful.) @veluca93: no performance runs were done before merging. Are these regressions expected? Any ideas on how to eliminate them? |
On instruction count: I expected some compile time increase, although the extent of it is perhaps slightly surprising to me. There's a fixme about caching some intermediate values in the codebase that will probably mitigate the issue. On binary size, OTOH, I am somewhat surprised - what does that benchmark measure exactly? This PR adds some fields to rmeta, but I am not sure if that should have such an effect... |
For binary benchmarks, it measures the final binary size. For library benchmarks, it records the size of rlibs, so executable code + metadata. |
I see. Since this PR adds new metadata to ADTs, then the size increase for libraries is indeed expected. Results for binaries are within noise thresholds, so that checks out. I am not sure if it is possible to mitigate this - the field I added is a |
Visiting for weekly rustc-perf triage
|
struct_target_features: reduce serialized rmeta Reduce the amount of serialized information in rmeta. This should fix the binary size regression in rust-lang#127537 and *may* also fix the speed regression. r? compiler-errors Tracking issue: rust-lang#129107
struct_target_features: reduce serialized rmeta Reduce the amount of serialized information in rmeta. This should fix the binary size regression in rust-lang#127537 and *may* also fix the speed regression. r? compiler-errors Tracking issue: rust-lang#129107
struct_target_features: cache feature computation. This commit moves the type-recursion to a query, causing it to be cached and (hopefully!) fixing the instruction-count regression from rust-lang#127537. r? compiler-errors Tracking issue: rust-lang#129107
…r=fmease Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver We shouldn't encourage using `rustc_type_ir::inherent` outside of the new solver[^1], though this can happen by accident due to rust-analyzer, for example. See rust-lang#127537 (comment) for an example in practice. r? fmease [^1]: Unless we go the fully radical approach of always using these inherent methods everywhere in favor of inherent methods, which would be a major overhaul of the compiler, IMO. I don't really want to consider that possibility right now, tho.
We have a suspicion that this PR might have introduced an instability of perf. results that started appearing in recent days. Opened #129854 to see if a revert helps. |
Revert "Auto merge of rust-lang#127537 - veluca93:struct_tf, r=BoxyUwU" This reverts commit acb4e8b, reversing changes made to 100fde5. Opening to see if this can help resolve the recent perf. results [instability](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Weird.20perf.20results).
…r=fmease Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver We shouldn't encourage using `rustc_type_ir::inherent` outside of the new solver[^1], though this can happen by accident due to rust-analyzer, for example. See rust-lang#127537 (comment) for an example in practice. r? fmease [^1]: Unless we go the fully radical approach of always using these inherent methods everywhere in favor of inherent methods, which would be a major overhaul of the compiler, IMO. I don't really want to consider that possibility right now, tho.
Revert "Auto merge of rust-lang#127537 - veluca93:struct_tf, r=BoxyUwU" This reverts rust-lang#127537 (commit acb4e8b), reversing changes made to 100fde5. Opening to see if this can help resolve the recent perf. results [instability](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Weird.20perf.20results).
…r=fmease Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver We shouldn't encourage using `rustc_type_ir::inherent` outside of the new solver[^1], though this can happen by accident due to rust-analyzer, for example. See rust-lang#127537 (comment) for an example in practice. r? fmease [^1]: Unless we go the fully radical approach of always using these inherent methods everywhere in favor of inherent methods, which would be a major overhaul of the compiler, IMO. I don't really want to consider that possibility right now, tho.
…r=fmease Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver We shouldn't encourage using `rustc_type_ir::inherent` outside of the new solver[^1], though this can happen by accident due to rust-analyzer, for example. See rust-lang#127537 (comment) for an example in practice. r? fmease [^1]: Unless we go the fully radical approach of always using these inherent methods everywhere in favor of inherent methods, which would be a major overhaul of the compiler, IMO. I don't really want to consider that possibility right now, tho.
Rollup merge of rust-lang#129678 - compiler-errors:type-ir-inherent, r=fmease Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver We shouldn't encourage using `rustc_type_ir::inherent` outside of the new solver[^1], though this can happen by accident due to rust-analyzer, for example. See rust-lang#127537 (comment) for an example in practice. r? fmease [^1]: Unless we go the fully radical approach of always using these inherent methods everywhere in favor of inherent methods, which would be a major overhaul of the compiler, IMO. I don't really want to consider that possibility right now, tho.
This PR is an attempt at implementing rust-lang/rfcs#3525, behind a feature gate
struct_target_features
.There's obviously a few tasks that ought to be done before this is merged; in no particular order:
rmeta
(assuming I even understood that correctly :-))That said, as I am definitely not a
rustc
expert, I'd like to get some early feedback on the overall approach before fixing those things (and perhaps some pointers forrmeta
...), hence this early PR :-)Here's an example piece of code that I have been using for testing - with the new code, the calls to intrinsics get correctly inlined:
Tracking: