Skip to content

exponential blowup when rerunning due to changed provisional results #210

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

Open
lcnr opened this issue May 21, 2025 · 3 comments
Open

exponential blowup when rerunning due to changed provisional results #210

lcnr opened this issue May 21, 2025 · 3 comments

Comments

@lcnr
Copy link
Contributor

lcnr commented May 21, 2025

Diesel is currently really slow, @petervdonovan provided the following (likely related) minimization on zulip.

pub trait MapsTmf<E> {
    type Tmf;
}

pub struct BoundedNat;
pub struct Pair<L, R>(std::marker::PhantomData<(L, R)>);

pub trait Heap: Sized
+ MapsTmf<BoundedNat>
+ MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>
+ MapsTmf<Pair<Self::LeftOperand, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
+ MapsTmf<Pair<Self::RightOperand, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
+ MapsTmf<Pair<Self::Nat, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
+ MapsTmf<Pair<Self::F, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
+ MapsTmf<Pair<Self::Plus, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
+ MapsTmf<Pair<Self::Sum, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<BoundedNat>>::Tmf, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<Pair<Self::LeftOperand, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<Pair<Self::RightOperand, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<Pair<Self::Nat, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<Pair<Self::F, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<Pair<Self::Plus, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<Pair<Self::Sum, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<Pair<<Self as MapsTmf<BoundedNat>>::Tmf, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>
+ MapsTmf<<Self as MapsTmf<Pair<<Self as MapsTmf<Pair<Self::Nat, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>>::Tmf>
+ MapsTmf<<Self as MapsTmf<Pair<<Self as MapsTmf<Pair<Self::F, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>>::Tmf>
+ MapsTmf<<Self as MapsTmf<Pair<<Self as MapsTmf<Pair<Self::Plus, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>>::Tmf>
+ MapsTmf<Pair<<Self as MapsTmf<<Self as MapsTmf<Pair<<Self as MapsTmf<Pair<Self::Nat, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>>::Tmf>>::Tmf, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
+ MapsTmf<Pair<<Self as MapsTmf<<Self as MapsTmf<Pair<<Self as MapsTmf<Pair<Self::F, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>>::Tmf, <Self as MapsTmf<BoundedNat>>::Tmf>>>::Tmf>>::Tmf, <Self as MapsTmf<<Self as MapsTmf<BoundedNat>>::Tmf>>::Tmf>>
{
    // to trigger the perf issue, we do need multiple associated types involved
    // i.e., replacing all of them with Nat makes the issue go away
    type Plus;
    type LeftOperand;
    type RightOperand;
    type F;
    type Sum;
    type Nat;
}
@petervdonovan
Copy link

To clarify, I don't have special reasons to believe this is related to the diesel issue, other than that it is an example in which performance scaling is very bad when using -Znext-solver=globally.

@lcnr lcnr changed the title diesel performance regression exponential blowup when rerunning due to changed provisional results May 22, 2025
@lcnr
Copy link
Contributor Author

lcnr commented May 22, 2025

notes:

  • the above hang is due to an exponential amount of reruns when handling trait solver cycles
  • this is different from the slowdown in diesel which is does not have many such reruns

@lcnr lcnr moved this from unknown to potentially irrelevant in -Znext-solver=globally May 22, 2025
@lcnr
Copy link
Contributor Author

lcnr commented May 23, 2025

This issue, and the related hang in rayon (#109) could likely be fixed by adding some sort of "red-green tracking" to the search graph:

as in, when rerunning, instead of rerunning the whole subgraph, iteratively rerun the cyclic leaves and eagerly return if this part ends up with the same result.

Gonna look into this before stabilization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: potentially irrelevant
Development

No branches or pull requests

2 participants