Repository navigation
New solver opts for diesel (part 2) - #164234
nnethercote wants to merge 6 commits into
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
New solver opts for `diesel` (part 2)
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (f9f6136): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.5%, secondary -4.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 512.754s -> 487.269s (-4.97%) |
|
Perf results look excellent, especially for LLM disclosure: some of the ideas in the PR came from an LLM. I wrote the code and text myself. |
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
|
@lcnr: the first four commits are straightforward. The last one is a bit trickier and deserves careful checking. |
In `instantiate_and_apply_query_response`, instantiate the two instantiatable parts of the response separately. This requires adding a new method `instantiate_value` to `SolverDelegate` (r-a will need updating separately) and making a function of the same name in `rustc_infer` public. Do a similar thing for `State` in `instantiate_canonical_state`. This is equivalent behaviour that will enable further changes in subsequent commits.
Both `unify_query_var_values` call sites are preceded by a call to `instantiate_value` on the `var_values`. If instantiation changes any of the elements we end up interning an entirely new list, through `fold_list`. This commit changes things so that `unify_query_var_values` does instantiation on individual elements as it iterates, and avoids having to intern an entire list. This changes the caching behaviour in some cases, but overall it's a perf win.
This avoids a lot of calls to `instantiate_value`.
`Response` has `is_identity` and `is_identity_modulo_regions` methods. These are reasonably hot and traverse the response's `var_values` in very similar ways. This commit merges these two methods into a single method that returns a new three-value enum `IsIdentity`. It also pre-computes that `IsIdentity` for each response and stores it in the new `Response::var_values_is_identity` field. This is a perf win because it avoids repeated traversals.
If the response is an identity, and there are no external constraints, and the response var kinds match the canonical goal var kinds, this function is a no-op.
It provides a more principled and type-safe way to extract and process parts of a `Canonical` value.
62603ef to
1d54383
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I have addressed the comments.
|
A sequel to #163981. Details in individual commits.
Local measurements:
Also some small improvements on a range of other benchmarks.
r? @lcnr