K1504296 commented on issue #7799:
URL: https://github.com/apache/tvm/issues/7799#issuecomment-822023089


   It seems to be a problem related to LLVM. LLVM 6.0 returns a Segmentation 
Fault; however, LLVM 10.0 gets stuck during execution. Running with gdb and 
LLVM 10.0 the following is returned after interrupting the execution: 
   
   ```
   Thread 1 "python3" received signal SIGINT, Interrupt.
   0x0000ffff90fd60e8 in ?? () from /usr/lib/llvm-10/lib/libLLVM-10.so.1
   ```
   The segmentation fault occurs when trying to get the assembly code of the 
TVM model via : lib.get_source("asm") with an oc value of 32.
   
   Here is a minimal example which still causes the segmentation fault on 
aarch64: 
   
   ```
   import numpy as np
   import tvm
   from tvm import relay
   from tvm.relay import transform
    
   def _compile(ic, oc, target, data_layout, kernel_layout, dtypes):
           input_dtype, weight_dtype, output_dtype = dtypes
    
           n, h, w, ch, cw = 1, 64, 64, 3, 3
           data_shape = (n, ic, h, w)
           x = relay.var("x", relay.TensorType(data_shape, input_dtype))
           kernel_shape = (oc, ic, ch, cw)
    
           weight = relay.var("weight", relay.TensorType(kernel_shape, 
weight_dtype))
           y = relay.nn.conv2d(
               x,
               weight,
               kernel_size=(ch, cw),
               channels=oc,
               padding=(1, 1),
               dilation=(1, 1),
               data_layout=data_layout,
               kernel_layout=kernel_layout,
               out_dtype=output_dtype,
           )
           func = relay.Function([x, weight], y)
           wdata = np.random.rand(*kernel_shape) * 10
           parameters = {"weight": tvm.nd.array(wdata.astype(weight_dtype))}
    
           with tvm.transform.PassContext(opt_level=3):
               graph, lib, params = relay.build(func, target, params=parameters)
           assembly = lib.get_source("asm")
           return assembly
    
   target = "llvm -mcpu=core-avx2"
   fast_int8_dtypes = ("uint8", "int8", "int32")
   asm = _compile(
           ic=16,
           oc=32,
           target=target,
           data_layout="NCHW",
           kernel_layout="OIHW",
           dtypes=fast_int8_dtypes,
    )
   ```


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


Reply via email to