Repository navigation
Commit 380a7fa
authored
Rollup merge of #163130 - Gmes23:fix-provisional-cache-invalidation, r=oli-obk
Fix provisional cache invalidation in the old trait solver (ran into probing ICE issue)
Hi I found this issue while trying to fix incremental compilation ICE issue in a ledger system i was working at owrk(luckily it panic early)
I noticed that ! in ProvisionalEvaluationCache::on_failure at compiler/rustc_trait_selection/src/traits/select/mod.rs:3094 was not doing its intended behavior. The documentation says that on_failure should remove provisional cache entries created at or after the failing node, meaning entries where from_dfn >= dfn. The current condition is !eval.from_dfn >= dfn. Since from_dfn is usize and ! binds more tightly than >=; this applies a bitwise NOT to from_dfn before comparing it with dfn. For the small DFN values we normally encountered here, that produces a huge number causing the condition to always be true on_failure then clears the entire provisional cache instead of preserving entries created before the failing node. This PR removes the ! so fn works as is intended behavior makign the comments true, I also compared local compilation times using the old trait solver and emitting metadata only. The median results were:
```
Test case Before With ! removed
Regression test for #150907 32.56 ms 32.44 ms
Synthetic cyclic types with an error 32.15 ms 32.18 ms
Synthetic cyclic types without errors 27.15 ms 26.92 ms
```
I tested this on all avilable toolchains, all seem to produce similar results.
This DOES NOT fix the ICE issue it still happens this is just a correction on behavior and that boost performance and then i can fix the ICE issue, The ICE issue I fix by removing the tainted_by_errors() lines 1098-1105 else condition
(introduced by pr #155355 from what i believe was fixing a performance issue so timing is important)that allows caching results that depend on the evaluation stack
This fix plus the removal of the ! makes the existing regression test much slower yet faster than the original issue which was 30s (i believe)
(here is a small sample data i took)
```
Change Time
Baseline 0.035 s
Remove the tainted_by_errors() branch 30.59 s
Remove that branch and remove the ! 2.73 s
```
While its not beating the current baseline it does correctly not throw a panic(which has cause issues in our ledger), I would like to fix the ICE issue, but that needs more work if the intention is to equal the .03 time and i heard this trait solver is being deprecrated soon? For now I am keeping this PR focused on the provisional cache invalidation and would like to follow up on the ICE in a separate PR1 file changed
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3082 | 3082 | | |
3083 | 3083 | | |
3084 | 3084 | | |
3085 | | - | |
3086 | | - | |
3087 | | - | |
3088 | | - | |
3089 | | - | |
3090 | | - | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
3091 | 3091 | | |
3092 | 3092 | | |
3093 | 3093 | | |
3094 | | - | |
| 3094 | + | |
3095 | 3095 | | |
3096 | 3096 | | |
3097 | 3097 | | |
| |||
0 commit comments