Branch: master
Find file History

gotvm - Golang Frontend for TVM Runtime

This folder contain golang interface for TVM runtime. It brings TVM runtime to Golang.

  • It enable c runtime api of tvm exposed to golang.
  • It enables module loading (lib, graph and params) and inference operations.




  • src Module that generates golang package corresponding to the c runtime api exposed from tvm source tree. This process build golang package gotvm.a

  • samples Sample golang reference application to inference through gotvm package.


Once the Requirements are installed

To build gotvm package


To build and run internal tests

make tests

To build sample apps.

make samples


To Demonstrates sample TVM module compilation using python and deploy via golang.


To deploy a realtime module with lib, graph and param.


To demonstrate go function closure conversion to packed function handle.


To demonstrate a packed function handle given as an argument.


To register go function with runtime as a global function.


To demonstrate function closure passed as argument to a function call.


To demonstrate function closure returned from a packed function.



gotvm.go is documented with sufficient information about gotvm package. A html version documentation can be accessed by running below command after building runtime.

godoc -http=:6060  -goroot=./gopath

After above command try from any browser.

Also please refer to the sample applications under sample folder.


Docker setup may need below additions for dependencies and environment preparation.

Please refer docker/install/ for the packages dependencies.

go compiler 1.10 on ubuntu doesn't install on standard path, hence an explicit export may be needed as shown below.

export PATH="/usr/lib/go-1.10/bin:$PATH"```