[SOLVED] Failed to cross compile resnet50_v1 for tvm.target.mali ARMv7 Mali GPU

I tried to cross compile resnet50_v1 model for tvm.target.mali() ARMv7 Mali GPU (I run the compilation on x86_64 Ubuntu 16.04 box)

target = tvm.target.mali()
target_host = 'llvm -target=armv7l-linux-gnueabihf'

The code

Error:

model_name:  resnet50_v1 , target: opencl -device=mali -model=unknown , target_host:  llvm -target=armv7l-linux-gnueabihf , opt_level: 3 , data_shape: (1, 3, 224, 224)
Compiling...
Traceback (most recent call last):
  File "./compile.py", line 40, in <module>
    graph, lib, params = nnvm.compiler.build(sym, target=target, shape={"data": data_shape}, params=params, target_host=target_host)
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/compiler/build_module.py", line 281, in build
    graph = optimize(graph, shape, dtype, layout)
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/compiler/build_module.py", line 170, in optimize
    graph = graph.apply(["InferShape", "InferType", "AlterOpLayout"])
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/graph.py", line 234, in apply
    check_call(_LIB.NNGraphApplyPasses(self.handle, npass, cpass, ctypes.byref(ghandle)))
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/_base.py", line 75, in check_call
    raise NNVMError(py_str(_LIB.NNGetLastError()))
nnvm._base.NNVMError: TVMCall CFunc Error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tvm-0.5.dev0-py3.5-linux-x86_64.egg/tvm/_ffi/_ctypes/function.py", line 55, in cfun
    rv = local_pyfunc(*pyargs)
  File "/usr/local/lib/python3.5/dist-packages/nnvm-0.8.0-py3.5.egg/nnvm/top/nn.py", line 150, in alter_conv2d_layout
    return topi.nn.conv2d_alter_layout(attrs, inputs, tinfos)
  File "<decorator-gen-26>", line 2, in conv2d_alter_layout
  File "/usr/local/lib/python3.5/dist-packages/tvm-0.5.dev0-py3.5-linux-x86_64.egg/tvm/target.py", line 356, in dispatch_func
    return dispatch_dict[k](*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/topi-0.5.dev0-py3.5.egg/topi/arm_cpu/conv2d.py", line 537, in _alter_conv2d_layout
    new_attrs['kernel_layout'] = 'OIHW%do' % (cfg['tile_co'].size[-1])
  File "/usr/local/lib/python3.5/dist-packages/tvm-0.5.dev0-py3.5-linux-x86_64.egg/tvm/autotvm/task/space.py", line 758, in __getitem__
    return self._entity_map[name]
KeyError: 'tile_co'

This should be already fixed by https://github.com/dmlc/tvm/pull/1796. Please update to latest tvm

resnet50_v1 compilation working fine now! Thank you!

root@f53a92198c64:~/workplace/resnet50/tmp# ./compile.py 
Downloading /root/.mxnet/models/resnet50_v1-0aee57f9.zip from https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/models/resnet50_v1-0aee57f9.zip...
model: resnet50_v1 , target: opencl -device=mali -model=unknown , target_host: llvm -target=armv7l-linux-gnueabihf , opt_level: 3 , data_shape: (1, 3, 224, 224)
Compiling...
Compilation done
Saving files
Files saved

BTW, I noticed that resnet50_v2 Compilation works, but it shows WARNING:autotvm:Cannot find config for target=opencl -device=mali -model=unknown

root@f53a92198c64:~/workplace/resnet50/tmp# ./compile.py 
Downloading /root/.mxnet/models/resnet50_v2-ecdde353.zip from https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/models/resnet50_v2-ecdde353.zip...
model: resnet50_v2 , target: opencl -device=mali -model=unknown , target_host: llvm -target=armv7l-linux-gnueabihf , opt_level: 3 , data_shape: (1, 3, 224, 224)
Compiling...
...100%, 0.14 MB, 1493 KB/s, 0 seconds passed
WARNING:autotvm:Cannot find config for target=opencl -device=mali -model=unknown, workload=('conv2d', (1, 128, 56, 56, 'float32'), (128, 128, 3, 3, 'float32'), (2, 2), (1, 1), 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
WARNING:autotvm:Cannot find config for target=opencl -device=mali -model=unknown, workload=('conv2d', (1, 256, 28, 28, 'float32'), (256, 256, 3, 3, 'float32'), (2, 2), (1, 1), 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
WARNING:autotvm:Cannot find config for target=opencl -device=mali -model=unknown, workload=('conv2d', (1, 512, 14, 14, 'float32'), (512, 512, 3, 3, 'float32'), (2, 2), (1, 1), 'NCHW', 'float32'). A fallback configuration is used, which may bring great performance regression.
Compilation done
Saving files
Files saved