Skip to content

Scheduler: Allow configuring max number of iterations of rewrites #43

@alt-romes

Description

@alt-romes

As mentioned in #42, in runEqualitySaturation, we seemingly stop after 30 iterations.

This both seems ad-hoc and would be useful if it were configurable, so users could iteratively experiment running a few iterations of rewrites and observing it afterwards without reaching saturation.

I was thinking we could implement this by adding a method "maxRewriteIterations" to the Scheduler class. We try reaching saturation up to maxRewriteIterations and there we simply exit.

Then, we could have some datatype + instance like

newtype WithMaxIterations (n :: Nat) a = WithMaxIterations a

instance (KnownNat a, Scheduler a) => Scheduler n a where
    maxIterations (WithMaxIterations @n) = natVal (Proxy @n)
    -- for other methods delegate to `Scheduler a`

From a user perspective, to run N iterations of equality saturation you'd now have:

- runEqualitySaturation defaultBackoffScheduler <rewrites>
+ runEqualitySaturation (WithMaxIterations @5 defaultBackoffScheduler) <rewrites>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions