Skip to content
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

[Tree Optimizer] Unnecessary Let deletion #247

Open
oflatt opened this issue Jan 12, 2024 · 3 comments
Open

[Tree Optimizer] Unnecessary Let deletion #247

oflatt opened this issue Jan 12, 2024 · 3 comments
Assignees

Comments

@oflatt
Copy link
Member

oflatt commented Jan 12, 2024

An important optimization to enable other optimizations is to get rid of unnecessary lets.
In the case of pure computations, let bindings are not necessary and they should be removed- maybe destructively?

For impure computations that are used just once, the let binding is not necessary. However, we must be careful to avoid bugs since later the e-class could have representatives that use it twice.

@yihozhang
Copy link
Collaborator

Let bindings save duplicate evaluations even for pure computations, e.g.

let x = sum(1, 10000) in
x+x

vs

sum(1, 10000) + sum(1, 10000) 

so we need to be careful here.

@oflatt
Copy link
Member Author

oflatt commented Jan 12, 2024

Yeah, that's a great point.
What if we used DAG-based extraction, even for trees? It could count things multiple times when they are impure

@yihozhang yihozhang self-assigned this Jan 23, 2024
@yihozhang
Copy link
Collaborator

Related to gamma/switch pull in

@oflatt oflatt changed the title [Tree unique] Unnecessary Let deletion [Tree Optimizer] Unnecessary Let deletion Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants