I am testing VM runtime with it’s c++ API, it worked with this commit a while ago.
But after I update to the lasted master branch, it breaks(I changed my code a bit due to the recent changes in vm apis.), I got the following error:
terminate called after throwing an instance of ‘dmlc::Error’ what(): [12:25:59] /home/developer/LocalLib/tvm/src/runtime/vm/executable.cc:460: Check failed: header == kTVMVMBytecodeMagic: Invalid VM file format in the header section.
Stack trace: [bt] (0) /home/developer/LocalLib/tvm_runtime/lib/libtvm_runtime.so(+0x964f2) [0x7f0129afe4f2] [bt] (1) /home/developer/LocalLib/tvm_runtime/lib/libtvm_runtime.so(tvm::runtime::vm::LoadHeader(dmlc::Stream*)+0xdf) [0x7f0129afec3f] [bt] (2) /home/developer/LocalLib/tvm_runtime/lib/libtvm_runtime.so(tvm::runtime::vm::Executable::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tvm::runtime::Module)+0x135) [0x7f0129b062a5]
Here is my code to load the bytecode:
std::string vm_bytecode; std::ifstream bytecode_file(bytecode_path, std::ios::binary); vm_bytecode.assign(std::istreambuf_iterator(bytecode_file), std::istreambuf_iterator()); m_exec_mod = tvm::runtime::vm::Executable::Load(vm_bytecode, m_lib);
I guess the error is related to how I read the bytecode file, but I can’t find any examples of the recent changes, anyone know how to fix this?