From feb72fcf08bb998b8a7c39da6b096b54bc786e27 Mon Sep 17 00:00:00 2001 From: Haichen Shen Date: Mon, 22 Mar 2021 14:30:37 -0700 Subject: [PATCH] lint --- include/tvm/runtime/device_api.h | 7 +++--- include/tvm/runtime/ndarray.h | 4 ++-- src/relay/analysis/context_analysis.cc | 6 ++--- src/relay/transforms/memory_alloc.cc | 3 +-- src/runtime/c_runtime_api.cc | 7 +++--- src/runtime/contrib/edgetpu/edgetpu_runtime.h | 3 ++- src/runtime/contrib/ethosn/ethosn_device.cc | 3 ++- src/runtime/cpu_device_api.cc | 3 +-- src/runtime/crt/common/crt_runtime_api.c | 4 ++-- src/runtime/crt/graph_runtime/graph_runtime.c | 3 +-- src/runtime/cuda/cuda_device_api.cc | 3 +-- src/runtime/graph/graph_runtime.cc | 2 +- src/runtime/graph/graph_runtime.h | 3 +-- src/runtime/hexagon/hexagon_device_api.cc | 10 ++++---- src/runtime/metal/metal_device_api.mm | 5 ++-- src/runtime/minrpc/minrpc_server.h | 4 ++-- src/runtime/ndarray.cc | 5 ++-- src/runtime/opencl/opencl_device_api.cc | 11 ++++----- src/runtime/rocm/rocm_device_api.cc | 24 ++++++++++--------- src/runtime/rpc/rpc_device_api.cc | 7 +++--- src/runtime/rpc/rpc_endpoint.cc | 6 ++--- src/runtime/rpc/rpc_module.cc | 4 ++-- src/runtime/rpc/rpc_session.h | 4 ++-- src/runtime/vm/memory_manager.cc | 3 ++- src/runtime/vulkan/vulkan.cc | 3 +-- 25 files changed, 64 insertions(+), 73 deletions(-) diff --git a/include/tvm/runtime/device_api.h b/include/tvm/runtime/device_api.h index afa2cfa2affda..3caea1041f835 100644 --- a/include/tvm/runtime/device_api.h +++ b/include/tvm/runtime/device_api.h @@ -156,8 +156,7 @@ class TVM_DLL DeviceAPI { * \param event_src The source stream to synchronize. * \param event_dst The destination stream to synchronize. */ - virtual void SyncStreamFromTo(Device dev, TVMStreamHandle event_src, - TVMStreamHandle event_dst); + virtual void SyncStreamFromTo(Device dev, TVMStreamHandle event_src, TVMStreamHandle event_dst); /*! * \brief Allocate temporal workspace for backend execution. * @@ -299,8 +298,8 @@ inline std::ostream& operator<<(std::ostream& os, DLDevice dev); * \return A Device with RPC session mask added, valid on the RPC client. */ inline Device AddRPCSessionMask(Device dev, int session_table_index) { - CHECK(!IsRPCSessionDevice(dev)) - << "AddRPCSessionMask: dev already non-zero RPCSessionIndex: " << dev; + CHECK(!IsRPCSessionDevice(dev)) << "AddRPCSessionMask: dev already non-zero RPCSessionIndex: " + << dev; dev.device_type = static_cast(dev.device_type | (kRPCSessMask * (session_table_index + 1))); return dev; diff --git a/include/tvm/runtime/ndarray.h b/include/tvm/runtime/ndarray.h index 1b056e4d6a2b0..de558d77c3343 100644 --- a/include/tvm/runtime/ndarray.h +++ b/include/tvm/runtime/ndarray.h @@ -421,8 +421,8 @@ inline bool SaveDLTensor(dmlc::Stream* strm, const DLTensor* tensor) { int64_t data_byte_size = type_bytes * num_elems; strm->Write(data_byte_size); - if (DMLC_IO_NO_ENDIAN_SWAP && tensor->device.device_type == kDLCPU && tensor->strides == nullptr && - tensor->byte_offset == 0) { + if (DMLC_IO_NO_ENDIAN_SWAP && tensor->device.device_type == kDLCPU && + tensor->strides == nullptr && tensor->byte_offset == 0) { // quick path strm->Write(tensor->data, data_byte_size); } else { diff --git a/src/relay/analysis/context_analysis.cc b/src/relay/analysis/context_analysis.cc index 08729cce044d9..970ceda070dff 100644 --- a/src/relay/analysis/context_analysis.cc +++ b/src/relay/analysis/context_analysis.cc @@ -104,7 +104,8 @@ class DeviceDomain { // Check if the current domain equals the other one. bool operator==(const DeviceDomain& other) const { - return device_.device_type == other.device_.device_type && device_.device_id == other.device_.device_id; + return device_.device_type == other.device_.device_type && + device_.device_id == other.device_.device_id; } bool operator!=(const DeviceDomain& other) const { return !(*this == other); } @@ -701,8 +702,7 @@ AnalysisResultMap ContextAnalysis(const IRModule& mod, const Device& default_dev // Unpack the device type and deivce id fields in Device for PackedFunc calls // as Device is not in the object system. -PackedAnalysisResultMap ContextAnalysisPacked(const IRModule& mod, - const Device& default_device) { +PackedAnalysisResultMap ContextAnalysisPacked(const IRModule& mod, const Device& default_device) { PackedAnalysisResultMap ret; auto res = ContextAnalysis(mod, default_device); for (const auto& it : res) { diff --git a/src/relay/transforms/memory_alloc.cc b/src/relay/transforms/memory_alloc.cc index 2a1e0e6d6d683..dd0cfc85a5108 100644 --- a/src/relay/transforms/memory_alloc.cc +++ b/src/relay/transforms/memory_alloc.cc @@ -262,8 +262,7 @@ class DialectRewriter : public ExprMutator { } // Allocate a tensor with a statically known shape. - Var MakeStaticAllocation(LetList* scope, const TensorType& type, Device dev, - String name_hint) { + Var MakeStaticAllocation(LetList* scope, const TensorType& type, Device dev, String name_hint) { std::vector int_shape; for (auto it : type->shape) { const auto* imm = it.as(); diff --git a/src/runtime/c_runtime_api.cc b/src/runtime/c_runtime_api.cc index aba8f9bd0c5c8..b9e8c2549fd57 100644 --- a/src/runtime/c_runtime_api.cc +++ b/src/runtime/c_runtime_api.cc @@ -199,8 +199,7 @@ void DeviceAPI::FreeStream(Device dev, TVMStreamHandle stream) { LOG(FATAL) << "Device does not support stream api."; } -void DeviceAPI::SyncStreamFromTo(Device dev, TVMStreamHandle event_src, - TVMStreamHandle event_dst) { +void DeviceAPI::SyncStreamFromTo(Device dev, TVMStreamHandle event_src, TVMStreamHandle event_dst) { LOG(FATAL) << "Device does not support stream api."; } @@ -597,8 +596,8 @@ int TVMDeviceAllocDataSpace(DLDevice dev, size_t nbytes, size_t alignment, DLDat API_END(); } -int TVMDeviceAllocDataSpaceWithScope(DLDevice dev, int ndim, const int64_t* shape, - DLDataType dtype, const char* mem_scope, void** out_data) { +int TVMDeviceAllocDataSpaceWithScope(DLDevice dev, int ndim, const int64_t* shape, DLDataType dtype, + const char* mem_scope, void** out_data) { API_BEGIN(); Optional scope; if (mem_scope != nullptr) { diff --git a/src/runtime/contrib/edgetpu/edgetpu_runtime.h b/src/runtime/contrib/edgetpu/edgetpu_runtime.h index 8802e550c9e55..a7a57ff422e30 100644 --- a/src/runtime/contrib/edgetpu/edgetpu_runtime.h +++ b/src/runtime/contrib/edgetpu/edgetpu_runtime.h @@ -25,9 +25,10 @@ #ifndef TVM_RUNTIME_CONTRIB_EDGETPU_EDGETPU_RUNTIME_H_ #define TVM_RUNTIME_CONTRIB_EDGETPU_EDGETPU_RUNTIME_H_ +#include + #include #include -#include #include "../tflite/tflite_runtime.h" diff --git a/src/runtime/contrib/ethosn/ethosn_device.cc b/src/runtime/contrib/ethosn/ethosn_device.cc index eee78a86a1128..0ffbee29032b2 100644 --- a/src/runtime/contrib/ethosn/ethosn_device.cc +++ b/src/runtime/contrib/ethosn/ethosn_device.cc @@ -190,7 +190,8 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.test.infra.inference_result") for (int argc = 0; argc < args.size(); argc++) { const DLTensor* tensor = args[argc]; auto shape = std::vector(tensor->shape, tensor->shape + tensor->ndim); - test_outputs.emplace_back(tvm::runtime::NDArray::Empty(shape, tensor->dtype, tensor->device)); + test_outputs.emplace_back( + tvm::runtime::NDArray::Empty(shape, tensor->dtype, tensor->device)); test_outputs[test_outputs.size() - 1].CopyFrom(tensor); } }); diff --git a/src/runtime/cpu_device_api.cc b/src/runtime/cpu_device_api.cc index 4fdf348b60832..774335f5660be 100644 --- a/src/runtime/cpu_device_api.cc +++ b/src/runtime/cpu_device_api.cc @@ -44,8 +44,7 @@ class CPUDeviceAPI final : public DeviceAPI { *rv = 1; } } - void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, - DLDataType type_hint) final { + void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, DLDataType type_hint) final { void* ptr; #if _MSC_VER ptr = _aligned_malloc(nbytes, alignment); diff --git a/src/runtime/crt/common/crt_runtime_api.c b/src/runtime/crt/common/crt_runtime_api.c index f0dc2ab530129..6634cfa7db89c 100644 --- a/src/runtime/crt/common/crt_runtime_api.c +++ b/src/runtime/crt/common/crt_runtime_api.c @@ -91,8 +91,8 @@ int TVMDeviceAllocDataSpace(DLDevice dev, size_t nbytes, size_t alignment, DLDat return TVMPlatformMemoryAllocate(nbytes, dev, out_data); } -int TVMDeviceAllocDataSpaceWithScope(DLDevice dev, int ndim, const int64_t* shape, - DLDataType dtype, const char* mem_scope, void** out_data) { +int TVMDeviceAllocDataSpaceWithScope(DLDevice dev, int ndim, const int64_t* shape, DLDataType dtype, + const char* mem_scope, void** out_data) { size_t nbytes = 1; for (int i = 0; i < ndim; ++i) { nbytes *= shape[i]; diff --git a/src/runtime/crt/graph_runtime/graph_runtime.c b/src/runtime/crt/graph_runtime/graph_runtime.c index b6a62be4742d9..ad4bd99821062 100644 --- a/src/runtime/crt/graph_runtime/graph_runtime.c +++ b/src/runtime/crt/graph_runtime/graph_runtime.c @@ -266,8 +266,7 @@ int TVMGraphRuntimeGraphAttr_Load(TVMGraphRuntimeGraphAttr* attr, JSONReader* re } DLDevice dev = {kDLCPU, 0}; tvm_crt_error_t err = - TVMPlatformMemoryAllocate(TVM_CRT_STRLEN_DLTYPE * num_items, dev -, (void**)&attr->dltype); + TVMPlatformMemoryAllocate(TVM_CRT_STRLEN_DLTYPE * num_items, dev, (void**)&attr->dltype); if (err != kTvmErrorNoError) { fprintf(stderr, "memory allocate error: %08x", err); return -1; diff --git a/src/runtime/cuda/cuda_device_api.cc b/src/runtime/cuda/cuda_device_api.cc index ed072caaeca1e..5d6ff2b263c2a 100644 --- a/src/runtime/cuda/cuda_device_api.cc +++ b/src/runtime/cuda/cuda_device_api.cc @@ -106,8 +106,7 @@ class CUDADeviceAPI final : public DeviceAPI { } *rv = value; } - void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, - DLDataType type_hint) final { + void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, DLDataType type_hint) final { ICHECK_EQ(256 % alignment, 0U) << "CUDA space is aligned at 256 bytes"; void* ret; if (dev.device_type == kDLCPUPinned) { diff --git a/src/runtime/graph/graph_runtime.cc b/src/runtime/graph/graph_runtime.cc index bccae25b3c822..2e64774886e5f 100644 --- a/src/runtime/graph/graph_runtime.cc +++ b/src/runtime/graph/graph_runtime.cc @@ -306,7 +306,7 @@ void GraphRuntime::SetupStorage() { { std::vector shape_vec{attrs_.shape[i].begin(), attrs_.shape[i].end()}; DLTensor template_tensor{nullptr, Device{kDLCPU, 0}, static_cast(shape_vec.size()), - vtype[i], shape_vec.data(), nullptr, + vtype[i], shape_vec.data(), nullptr, 0}; lookup_rv = lookup_linked_param_(module_, sid, &template_tensor, devices_[0]); } diff --git a/src/runtime/graph/graph_runtime.h b/src/runtime/graph/graph_runtime.h index 26d550eae5476..aeaee9e3483ed 100644 --- a/src/runtime/graph/graph_runtime.h +++ b/src/runtime/graph/graph_runtime.h @@ -97,8 +97,7 @@ class TVM_DLL GraphRuntime : public ModuleNode { */ void Init(const std::string& graph_json, tvm::runtime::Module module, - const std::vector& devs, - const PackedFunc lookup_linked_param_func = nullptr); + const std::vector& devs, const PackedFunc lookup_linked_param_func = nullptr); /*! * \brief Get the input index given the name of input. diff --git a/src/runtime/hexagon/hexagon_device_api.cc b/src/runtime/hexagon/hexagon_device_api.cc index ea5c3bc953dec..a07a7c683026b 100644 --- a/src/runtime/hexagon/hexagon_device_api.cc +++ b/src/runtime/hexagon/hexagon_device_api.cc @@ -48,8 +48,8 @@ class HexagonDeviceAPI : public DeviceAPI { protected: void CopyDataFromTo(const void* from, size_t from_offset, void* to, size_t to_offset, - size_t num_bytes, Device dev_from, Device dev_to, - DLDataType type_hint, TVMStreamHandle stream) final; + size_t num_bytes, Device dev_from, Device dev_to, DLDataType type_hint, + TVMStreamHandle stream) final; }; // HexagonDeviceAPI. @@ -72,9 +72,9 @@ inline void HexagonDeviceAPI::FreeDataSpace(Device dev, void* ptr) { } inline void HexagonDeviceAPI::CopyDataFromTo(const void* from, size_t from_offset, void* to, - size_t to_offset, size_t num_bytes, - Device dev_from, Device dev_to, - DLDataType type_hint, TVMStreamHandle stream) { + size_t to_offset, size_t num_bytes, Device dev_from, + Device dev_to, DLDataType type_hint, + TVMStreamHandle stream) { const char* src = static_cast(from) + from_offset; char* dst = static_cast(to) + to_offset; diff --git a/src/runtime/metal/metal_device_api.mm b/src/runtime/metal/metal_device_api.mm index de73472d0cb2c..555c1f836d288 100644 --- a/src/runtime/metal/metal_device_api.mm +++ b/src/runtime/metal/metal_device_api.mm @@ -172,9 +172,8 @@ int GetWarpSize(id dev) { } void MetalWorkspace::CopyDataFromTo(const void* from, size_t from_offset, void* to, - size_t to_offset, size_t size, Device dev_from, - Device dev_to, DLDataType type_hint, - TVMStreamHandle stream) { + size_t to_offset, size_t size, Device dev_from, Device dev_to, + DLDataType type_hint, TVMStreamHandle stream) { this->Init(); ICHECK(stream == nullptr); Device dev = dev_from; diff --git a/src/runtime/minrpc/minrpc_server.h b/src/runtime/minrpc/minrpc_server.h index 9ccee2f48e9d6..4ba09d803f834 100644 --- a/src/runtime/minrpc/minrpc_server.h +++ b/src/runtime/minrpc/minrpc_server.h @@ -418,8 +418,8 @@ class MinRPCServer { DLTensor* arr = reinterpret_cast(values[0].v_handle); const char* mem_scope = (tcodes[1] == kTVMNullptr ? nullptr : values[1].v_str); void* handle; - int call_ecode = TVMDeviceAllocDataSpaceWithScope(arr->device, arr->ndim, arr->shape, arr->dtype, - mem_scope, &handle); + int call_ecode = TVMDeviceAllocDataSpaceWithScope(arr->device, arr->ndim, arr->shape, + arr->dtype, mem_scope, &handle); if (call_ecode == 0) { this->ReturnHandle(handle); } else { diff --git a/src/runtime/ndarray.cc b/src/runtime/ndarray.cc index f5fe68f879004..0d50010a73c1f 100644 --- a/src/runtime/ndarray.cc +++ b/src/runtime/ndarray.cc @@ -193,8 +193,9 @@ DLManagedTensor* NDArray::ToDLPack() const { return Internal::ToDLPack(get_mutab NDArray NDArray::Empty(std::vector shape, DLDataType dtype, Device dev, Optional mem_scope) { NDArray ret = Internal::Create(shape, dtype, dev); - ret.get_mutable()->dl_tensor.data = DeviceAPI::Get(ret->device)->AllocDataSpace( - ret->device, shape.size(), shape.data(), ret->dtype, mem_scope); + ret.get_mutable()->dl_tensor.data = + DeviceAPI::Get(ret->device) + ->AllocDataSpace(ret->device, shape.size(), shape.data(), ret->dtype, mem_scope); return ret; } diff --git a/src/runtime/opencl/opencl_device_api.cc b/src/runtime/opencl/opencl_device_api.cc index 2a91d144a2cad..7f0974bc90b3f 100644 --- a/src/runtime/opencl/opencl_device_api.cc +++ b/src/runtime/opencl/opencl_device_api.cc @@ -36,9 +36,7 @@ OpenCLWorkspace* OpenCLWorkspace::Global() { return inst; } -void OpenCLWorkspace::SetDevice(Device dev) { - GetThreadEntry()->device.device_id = dev.device_id; -} +void OpenCLWorkspace::SetDevice(Device dev) { GetThreadEntry()->device.device_id = dev.device_id; } void OpenCLWorkspace::GetAttr(Device dev, DeviceAttrKind kind, TVMRetValue* rv) { this->Init(); @@ -136,9 +134,8 @@ void OpenCLWorkspace::FreeDataSpace(Device dev, void* ptr) { } void OpenCLWorkspace::CopyDataFromTo(const void* from, size_t from_offset, void* to, - size_t to_offset, size_t size, Device dev_from, - Device dev_to, DLDataType type_hint, - TVMStreamHandle stream) { + size_t to_offset, size_t size, Device dev_from, Device dev_to, + DLDataType type_hint, TVMStreamHandle stream) { this->Init(); ICHECK(stream == nullptr); if (IsOpenCLDevice(dev_from) && IsOpenCLDevice(dev_to)) { @@ -264,7 +261,7 @@ void OpenCLWorkspace::Init(const std::string& type_key, const std::string& devic } cl_int err_code; this->device = clCreateContext(nullptr, this->devices.size(), &(this->devices[0]), nullptr, - nullptr, &err_code); + nullptr, &err_code); OPENCL_CHECK_ERROR(err_code); ICHECK_EQ(this->queues.size(), 0U); for (size_t i = 0; i < this->devices.size(); ++i) { diff --git a/src/runtime/rocm/rocm_device_api.cc b/src/runtime/rocm/rocm_device_api.cc index e8bf5647bb784..70c614551884c 100644 --- a/src/runtime/rocm/rocm_device_api.cc +++ b/src/runtime/rocm/rocm_device_api.cc @@ -67,11 +67,11 @@ class ROCMDeviceAPI final : public DeviceAPI { } case kComputeVersion: { std::ostringstream os; - ROCM_CALL( - hipDeviceGetAttribute(&value, hipDeviceAttributeComputeCapabilityMajor, device.device_id)); + ROCM_CALL(hipDeviceGetAttribute(&value, hipDeviceAttributeComputeCapabilityMajor, + device.device_id)); os << value << "."; - ROCM_CALL( - hipDeviceGetAttribute(&value, hipDeviceAttributeComputeCapabilityMinor, device.device_id)); + ROCM_CALL(hipDeviceGetAttribute(&value, hipDeviceAttributeComputeCapabilityMinor, + device.device_id)); os << value; *rv = os.str(); return; @@ -94,9 +94,12 @@ class ROCMDeviceAPI final : public DeviceAPI { } case kMaxThreadDimensions: { int dims[3]; - ROCM_CALL(hipDeviceGetAttribute(&dims[0], hipDeviceAttributeMaxBlockDimX, device.device_id)); - ROCM_CALL(hipDeviceGetAttribute(&dims[1], hipDeviceAttributeMaxBlockDimY, device.device_id)); - ROCM_CALL(hipDeviceGetAttribute(&dims[2], hipDeviceAttributeMaxBlockDimZ, device.device_id)); + ROCM_CALL( + hipDeviceGetAttribute(&dims[0], hipDeviceAttributeMaxBlockDimX, device.device_id)); + ROCM_CALL( + hipDeviceGetAttribute(&dims[1], hipDeviceAttributeMaxBlockDimY, device.device_id)); + ROCM_CALL( + hipDeviceGetAttribute(&dims[2], hipDeviceAttributeMaxBlockDimZ, device.device_id)); std::stringstream ss; ss << "[" << dims[0] << ", " << dims[1] << ", " << dims[2] << "]"; @@ -104,8 +107,8 @@ class ROCMDeviceAPI final : public DeviceAPI { return; } case kMaxRegistersPerBlock: - ROCM_CALL( - hipDeviceGetAttribute(&value, hipDeviceAttributeMaxRegistersPerBlock, device.device_id)); + ROCM_CALL(hipDeviceGetAttribute(&value, hipDeviceAttributeMaxRegistersPerBlock, + device.device_id)); break; case kGcnArch: { hipDeviceProp_t prop; @@ -120,8 +123,7 @@ class ROCMDeviceAPI final : public DeviceAPI { } *rv = value; } - void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, - DLDataType type_hint) final { + void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, DLDataType type_hint) final { ROCM_CALL(hipSetDevice(dev.device_id)); ICHECK_EQ(256 % alignment, 0U) << "ROCM space is aligned at 256 bytes"; void* ret; diff --git a/src/runtime/rpc/rpc_device_api.cc b/src/runtime/rpc/rpc_device_api.cc index 73682378b9ed2..1d6fb85d94955 100644 --- a/src/runtime/rpc/rpc_device_api.cc +++ b/src/runtime/rpc/rpc_device_api.cc @@ -55,8 +55,7 @@ class RPCDeviceAPI final : public DeviceAPI { return space; } - void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, - DLDataType type_hint) final { + void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, DLDataType type_hint) final { auto sess = GetSess(dev); auto remote_dev = RemoveRPCSessionMask(dev); void* data = @@ -119,8 +118,8 @@ class RPCDeviceAPI final : public DeviceAPI { protected: void CopyDataFromTo(const void* from, size_t from_offset, void* to, size_t to_offset, - size_t num_bytes, Device dev_from, Device dev_to, - DLDataType type_hint, TVMStreamHandle stream) final { + size_t num_bytes, Device dev_from, Device dev_to, DLDataType type_hint, + TVMStreamHandle stream) final { LOG(FATAL) << "Not implemented."; } diff --git a/src/runtime/rpc/rpc_endpoint.cc b/src/runtime/rpc/rpc_endpoint.cc index 9e01cbb84b7be..83107e573bffa 100644 --- a/src/runtime/rpc/rpc_endpoint.cc +++ b/src/runtime/rpc/rpc_endpoint.cc @@ -178,8 +178,7 @@ class RPCEndpoint::EventHandler : public dmlc::Stream { << args[i].AsObjectRef()->GetTypeKey() << " is not supported by RPC"; } else if (tcode == kDLDevice) { DLDevice dev = args[i]; - ICHECK(!IsRPCSessionDevice(dev)) - << "InternalError: cannot pass RPC context in the channel"; + ICHECK(!IsRPCSessionDevice(dev)) << "InternalError: cannot pass RPC context in the channel"; } } } @@ -1004,8 +1003,7 @@ class RPCClientSession : public RPCSession, public DeviceAPI { } } - void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, - DLDataType type_hint) final { + void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, DLDataType type_hint) final { return endpoint_->SysCallRemote(RPCCode::kDevAllocData, dev, nbytes, alignment, type_hint); } diff --git a/src/runtime/rpc/rpc_module.cc b/src/runtime/rpc/rpc_module.cc index 43071da4bb76a..7db84862604fe 100644 --- a/src/runtime/rpc/rpc_module.cc +++ b/src/runtime/rpc/rpc_module.cc @@ -342,8 +342,8 @@ inline void CPUCacheFlush(int begin_index, const TVMArgs& args) { } } -PackedFunc WrapTimeEvaluator(PackedFunc pf, Device dev, int number, int repeat, - int min_repeat_ms, PackedFunc f_preproc) { +PackedFunc WrapTimeEvaluator(PackedFunc pf, Device dev, int number, int repeat, int min_repeat_ms, + PackedFunc f_preproc) { ICHECK(pf != nullptr); if (static_cast(dev.device_type) == static_cast(kDLMicroDev)) { diff --git a/src/runtime/rpc/rpc_session.h b/src/runtime/rpc/rpc_session.h index 0dc657a745e69..8923103157d56 100644 --- a/src/runtime/rpc/rpc_session.h +++ b/src/runtime/rpc/rpc_session.h @@ -302,8 +302,8 @@ struct RemoteSpace { * \param f_preproc The function to be executed before we excetute time evaluator. * \return f_timer A timer function. */ -PackedFunc WrapTimeEvaluator(PackedFunc f, Device dev, int number, int repeat, - int min_repeat_ms, PackedFunc f_preproc = nullptr); +PackedFunc WrapTimeEvaluator(PackedFunc f, Device dev, int number, int repeat, int min_repeat_ms, + PackedFunc f_preproc = nullptr); /*! * \brief Create a Global RPC module that refers to the session. diff --git a/src/runtime/vm/memory_manager.cc b/src/runtime/vm/memory_manager.cc index dd5b148c49c68..fa5edf18335c8 100644 --- a/src/runtime/vm/memory_manager.cc +++ b/src/runtime/vm/memory_manager.cc @@ -80,7 +80,8 @@ NDArray StorageObj::AllocNDArray(size_t offset, std::vector shape, DLDa VerifyDataType(dtype); // crtical zone: allocate header, cannot throw - NDArray::Container* container = new NDArray::Container(nullptr, shape, dtype, this->buffer.device); + NDArray::Container* container = + new NDArray::Container(nullptr, shape, dtype, this->buffer.device); container->SetDeleter(StorageObj::Deleter); size_t needed_size = GetDataSize(container->dl_tensor); diff --git a/src/runtime/vulkan/vulkan.cc b/src/runtime/vulkan/vulkan.cc index e78c94fcda046..741a0262affcd 100644 --- a/src/runtime/vulkan/vulkan.cc +++ b/src/runtime/vulkan/vulkan.cc @@ -118,8 +118,7 @@ class VulkanDeviceAPI final : public DeviceAPI { void SetDevice(Device dev) final { VulkanThreadEntry::ThreadLocal()->device = dev; } void GetAttr(Device dev, DeviceAttrKind kind, TVMRetValue* rv) final; std::vector GetComputeQueueFamilies(VkPhysicalDevice phy_dev); - void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, - DLDataType type_hint) final { + void* AllocDataSpace(Device dev, size_t nbytes, size_t alignment, DLDataType type_hint) final { if (nbytes == 0) { // Vulkan seems to have issues if we return nullptr on zero size alloc nbytes = 1;