tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] comaniac opened a new issue #5605: [BUG] Pattern Reeriter Seg Fault
Date Sat, 16 May 2020 00:59:59 GMT

comaniac opened a new issue #5605:
URL: https://github.com/apache/incubator-tvm/issues/5605


   I was trying the new merged pattern language. Specifically, my goal is to create a function
for the matched pattern and rewrite the pattern with a function call, which is very similar
to fusion.
   
   However, the following example encounters segmentation fault. I breifly located the position
and found that it was in dominator analysis. Specifically in `LeastCommonAncestor`. It crashes
when visiting an input node with null parent.
   
   Here is the code snippet to reproduce the problem. I am not sure if I wrote the pattern
in the right way, but it works fine with `pattern.match`.
   
   cc @mbrookhart 
   
   ```python
   import tvm
   from tvm import relay
   from tvm.relay.dataflow_pattern import *
   
   class PatternCallback(DFPatternCallback):
       def __init__(self, pattern):
           self.pattern = pattern
   
       def callback(self, pre, post, node_map):
           return post
   
   def gen():
       x = relay.var('x')
       y = relay.var('y')
       y_add = relay.add(y, y)
       n0 = relay.add(x, y_add)
       n1 = relay.add(x, n0)
       return relay.add(n1, n0)
   
   def pattern():
       a = wildcard()
       b = wildcard()
       n0 = is_op('add')(a, b)
       n1 = is_op('add')(n0, a)
       return is_op('add')(n0, n1)
   
   out = gen()
   pat = pattern()
   print(pat.match(out))
   new_out = rewrite(PatternCallback(pat), out)
   print(new_out)
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message