cyx-6 commented on pull request #51: URL: https://github.com/apache/tvm-rfcs/pull/51#issuecomment-1015900542
Thanks @areusch for your questions! Just to provide more context, it's worth mentioning that the majority of DL compilers built on top of the TVM compiler (not only the runtime) use TVM's C++ APIs directly in the project, i.e. all the C++ APIs under `include/tvm/` are considered public APIs as a common practice in C++ libraries. > there is a fast path in calling them from C++ that avoid re-encoding the arguments into the documented `PackedFunc` C ABI To be clear, the primary motivation of this RFC isn't about performance, but about usability - TVM-based compilers use `PackedFunc` either created by TVM or the compilers themselves. The missing piece here is that TVM's `PackedFunc` uses `std::function` internally right now, which is practically not shareable across C++ DLL boundary. Therefore, this RFC mainly focuses on stabilizing the `PackedFunc` into a layout-stable TVM object. > i'm okay with creating this ABI if it provides a clear benefit over the already-defined one. To clarify, This RFC isn't creating new ABIs, just refactoring existing ones. Note that existing TVM-based DL compilers all use C++ APIs instead of C APIs (the generated kernel uses C ABI though). This RFC mainly focuses on standardization of a single specific layout-stable implementation of `PackedFunc` so that its content could be shared across the DLL boundary - by "refactoring", the impact is limited to the standard TVM runtime and doesn't affect microTVM runtime and the C API is unchanged. > such as extracting packed_func.h into a separate e.g. dlpack library and allow you to use the C++ `PackedFunc` wrappers in your code directly I like this proposal. AFAIK there is long-term need from other libraries (e.g. DGL, MXNet) to incorporate with the TVM object/FFI system because it's really easy to use. However, I would say it's separate need from this RFC, but if anyone is interested, please feel free to do so. > it would be great to motivate creating this second ABI with some details about why you can't use the already-defined `PackedFunc` ABI. For context, TVM is largely used as a C++ submodule in DL compilers, where all its C++ APIs under `include/tvm` is treated as public APIs. It's more like a convention for C++ projects. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
