Skip to content

Add search_with_limit#197

Merged
mwillsey merged 4 commits intoegraphs-good:mainfrom
yihozhang:search-with-limit
Aug 3, 2022
Merged

Add search_with_limit#197
mwillsey merged 4 commits intoegraphs-good:mainfrom
yihozhang:search-with-limit

Conversation

@yihozhang
Copy link
Copy Markdown
Contributor

@yihozhang yihozhang commented Jul 8, 2022

Currently, the BackoffScheduler will search each pattern, and if the match size is larger than the threshold, all the matches will be threw away and the rule will be banned. However, rules like AC will take an intractable amount of time and find ridiculously many matches, even when the threshold is small.

This PR tries to add an interface for search_with_limit and search_eclass_with_limit, while being compatible with the existing interface. With this PR, the e-matching machine will stop searching as soon as the number of matches hits the limit.

@yihozhang yihozhang marked this pull request as ready for review July 11, 2022 20:07
src/rewrite.rs Outdated
/// This should not return a SearchMatches with no substs.
fn search_eclass(&self, egraph: &EGraph<L, N>, eclass: Id) -> Option<SearchMatches<L>>;
///
/// Implementation of [`Searcher`] should implement one of
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, I appreciate the effort to not break the API, but this could be a little confusing because the "default" behavior is an infinite loop! I think we should require search_with_limit.

@yihozhang
Copy link
Copy Markdown
Contributor Author

I've removed the default implementation of search_with_limit @mwillsey

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