[AutoTVM] Multiple errors on ARM cpu

Hi,

autotuning a model on ARM cpu is causing few errors as follows:

  • tuning is successfull but when trying to run graph tuner with autoning log as input, it throws:
Traceback (most recent call last):

  File "../scripts/tvm_autotune_android.py", line 279, in <module>
    tune_and_evaluate(tuning_option)

  File "../scripts/tvm_autotune_android.py", line 222, in tune_and_evaluate
    tune_graph(func, input_shape, log_file, graph_opt_sch_file)

  File "../scripts/tvm_autotune_android.py", line 204, in tune_graph
    executor = Tuner(graph, {"data": dshape}, records, target_op, target)

  File "/tvm/incubator-tvm/python/tvm/autotvm/graph_tuner/dynamic_programming_tuner.py", line 43, in __init__
    super(DPTuner, self).__init__(*args, **kwargs)

  File "/tvm/incubator-tvm/python/tvm/autotvm/graph_tuner/base_graph_tuner.py", line 157, in __init__
    self._fetch_cfg()

  File "/tvm/incubator-tvm/python/tvm/autotvm/graph_tuner/base_graph_tuner.py", line 224, in _fetch_cfg
    layouts = infer_layout_func(workload, cfg)

  File "</usr/local/lib/python3.6/dist-packages/decorator.py:decorator-gen-36>", line 2, in conv2d_infer_layout

  File "/tvm/incubator-tvm/python/tvm/target.py", line 382, in dispatch_func
    return dispatch_dict[k](*args, **kwargs)

  File "/tvm/incubator-tvm/topi/python/topi/x86/conv2d.py", line 351, in _conv2d_infer_layout
    tile_ic, tile_oc = cfg["tile_ic"].size[-1], cfg["tile_oc"].size[-1]

  File "/tvm/incubator-tvm/python/tvm/autotvm/task/space.py", line 806, in __getitem__
    return self._entity_map[name]

KeyError: 'tile_ic'
  • when I try to compile the model with autotunig log (no graph tuner) it throws:
Traceback (most recent call last):

  File "../scripts/tvm_autotune_android.py", line 279, in <module>
    tune_and_evaluate(tuning_option)

  File "../scripts/tvm_autotune_android.py", line 230, in tune_and_evaluate
    graph, lib, params = relay.build_module.build(mod, target=target, target_host=target_host, params=param)

  File "/tvm/incubator-tvm/python/tvm/relay/build_module.py", line 244, in build
    graph_json, mod, params = bld_mod.build(func, target, target_host, params)

  File "/tvm/incubator-tvm/python/tvm/relay/build_module.py", line 109, in build
    self._build(func, target, target_host)

  File "/tvm/incubator-tvm/python/tvm/_ffi/_ctypes/function.py", line 207, in __call__
    raise get_last_ffi_error()

ValueError: Traceback (most recent call last):
  [bt] (8) /tvm/incubator-tvm/build/libtvm.so(tvm::relay::ScheduleGetter::VisitExpr(tvm::relay::Expr const&)+0x7e) [0x7f54b20c735e]
  [bt] (7) /tvm/incubator-tvm/build/libtvm.so(tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>::VisitExpr(tvm::relay::Expr const&)+0x92) [0x7f54b20c5802]
  [bt] (6) /tvm/incubator-tvm/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&)>*)+0x27) [0x7f54b20b7f87]
  [bt] (5) /tvm/incubator-tvm/build/libtvm.so(tvm::relay::ScheduleGetter::VisitExpr_(tvm::relay::CallNode const*)+0x169) [0x7f54b20c3ea9]
  [bt] (4) /tvm/incubator-tvm/build/libtvm.so(tvm::relay::ScheduleGetter::VisitExpr(tvm::relay::Expr const&)+0x7e) [0x7f54b20c735e]
  [bt] (3) /tvm/incubator-tvm/build/libtvm.so(tvm::relay::ExprFunctor<tvm::Array<tvm::Tensor, void> (tvm::relay::Expr const&)>::VisitExpr(tvm::relay::Expr const&)+0x92) [0x7f54b20c5802]
  [bt] (2) /tvm/incubator-tvm/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&)>*)+0x27) [0x7f54b20b7f87]
  [bt] (1) /tvm/incubator-tvm/build/libtvm.so(tvm::relay::ScheduleGetter::VisitExpr_(tvm::relay::CallNode const*)+0x683) [0x7f54b20c43c3]
  [bt] (0) /tvm/incubator-tvm/build/libtvm.so(+0xb7ea6b) [0x7f54b2240a6b]
  File "/tvm/incubator-tvm/python/tvm/_ffi/_ctypes/function.py", line 72, in cfun
    rv = local_pyfunc(*pyargs)
  File "/tvm/incubator-tvm/python/tvm/relay/op/nn/_nn.py", line 179, in compute_conv2d
    out_dtype)
  File "</usr/local/lib/python3.6/dist-packages/decorator.py:decorator-gen-41>", line 2, in group_conv2d_nchw
  File "/tvm/incubator-tvm/python/tvm/target.py", line 383, in dispatch_func
    return func(*args, **kwargs)
  File "/tvm/incubator-tvm/topi/python/topi/nn/conv2d.py", line 815, in group_conv2d_nchw
    num_filter, _, kernel_h, kernel_w = get_const_tuple(Filter.shape)
ValueError: too many values to unpack (expected 4)

Any idea about how to fix these? Thank you.

Does anyone experience such issues?

Seems that you have used contrib_spatial_pack schedule. Try this pr: https://github.com/apache/incubator-tvm/pull/4384.

And don’t use graph tuner for arm cpu, currently, graph tuner should only work and be tested on x86 cpu.

1 Like

I will try it out, thank you!