diff --git a/mindspore/ccsrc/backend/common/pass/custom_op_const_input_to_attr.cc b/mindspore/ccsrc/backend/common/pass/custom_op_const_input_to_attr.cc index d606fc1c002..ea5dd54a3cd 100644 --- a/mindspore/ccsrc/backend/common/pass/custom_op_const_input_to_attr.cc +++ b/mindspore/ccsrc/backend/common/pass/custom_op_const_input_to_attr.cc @@ -31,11 +31,10 @@ const AnfNodePtr CustomOpConstInputToAttr::Process(const FuncGraphPtr &, const A auto cnode = node->cast(); MS_EXCEPTION_IF_NULL(cnode); - - // Only process Custom operator. if (!IsPrimitiveCNode(cnode, prim::kPrimCustom)) { return nullptr; } + auto primitive = common::AnfAlgo::GetCNodePrimitive(cnode); MS_EXCEPTION_IF_NULL(primitive); mindspore::HashSet attr_indices; diff --git a/mindspore/ccsrc/backend/common/pass/custom_op_reg_info_to_attr.cc b/mindspore/ccsrc/backend/common/pass/custom_op_reg_info_to_attr.cc index 34c27f63534..e5748b34213 100644 --- a/mindspore/ccsrc/backend/common/pass/custom_op_reg_info_to_attr.cc +++ b/mindspore/ccsrc/backend/common/pass/custom_op_reg_info_to_attr.cc @@ -123,14 +123,12 @@ const AnfNodePtr CustomOpRegInfoToAttr::Process(const FuncGraphPtr &, const AnfN if (node == nullptr || !AnfUtils::IsRealCNodeKernel(node)) { return nullptr; } - auto cnode = node->cast(); MS_EXCEPTION_IF_NULL(cnode); - - // Only process Custom operator. if (!IsPrimitiveCNode(cnode, prim::kPrimCustom)) { return nullptr; } + auto primitive = common::AnfAlgo::GetCNodePrimitive(cnode); MS_EXCEPTION_IF_NULL(primitive); auto func_type = common::AnfAlgo::GetNodeAttr(cnode, kAttrFuncType); @@ -148,7 +146,7 @@ const AnfNodePtr CustomOpRegInfoToAttr::Process(const FuncGraphPtr &, const AnfN auto attr_names_vec = GetValue>(attr_names); for (const auto &name : attr_names_vec) { if (!primitive->HasAttr(name)) { - missing_attrs.insert(name); + (void)missing_attrs.insert(name); } } if (missing_attrs.empty()) { diff --git a/mindspore/ccsrc/backend/common/somas/somas_parameter.h b/mindspore/ccsrc/backend/common/somas/somas_parameter.h index ed4ba14945e..697130748b1 100644 --- a/mindspore/ccsrc/backend/common/somas/somas_parameter.h +++ b/mindspore/ccsrc/backend/common/somas/somas_parameter.h @@ -25,7 +25,7 @@ namespace mindspore { namespace somas { class SomasParameter { public: - SomasParameter(size_t id, const std::string source_node_name, size_t index, const void *addr, size_t size) + SomasParameter(size_t id, const std::string &source_node_name, size_t index, const void *addr, size_t size) : id_(id), source_node_name_(source_node_name), output_index_(index), diff --git a/mindspore/ccsrc/kernel/environ_manager.cc b/mindspore/ccsrc/kernel/environ_manager.cc index 5dcf38a28ac..e546775fc15 100644 --- a/mindspore/ccsrc/kernel/environ_manager.cc +++ b/mindspore/ccsrc/kernel/environ_manager.cc @@ -17,6 +17,7 @@ #include "kernel/environ_manager.h" #include "utils/ms_utils.h" #include "utils/log_adapter.h" +#include "include/common/utils/utils.h" namespace mindspore { namespace kernel { @@ -89,8 +90,8 @@ bool EnvironMgr::CheckEnvInput(const CNodePtr &kernel_node) const { } // Check the input value. - auto value_type = AnfAlgo::GetInputDeviceDataType(kernel_node, 2); - auto value_shapes = AnfAlgo::GetInputDeviceShape(kernel_node, 2); + auto value_type = AnfAlgo::GetInputDeviceDataType(kernel_node, kIndex2); + auto value_shapes = AnfAlgo::GetInputDeviceShape(kernel_node, kIndex2); if ((value_type_attr == kObjectTypeEnvType) && (!IsScalarTensor(value_type, value_shapes))) { MS_LOG(ERROR) << "The input value checks invalid, kernel: " << kernel_node->fullname_with_scope(); return false; diff --git a/mindspore/ccsrc/kernel/kash/kernel_pack.cc b/mindspore/ccsrc/kernel/kash/kernel_pack.cc index b2ce42f31ce..37769abdb41 100644 --- a/mindspore/ccsrc/kernel/kash/kernel_pack.cc +++ b/mindspore/ccsrc/kernel/kash/kernel_pack.cc @@ -101,7 +101,7 @@ bool KernelPack::ReadFromJsonFile(const std::string &json_f, const std::string & (void)kernel_json.read(json_->contents, SizeToLong(json_->len)); if (processor == kProcessorCpu) { - std::string bin_f = json_f.substr(0, json_f.length() - 5) + ".so"; + std::string bin_f = json_f.substr(0, json_f.length() - kJsonSuffixLength) + ".so"; if (!CheckHash(json_f, bin_f, js)) { return false; } diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc index 7e2ea0ee0d1..f564a329b3d 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc @@ -694,7 +694,7 @@ std::string AscendKernelRuntime::GetDumpPath() { } #ifndef ENABLE_SECURITY -void AscendKernelRuntime::DumpTaskExceptionInfo(const session::KernelGraph & /* graph */) { +void AscendKernelRuntime::DumpTaskExceptionInfo(const session::KernelGraph &) { const std::string path = GetDumpPath(); if (access(path.c_str(), F_OK) == 0) { if (!DeleteDumpDir(path)) { diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_device_context.cc b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_device_context.cc index 4c5d58babed..7716ef821c1 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_device_context.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_device_context.cc @@ -421,7 +421,6 @@ void AscendDeviceContext::PreprocessBeforeRunGraph(const KernelGraphPtr &graph) MS_LOG(EXCEPTION) << "Preprocess failed before run graph " << graph->graph_id() << ", \nerror msg: " << e.what(); } - // TODO(dsj): for ms_function running in graph_mode. should be delete later const std::vector &kernels = graph->execution_order(); for (const auto &kernel : kernels) { common::AnfAlgo::SetNodeAttr(kAttrMSFunction, MakeValue(true), kernel); @@ -831,7 +830,6 @@ bool AscendDeviceContext::LaunchKernel(const CNodePtr &kernel, const vector locker(launch_mutex_); // launch atomic clean @@ -846,7 +844,6 @@ bool AscendDeviceContext::LaunchKernel(const CNodePtr &kernel, const vectorfullname_with_scope(); - // TODO(dsj): for ms_function running in graph_mode. should be delete later if (is_dynamic_shape && !(common::AnfAlgo::GetBooleanAttr(kernel, kAttrMSFunction))) { ret = kernel_mod->Launch(real_inputs, workspace, outputs, GetKernelStream(kernel)); if (!ret) { diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_graph_optimization.cc b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_graph_optimization.cc index 1f7207158c1..813bed60033 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_graph_optimization.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_graph_optimization.cc @@ -122,7 +122,6 @@ void AscendGraphOptimization::OptimizeExecutionOrder(const KernelGraphPtr &graph } #endif - // TODO(sida): do not hide nop op in kernel_by_kernel mode if (graph->is_executing_sink()) { opt::HideNopNode(graph.get()); } diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/label_set.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/label_set.cc index 275ce7b60eb..19873f1e1b3 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/label_set.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/label_set.cc @@ -43,8 +43,8 @@ bool LabelSetKernel::Init(const AnfNodePtr &anf_node) { return true; } -bool LabelSetKernel::Launch(const std::vector & /*inputs*/, const std::vector & /*workspace*/, - const std::vector & /*outputs*/, void * /*stream_ptr*/) { +bool LabelSetKernel::Launch(const std::vector &, const std::vector &, + const std::vector &, void *) { MS_LOG(INFO) << "LabelSetKernel launch"; return true; } diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/memcpy_async.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/memcpy_async.cc index 77143e03d92..f92ae5a34ec 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/memcpy_async.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/memcpy_async.cc @@ -38,7 +38,7 @@ MemCpyAsyncKernel::MemCpyAsyncKernel() {} MemCpyAsyncKernel::~MemCpyAsyncKernel() {} -bool MemCpyAsyncKernel::Launch(const std::vector &inputs, const std::vector & /* workspace */, +bool MemCpyAsyncKernel::Launch(const std::vector &inputs, const std::vector &, const std::vector &outputs, void *stream_ptr) { if (inputs.size() != 1) { MS_LOG(ERROR) << "inputs size is not one"; diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/tensor_copy_slices.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/tensor_copy_slices.cc index 86820fabeb3..b2eb8b84f3f 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/tensor_copy_slices.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/tensor_copy_slices.cc @@ -36,7 +36,7 @@ TensorCopySlices::TensorCopySlices() {} TensorCopySlices::~TensorCopySlices() {} -bool TensorCopySlices::Launch(const std::vector &inputs, const std::vector & /*workspace*/, +bool TensorCopySlices::Launch(const std::vector &inputs, const std::vector &, const std::vector &outputs, void *stream_ptr) { if (inputs.size() != 2) { MS_LOG(ERROR) << "inputs size is not 2"; diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/dynamic_tbe_kernel_mod.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/dynamic_tbe_kernel_mod.cc index ff198a298f5..54fddf30ade 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/dynamic_tbe_kernel_mod.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/dynamic_tbe_kernel_mod.cc @@ -260,12 +260,12 @@ bool DynamicTbeKernelMod::Launch(const std::vector &inputs, const st // pack all addresses into a vector. std::vector runtimeargs; (void)std::transform(std::begin(inputs), std::end(inputs), std::back_inserter(runtimeargs), - [](const AddressPtr &input) -> void * { return input->addr; }); + [](const AddressPtr &input) { return input->addr; }); (void)std::transform(std::begin(outputs), std::end(outputs), std::back_inserter(runtimeargs), - [](const AddressPtr &output) -> void * { return output->addr; }); + [](const AddressPtr &output) { return output->addr; }); if (!workspace.empty()) { (void)std::transform(std::begin(workspace), std::end(workspace), std::back_inserter(runtimeargs), - [](const AddressPtr &addr) -> void * { return addr->addr; }); + [](const AddressPtr &addr) { return addr->addr; }); } if (!tiling_data_.empty() && tiling_data_ptr_ != nullptr) { diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/fusion_tbe_json_creator.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/fusion_tbe_json_creator.cc index b768ce1b05b..0294641294f 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/fusion_tbe_json_creator.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/fusion_tbe_json_creator.cc @@ -303,8 +303,6 @@ std::vector FusionBuildTbeJsonCreator::GetDescOutputIndex(const std::vec bool FusionBuildTbeJsonCreator::AttrsJsonPostProcessing(const AnfNodePtr &anf_node, const OpInfoPtr &op_info_ptr, nlohmann::json *attrs_json) { - // just keep it - // tbe::TbeAdapter::CastAttrJsonPost(anf_node, attrs_json); return true; } diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_fusedmuladd_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_fusedmuladd_fusion_pass.cc index 0bc87f70902..e399c50bc5a 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_fusedmuladd_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_fusedmuladd_fusion_pass.cc @@ -23,8 +23,7 @@ namespace mindspore { namespace opt { -void BatchMatmulFusedMulAddFusionPass::MatchBatchMatmulFusedMulAdd(const CNodePtr &cnode, - const session::KernelGraph & /* kernel_graph */, +void BatchMatmulFusedMulAddFusionPass::MatchBatchMatmulFusedMulAdd(const CNodePtr &cnode, const session::KernelGraph &, FusedNodeRecord *candidate_fusion) { MS_EXCEPTION_IF_NULL(cnode); MS_EXCEPTION_IF_NULL(candidate_fusion); diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.h b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.h index c3acbfc0bed..cdc032d3b49 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.h +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.h @@ -29,7 +29,7 @@ namespace mindspore { namespace opt { class BnupdateEltwiseEltwiseFusionPass : public FusionBasePass { public: - explicit BnupdateEltwiseEltwiseFusionPass(FusionIdAllocatorPtr idAllocator) + explicit BnupdateEltwiseEltwiseFusionPass(const FusionIdAllocatorPtr &idAllocator) : FusionBasePass("BnupdateEltwiseEltwiseFusionPass", idAllocator) { PassSwitchManager::GetInstance().RegistLicPass(name(), OptPassEnum::BnupdateEltwiseEltwiseFusionPass); } diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/conv2dbackprop_eltwise_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/conv2dbackprop_eltwise_fusion_pass.cc index 6dbd350db57..9fda5cb15a2 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/conv2dbackprop_eltwise_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/conv2dbackprop_eltwise_fusion_pass.cc @@ -24,7 +24,7 @@ namespace mindspore { namespace opt { void Conv2DBackpropEltwiseFusionPass::MatchConv2DBackpropInputEltwise(const CNodePtr &cnode, - const session::KernelGraph & /* kernel_graph */, + const session::KernelGraph &, FusedNodeRecord *candidate_fusion) { MS_EXCEPTION_IF_NULL(cnode); MS_EXCEPTION_IF_NULL(candidate_fusion); diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/depthwiseconv_eltwise_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/depthwiseconv_eltwise_fusion_pass.cc index 62b8d19f5ce..48c0ea7eddd 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/depthwiseconv_eltwise_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/depthwiseconv_eltwise_fusion_pass.cc @@ -24,8 +24,7 @@ namespace mindspore { namespace opt { -void DepthwiseConvEltwiseFusionPass::MatchDepthwiseConvRelu(const CNodePtr &cnode, - const session::KernelGraph & /* kernel_graph */, +void DepthwiseConvEltwiseFusionPass::MatchDepthwiseConvRelu(const CNodePtr &cnode, const session::KernelGraph &, FusedNodeRecord *candidate_fusion, bool is_order) { MS_EXCEPTION_IF_NULL(cnode); MS_EXCEPTION_IF_NULL(candidate_fusion); diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/matmul_confusiontranspose_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/matmul_confusiontranspose_fusion_pass.cc index 966982ebf5f..5fad322b1aa 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/matmul_confusiontranspose_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/matmul_confusiontranspose_fusion_pass.cc @@ -28,7 +28,7 @@ constexpr auto kAttrTransposeX2 = "transpose_x2"; } // namespace void MatmulConfusionTranposeFusionPass::MatchMatmulConfusionTranpose(const CNodePtr &cnode, - const session::KernelGraph & /* kernel_graph */, + const session::KernelGraph &, FusedNodeRecord *candidate_fusion) { MS_EXCEPTION_IF_NULL(cnode); MS_EXCEPTION_IF_NULL(candidate_fusion); diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/dynamic_rnn_grad_fission_v2.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/dynamic_rnn_grad_fission_v2.cc index 39eaf285662..af644037c06 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/dynamic_rnn_grad_fission_v2.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/dynamic_rnn_grad_fission_v2.cc @@ -564,11 +564,9 @@ AnfNodePtr DynamicRnnGradFissionV2::CreateConcatNodeT1(const FuncGraphPtr &func_ auto reshape_in0 = NewCNode(reshape_inputs, func_graph); std::vector shape = {origin_input0_shape[kDim0] * origin_input0_shape[kDim1], origin_input0_shape[kDim2]}; common::AnfAlgo::SetOutputInferTypeAndShape({origin_input0_dtype}, {shape}, reshape_in0.get()); - // t_size * batch_size, input_size (t_size = 1) - concat_inputs.push_back(reshape_in0); + (void)concat_inputs.emplace_back(reshape_in0); } else { - // t_size, batch_size, input_size (t_size = 1) - concat_inputs.push_back(origin_input0); + (void)concat_inputs.emplace_back(origin_input0); } auto origin_input4 = dynamic_rnn_grad_cnode->input(kIndex5); diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/matmul_biasadd_fusion.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/matmul_biasadd_fusion.cc index 60e1e7827f6..d12f70d7e3e 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/matmul_biasadd_fusion.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/matmul_biasadd_fusion.cc @@ -36,10 +36,10 @@ AnfNodePtr MatmulBiasaddFusion::CreateMatmulWithBias(const FuncGraphPtr &graph, } std::vector inputs; - inputs.emplace_back(NewValueNode(std::make_shared(prim::kPrimMatMul->name()))); - inputs.emplace_back(GetAnfNodeByVar(equiv, x0_)); - inputs.emplace_back(GetAnfNodeByVar(equiv, x1_)); - inputs.emplace_back(GetAnfNodeByVar(equiv, x2_)); + (void)inputs.emplace_back(NewValueNode(std::make_shared(prim::kPrimMatMul->name()))); + (void)inputs.emplace_back(GetAnfNodeByVar(equiv, x0_)); + (void)inputs.emplace_back(GetAnfNodeByVar(equiv, x1_)); + (void)inputs.emplace_back(GetAnfNodeByVar(equiv, x2_)); auto new_node = NewCNode(inputs, graph); MS_EXCEPTION_IF_NULL(new_node); new_node->set_scope(node->scope()); diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/all_to_all_unify_mindir.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/all_to_all_unify_mindir.cc index 1088fe444a6..af743cb8795 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/all_to_all_unify_mindir.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/all_to_all_unify_mindir.cc @@ -180,7 +180,7 @@ CNodePtr AllToAllUnifyMindIR::CreateConcatNode(const FuncGraphPtr &graph, const max_shape[LongToSize(concat_dim)] *= split_count; min_shape[LongToSize(concat_dim)] *= split_count; ShapeVector new_shape; - std::transform(single_shape.begin(), single_shape.end(), std::back_inserter(new_shape), SizeToLong); + (void)std::transform(single_shape.begin(), single_shape.end(), std::back_inserter(new_shape), SizeToLong); common::AnfAlgo::SetOutputTypeAndDetailShape({common::AnfAlgo::GetOutputInferDataType(all_to_all_v_outputs[0], 0)}, {std::make_shared(new_shape, min_shape, max_shape)}, concat.get());