-
Notifications
You must be signed in to change notification settings - Fork 72
Add support for a non-backtracking version of pattern disjunction #2242
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
Conversation
❌ 4 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
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.
Thanks! This will be super useful in avoiding bloating the patterns with parameters. Just mentioning a couple clarifying questions.
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.
Could you add an entry to https://github.com/microsoft/onnxscript/blob/main/docs/api/rewriter_pattern.md ? Thanks
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.
Thanks, will create a follow up PR converting some of the patterns in ort-fusion to utilize OrPatterns
Several fusions need to support multiple variants of a pattern (such as the optional presence of an Add or some such op). This PR adds support for a non-backtracking version of pattern disjunction. We can now use an "Or" between variants such as "Add(...)" and "MatMul(...)", for example.
Supporting unrestricted Or patterns is more complicated, since failure of one alternative will require backtracking, which will require unbinding any bindings added during the unsuccessful partial search. (We can consider that later, if it seems useful.)