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

[Reducer] Speed up OperationPruner #5311

Merged
merged 1 commit into from
Jun 4, 2023

Conversation

maerhart
Copy link
Member

@maerhart maerhart commented Jun 4, 2023

  • Don't delete terminators because they are typically verified to be present and can usually not be removed without removing the whole block.
  • Cache the user map instead of traversing the whole module again for each matched operation. This means that not all operations that could have been removed are actually removed in one iteration, but doing multiple iterations with this faster implementation is usually a lot faster than doing one more thorough iteration (there might be some corner cases where it's slightly slower, but probably not relevant in practice).

No unit test because it's only a performance optimization and the result should stay the same when performed until convergence.

Reduces the original file of #5307 with size 23672972 to size 2208 in 33 sec when only including the operation-pruner and cse patterns. Didn't measure time without this PR, because I didn't want to let it run for hours 😄

@maerhart maerhart added the Reducer Related to `circt-reduce` label Jun 4, 2023
Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for improving the reducer 🙏!

@maerhart maerhart merged commit 7233d32 into main Jun 4, 2023
@maerhart maerhart deleted the dev/maerhart/reducer-operation-pruner branch June 4, 2023 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reducer Related to `circt-reduce`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants