tlc-pack / tlcpack

https://tlcpack.ai/
Apache License 2.0
23 stars 30 forks source link

LLVM build used to generate tlcpack only allows native compilation #31

Closed leandron closed 3 years ago

leandron commented 3 years ago

In the context of docker/install/centos_install_llvm.sh, it is possible to see the LLVM is compile with LLVM_TARGETS_TO_BUILD=host: https://github.com/tlc-pack/tlcpack/blob/4243d2d0ba4b6be952b1caafa52dd9bbf2e3a76d/docker/install/centos_build_llvm.sh#L26-L31

As a consequence, when we try to cross-compile using TVM, we get the following message:

Traceback (most recent call last):
  File "/usr/local/bin/tvmc", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/tvm/driver/tvmc/main.py", line 95, in main
    sys.exit(_main(sys.argv[1:]))
  File "/usr/local/lib/python3.6/dist-packages/tvm/driver/tvmc/main.py", line 88, in _main
    return args.func(args)
  File "/usr/local/lib/python3.6/dist-packages/tvm/driver/tvmc/compiler.py", line 114, in drive_compile
    args.desired_layout,
  File "/usr/local/lib/python3.6/dist-packages/tvm/driver/tvmc/compiler.py", line 211, in compile_model
    graph_module = relay.build(mod, tvm_target, params=params, target_host=target_host)
  File "/usr/local/lib/python3.6/dist-packages/tvm/relay/build_module.py", line 275, in build
    graph_json, mod, params = bld_mod.build(mod, target, target_host, params)
  File "/usr/local/lib/python3.6/dist-packages/tvm/relay/build_module.py", line 138, in build
    self._build(mod, target, target_host)
  File "tvm/_ffi/_cython/./packed_func.pxi", line 322, in tvm._ffi._cy3.core.PackedFuncBase.__call__
  File "tvm/_ffi/_cython/./packed_func.pxi", line 257, in tvm._ffi._cy3.core.FuncCall
  File "tvm/_ffi/_cython/./packed_func.pxi", line 246, in tvm._ffi._cy3.core.FuncCall3
  File "tvm/_ffi/_cython/./base.pxi", line 160, in tvm._ffi._cy3.core.CALL
tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (8) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(std::_Function_handler<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*), tvm::relay::backend::RelayBuildModule::GetFunction(std::string const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#3}>::_M_invoke(std::_Any_data const&, tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&)+0x128) [0x7fdd61913348]
  [bt] (7) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(tvm::relay::backend::RelayBuildModule::BuildRelay(tvm::IRModule, std::unordered_map<std::string, tvm::runtime::NDArray, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, tvm::runtime::NDArray> > > const&)+0x1b87) [0x7fdd619123c7]
  [bt] (6) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(tvm::build(tvm::Map<tvm::runtime::String, tvm::IRModule, void, void> const&, tvm::Target const&)+0x68f) [0x7fdd60f5c21f]
  [bt] (5) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(tvm::build(tvm::Map<tvm::Target, tvm::IRModule, void, void> const&, tvm::Target const&)+0x4e9) [0x7fdd60f5b479]
  [bt] (4) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(tvm::codegen::Build(tvm::IRModule, tvm::Target)+0x2a0) [0x7fdd6143e230]
  [bt] (3) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(+0x17dd2b3) [0x7fdd61aac2b3]
  [bt] (2) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(tvm::codegen::LLVMModuleNode::Init(tvm::IRModule const&, tvm::Target const&)+0x4c) [0x7fdd61aaf16c]
  [bt] (1) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(tvm::codegen::GetLLVMTargetMachine(tvm::Target const&, bool)+0x51a) [0x7fdd61aa7e2a]
  [bt] (0) /usr/local/lib/python3.6/dist-packages/tvm/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x6e) [0x7fdd60e6cf5e]
  File "/workspace/tvm/src/target/llvm/llvm_common.cc", line 136
TVMError: 
---------------------------------------------------------------
An internal invariant was violated during the execution of TVM.
Please read TVM's error reporting guidelines.
More details can be found here: https://discuss.tvm.ai/t/error-reporting/7793.
---------------------------------------------------------------
  Check failed: allow_null == false: No available targets are compatible with triple "aarch64-linux-gnu" target_triple=aarch64-linux-gnu