Hi all ,
i was exploring MergeComposite pass and pattern language, when i discovered this strange behaviour.
Lets say , we have 2 patterns to be matched and fused if found:
- Dense + add
- Dense + add + relu.
After we create patterns for both of them using tvm pattern language , we append them to the pattern list and send this list to MergeComposite pass.
But it seems that the order of the patterns in the list plays a significant role in what pattern is getting recognised in case there are similar patterns in the list.
for ex :
If i create a pattern list = [dense_bias_pattern , dense_bias_relu_pattern] :
then i would never be able to match Dense+Bias_add+relu pattern , because as soon as pattern matcher figures out that dense_bias_pattern has been matched , then it stops matching the patterns altogether.
As a obvious solution , we need to append the patterns with higher depth first into the list (dense_bias_relu) , followed by patterns with smaller depth (dense_bias),.
Which i am not sure :
if this is the supposed way of creating a list of patterns , or is it a BUG?