-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fix ExtractReport generation and extracting in sub-graph #205
Conversation
// Extract an expression from the current state, returning the cost, the extracted expression and some number | ||
// of other variants, if variants is not zero. | ||
pub fn extract_expr(&mut self, e: Expr, num_variants: usize) -> Result<ExtractReport, Error> { |
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.
This function was previously used in a number of places before #176 and was now only being used in the un-tested Output command.
Do we want the report to be an enum? I feel that the single and multiple extraction case could be handled uniformly, no? |
After #176, the logic for the extraction now seems disjoint between the variants and the best. If there are variants, then there is no "best" expression extracted, and vice versa: Lines 879 to 909 in 9e53038
Whereas previously, if you extracted some variants, a best was also extracted. So I thought now an enum is appropriate? |
On another note, I noticed that As a solution, I am considering changing from a saved "report" to a callback on the EGraph which is called during extraction. Any thoughts on that? |
What simplify are we talking about? I’m not sure what the callback would do.
…On Wed, Aug 23, 2023 at 10:42 AM Saul Shanabrook ***@***.***> wrote:
On another note, I noticed that simplify is not working with this new
scheme, due to it running the extraction in a sub-egraph.
As a solution, I am considering changing from a saved "report" to a
callback on the EGraph which is called during extraction.
Any thoughts on that?
—
Reply to this email directly, view it on GitHub
<#205 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANTPTDSK7IR6UMXREKY44LXWY6IFANCNFSM6AAAAAA33ZJDC4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
otherwise it wont be preserved when after (pop) in de-sugared simplify
The
Instead of adding a report, it would call a callback on every extraction, so that from Python, we could still see what was extracted. I opted not to do this, due to the added complexity, and instead copy reports from children to parents when popping. |
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.
looks like a good change to me!
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.
This looks like a good change, and fixes a bug in preserving messages across push/pop.
Had a small nit before we merge.
In the switch to using an extract action over an extract command in #176, the saving of the extracted expressions in a report was lost.
This PR restores that behavior and also refactors the
ExtractReport
to be an enum. In #176, the extraction logic was also changed, so that if passed in a non-zero number of variants, it would no longer perform a normal cost-based extraction as well. So now the report captures these two cases as distinct.This PR also fixes printing the extracted expression in the
simplify
command, which was broken in #195.