Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh committed Apr 14, 2021
1 parent ac3d4e7 commit ef8f193
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/runtime/crt/common/crt_runtime_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ static tvm_crt_error_t FindFunctionOrSetAPIError(tvm_module_index_t module_index
}

int TVMFuncGetGlobal(const char* name, TVMFunctionHandle* out) {
tvm_crt_error_t to_return = FindFunctionOrSetAPIError(kGlobalFuncModuleIndex, &global_func_registry.registry, name,
out);
tvm_crt_error_t to_return =
FindFunctionOrSetAPIError(kGlobalFuncModuleIndex, &global_func_registry.registry, name, out);
// For compatibility with C++
if (to_return == kTvmErrorFunctionNameNotFound) {
*out = NULL;
Expand Down Expand Up @@ -380,7 +380,7 @@ int RPCTimeEvaluator(TVMValue* args, int* type_codes, int num_args, TVMValue* re

// Sends maximum transfer size for RPC.
int RPCGetTransferMaxSize(TVMValue* args, int* type_codes, int num_args, TVMValue* ret_value,
int* ret_type_codes) {
int* ret_type_codes) {
ret_value[0].v_int64 = TVM_CRT_RPC_MAX_TRANSFER_SIZE_BYTES;
ret_type_codes[0] = kTVMArgInt;
return 0;
Expand Down
22 changes: 11 additions & 11 deletions src/runtime/rpc/rpc_endpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -983,11 +983,11 @@ class RPCClientSession : public RPCSession, public DeviceAPI {
// update max transfer size if not set already.
SetRPCMaxTransferSize();

uint64_t block_size = (uint64_t) rpc_chunk_max_size_bytes_;
uint64_t block_size = (uint64_t)rpc_chunk_max_size_bytes_;
uint64_t block_count = 0;
uint64_t num_blocks = nbytes/block_size;
uint64_t num_blocks = nbytes / block_size;

for (block_count=0; block_count<num_blocks; block_count++) {
for (block_count = 0; block_count < num_blocks; block_count++) {
remote_to->byte_offset = block_count * block_size;
endpoint_->CopyToRemote(local_from_bytes, remote_to, block_size);
}
Expand Down Expand Up @@ -1057,20 +1057,20 @@ 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
rpc_chunk_max_size_bytes_ = (int64_t) args[1];
rpc_chunk_max_size_bytes_ = (int64_t)args[1];
}

void SetRPCMaxTransferSize() {
if (rpc_chunk_max_size_bytes_ < 0) {
PackedFuncHandle rpc_func = GetFunction("tvm.rpc.server.GetTransferMaxSize");
if (rpc_func == nullptr) {
rpc_chunk_max_size_bytes_ = kRPCMaxTransferSizeDefault;
return;
}
CallFunc(rpc_func, nullptr, nullptr, 0, [this](TVMArgs args){RPCMaxTransferRemoteReturnValue(args);});
PackedFuncHandle rpc_func = GetFunction("tvm.rpc.server.GetTransferMaxSize");
if (rpc_func == nullptr) {
rpc_chunk_max_size_bytes_ = kRPCMaxTransferSizeDefault;
return;
}
CallFunc(rpc_func, nullptr, nullptr, 0,
[this](TVMArgs args) { RPCMaxTransferRemoteReturnValue(args); });
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/rpc/rpc_endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const int kRPCSuccess = kRPCMagic + 0;
// cannot found matched key in server
const int kRPCMismatch = kRPCMagic + 2;

// When tvm.rpc.server.GetTransferMaxSize global function is not registered.
// When tvm.rpc.server.GetTransferMaxSize global function is not registered.
const int kRPCMaxTransferSizeDefault = 128000;

/*! \brief Enumeration code for the RPC tracker */
Expand Down

0 comments on commit ef8f193

Please sign in to comment.