Open Audrius-St opened 1 year ago
Yes.
You have to:
@theory
astsize
)SaturationParams
EGraph
with the input expression and saturate!
it.extract!
and get your optimized output expression.The challenges you may encounter are the handling of associative-commutative equality rules (e.g. @rule ~a + (~b + ~c) == (~a + ~b) + ~c
), as they may "blow up" the e-graph.
You can check the test/integration
folder for a bunch of examples
test/integration/cas.jl
may be a good example :)
Thank you for the instructions and pointer to the example.
Hello,
After going through the Metatheory.jl documentation, there are a number of concepts that are novel and unfamilair to me, so I'm unable to discern if the package can do the following:
It is possible to use Metatheory.jl for code optimization in the sense of reducing the number of basic operations {+, -, x, /, ^} for large multivariate polynomial and polynomial-like expressions?
I'm currently using FORM 4.2.1 which performs a stochastic local search via stochastic hill climbing to find the near-minimal number of operations for a multivariate Horner scheme combined with CSEE [Common Subexpression Elimination]. FORM reduces the number of basic operations by about a factor of eight.
Is it possible to use Metatheory.jl to do the same or equivalent? It would be both useful and much simpler, from a coding perspective, to have an all-Julia solution.