Documentation/Examples using the C API


#1

Hi

I’m trying to use TVM from D and figured it would be much simpler to start off with porting the C API rather than the C++ API.

I can’t seem to find any examples using the C API, do they exist? Trying to follow the Python API while source diving just got me stuck in the rabbit hole.

Thanks,
Nic


#2

There are a few frontend bindings, all uses C API, you can try to take a look at their implementations, in particular:

  • jvm package
  • golang
  • rust frontend (still in PR)

Here are some docs that might be helpful

TVM C API is quite low level and is not intended for direct use(but serve as an FFI system). You can likely create a wrapper around it. The key is to support a wrapper of PackedFunc, which is described in here: https://docs.tvm.ai/dev/runtime.html, everything is then exposed as PackedFunc directly in the frontend language.