From 4063a69846d5d691ec9151d373884a1a9402c991 Mon Sep 17 00:00:00 2001 From: laiyongqiang Date: Mon, 14 Sep 2020 16:00:31 +0800 Subject: [PATCH] clean codex warning --- .../ccsrc/backend/optimizer/mem_reuse/mem_reuse_allocator.cc | 3 +-- mindspore/ccsrc/runtime/device/kernel_runtime.cc | 2 +- mindspore/ccsrc/runtime/device/kernel_runtime.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mindspore/ccsrc/backend/optimizer/mem_reuse/mem_reuse_allocator.cc b/mindspore/ccsrc/backend/optimizer/mem_reuse/mem_reuse_allocator.cc index e791d318fa..7d6b9a4eeb 100644 --- a/mindspore/ccsrc/backend/optimizer/mem_reuse/mem_reuse_allocator.cc +++ b/mindspore/ccsrc/backend/optimizer/mem_reuse/mem_reuse_allocator.cc @@ -176,7 +176,6 @@ void BestFitMemReuse::AssignCommonNodeOutputOffset() { void BestFitMemReuse::AssignCommunicationNodeOutputOffset() { size_t total_kernel_output_size = 0; - size_t output_num = 0; // get all output size MS_EXCEPTION_IF_NULL(current_kernel_); for (const auto &tensor_idx : current_kernel_->GetOutputRefIndexs()) { @@ -203,7 +202,7 @@ void BestFitMemReuse::AssignCommunicationNodeOutputOffset() { size_t index = GetTensorIndex(tensor_idx); auto tensor_desc = tensor_ptr_list_[index]; MS_EXCEPTION_IF_NULL(tensor_desc); - if (output_index == 0 || output_index == output_num - 1) { + if (output_index == 0 || output_index == output_ref_indexes.size() - 1) { tensor_desc->size_ += kDefaultMemAlignSize; } diff --git a/mindspore/ccsrc/runtime/device/kernel_runtime.cc b/mindspore/ccsrc/runtime/device/kernel_runtime.cc index a82d248d9e..906ed2a429 100644 --- a/mindspore/ccsrc/runtime/device/kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/kernel_runtime.cc @@ -422,7 +422,7 @@ void KernelRuntime::AssignStaticMemoryInput(const session::KernelGraph *graph) { } } -void KernelRuntime::AssignStaticMemoryOutput(session::KernelGraph *graph) { +void KernelRuntime::AssignStaticMemoryOutput(const session::KernelGraph *graph) { MS_EXCEPTION_IF_NULL(graph); auto nodes = AnfAlgo::GetAllOutput(graph->output(), {prim::kPrimTupleGetItem}); std::vector non_communication_op; diff --git a/mindspore/ccsrc/runtime/device/kernel_runtime.h b/mindspore/ccsrc/runtime/device/kernel_runtime.h index b81954a557..b009742681 100644 --- a/mindspore/ccsrc/runtime/device/kernel_runtime.h +++ b/mindspore/ccsrc/runtime/device/kernel_runtime.h @@ -107,7 +107,7 @@ class KernelRuntime { #endif private: - void AssignStaticMemoryOutput(session::KernelGraph *graph); + void AssignStaticMemoryOutput(const session::KernelGraph *graph); void GenLaunchArgs(const mindspore::kernel::KernelMod &kernel_mod, const AnfNodePtr &kernel, AddressPtrList *kernel_inputs, AddressPtrList *kernel_workspaces, AddressPtrList *kernel_outputs); bool LaunchKernelMod(const session::KernelGraph &graph);