tqchen edited a comment on issue #17097: [RFC][mxnet 2.0][item 10.1] MXNet 
Imperative Op Invocation Overhead
URL: 
https://github.com/apache/incubator-mxnet/issues/17097#issuecomment-568777082
 
 
   @hzfan thanks for implementing a poc:) However, these is a subtle but 
important difference which worth discussing in here :) I will use cython-ffi to 
refer to the above poc, and tvm-ffi to refer to tvm's poc
   
   - 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(tuple, int, slice, ellipsis). 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. This property allows 
us to construct an object 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 object 
structures that does not change over time.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to