-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exploding egraphs - Troubles defining rule sets working with eq-sat #190
Comments
Can you please try on this branch? #185 |
The debugging info should also be a lot better. |
Yes, there is indeed more debugging info (output for timeout=20). It seems the problem remains (if it is indeed a problem and not a misunderstanding on my side), as the graph is expanded to over 3000 nodes and saturation stops because of timeout. If it is helpful, I could try to run this with egg on rust. I refrained to do so for now, because I would first need to setup everything on the rust side.
|
I tried to run the example with egg in Rust by adapting https://github.com/JuliaSymbolics/Metatheory.jl/tree/master/scratch. I was not successful so far as egg does not seem to have the concept of a |
I will try to reproduce as soon as I can (im working RN). Is it super urgent? |
Not super urgent. If you have an idea that I could investigate myself or a hint which parts of the code I should look at that would be helpful. |
https://web.archive.org/web/20221226130645/https://github.com/egraphs-good/egg/discussions/60 This is an interesting discussion. It may be possible that the system is not terminating but I would have to investigate.
Does it terminate with the simple scheduler with a high iteration number and e-class limit? Associativity can be really nasty. It's usually associative-commutative-distributive rules that make e-graphs explode. I would like to explore theoretically how one can design a special kind of e-graph, with a special kind of e-node that is "associative", e.g. |
Thanks for pulling up this egg discussion. In fact, the very first "Nonterminating Example" with "associativity combined with annihilation" is more or less the same as I have posted here. |
It's mostly the entire What I suggest for more hardcore debugging is to draw an e-graph on a piece of paper and to the saturation step by step by hand, comparing it with one run with the simple scheduler, starting at super low iteration limit. Add some prints in Then you can see if it's inserting all the terms that are expected, or if it's inserting something extra. Please feel free to open a PR to the 3.0 branch if you find anything wrong, or in case you would just like to help out. Thanks a lot for the interest! |
I have continued to work on this, and I would say the issue is solved for me. So feel free to close this issue if you like. The following might be helpful for other users like me.
|
I have also fixed a few obvious mistakes in the ale/3.0 branch in my fork (branch 3.0-fixes) https://github.com/gkronber/Metatheory.jl/tree/3.0_fixes . Feel free to use the fixes or I can create a PR if you want. Let me know if I should split up the changes into multiple PR. |
A PR would be really appreciated!! Also, I found the comments above quite useful, so feel free to include them in the docs (maybe a new I'm curious about what you're working on, please send me a mail at |
I've opened a PR #191 |
Concerning the docs I suggest to create a new example with a new analysis example. I'll do this in a separate branch. |
Thanks, that would be really nice. The test files in So if you add a test file with an example there, and write some markdown in the docs it'll be instantly included in the docs, in the style of https://juliasymbolics.github.io/Metatheory.jl/dev/tutorials/while_interpreter/ |
Closing the issue. Thanks a lot for your contribution |
I struggle to define a set of rules that does not lead to exponentially growing egraphs which never saturate for simple expressions (Metatheory v2.0.2).
In the following code I try to fold constants. The rule set is designed to trigger the issue I observe:
In Iteration two a loop for an e-class is created which is later expanded in each iteration.
After two iterations:
After three iterations:
The default scheduler is the BackoffScheduler and it starts to ban some rules after a few iterations. However, I feel I should be able to solve this without relying on the scheduler.
The problem does not occur for the expression "1+1+1" . What do I miss?
The text was updated successfully, but these errors were encountered: