tqchen commented on PR #13539: URL: https://github.com/apache/tvm/pull/13539#issuecomment-1365569792
I put a bit more thoughts into this, here is one possible proposal that might be interesting. We can make runtime::DataType an ObjectRef. This way most of the dtype can naturally be exposed as TVMObject which have similar kind of semantics defined. Then it would be natural to have `Optional[DataType]` and place data type along with other object containers such as Map and Array. We can still preserve the overloading behavior like @Lunderberg mentioned. To maintain compatibility, we can preserve DLDataType convention, and allow auto convert to runtime::DataType. RPC will pass DataType as DLDataType. When we return DataType into the FFI, it now directly becomes an Object just like String. One possible concern is the additional memory alloca overhead of DataType object. That is unlikely would become an issue, in case it is, we can have static table of common ones(like i32, i64, f32) and return the same tabled object. The benefit on the other hand is we can mix data type freely with containers, optional and other things. -- 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]
