ysh329 commented on issue #15716: URL: https://github.com/apache/tvm/issues/15716#issuecomment-1757342185
Hi all, with `git bisect`, I locate the commit below which from error message `Could not convert TVM object of type runtime.Closure to a string` to error message `Unknown type index 8`. ```shell commit 6554e2e082cf9d3ecf867fcd81b1b6d483df46a8 (HEAD) Author: Junru Shao <[email protected]> Date: Sun Aug 27 20:43:33 2023 -0700 Result: First (index 8) [RPC] Enhance RPC Protocol to support TVM Object (#15631) This PR introduces object support in TVM RPC protocol by introducing three new interfaces in `rpc_reference.h`: - `uint64_t GetObjectBytes(Object* obj)`, which is a required implementation that returns the length of the object during serialization; - `void WriteObject(Object* obj)` used to serialize an object to a writable channel; - `void ReadObject(int* type_code, TVMValue* value)`, which deserializes } } uint64_t GetObjectBytes(Object* obj) { uint64_t result = 0; if (obj is ShapeTuple) { result += sizeof(uint32_t); # for `type_index` result += sizeof(int32_t); # for `ndim` result += sizeof(int64_t) * obj->ndim; # for content of the shape } else { throw Unsupported; } return result; } ``` To deserialize an object, similar to serialization, the recommended approach paradigm is to read `type_index` and disptch based on it. Caveat on deserialization: RPC Reference itself does not own or allocate any memory to store objects, meaning extra logic is usually required in `ReadObject` to keep their liveness. ``` However, it's so strange due to this commit PR (https://github.com/apache/tvm/pull/15631) seems done changes about RPC only. -- 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]
