tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Tracking Issue] 0.21.dev tag do not have c++ runtime inference demo

Open gugudeshubao opened this issue 7 months ago • 6 comments

I want use tvm on automatic drive。 all the code is write in cpp 17,so i need use c++ to run the tvm export so。 0.21.dev tag do not have c++ runtime inference demo。 is there have some docs or example?I read all the file in doc and tests dir ,i not find usefull infomation。 thanks。

gugudeshubao avatar Jul 25 '25 11:07 gugudeshubao

I made a small example project showing how to run TVM Relax module with C++: https://github.com/mshr-h/tvm-relax-cpp-example

Hope it helps.

mshr-h avatar Aug 02 '25 14:08 mshr-h

I made a small example project showing how to run TVM Relax module with C++: https://github.com/mshr-h/tvm-relax-cpp-example

Hope it helps.

Hi, I wonder if it would be convenient for you to also provide a Python demo. I've been going through the docs for a couple of days and found that some parts are somewhat out-of-date, which has caused difficulties in getting started. For instance, I tried exporting the optimized model and reloading to examine it. However, I find the api provided in the doc Introduction to Module Serialization is no longer available. It seems that the 'tvm.runtime.load' function has been removed. I also searched the keywords such as 'save', 'export', 'load' in the documents, but unfortunately didn't find the information I needed. Many thanks in advance :)

YouCaiJun98 avatar Aug 07 '25 07:08 YouCaiJun98

I made a small example project showing how to run TVM Relax module with C++: https://github.com/mshr-h/tvm-relax-cpp-example Hope it helps.

Hi, I wonder if it would be convenient for you to also provide a Python demo. I've been going through the docs for a couple of days and found that some parts are somewhat out-of-date, which has caused difficulties in getting started. For instance, I tried exporting the optimized model and reloading to examine it. However, I find the api provided in the doc Introduction to Module Serialization is no longer available. It seems that the 'tvm.runtime.load' function has been removed. I also searched the keywords such as 'save', 'export', 'load' in the documents, but unfortunately didn't find the information I needed. Many thanks in advance :)

Additionally, most of the blogs I could find are based on the 'relay' module, which I reckon is an older module that has been restructured in the latest version. Could you provide a document detailing the interface changes? Thanks!

YouCaiJun98 avatar Aug 07 '25 07:08 YouCaiJun98

thanks all. i'll test it on my env。

gugudeshubao avatar Aug 07 '25 09:08 gugudeshubao

I made a small example project showing how to run TVM Relax module with C++: https://github.com/mshr-h/tvm-relax-cpp-example

Hope it helps.

I find in tvm0.21 version no class PackedFunc。Module.GetFunction() return class ffi::Function. Can you try in 0.21dev. thanks.

gugudeshubao avatar Aug 07 '25 09:08 gugudeshubao

Updated. Should work with the latest tvm ffi system. https://github.com/mshr-h/tvm-relax-cpp-example

mshr-h avatar Aug 09 '25 04:08 mshr-h