IshwaraK opened a new issue #4748: Segmentation Fault at Optimization level 2 
and above
URL: https://github.com/apache/incubator-tvm/issues/4748
 
 
   The below reduced test-case shows segmentation fault in TVM compiler stack 
at the optimization level 2 and above. The problem is in call to 
'lib.get_source()', as constant folding optimizes away whole graph and lib 
object becomes NULL.
   
       import tvm
       from tvm import relay
       from tvm.contrib import graph_runtime
       import numpy as np
       
       data_shape = (2, 2)
       matrix_x = relay.var('matrix_x', shape=data_shape, dtype='int32')
       matrix_y = relay.var('matrix_y', shape=data_shape, dtype='int32')
       
       add = relay.op.add(matrix_x, matrix_y)
       fun = relay.Function([matrix_x,matrix_y], add)
       relayMod = relay.Module({})
       fname = relay.GlobalVar('main')
       relayMod.entry_func = fname
       relayMod[fname] = fun
       print("Relay Module:\n", relayMod)
       
       x_data = np.matrix('1 2; 3 4', dtype='int32')
       y_data = np.matrix('5 6; 7 8', dtype='int32')
       params = {
           "matrix_x" : x_data,
           "matrix_y" : y_data,
       }
       with relay.build_config(opt_level=3):
           graph, lib, params = relay.build(relayMod, "llvm", params=params)
       print("Model graph:\n", graph)
       print("\nModel parameters:")
       for item in params:
           print(item, ":\n", params[item])
       print("\nOperator library:\n", lib.get_source())
       mod = graph_runtime.create(graph, lib, ctx=tvm.cpu(0))
       mod.set_input(**params)
       mod.run()
       res = mod.get_output(0).asnumpy()
       print("inference:\n", res)
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to