`-Znext-solver` caching by lcnr · Pull Request #128828 · rust-lang/rust

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 8, 2024
[try-me]  `-Znext-solver` caching

try-job: x86_64-fuchsia

r? `@compiler-errors`

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 9, 2024
[try-me]  `-Znext-solver` caching

try-job: x86_64-fuchsia

r? `@compiler-errors`

@compiler-errors compiler-errors added S-experimental

Status: Ongoing experiment that does not require reviewing and won't be merged in its current state.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Aug 10, 2024
doing so requires overwriting global cache entries and
generally adds significant complexity to the solver. This is
also only ever done for root goals, so it feels easier to wrap
the `evaluate_canonical_goal` in an ordinary query if
necessary.
this allows us to only sometimes disable the global cache.

@lcnr

@lcnr

@lcnr

@lcnr

this makes it easier to maintain and modify going forward.
There may be a small performance cost as we now need to
access the provisional cache *and* walk through the stack
to detect cycles. However, the provisional cache should be
mostly empty and the stack should only have a few elements
so the performance impact is likely minimal.

Given the complexity of the search graph maintainability
trumps linear performance improvements.

@lcnr lcnr changed the title [try-me] -Znext-solver caching -Znext-solver caching

Aug 12, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 12, 2024
`-Znext-solver` caching

Updating stack entries pretty much exclusively happens lazily now, so `fn check_invariants` ended up being mostly useless and I've removed it. See https://gist.github.com/lcnr/8de338fdb2685581e17727bbfab0622a for the invariants we would be able to assert with it.

try-job: x86_64-fuchsia

r? `@compiler-errors`

compiler-errors

@lcnr

@bors bors added the S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

label

Aug 13, 2024

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request

Aug 13, 2024
…rrors

`-Znext-solver` caching

This PR has two major changes while also fixing multiple issues found via fuzzing.

The main optimization is the ability to not discard provisional cache entries when popping the highest cycle head the entry depends on. This fixes the hang in Fuchsia with `-Znext-solver=coherence`.

It also bails if the result of a fixpoint iteration is ambiguous, even without reaching a fixpoint. This is necessary to avoid exponential blowup if a coinductive cycle results in ambiguity, e.g. due to unknowable candidates in coherence.

Updating stack entries pretty much exclusively happens lazily now, so `fn check_invariants` ended up being mostly useless and I've removed it. See https://gist.github.com/lcnr/8de338fdb2685581e17727bbfab0622a for the invariants we would be able to assert with it.

For a general overview, see the in-process update of the relevant rustc-dev-guide chapter: https://hackmd.io/1ALkSjKlSCyQG-dVb_PUHw

r? `@compiler-errors`

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 13, 2024
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#127857 (Allow to customize `// TODO:` comment for deprecated safe autofix)
 - rust-lang#128410 (Migrate `remap-path-prefix-dwarf` `run-make` test to rmake)
 - rust-lang#128828 (`-Znext-solver` caching)
 - rust-lang#128873 (Add windows-targets crate to std's sysroot)
 - rust-lang#129034 (Add `#[must_use]` attribute to `Coroutine` trait)
 - rust-lang#129049 (compiletest: Don't panic on unknown JSON-like output lines)
 - rust-lang#129050 (Emit a warning instead of an error if `--generate-link-to-definition` is used with other output formats than HTML)

r? `@ghost`
`@rustbot` modify labels: rollup

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Aug 14, 2024
…rrors

`-Znext-solver` caching

This PR has two major changes while also fixing multiple issues found via fuzzing.

The main optimization is the ability to not discard provisional cache entries when popping the highest cycle head the entry depends on. This fixes the hang in Fuchsia with `-Znext-solver=coherence`.

It also bails if the result of a fixpoint iteration is ambiguous, even without reaching a fixpoint. This is necessary to avoid exponential blowup if a coinductive cycle results in ambiguity, e.g. due to unknowable candidates in coherence.

Updating stack entries pretty much exclusively happens lazily now, so `fn check_invariants` ended up being mostly useless and I've removed it. See https://gist.github.com/lcnr/8de338fdb2685581e17727bbfab0622a for the invariants we would be able to assert with it.

For a general overview, see the in-process update of the relevant rustc-dev-guide chapter: https://hackmd.io/1ALkSjKlSCyQG-dVb_PUHw

r? ``@compiler-errors``

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 14, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#128828 (`-Znext-solver` caching)
 - rust-lang#128954 (Explicitly specify type parameter on FromResidual for Option and ControlFlow.)
 - rust-lang#129054 (Subtree update of `rust-analyzer`)
 - rust-lang#129059 (Record the correct target type when coercing fn items/closures to pointers)
 - rust-lang#129071 (Port `run-make/sysroot-crates-are-unstable` to rmake)

r? `@ghost`
`@rustbot` modify labels: rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 14, 2024
Rollup of 6 pull requests

Successful merges:

 - rust-lang#128570 (Stabilize `asm_const`)
 - rust-lang#128828 (`-Znext-solver` caching)
 - rust-lang#128954 (Explicitly specify type parameter on FromResidual for Option and ControlFlow.)
 - rust-lang#129059 (Record the correct target type when coercing fn items/closures to pointers)
 - rust-lang#129071 (Port `run-make/sysroot-crates-are-unstable` to rmake)
 - rust-lang#129088 (Make the rendered html doc for rustc better)

r? `@ghost`
`@rustbot` modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Aug 14, 2024
Rollup merge of rust-lang#128828 - lcnr:search-graph-11, r=compiler-errors

`-Znext-solver` caching

This PR has two major changes while also fixing multiple issues found via fuzzing.

The main optimization is the ability to not discard provisional cache entries when popping the highest cycle head the entry depends on. This fixes the hang in Fuchsia with `-Znext-solver=coherence`.

It also bails if the result of a fixpoint iteration is ambiguous, even without reaching a fixpoint. This is necessary to avoid exponential blowup if a coinductive cycle results in ambiguity, e.g. due to unknowable candidates in coherence.

Updating stack entries pretty much exclusively happens lazily now, so `fn check_invariants` ended up being mostly useless and I've removed it. See https://gist.github.com/lcnr/8de338fdb2685581e17727bbfab0622a for the invariants we would be able to assert with it.

For a general overview, see the in-process update of the relevant rustc-dev-guide chapter: https://hackmd.io/1ALkSjKlSCyQG-dVb_PUHw

r? ```@compiler-errors```

@lcnr lcnr mentioned this pull request

Aug 15, 2024

@lcnr lcnr deleted the search-graph-11 branch

August 15, 2024 10:08

@lcnr lcnr mentioned this pull request

Aug 15, 2024

This was referenced

Aug 15, 2024

This was referenced

Sep 2, 2024

@lcnr lcnr mentioned this pull request

Feb 6, 2026