From afdc255d74732fbbdfc8da875834d28c30dd0cbc Mon Sep 17 00:00:00 2001 From: tanghuikang Date: Fri, 18 Mar 2022 19:06:09 +0800 Subject: [PATCH] Clean code --- .../ccsrc/backend/common/somas/somas_solver_pre.cc | 2 +- .../model/acl/acl_vm/acl_multi_graph_session.cc | 1 - .../hal/device/ge_runtime/task/event_record_task.cc | 5 ++++- .../hal/device/ge_runtime/task/label_goto_task.cc | 2 ++ .../kernel/tbe/tbe_kernel_select/tbe_kernel_select.cc | 10 +++++----- .../ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc | 4 ---- .../batchmatmul_fusedmuladd_fusion_pass.h | 2 +- .../ir_fission/bce_with_logits_loss_fission.cc | 2 +- .../ascend/optimizer/ir_fission/broadcastto_fission.cc | 4 ++-- ...e_softmax_cross_entropy_with_logits_unify_mindir.cc | 6 +++--- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/mindspore/ccsrc/backend/common/somas/somas_solver_pre.cc b/mindspore/ccsrc/backend/common/somas/somas_solver_pre.cc index 504386fb0e3..7db61d9a78c 100644 --- a/mindspore/ccsrc/backend/common/somas/somas_solver_pre.cc +++ b/mindspore/ccsrc/backend/common/somas/somas_solver_pre.cc @@ -54,7 +54,7 @@ Status SomasSolverPre::AddContiguousInfoInMap(const vector> &cont for (size_t i = 0; i < aux.size() - 1; i++) { auto index1 = aux[i]; auto index2 = aux[i + 1]; - if (CheckTensors(pTensors, index1, index2) == FAILED) { + if (CheckTensors(pTensors, SizeToUint(index1), SizeToUint(index2)) == FAILED) { return FAILED; } tensors[index1]->right_ = tensors[index2]; diff --git a/mindspore/ccsrc/cxx_api/model/acl/acl_vm/acl_multi_graph_session.cc b/mindspore/ccsrc/cxx_api/model/acl/acl_vm/acl_multi_graph_session.cc index c7d9412af08..7da6c22bad8 100644 --- a/mindspore/ccsrc/cxx_api/model/acl/acl_vm/acl_multi_graph_session.cc +++ b/mindspore/ccsrc/cxx_api/model/acl/acl_vm/acl_multi_graph_session.cc @@ -26,7 +26,6 @@ #include "cxx_api/graph/graph_data.h" namespace mindspore::session { - void MultiGraphAclSession::Init(uint32_t device_id) { InitExecutor(kDavinciMultiGraphInferenceDevice, device_id); } GraphId MultiGraphAclSession::CompileGraphImpl(const AnfNodePtrList &lst, const AnfNodePtrList &outputs) { diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/task/event_record_task.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/task/event_record_task.cc index f8f8bc5911f..5975da87c4c 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/task/event_record_task.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/task/event_record_task.cc @@ -38,7 +38,10 @@ EventRecordTask::EventRecordTask(const ModelContext &model_context, event_ = event_list[event_id]; } -EventRecordTask::~EventRecordTask() {} +EventRecordTask::~EventRecordTask() { + stream_ = nullptr; + event_ = nullptr; +} void EventRecordTask::Distribute() { MS_LOG(INFO) << "EventRecordTask Distribute start, stream: " << stream_ << ", event: " << event_ diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/task/label_goto_task.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/task/label_goto_task.cc index 95e09d7a38c..b68155fc7e6 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/task/label_goto_task.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/task/label_goto_task.cc @@ -51,6 +51,8 @@ LabelGotoTask::~LabelGotoTask() { } index_value_ = nullptr; } + stream_ = nullptr; + rt_model_handle_ = nullptr; } void LabelGotoTask::Distribute() { diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_select/tbe_kernel_select.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_select/tbe_kernel_select.cc index ec88e118e49..97a82262e8e 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_select/tbe_kernel_select.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_select/tbe_kernel_select.cc @@ -562,13 +562,13 @@ void TbeKernelSelect::PrintSupportedFormat(const SupportFormat &support_format) auto output_items = support_format.output_format.at(i); std::string print_str = "["; for (const auto &input : input_items) { - print_str.append(input); - print_str.append(", "); + (void)print_str.append(input); + (void)print_str.append(", "); } - print_str.append("] -->"); + (void)print_str.append("] -->"); for (const auto &output : output_items) { - print_str.append(output); - print_str.append(", "); + (void)print_str.append(output); + (void)print_str.append(", "); } MS_LOG(INFO) << "Support format: " << print_str; } diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc index 8cd2683a5a7..c01d4bcb4f9 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc @@ -221,10 +221,6 @@ void TbeUtils::UpdateCache(const std::string &kernel_name) { KernelPackPtr TbeUtils::SearchCache(const std::string &kernel_name, const bool is_akg) { // search cache. KernelMeta *bin_map = KernelMeta::GetInstance(); - if (bin_map == nullptr) { - MS_LOG(INFO) << "kernel cache is invalid."; - return nullptr; - } return bin_map->GetKernelPack(kernel_name, is_akg); } diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_fusedmuladd_fusion_pass.h b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_fusedmuladd_fusion_pass.h index 5d5234419fc..89e4e2ea8c4 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_fusedmuladd_fusion_pass.h +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_fusedmuladd_fusion_pass.h @@ -29,7 +29,7 @@ namespace mindspore { namespace opt { class BatchMatmulFusedMulAddFusionPass : public FusionBasePass { public: - explicit BatchMatmulFusedMulAddFusionPass(FusionIdAllocatorPtr idAllocator) + explicit BatchMatmulFusedMulAddFusionPass(const FusionIdAllocatorPtr &idAllocator) : FusionBasePass("BatchMatmulFusedMulAddFusionPass", idAllocator) { PassSwitchManager::GetInstance().RegistLicPass(name(), OptPassEnum::BatchMatmulFusedMulAddFusionPass); } diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/bce_with_logits_loss_fission.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/bce_with_logits_loss_fission.cc index 9775ae4405c..5294a55d05d 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/bce_with_logits_loss_fission.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/bce_with_logits_loss_fission.cc @@ -35,7 +35,7 @@ AnfNodePtr BCEWithLogitsLossFission::AddReduceNode(const FuncGraphPtr &func_grap // Copy a new sigmoid node, shape of output is the same as input std::vector new_simoid_inputs = { NewValueNode(std::make_shared(prim::kPrimBCEWithLogitsLoss->name()))}; - new_simoid_inputs.insert(new_simoid_inputs.end(), cnode->inputs().begin() + 1, cnode->inputs().end()); + (void)new_simoid_inputs.insert(new_simoid_inputs.end(), cnode->inputs().begin() + 1, cnode->inputs().end()); CNodePtr new_cnode = NewCNode(new_simoid_inputs, func_graph); MS_EXCEPTION_IF_NULL(new_cnode); auto predict_input = cnode->inputs()[kIndex1]; diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/broadcastto_fission.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/broadcastto_fission.cc index 1fb1b30b4b1..0ba637ce016 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/broadcastto_fission.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/broadcastto_fission.cc @@ -29,10 +29,10 @@ CNodePtr AddCastNode(const FuncGraphPtr &func_graph, const TypeId dst_type, cons std::vector new_cast_inputs = {NewValueNode(std::make_shared(prim::kPrimCast->name()))}; BaseShapePtr shape; if (fir_flag) { - new_cast_inputs.emplace_back(input_node->inputs()[kIndex1]); + (void)new_cast_inputs.emplace_back(input_node->inputs()[kIndex1]); shape = common::AnfAlgo::GetOutputDetailShape(input_node->inputs()[kIndex1], 0); } else { - new_cast_inputs.emplace_back(input_node); + (void)new_cast_inputs.emplace_back(input_node); shape = common::AnfAlgo::GetOutputDetailShape(input_node, 0); } CNodePtr new_cast = NewCNode(new_cast_inputs, func_graph); diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/sparse_softmax_cross_entropy_with_logits_unify_mindir.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/sparse_softmax_cross_entropy_with_logits_unify_mindir.cc index de48e1876ec..978685f7ff6 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/sparse_softmax_cross_entropy_with_logits_unify_mindir.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/sparse_softmax_cross_entropy_with_logits_unify_mindir.cc @@ -281,7 +281,7 @@ CNodePtr CreateExpandDimsPynative(const FuncGraphPtr &graph, const CNodePtr &rea expand_dims_node->set_scope(real_div_node->scope()); std::vector y_shape = common::AnfAlgo::GetOutputInferShape(real_div_node, 0); - y_shape.emplace_back(1); + (void)y_shape.emplace_back(1); if (AnfUtils::IsShapeDynamic(y_shape)) { auto min_shape = common::AnfAlgo::GetOutputMinShape(real_div_node, 0); auto max_shape = common::AnfAlgo::GetOutputMaxShape(real_div_node, 0); @@ -552,8 +552,8 @@ const AnfNodePtr GradSparseSoftmaxCrossEntropyWithLogitsUnifyMindIR::Process(con auto manager = graph->manager(); MS_EXCEPTION_IF_NULL(manager); - manager->Replace(sparse_softmax_node, reduce_node); - manager->Replace(mul_node, new_mul_node); + (void)manager->Replace(sparse_softmax_node, reduce_node); + (void)manager->Replace(mul_node, new_mul_node); std::vector inputs = {NewValueNode(std::make_shared(prim::kPrimDepend->name())), NewValueNode(MakeValue(true)), NewValueNode(MakeValue(true))}; auto new_depend = graph->NewCNode(inputs);