How would I move nnvm.compiler.lower to C++?


#1

Trying to run ApplyPass(g, "GraphCompile"); in C++ and hitting this error:
packed_func_ext.h:32] Check failed: pf != nullptr Cannot find function nnvm.compiler.lower in registry.

Looking at packed_func_ext.h it looks like it depends on the python registration in tvm/nnvm/python/nnvm/compiler/build_module.py – is there a way to move this to C++?

(code here https://jott.live/code/nnvm_test.cc)


#2

Even if you manage to port nnvm.build.lower to c++, there are other places in the c++ code base that might call into python function.

For example, here, fcompute and fschedule might be C-wrapped python function, if the corresponding operator is registered in python. In particular, the compute and schedule of conv2d op is written entirely in python, and I don’t think they will ever be ported to C++. So you do need python for compiling. (Deployment can be done without python, of course)