| Copyright | (c) Fabricio Olivetti 2021 - 2024 |
|---|---|
| License | BSD3 |
| Maintainer | fabricio.olivetti@gmail.com |
| Stability | experimental |
| Portability | |
| Safe Haskell | Safe-Inferred |
| 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 :: Fix SRTree -> [Rule] -> CostFun -> Int -> EGraphST (Fix SRTree)
- type CostMap = Map EClassId (Int, Fix SRTree)
- getBest :: EClassId -> EGraphST (Fix SRTree)
- recalculateBest :: CostFun -> EClassId -> EGraphST (Fix SRTree)
- runEqSat :: CostFun -> [Rule] -> Int -> EGraphST (Bool, Int)
- matchWithScheduler :: DB -> Int -> Int -> Rule -> Scheduler [(Rule, (Map ClassOrVar ClassOrVar, ClassOrVar))]
Documentation
type Scheduler a = State (IntMap Int) a #
The Scheduler stores a map with the banned iterations of a certain rule .
TODO: make it more customizable.
eqSat :: Fix SRTree -> [Rule] -> CostFun -> Int -> EGraphST (Fix SRTree) #
runs equality saturation from an expression tree, a given set of rules, and a cost function. Returns the tree with the smallest cost.
getBest :: EClassId -> EGraphST (Fix SRTree) #
gets the best expression given the default cost function
recalculateBest :: CostFun -> EClassId -> EGraphST (Fix SRTree) #
recalculates the costs with a new cost function
runEqSat :: CostFun -> [Rule] -> Int -> EGraphST (Bool, Int) #
run equality saturation for a number of iterations
matchWithScheduler :: DB -> Int -> Int -> Rule -> Scheduler [(Rule, (Map ClassOrVar ClassOrVar, ClassOrVar))] #
matches the rules given a scheduler