areusch commented on a change in pull request #7838:
URL: https://github.com/apache/tvm/pull/7838#discussion_r616807790
##########
File path: src/runtime/rpc/rpc_endpoint.cc
##########
@@ -1042,12 +1079,43 @@ class RPCClientSession : public RPCSession, public
DeviceAPI {
bool IsLocalSession() const final { return false; }
private:
+ void RPCMaxTransferRemoteReturnValue(TVMArgs args) {
+ // Use args[1] as return value, args[0] is tcode
+ // Look at RPCWrappedFunc in src/runtime/rpc/rpc_module.cc
+ rpc_chunk_max_size_bytes_ = (int64_t)args[1];
+ }
+
+ uint64_t GetRPCMaxTransferSize() {
+ if (rpc_chunk_max_size_bytes_ > 0) {
+ return (uint64_t)rpc_chunk_max_size_bytes_;
+ }
+
+ PackedFuncHandle rpc_func =
GetFunction("tvm.rpc.server.GetCRTMaxPacketSize");
+ if (rpc_func == nullptr) {
+ rpc_chunk_max_size_bytes_ = (int64_t)kRPCMaxTransferSizeBytesDefault;
+ } else {
+ CallFunc(rpc_func, nullptr, nullptr, 0,
+ [this](TVMArgs args) { RPCMaxTransferRemoteReturnValue(args);
});
Review comment:
okay sorry just one final thing: could we tweak the closure as follows:
1. add an `ICHECK(rpc_chunk_max_size_bytes_ > 0)` after assigning it with a
detailed error message
2. I think you can just remove RPCMaxTransferRemoteReturnValue and place the
body in this closure--that should be a bit clearer.
##########
File path: src/runtime/rpc/rpc_endpoint.h
##########
@@ -204,6 +204,15 @@ template <typename... Args>
inline TVMRetValue RPCEndpoint::SysCallRemote(RPCCode code, Args&&... args) {
return syscall_remote_(static_cast<int>(code), std::forward<Args>(args)...);
}
+
+/*!
+ * \brief Calculates overhead size of a CopyToRemote packet.
+ * \param to DLTensor to copy.
+ * \param code RPCCode for this transfer.
+ * \param nbytes Number of bytes to transfer.
Review comment:
can you document the return value?
--
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]