Hello,
I was looking at the Arm EthosU integration in TVM and noticed that there was a new conv2d Relay operator defined. Obviously this operator is only legal/valid for offloading onto the EthosU, so they decide to replace standard Relay operator patterns inside of a Composite with this single operator. That makes it easier to define their own Relay->Tir pipeline since they only need to parse one node and all its parameters/attributes.
I was wondering though, how could this (or any) new Relay operator be added into the pattern matching infrastructure?
I guess what I would like is the following
#Original Relay module using standard Relay operators
%1 = standard_relay_op_1(...)
%2 = standard_relay_op_2(...)
#Assume I have some custom Relay operators that each match to one of those from above
%1 = my_custom_relay_op_1(...)
%2 = my_custom_relay_op_2(...)
#Now, I further have a third Relay operator which matches exactly to the pattern above
%1 = my_custom_rela_op_3(....)
I know in this simple case there is a solution using the already available pattern matcher infrastructure (i.e. defining the pattern to be match of my_custom_relay_op_3
before the others in the pattern list). But let’s say for more complex situations I couldn’t just solve it via position in the pattern list.
How do I add my_custom_relay_op_{1,2}
to the pattern matching infrastructure such that I can define the pattern matching for my_custom_relay_op_3
to have statements/expression like is_op('my_custom_relay_op_1')
?
Thank you all
Friendly mention @comaniac