-
Notifications
You must be signed in to change notification settings - Fork 13.3k
polymorphization: various improvements #75155
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
polymorphization: various improvements #75155
Conversation
This commit changes polymorphization to return a `FiniteBitSet<u32>` rather than a `FiniteBitSet<u64>` because most functions do not use anywhere near sixty-four generic parameters so keeping a `u64` around is unnecessary in most cases. Signed-off-by: David Wood <[email protected]>
aae7ad4
to
e040736
Compare
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.
r=me
Do you want to deal with my nits here?
Also @bors rollup=never |
I'll address those here but I won't get around to it until tomorrow (turned everything off for the day). |
e040736
to
adea212
Compare
Fixed those nits, it was bugging me knowing that the PR had unresolved comments. |
This commit skips encoding empty polymorphization results - while polymorphization is disabled, this should be every polymorphization result; but when polymorphization is re-enabled, this would help with non-generic functions and those which do use all their parameters (most functions). Signed-off-by: David Wood <[email protected]>
This commit adds some debug assertions to `ensure_monomorphic_enough` which checks that unused generic parameters have been replaced with a parameter. Signed-off-by: David Wood <[email protected]>
adea212
to
63fadee
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 63fadee with merge 7a4d90c2e80578e57956455e81b511d8fb964d70... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 7a4d90c2e80578e57956455e81b511d8fb964d70 with parent 5f6bd6e, future comparison URL. |
Finished benchmarking try commit (7a4d90c2e80578e57956455e81b511d8fb964d70): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Nice @bors r+ rollup=never |
📌 Commit 63fadee has been approved by |
☀️ Test successful - checks-actions, checks-azure |
I don't understand how can this be a perf improvement when the polymorphization is still disabled. Does the pass run even when disabled but results are just not used?
Well, most functions won't have 32 generic parameters either 😄, I am curious if |
Polymorphisation still gets invoked but immediately returns with a result indicating that all generic parameters are used. Other parts of the PR which introduced polymorphisation are still present. Among these changes, the results of polymorphisation are being written to the cross-crate metadata so when polymorphisation is invoked while disabled, it would still preferentially load that from the cross-crate metadata - that's slower when the query is really fast (e.g. when polymorphisation is disabled). See this comment for this phrased differently. |
I see, that makes sense. Thanks for clarification 😉 |
I tried an inner function from a vague recollection of https://matklad.github.io/2023/01/26/rusts-ugly-syntax.html But it turns out compilers are good at compiler things: rust-lang/rust#75155
This PR includes a handful of polymorphisation-related changes:
FiniteBitSet<u32>
over aFiniteBitSet<u64>
as most functions won't have 64 generic parameters.ensure_monomorphic_enough
to make sure that polymorphisation did what we expect.r? @lcnr