Uh oh!
There was an error while loading. Please reload this page.
Use DeepRejectCtxt to quickly reject ParamEnv candidates - #128776
Conversation
| { | ||
| return Err(NoSolution); | ||
| } | ||
There was a problem hiding this comment.
please also add this for NormalizesTo goals
| // Non rigid types may unify with each other. | ||
| if !lhs.is_known_rigid() && !rhs.is_known_rigid() { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
this means we never reject Param(T) == Param(U)
when treating params as rigid, compare their index
5520ecc to
a36b90fCompare
lcnr
left a comment
There was a problem hiding this comment.
and also in project::assemble_candidates_from_predicates to also use a fast-path when normalizing in the old solver
| match ty.kind() { | ||
| ty::Param(p) => match (self.treat_lhs_params, self.treat_rhs_params) { | ||
| (TreatParams::AsRigid, TreatParams::AsRigid) => param == p, | ||
| _ => true, |
| (ty::Placeholder(lhs), ty::Placeholder(rhs)) => lhs == rhs, | ||
| (ty::Placeholder(_), _) | (_, ty::Placeholder(_)) => false, | ||
| _ => false, |
There was a problem hiding this comment.
this function has to be an overapproximation, so incorrectly returning false would result in subtle bugs. Please exhaustively match here: (ty::Whatever | ty::Whatever | ...., _) | (_, ty::whatever | .....)
a36b90f to
77fc853Compare| (TreatParams::InstantiateWithInfer, TreatParams::AsRigid) | ||
| | (TreatParams::AsRigid, TreatParams::InstantiateWithInfer) | ||
| | (TreatParams::InstantiateWithInfer, TreatParams::InstantiateWithInfer) => { |
There was a problem hiding this comment.
| (TreatParams::InstantiateWithInfer,TreatParams::AsRigid) | |
| | (TreatParams::AsRigid,TreatParams::InstantiateWithInfer) | |
| | (TreatParams::InstantiateWithInfer,TreatParams::InstantiateWithInfer) => { | |
| (TreatParams::InstantiateWithInfer, _) | |
| | (_,TreatParams::InstantiateWithInfer) => { |
small style preference
| }, | ||
| ty::Pat(obl_ty, _) => { | ||
| } | ||
| (ty::Param(_), ty::Placeholder(_)) | (ty::Placeholder(_), ty::Param(_)) => true, |
There was a problem hiding this comment.
not really relevant as it doesnt ever happen on stable, but ty::Param and placeholder can't unify when treating params as rigid, so you can remove this branch and just use the self.treat_lhs_params == TreatParams::InstantiateWithInfer branch
lcnr
commented
Aug 9, 2024
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidates The description is on the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.5Basking.20for.20help.5D.20.60DeepRejectCtxt.60.20for.20param.20env.20candidates) r? `@lcnr`
bors
commented
Aug 9, 2024
bors
commented
Aug 9, 2024
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Aug 9, 2024
Finished benchmarking commit (7a0b60e): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking 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 may lead 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 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 -3.7%, secondary 2.9%)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%)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 sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 759.636s -> 760.059s (0.06%) |
lcnr
left a comment
There was a problem hiding this comment.
2 ideas for perf
- move all
(Rigid, _) | (_, Rigid) => falseinto a single branch at the end
and if that doesn't fix the regressions make the deep reject ctxt instead be generic over TreatParams 🤔
Bryanskiy
commented
Aug 12, 2024
A small statistical observation:
std:
We waste time more often in |
the impact on diesel seems quite desirable however. I think we can improve the performance of fast reject significantly so that even the ~20% hit rate from typenum is a perf improvement. |
lcnr
commented
Aug 12, 2024
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
Aug 12, 2024
Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidates The description is on the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.5Basking.20for.20help.5D.20.60DeepRejectCtxt.60.20for.20param.20env.20candidates) r? `@lcnr`
bors
commented
Sep 3, 2024
rust-log-analyzer
commented
Sep 3, 2024
The job Click to see the possible cause of the failure (guessed by this bot) |
bors
commented
Sep 3, 2024
💔 Test failed - checks-actions |
lqd
commented
Sep 3, 2024
@bors retry |
bors
commented
Sep 3, 2024
Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidates The description is on the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.5Basking.20for.20help.5D.20.60DeepRejectCtxt.60.20for.20param.20env.20candidates) r? `@lcnr`
rust-log-analyzer
commented
Sep 3, 2024
The job Click to see the possible cause of the failure (guessed by this bot) |
bors
commented
Sep 3, 2024
💔 Test failed - checks-actions |
I think that's also a spurious error? cc @rust-lang/infra |
Kobzol
commented
Sep 4, 2024
Sadly, yes. @bors retry |
bors
commented
Sep 6, 2024
bors
commented
Sep 6, 2024
☀️ Test successful - checks-actions |
rust-timer
commented
Sep 6, 2024
Finished benchmarking commit (26b5599): comparison URL. Overall result: ✅ improvements - no action needed@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)This benchmark run did not return any relevant results for this metric. CyclesResults (primary -1.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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 754.723s -> 756.217s (0.20%) |
Relevant upstream PR: rust-lang/rust#128776: The `TreatParams` enum variants were renamed. Resolves#3503 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
The description is on the zulip thread
r? @lcnr