This is an interesting case and thanks for pointing out. I investigated it a 
bit and identified that this is not the problem of MergeComposite but the 
pattern partition. Specifically, you can reproduce this problem by replacing 
`assert test_pattern.match(r) # True` with `assert test_pattern.partition(r)`.

In pattern partition, for each matched pattern, it creates 1) a set of new 
parameters with `FunctionVar_<group ID>_<var_ID>` as their names, and 2) a new 
set of nodes to be the partitioned function body. Finally, it uses the above 
two to create a partition function. The problem comes from 
dataflow_matcher.cc:647, where it tries to check if the new sets of nodes still 
matches the pattern. However, since the parameter names are changed, it doesn't 
match your variable name `x` anymore. That's why it throws the exception.

The fastest workaround is commenting out dataflow_matcher.cc:647 in case you 
need to move forward now. We should still solve this problem. At the first 
glance, I can think of two approaches.

1. Simply remove this check.
2. Canoncialize the pattern used in L647 by removing name specific matching.


@mbrookhart do you have any suggestion? Thanks.





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/mergecomposite-error-when-defining-custom-pattern/8505/2)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/bd50faa62792a10fec8f0ec66a3085bf0b6d29dd1f4b81af06c2927b362be6e8).

Reply via email to