@hzfan thanks for implementing a poc:) However, these is a subtle but important 
difference which worth discusses here :) I will use cython-ffi to refer to the 
above approach, and tvm-ffi to refer to tvm's approach

- In cython-ffi, both data structure and functions are exposed, this means a in 
order to grow the set of functions, we need to expand the set of C API. In 
another words, we need to grow the set of FFI API as we add more functions
- In the tvm-ffi, the set of C API is fixed, and only data structure 
constructions are exposed to the cython side, given that a set of supported 
data structures are also fixed. In this way, we do not have to grow the set of 
FFI API as we add functions.
- Another subtle point is that we are passing data structure across dll 
boundaries. In the case of cython-ffi, it could be a c++ container(Tuple). 
TVM's object structure is designed to be C ABI compatible, which allows us to 
construct in one dll and pass to another, however it is not necessarily true 
for all c++ classes. There is a potential danger when passing c++ container 
across DLL boundaries(when two dll has different allocator, calling push_back 
in another dll could cause error). 

The difference again boils down to the design point of what is a clear cut of 
FFI conventions. Ideally, it would be: a stable set of C API and container 
structures that does not change over time.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-mxnet/issues/17097#issuecomment-568777082

Reply via email to