hi @cyx thanks for this proposal! I have a couple questions for you on it.
First, could you elaborate a bit more on the use case you have in mind?
it seems like this might be one of them. Given we can already pass PackedFunc as arguments to other PackedFunc and return them, it seems like one of the big changes here is making the TVM data structures more expressive. I can certainly think of some good use cases for storing function pointers in a map, but I wonder about passing such a data structure at an API boundary.
Could you say what you mean/imply by “ABI stable” here? Are you separately compiling a library which needs to invoke PackedFunc? Is there a reason you prefer not to include the PackedFunc library inside that one? (just playing devils’ advocate here–iiuc it seems like another solution is to extract include/tvm/runtime/packed_func.h
into a separate library to make it easy to implement PackedFunc stubs to a separate library)
Could you elaborate? Would there be operator PackedFuncObj
?
Sort of the inverse of my last question–suppose I have e.g. a Map
whose values are PackedFuncObj
. How can I invoke the PackedFunc or reconstruct? The function pointer seems to be private in this definition.