Hello,
I was working on Relax IR module and trying to optimize certain patterns. I am going through relax pattern matcher examples and listed down below questions.
pre and post ops information will be available in the callback function when using Relay’s pattern matcher. But I don’t see any such information in rewriter function definition for Relax pattern matcher.
How to we retrieve pre and post ops when using relax pattern matcher?
Pattern of Interest: op_x > nn.maxpool > op_y
Can we identify Topi ops using relax pattern matcher?
Can we do pattern-matching on Relax IR to capture an op with its predecessor and successor ops?
As described in the above comment, I want to patter-match maxpool op, along with its predecessor op(requantize) and successor op(conv2d). The predecessor and successor ops can change over the IR module.
I was facing difficulty in giving successive op information as wildcard() while defining the pattern. Is it even possible to acheive this?
I see, the pattern rewriters in and Relay and Relax are implemented very differently, and due to the visit order of Relax ExprMutator, we don’t have any information about a successor expr when visiting a target expr to match and rewrite.
Yes, you can match against call_tir and check the name of the function being called.