Replies: 3 comments 2 replies
-
Cool!! I think @oflatt is the right person to answer this. |
Beta Was this translation helpful? Give feedback.
-
Great question! Let me answer this in three parts. backwards rewritesUnfortunately, there's no way to turn off "backwards rewrites" in the egraph. At a high level, this is because the congruence closure algorithm treats all of the actual matches of rewrites as equalities with no direction. At a deeper level, it's very difficult to attempt to generate a proof with only forward rewrites due to proofs of congruence. Imagine we need a proof of congruence between egraphs / proofs of minimum sizeIn fact, finding the size of the minimum possible e-graph that has the solution is an NP-complete problem, since it's the same problem as finding a proof of optimal size (https://link.springer.com/article/10.1007/s10703-017-0283-x). So we can't actually figure out what the optimal schedule of rewrites would be to arrive at your solution. However, egg has a greedy algorithm that does it's best to minimize the proof size. It's not in the latest egg release yet, so you need to use the lastest proofs as a baseline for rewrite schedulingIt's a really interesting idea to use proofs as a baseline for how good your scheduler is! We have thought about it too, but nobody has tried it yet. The proof is our best guess at the smallest egraph that contains the solution. So instead of using the size of your smaller egraph, I suggest using the number of unique equalities in the proof as your baseline (the smallest egraph we have discovered that contains your target equality) and compare to the number of equalities in the larger egraph. |
Beta Was this translation helpful? Give feedback.
-
Here's the arxiv for the paper! |
Beta Was this translation helpful? Give feedback.
-
What would be the quickest way to turn off using backward rewrites to explain the equivalence between two expressions on an e-graph?
For context, I am investigating rewrite scheduling techniques to delay the exponential blowup of the e-graph. My strategy is to run a testcase using the SimpleScheduler for a large number of iterations, to get an empirically optimal solution. Then, I will run the testcase using an experimental scheduler, and try to reach an e-graph that is much smaller, but still contains the same optimal solution.
I want to get an understanding of the upper bound on the performance of any scheduler that applies all matches on a rewrite (does not rewrite only certain parts of the e-graph), by estimating the size of the minimum possible e-graph that still contains an optimal solution. To do this I am running the testcase with only the rewrites that appear in the proof of the optimal solution. However, due to the presence of backwards rewrites in the proof, I am rarely able to make an e-graph that contains the target solution (missing some crucial forward rewrites).
Beta Was this translation helpful? Give feedback.
All reactions