Copyright | (c) Fabricio Olivetti 2021 - 2024 |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | |
Safe Haskell | None |
Language | Haskell2010 |
Algorithm.EqSat
Description
Equality Saturation for SRTree Heavily based on hegg (https:/github.comalt-romes/hegg by alt-romes)
Synopsis
- type Scheduler a = State (IntMap Int) a
- fromJust :: Maybe a -> a
- eqSat :: forall (m :: Type -> Type). Monad m => Fix SRTree -> [Rule] -> CostFun -> Int -> EGraphST m (Fix SRTree)
- type CostMap = Map EClassId (Int, Fix SRTree)
- recalculateBest :: forall (m :: Type -> Type). Monad m => CostFun -> EClassId -> EGraphST m (Fix SRTree)
- runEqSat :: forall (m :: Type -> Type). Monad m => CostFun -> [Rule] -> Int -> EGraphST m (Bool, Int)
- applySingleMergeOnlyEqSat :: forall (m :: Type -> Type). Monad m => CostFun -> [Rule] -> EGraphST m ()
- matchWithScheduler :: Int -> Int -> Rule -> Scheduler [Rule]
Documentation
type Scheduler a = State (IntMap Int) a Source #
The Scheduler
stores a map with the banned iterations of a certain rule .
TODO: make it more customizable.
eqSat :: forall (m :: Type -> Type). Monad m => Fix SRTree -> [Rule] -> CostFun -> Int -> EGraphST m (Fix SRTree) Source #
runs equality saturation from an expression tree, a given set of rules, and a cost function. Returns the tree with the smallest cost.
recalculateBest :: forall (m :: Type -> Type). Monad m => CostFun -> EClassId -> EGraphST m (Fix SRTree) Source #
recalculates the costs with a new cost function
runEqSat :: forall (m :: Type -> Type). Monad m => CostFun -> [Rule] -> Int -> EGraphST m (Bool, Int) Source #
run equality saturation for a number of iterations