[Cross compilation] Ubuntu for tvm generation and windows for executing in tvm runtime

is it possible to compile an onnx model using nnvm/tvm stack in Ubuntu and deploy the same tvm module execution in Windows environment via RPC ?,
please explain in brief

Thanks

I would recommend directly build tvm in windows. You will need to build LLVM using MSVC from source and use CMake to build tvm with llvm enabled under windows.

The cross-compilation you asked for is not supported currently, but maybe possible with some effort. Specifically, we will need to call MSVC’s linker correctly to create a dll file. What will happen is that you cross-compile things in ubuntu, store things as .o file. Just in the same way we enable execution on raspberry pi. Assuming on that the windows compiler can recognize .o file written in ubuntu

1 Like

Thankyou .I did try installing in windows but nnvm failed to compile .I will post it as a separate thread .

@tqchen I have compiled TVM with LLVM from source successfully, but it ways output error when I call “sym, params = relay.frontend.from_onnx(onnx_model, shape_dict)”: … reflection.cc:109: AttributeError: relay.Call object has no attributed name_hint …

My onnx model exported from pytorch, which works well on Ubuntu when compiling(same python script), I found these discussions: 1.https://github.com/apache/incubator-tvm/issues/4262 Someone said that it because the scale operator, but that is obvious not my case, as it works well on ubuntu. 2.Compile onnx model error in pytorch 1.1.0 Someone said that it because the pytorch version, but I tried almost every version, still failed, and we actually installed the same version between windows and ubuntu, for both onnx and tvm.

1.on Ubuntu: we install onnx and tvm with the latest/master version. it works well 2.on Windows: 1.)build tvm(latest/master) with LLVM from source successfully, and install by way of python setup.py install in both tvm and tvm/topi 2.)build onnx with source code(latest/master) and install it according to the their readme But it always generate the error above on the same model file.

Thank you.

There seems to be an issue on Windows where hasattr throws an AttributeError instead of returning false. Both me and @jmorrill have experienced it. I am not sure of the root cause, but the fix should be straightforward.

1 Like

I just sent out a fix along with a description of the root cause for this here.

@tqchen Not sure if this ever get supported; I was trying to cross compile tvm model to dll with mingw in Ubuntu and receive the following exceptions https://gist.github.com/chjasonwu/b5a506f466eb0e936ea485f740f2bf6f. It seems to me that there are other actions need to be taken for this to work?