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

Separate optimization of functions #660

Merged
merged 10 commits into from
Nov 13, 2024
Merged

Separate optimization of functions #660

merged 10 commits into from
Nov 13, 2024

Conversation

oflatt
Copy link
Member

@oflatt oflatt commented Nov 11, 2024

This PR adds separate optimization of functions. This allows us to run the egraph separately for different functions, while still doing inlining and all our optimizations we did before.
We could also in the future choose which functions to batch together.

The extractor is now aware of what function it is extracting, which I plan to leverage soon for a better cost model of recursive functions.

@oflatt oflatt changed the base branch from main to oflatt-before-linearity November 11, 2024 21:13
@oflatt oflatt marked this pull request as ready for review November 11, 2024 21:34
Base automatically changed from oflatt-before-linearity to main November 12, 2024 19:42
pub fn build_program(
program: &TreeProgram,
inline_program: Option<&TreeProgram>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both program and inline_program? How are they different? Is inline_program the "full" program and program a batch of programs to be optimized?

Copy link
Member Author

@oflatt oflatt Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline program is the original program for this iteration- if you make them the same, you might inline something that has already been inlined, causing blowup

br v4_ .b12_ .b13_;
.b12_:
v11_: int = id c5_;
v11_: int = select v4_ c5_ c10_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that the select optimization is applied. Any idea why it was not applied before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's flaky, probably an extraction problem or same cost

@oflatt oflatt merged commit efdc6e2 into main Nov 13, 2024
4 checks passed
@oflatt oflatt deleted the oflatt-separate-compilation branch November 13, 2024 22:30
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

Successfully merging this pull request may close these issues.

2 participants