-
Notifications
You must be signed in to change notification settings - Fork 34
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
Prune once before extraction instead of every eqsat iteration #1109
base: main
Are you sure you want to change the base?
Conversation
5acb07a
to
1fd16bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, if need be I'd be willing to merge this as is but I think it would be nicer if we could remove the old pruning code, which I think would mean changing the lib.rs
code to not use is_some
and instead just scan the whole e-class for leaf nodes. Do you think that's reasonable? It'd let us delete some code (good) and I don't think we'll want to keep pruning around once we get rid of it.
I'll remove the old pruning code! I agree, I don't think it needs to be configurable. Regarding the |
I didn't mean removing that conditional on its own, but I think we can prune all enodes for classes with any leaf node, right? At least I think any variable should also be good? |
50ea970
to
c9389bd
Compare
Awesome, looks like even more performance gains with your pruning approach (up to 9%). I'm surprised it worked! I thought that pruning e-classes with at least one e-node would result in an e-graph that only contains the shortest expressions. Since the optimal floating point expression is sometimes longer than the original expression, I thought accuracy would go down. Are e-graphs used differently than I expected? |
Yes, though it also makes low-accuracy results worse. I’d love to investigate, but willing to merge on balance without that. Unrelated, but strongly encourage thinking about speedups in absolute, not relative, amounts. 5min not 9%. Otherwise easy to confuse self with iterated improvements, like Amdahl law. |
My plan:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good (though please fix comment). My plan remains as above—I'll see if I find time to investigate the things I want to, but if I don't in a few days I'll just tell you to merge it.
c9389bd
to
7616e53
Compare
Update: I figured out why Rump from Stadherr changes input accuracy; it's a Herbie bug but not related to this PR, so that's no longer a blocker. I did notice that the accuracy is now worse than |
Thank you for the thorough investigation! I’m also willing to be thorough. :)
Are you referring to Rump from Stadherr specifically or the overall benchmark suite? I can experiment with reinstating the constant fold pruning and trying different seeds. |
Overall |
Just the max abs exponent portion of #1109
7616e53
to
1fb9ba9
Compare
pow
constant foldingRuntime performance is improved by 6-8%, from ~70 minutes for a full benchmark run on
main
to ~65 minutes with this PR. Accuracy changes are a tossup (some worse, some better).In this context, "pruning" means removing e-nodes with children if its e-class contains at least one leaf e-node.