C target for Relay?

I’m wondering if it’s possible to use C backend for Relay frontend. I’m trying to compile Relay models to MicroTVM targets by using target="c" in tutorials/tune_relay_x86.py, and I’m running into this obscure trace during tuning:

Traceback (most recent call last):
  [bt] (8) /home/jsteward/work/tvm/build/libtvm.so(tvm::NodeFunctor<void (tvm::runtime::ObjectRef const&, tvm::ir::StmtFunctor<void (tvm::Stmt const&)>*)>::operator()(tvm::runtime::ObjectRef const&, tvm::ir::StmtFunctor<void (tvm::Stmt const&)>*) const+0x52) [0x7f1e1fab0802]
  [bt] (7) /home/jsteward/work/tvm/build/libtvm.so(tvm::codegen::CodeGenC::VisitStmt_(tvm::ir::Block const*)+0x1c) [0x7f1e1faa277c]
  [bt] (6) /home/jsteward/work/tvm/build/libtvm.so(tvm::NodeFunctor<void (tvm::runtime::ObjectRef const&, tvm::ir::StmtFunctor<void (tvm::Stmt const&)>*)>::operator()(tvm::runtime::ObjectRef const&, tvm::ir::StmtFunctor<void (tvm::Stmt const&)>*) const+0x52) [0x7f1e1fab0802]
  [bt] (5) /home/jsteward/work/tvm/build/libtvm.so(tvm::codegen::CodeGenC::VisitStmt_(tvm::ir::Store const*)+0x317) [0x7f1e1faab217]
  [bt] (4) /home/jsteward/work/tvm/build/libtvm.so(tvm::codegen::CodeGenC::PrintExpr[abi:cxx11](tvm::Expr const&)+0x19b) [0x7f1e1fab709b]
  [bt] (3) /home/jsteward/work/tvm/build/libtvm.so(tvm::codegen::CodeGenC::PrintExpr(tvm::Expr const&, std::ostream&)+0x99) [0x7f1e1faa5039]
  [bt] (2) /home/jsteward/work/tvm/build/libtvm.so(tvm::codegen::CodeGenCHost::VisitExpr_(tvm::ir::Broadcast const*, std::ostream&)+0x56) [0x7f1e1faba9d6]
  [bt] (1) /home/jsteward/work/tvm/build/libtvm.so(tvm::codegen::CodeGenCHost::PrintType(tvm::DataType, std::ostream&)+0x14a) [0x7f1e1faba57a]
  [bt] (0) /home/jsteward/work/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x43) [0x7f1e1f95b4a3]
  File "../src/codegen/codegen_c_host.cc", line 143
TVMError: Cannot convert type float32x64 to C type

I’ve looked around and thought that float32x64 might be SIMD-related, but I don’t have any clues on how to disable SIMD in this case. Any help would be appreciated.

Current MicroTVM implementation seems to limit to C backends for the devices. In this case, I wonder if we’re relying on LLVM’s ability to flatten out SIMD types (such as the <64 x f32> type corresponding to the float32x64) to scalar types when SIMD is not enabled. Shall this be fixed from Relay, or shall we bring LLVM support to MicroTVM?

Cc @weberlo @tqchen

with tvm.target.build_config(disable_vectorize=True):
    graph, c_mod, params = relay.build(func, target="c", params=params)

Hi, how about try to disable vectorize?

1 Like