KeyError: 'tile_k' while auto tuning

Posted here

I am using the following script. https://raw.githubusercontent.com/apache/incubator-tvm/v0.6/tutorials/autotvm/tune_relay_x86.py

2020-09-07 10:27:06,906 INFO Benchmarking layout transformation successful.
2020-09-07 10:27:07,037 INFO Start to run PBQP algorithm...
2020-09-07 10:27:07,444 INFO Finished PBQPExecutor run. Got optimal solution.
2020-09-07 10:27:07,450 INFO Writing optimal schedules to mxnet_graph_opt.log successfully.
Compile...
Traceback (most recent call last):

  File "convert.py", line 232, in <module>
    tune_and_evaluate(tuning_option)

  File "convert.py", line 206, in tune_and_evaluate
    graph, lib, params = relay.build_module.build(mod, target=target, params=params)

  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/relay/build_module.py", line 244, in build
    graph_json, mod, params = bld_mod.build(func, target, target_host, params)

  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/relay/build_module.py", line 109, in build
    self._build(func, target, target_host)

  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/_ffi/_ctypes/function.py", line 207, in __call__
    raise get_last_ffi_error()

tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (8) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::relay::ScheduleGetter::VisitExpr(tvm::relay::Expr const&)+0x86) [0x7f1098e5df16]
  [bt] (7) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>::VisitExpr(tvm::relay::Expr const&)+0x7c) [0x7f1098e5c5dc]
  [bt] (6) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>*)+0x13) [0x7f1098e4f3d3]
  [bt] (5) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::relay::ScheduleGetter::VisitExpr_(tvm::relay::CallNode const*)+0x159) [0x7f1098e592b9]
  [bt] (4) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::relay::ScheduleGetter::VisitExpr(tvm::relay::Expr const&)+0x86) [0x7f1098e5df16]
  [bt] (3) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>::VisitExpr(tvm::relay::Expr const&)+0x7c) [0x7f1098e5c5dc]
  [bt] (2) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>::InitVTable()::{lambda(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>*)#6}::_FUN(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>*)+0x13) [0x7f1098e4f3d3]
  [bt] (1) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::relay::ScheduleGetter::VisitExpr_(tvm::relay::CallNode const*)+0xa25) [0x7f1098e59b85]
  [bt] (0) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(+0x11a5b63) [0x7f1098fa6b63]
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/_ffi/_ctypes/function.py", line 72, in cfun
    rv = local_pyfunc(*pyargs)
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/relay/op/nn/_nn.py", line 62, in compute_dense
    return [topi.nn.dense(inputs[0], inputs[1], None, out_dtype)]
  File "<decorator-gen-52>", line 2, in dense
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/target.py", line 299, in dispatch_func
    return generic_func_node(*args)
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/target.py", line 161, in __call__
    return _api_internal._GenericFuncCallFunc(self, *args)
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/_ffi/_ctypes/function.py", line 207, in __call__
    raise get_last_ffi_error()
  [bt] (3) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(TVMFuncCall+0x46) [0x7f1098fac986]
  [bt] (2) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(+0xb8838d) [0x7f109898938d]
  [bt] (1) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(tvm::GenericFunc::CallPacked(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const+0x119) [0x7f1098989179]
  [bt] (0) /home/xyz/Desktop/tvm/tvm_0.6.1/build/libtvm.so(+0x11a5b63) [0x7f1098fa6b63]
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/_ffi/_ctypes/function.py", line 72, in cfun
    rv = local_pyfunc(*pyargs)
  File "<decorator-gen-136>", line 2, in config_dispatcher
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/autotvm/task/dispatcher.py", line 221, in dispatch_func
    return dispatch_dict[cfg.template_key](cfg, *args, **kwargs)
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/autotvm/task/topi_integration.py", line 385, in template_call
    node = f(cfg, *args, **kwargs)
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/topi/python/topi/x86/dense.py", line 50, in _declaration_dense
    return _declaration_dense_nopack(cfg, data, weight, bias, out_dtype)
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/topi/python/topi/x86/dense.py", line 102, in _declaration_dense_nopack
    vec = cfg["tile_k"].size[-1]
  File "/home/xyz/Desktop/tvm/tvm_0.6.1/python/tvm/autotvm/task/space.py", line 808, in __getitem__
    return self._entity_map[name]
KeyError: 'tile_k'

This is the issue in TVM 0.6. Please try 0.7 if possible.

@comaniac Thanks brother i have resolved the issue. The solution was to remove all .log files in the folder and i re-run the script.