Benefits of cythonization in tvm?

Hi all,

TVM python code can be compiled with cython on Linux:

In fact it is automatically activated when cython is installed.

Can anyone please tell me what advantages this brings for tvm?

The generic assumption is that cythonized code supposed to be faster, but sometimes the gain is not significant, or even the code can be slower.
Does anyone have any benchmarks, or did any measurements which show if cythonized TVM code is faster, how much faster, and in which cases?

Thanks!

We are not cythonizing all the python code.

TVM is primarily written in C++ and we interact with Libtvm via a PackedFunc FFI defined by a stable C API. We provide two ways to interact with the C API: ctypes and cython.

You can view the cython part as a way to interact with the python C API. Most of the python APIs are then build on top of the FFI and are written in python.

Cythonized ffi provides lower ffi overhead than the ctypes variant and can get close to the overhead of numpy api calls

Thanks for detailed explanation!