Lunderberg opened a new pull request, #13933:
URL: https://github.com/apache/tvm/pull/13933
Frequently, several related rewrite rules will have identical output
patterns and preconditions, differing only by the form of the input pattern.
For example, both `(x + y) - y` and `(y + x) - y` can be simplified to `x`.
Previously, these would be written as separate rewrite rules, which required
duplicating the output and preconditions.
This commit introduces `PMatchesOneOf`, which attempts a series of pattern
matches, stopping after the first successful match. The `PMatchesOneOf`
instance can be used as the input pattern for rewrite rules. A helper function
`matches_one_of` is also added, which returns an instance of `PMatchesOneOf`.
```c++
// Before
TVM_TRY_REWRITE( (x + y) - y, x);
TVM_TRY_REWRITE( (y + x) - y, x);
// After
TVM_TRY_REWRITE( matches_one_of( (x + y) - y,
(y + x) - y),
x);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]