From ef8f193ab8c50187f398cd586aa48a43d1eea114 Mon Sep 17 00:00:00 2001 From: Mehrdad Hessar Date: Wed, 14 Apr 2021 10:43:28 -0700 Subject: [PATCH] fix format --- src/runtime/crt/common/crt_runtime_api.c | 6 +++--- src/runtime/rpc/rpc_endpoint.cc | 22 +++++++++++----------- src/runtime/rpc/rpc_endpoint.h | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/runtime/crt/common/crt_runtime_api.c b/src/runtime/crt/common/crt_runtime_api.c index dacc7320b979d..c53c8cad81198 100644 --- a/src/runtime/crt/common/crt_runtime_api.c +++ b/src/runtime/crt/common/crt_runtime_api.c @@ -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; @@ -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; diff --git a/src/runtime/rpc/rpc_endpoint.cc b/src/runtime/rpc/rpc_endpoint.cc index 705224e45e1d0..1bd777d149c08 100644 --- a/src/runtime/rpc/rpc_endpoint.cc +++ b/src/runtime/rpc/rpc_endpoint.cc @@ -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_countbyte_offset = block_count * block_size; endpoint_->CopyToRemote(local_from_bytes, remote_to, block_size); } @@ -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); }); } } diff --git a/src/runtime/rpc/rpc_endpoint.h b/src/runtime/rpc/rpc_endpoint.h index 99d26e7cb6e67..1fcdcf6400ac6 100644 --- a/src/runtime/rpc/rpc_endpoint.h +++ b/src/runtime/rpc/rpc_endpoint.h @@ -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 */