mehrdadh commented on a change in pull request #7838:
URL: https://github.com/apache/tvm/pull/7838#discussion_r613665743
##########
File path: src/runtime/rpc/rpc_endpoint.cc
##########
@@ -801,14 +801,14 @@ void RPCEndpoint::CopyToRemote(void* from_bytes,
DLTensor* to, uint64_t nbytes)
std::lock_guard<std::mutex> lock(mutex_);
RPCCode code = RPCCode::kCopyToRemote;
- uint64_t num_data_bytes = static_cast<uint64_t>(GetDataSize(*to));
- ICHECK_EQ(nbytes, num_data_bytes);
+ uint64_t tensor_max_size_bytes = static_cast<uint64_t>(GetDataSize(*to));
+ ICHECK_LE(to->byte_offset + nbytes, tensor_max_size_bytes) << "Overflow in
tensor size.";
Review comment:
Done!
##########
File path: src/runtime/rpc/rpc_endpoint.cc
##########
@@ -801,14 +801,14 @@ void RPCEndpoint::CopyToRemote(void* from_bytes,
DLTensor* to, uint64_t nbytes)
std::lock_guard<std::mutex> lock(mutex_);
RPCCode code = RPCCode::kCopyToRemote;
- uint64_t num_data_bytes = static_cast<uint64_t>(GetDataSize(*to));
- ICHECK_EQ(nbytes, num_data_bytes);
+ uint64_t tensor_max_size_bytes = static_cast<uint64_t>(GetDataSize(*to));
+ ICHECK_LE(to->byte_offset + nbytes, tensor_max_size_bytes) << "Overflow in
tensor size.";
- uint64_t to_data = reinterpret_cast<uint64_t>(to->data);
+ uint64_t to_data = reinterpret_cast<uint64_t>(static_cast<char*>(to->data) +
to->byte_offset);
Review comment:
Done!
--
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]