Hi, I am trying to follow this tutotial to tune my models on remote android devices: https://tvm.apache.org/docs/tutorials/autotvm/tune_relay_arm.html.
My tuning options are:
target = tvm.target.Target("llvm -device=arm_cpu -mtriple=aarch64-linux-gnu")
device_key = "rk3399"
use_android = True
tuning_option = {
"log_filename": log_file,
"tuner": "xgb",
"n_trial": 1, # 1500,
"early_stopping": 800,
"measure_option": autotvm.measure_option(
builder=autotvm.LocalBuilder(build_func="ndk" if use_android else "default"),
runner=autotvm.RPCRunner(
device_key,
host="192.168.185.9",
port=9190,
number=2,
timeout=6000,
),
),
}
Erery time before I do the tuning, I would clear all history log files. And my TVM version is v0.7.0, the latest release.
But I always get following error when it comes to build modules:
Traceback (most recent call last):
File "auto_tvm_onnx_test.py", line 143, in <module>
run(model_path, input_name, input_shape, lib_path)
File "auto_tvm_onnx_test.py", line 131, in run
lib = relay.build_module.build(mod, target=target, params=params)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/relay/build_module.py", line 259, in build
graph_json, mod, params = bld_mod.build(mod, target, target_host, params)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/relay/build_module.py", line 126, in build
self._build(mod, target, target_host)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
[bt] (8) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)+0x96) [0x7f9978b4e476]
[bt] (7) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)+0x76) [0x7f9978b54356]
[bt] (6) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>*)+0x2c) [0x7f99789f2afc]
[bt] (5) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::relay::MixedModeMutator::VisitExpr_(tvm::relay::CallNode const*)+0x49) [0x7f997898ecd9]
[bt] (4) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::relay::ForwardRewriter::Rewrite_(tvm::relay::CallNode const*, tvm::RelayExpr const&)+0x1041) [0x7f99789c7841]
[bt] (3) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::runtime::TypedPackedFunc<tvm::RelayExpr (tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&)>::AssignTypedLambda<tvm::RelayExpr (*)(tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&)>(tvm::RelayExpr (*)(tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&))::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}::operator()(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*) const+0x2cc) [0x7f9978924c3c]
[bt] (2) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::RelayExpr tvm::relay::LayoutRewriter<tvm::relay::alter_op_layout::AlterTransformMemorizer>(tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&)+0xcda) [0x7f997892cf2a]
[bt] (1) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::relay::alter_op_layout::AlterTransformMemorizer::CallWithNewLayouts(tvm::relay::Call const&, std::vector<tvm::RelayExpr, std::allocator<tvm::RelayExpr> > const&)+0x44f) [0x7f997892a3af]
[bt] (0) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(+0xb9eb8f) [0x7f9977e1bb8f]
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/_ffi/_ctypes/packed_func.py", line 81, in cfun
rv = local_pyfunc(*pyargs)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/relay/op/nn/_nn.py", line 102, in alter_op_layout_conv2d
return topi.nn.conv2d_alter_layout(attrs, inputs, tinfos, out_type)
File "<decorator-gen-53>", line 2, in conv2d_alter_layout
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/target/generic_func.py", line 275, in dispatch_func
return dispatch_dict[k](*args, **kwargs)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/topi/arm_cpu/conv2d_alter_op.py", line 39, in _alter_conv2d_layout
_, outs = relay.backend.compile_engine.select_implementation(
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/relay/backend/compile_engine.py", line 206, in select_implementation
outs = impl.compute(attrs, inputs, out_type)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/relay/op/op.py", line 91, in compute
return _OpImplementationCompute(self, attrs, inputs, out_type)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
raise get_last_ffi_error()
[bt] (3) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(TVMFuncCall+0x63) [0x7f9978c3aa23]
[bt] (2) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(+0x18e750c) [0x7f9978b6450c]
[bt] (1) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(tvm::relay::OpImplementation::Compute(tvm::Attrs const&, tvm::runtime::Array<tvm::te::Tensor, void> const&, tvm::Type const&)+0xb6) [0x7f9978b642e6]
[bt] (0) /home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/build/libtvm.so(+0xb9eb8f) [0x7f9977e1bb8f]
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/_ffi/_ctypes/packed_func.py", line 81, in cfun
rv = local_pyfunc(*pyargs)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/relay/op/strategy/generic.py", line 191, in _compute_conv2d
return [topi_compute(*args)]
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/autotvm/task/topi_integration.py", line 161, in wrapper
cfg = DispatchContext.current.query(tgt, workload)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/autotvm/task/dispatcher.py", line 76, in query
ret = self._query_inside(target, workload)
File "/home/sally/Workspace/soft_build/tvm_build/tvm-0.7.0/python/tvm/autotvm/task/dispatcher.py", line 421, in _query_inside
assert wkl == workload
TVMError: AssertionError
Have I done something wrong or is there any advice about how to fix it?
Thank you.