Relay.build target: rasp3b, something wrong

when i try use relay to build mxnet , target = llvm is work,it can run, but when i change target to rasp3b,i get error。i can‘’t use nnvm ,it doesn’t support L2norm

Environment

  • system: VM Ubuntu 18.04
  • python: 3.6
  • tvm: 0.6.dev

Code to reproduce

> target = "llvm"
> target = tvm.target.arm_cpu('rasp3b')
> 
> sym, arg_params, aux_params = load_checkpoint('facedetect', 0)

> parser = argparse.ArgumentParser()
> 
> parser.add_argument("-f", "--frontend", help="Frontend for compilation, nnvm or relay",
>                     type=str, default="relay")
> 
> args = parser.parse_args()
> 
> if args.frontend == "relay":
>     net, params = relay.frontend.from_mxnet(sym, {"data": dshape}, arg_params=arg_params, aux_params=aux_params)
>     with relay.build_config(opt_level=2):
>         graph, lib, params = relay.build(net, target, params=params)
> elif args.frontend == "nnvm":
>     net, params = from_mxnet(sym, arg_params, aux_params)
>     with compiler.build_config(opt_level=3):
>         graph, lib, params = compiler.build(net, target, {"data": dshape}, params=params)
> else:
>     parser.print_help()
>     parser.exit()

crash info

> Traceback (most recent call last):
>   File "/home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/relay/backend/compile_engine.py", line 92, in lower
>     return _backend._CompileEngineLower(self, key)
>   File "tvm/_ffi/_cython/./function.pxi", line 304, in tvm._ffi._cy3.core.FunctionBase.__call__
>   File "tvm/_ffi/_cython/./function.pxi", line 239, in tvm._ffi._cy3.core.FuncCall
>   File "tvm/_ffi/_cython/./function.pxi", line 228, in tvm._ffi._cy3.core.FuncCall3
>   File "tvm/_ffi/_cython/./base.pxi", line 168, in tvm._ffi._cy3.core.CALL
> tvm._ffi.base.TVMError: Traceback (most recent call last):
>   [bt] (3) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(TVMFuncCall+0x61) [0x7f29ea0c1ad1]
>   [bt] (2) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0xa7d05f) [0x7f29e9c7d05f]
>   [bt] (1) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0xa849ef) [0x7f29e9c849ef]
>   [bt] (0) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0xebe11b) [0x7f29ea0be11b]
>   File "/home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/relay/backend/_backend.py", line 52, in lower
>     f = _build.lower(sch, inputs, name=func_name)
>   File "/home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/build_module.py", line 387, in lower
>     stmt = ir_pass.VectorizeLoop(stmt)
>   File "tvm/_ffi/_cython/./function.pxi", line 304, in tvm._ffi._cy3.core.FunctionBase.__call__
>   File "tvm/_ffi/_cython/./function.pxi", line 239, in tvm._ffi._cy3.core.FuncCall
>   File "tvm/_ffi/_cython/./function.pxi", line 228, in tvm._ffi._cy3.core.FuncCall3
>   File "tvm/_ffi/_cython/./base.pxi", line 168, in tvm._ffi._cy3.core.CALL
>   [bt] (8) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x9ed311) [0x7f29e9bed311]
>   [bt] (7) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x9ec985) [0x7f29e9bec985]
>   [bt] (6) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(tvm::ir::IRMutator::Mutate(HalideIR::Expr)+0x5d) [0x7f29e99ea81d]
>   [bt] (5) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x79ca32) [0x7f29e999ca32]
>   [bt] (4) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x927a63) [0x7f29e9b27a63]
>   [bt] (3) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x91df97) [0x7f29e9b1df97]
>   [bt] (2) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(tvm::ir::IRMutator::Mutate_(HalideIR::Internal::LE const*, HalideIR::Expr const&)+0xf0) [0x7f29e9b23250]
>   [bt] (1) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x760b8e) [0x7f29e9960b8e]
>   [bt] (0) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x73db63) [0x7f29e993db63]
>   File "/home/wanghao/project/tvm_llvm_5.0.6/tvm/3rdparty/HalideIR/src/ir/./IR.h", line 177
>   File "tvm/_ffi/_cython/./function.pxi", line 55, in tvm._ffi._cy3.core.tvm_callback
>   File "/home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/relay/backend/_backend.py", line 60, in lower
>     raise RuntimeError(msg)
>   File "/home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/relay/backend/_backend.py", line 52, in lower
>     f = _build.lower(sch, inputs, name=func_name)
>   File "/home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/build_module.py", line 387, in lower
>     stmt = ir_pass.VectorizeLoop(stmt)
>   File "tvm/_ffi/_cython/./function.pxi", line 304, in tvm._ffi._cy3.core.FunctionBase.__call__
>   File "tvm/_ffi/_cython/./function.pxi", line 239, in tvm._ffi._cy3.core.FuncCall
>   File "tvm/_ffi/_cython/./function.pxi", line 228, in tvm._ffi._cy3.core.FuncCall3
>   File "tvm/_ffi/_cython/./base.pxi", line 168, in tvm._ffi._cy3.core.CALL
>   [bt] (8) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x9ed311) [0x7f29e9bed311]
>   [bt] (7) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x9ec985) [0x7f29e9bec985]
>   [bt] (6) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(tvm::ir::IRMutator::Mutate(HalideIR::Expr)+0x5d) [0x7f29e99ea81d]
>   [bt] (5) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x79ca32) [0x7f29e999ca32]
>   [bt] (4) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x927a63) [0x7f29e9b27a63]
>   [bt] (3) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x91df97) [0x7f29e9b1df97]
>   [bt] (2) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(tvm::ir::IRMutator::Mutate_(HalideIR::Internal::LE const*, HalideIR::Expr const&)+0xf0) [0x7f29e9b23250]
>   [bt] (1) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x760b8e) [0x7f29e9960b8e]
>   [bt] (0) /home/wanghao/.local/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so(+0x73db63) [0x7f29e993db63]
>   File "/home/wanghao/project/tvm_llvm_5.0.6/tvm/3rdparty/HalideIR/src/ir/./IR.h", line 177
> TVMError: Check failed: a.type() == b.type(): BinaryOp of mismatched types
> During handling of the above exception, another exception occurred:
> 
> TVMError: Check failed: a.type() == b.type(): BinaryOp of mismatched types
> Error during compile function
> -----------------------------
> v0.0.1
> %10 = fn (%p0: Tensor[(1, 12, 30, 40), float32], %p1: Tensor[(1, 8, 15, 20), float32], %p2: Tensor[(1, 8, 8, 10), float32], %p3: Tensor[(1, 12, 4, 5), float32], __dict__=meta[StrMap][0]) -> Tensor[(1, 17680), float32] {
>   %0 = transpose(%p0, axes=[0, 2, 3, 1]) // ty=Tensor[(1, 30, 40, 12), float32]
>   %1 = nn.batch_flatten(%0) // ty=Tensor[(1, 14400), float32]
>   %2 = transpose(%p1, axes=[0, 2, 3, 1]) // ty=Tensor[(1, 15, 20, 8), float32]
>   %3 = nn.batch_flatten(%2) // ty=Tensor[(1, 2400), float32]
>   %4 = transpose(%p2, axes=[0, 2, 3, 1]) // ty=Tensor[(1, 8, 10, 8), float32]
>   %5 = nn.batch_flatten(%4) // ty=Tensor[(1, 640), float32]
>   %6 = transpose(%p3, axes=[0, 2, 3, 1]) // ty=Tensor[(1, 4, 5, 12), float32]
>   %7 = nn.batch_flatten(%6) // ty=Tensor[(1, 240), float32]
>   %8 = (%1, %3, %5, %7)
>   %9 = concatenate(%8, axis=1) // ty=Tensor[(1, 17680), float32]
>   %9
> }
> %10
> /* meta data */
> {
>   "root": 1, 
>   "nodes": [
>     {
>       "type_key": ""
>     }, 
>     {
>       "type_key": "StrMap", 
>       "keys": [
>         "StrMap"
>       ], 
>       "data": [2]
>     }, 
>     {
>       "type_key": "Array", 
>       "data": [3]
>     }, 
>     {
>       "type_key": "StrMap", 
>       "keys": [
>         "Primitive"
>       ], 
>       "data": [4]
>     }, 
>     {
>       "type_key": "IntImm", 
>       "attrs": {
>         "dtype": "int32", 
>         "value": "1"
>       }
>     }
>   ], 
>   "b64ndarrays": [], 
>   "attrs": {"tvm_version": "0.6.dev"}
> }

I think if you remove this line: https://github.com/dmlc/tvm/blob/master/topi/python/topi/arm_cpu/injective.py#L43

 s[x].vectorize(ii)

It should work.

@hlu1

WOW! you are right, thank you very much

en… l meet another problem, By cross compiler to run on rasp3b, but i find no nms function, after detect there has multi box

What the exact wrong information? nms should be generic and could execute on x86 / arm.

thank you, there is no wrong infomation, just when i draw box, i get result likes without nms

Hmm…Seems it doesn’t be problem of TVM. If you could dig more deeply, we could discuss more.