From 33c879f69c3fd6b17baf53e7d0c6ff48e2bd9e5c Mon Sep 17 00:00:00 2001 From: lianliguang Date: Wed, 22 Sep 2021 14:31:33 +0800 Subject: [PATCH] clean pclint and codex warning --- .../pipeline/jit/static_analysis/async_eval_result.cc | 10 +++++----- .../pipeline/jit/static_analysis/program_specialize.cc | 2 +- mindspore/ccsrc/vm/graph_partition.cc | 2 +- mindspore/core/abstract/prim_statement.cc | 4 ++-- mindspore/core/abstract/primitive_infer_map.cc | 4 ++-- mindspore/core/gvar/log_adapter_common.cc | 4 +--- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.cc b/mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.cc index e3f16d9ea5b..ec5177a6fda 100644 --- a/mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.cc +++ b/mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.cc @@ -54,7 +54,7 @@ void AnalysisSchedule::Yield(const AsyncInferTask *async_infer_task) { if (async_infer_task->Ready() == 0) { MS_LOG(DEBUG) << " The active thread count: " << activate_threads_.size() << " thread id: " << GetThreadID() << " async_infer_task thread id:" << async_infer_task->ThreadID(); - activate_threads_.erase(GetThreadID()); + (void)activate_threads_.erase(GetThreadID()); } MS_LOG(DEBUG) << " The active thread count: " << activate_threads_.size() << " The infer_thread_count: " << infer_thread_count_ @@ -129,7 +129,7 @@ bool AnalysisSchedule::SetNextReady() { return item->HasResult(); }); if (it == scheduleList_.end()) { - if ((size_t)infer_thread_count_.load() >= scheduleList_.size()) { + if (IntToSize(infer_thread_count_.load()) >= scheduleList_.size()) { MS_LOG(DEBUG) << "There is some task to be added. Please wait."; return false; } @@ -137,7 +137,7 @@ bool AnalysisSchedule::SetNextReady() { << " The infer_thread_count: " << infer_thread_count_ << " schedule list size: " << scheduleList_.size(); // Enter endless loop if there is not ready result. - activate_threads_.insert(scheduleList_.front()->ThreadID()); + (void)activate_threads_.insert(scheduleList_.front()->ThreadID()); // Let the first thread to trigger endless loop exception. MS_LOG(DEBUG) << "Enter endless loop if there is not ready result.Set the async to trigger exception:" << scheduleList_.front().get() << " The active thread count: " << activate_threads_.size(); @@ -146,9 +146,9 @@ bool AnalysisSchedule::SetNextReady() { return true; } auto async_task = *it; - activate_threads_.insert(async_task->ThreadID()); + (void)activate_threads_.insert(async_task->ThreadID()); async_task->SetReady(); - scheduleList_.erase(it); + (void)scheduleList_.erase(it); MS_LOG(DEBUG) << " Success to SetReady. The active thread count: " << activate_threads_.size() << " The infer_thread_count: " << infer_thread_count_ << " schedule list size: " << scheduleList_.size() << " async: " << async_task->ThreadID() << " address: " << async_task.get(); diff --git a/mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc b/mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc index 88722c131f5..18e8cafc1b7 100644 --- a/mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc +++ b/mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc @@ -672,7 +672,7 @@ void FuncGraphSpecializer::ProcessCNode(const CNodePtr &new_node) { while (IsPrimitiveCNode(func, prim::kPrimPartial)) { std::vector inputs = func->cast()->inputs(); // First element is partial, second is func so arg is start from 2 - (void)args.insert(args.begin(), inputs.begin() + IntToSize(arg_start_index), inputs.end()); + (void)args.insert(args.begin(), inputs.begin() + SizeToInt(arg_start_index), inputs.end()); func = inputs[1]; } new_inputs = args; diff --git a/mindspore/ccsrc/vm/graph_partition.cc b/mindspore/ccsrc/vm/graph_partition.cc index e61e03e2b6b..d9221e8e268 100644 --- a/mindspore/ccsrc/vm/graph_partition.cc +++ b/mindspore/ccsrc/vm/graph_partition.cc @@ -452,7 +452,7 @@ void AddSegmentDependency(const FuncGraphPtr &graph, const std::map *segments) { +void RemoveUselessDependency(const std::vector *segments) { MS_EXCEPTION_IF_NULL(segments); for (auto &segment : *segments) { MS_EXCEPTION_IF_NULL(segment); diff --git a/mindspore/core/abstract/prim_statement.cc b/mindspore/core/abstract/prim_statement.cc index c2b551f2d8f..0eda0e38ed3 100644 --- a/mindspore/core/abstract/prim_statement.cc +++ b/mindspore/core/abstract/prim_statement.cc @@ -34,7 +34,7 @@ AbstractBasePtr InferImplReturn(const AnalysisEnginePtr &, const PrimitivePtr &, return abs_base; } -AbstractBasePtr InferImplSwitch(const AnalysisEnginePtr &, const PrimitivePtr &prim, +AbstractBasePtr InferImplSwitch(const AnalysisEnginePtr &, const PrimitivePtr &, const AbstractBasePtrList &args_spec_list) { // Inputs: condition, true branch, false branch if (args_spec_list.size() != 3) { @@ -187,7 +187,7 @@ AbstractBasePtr InferImplNotInDict(const AnalysisEnginePtr &, const PrimitivePtr return std::make_shared(!IsInDict(primitive, args_spec_list)); } -AbstractBasePtr InferImplIsConstant(const AnalysisEnginePtr &, const PrimitivePtr &primitive, +AbstractBasePtr InferImplIsConstant(const AnalysisEnginePtr &, const PrimitivePtr &, const AbstractBasePtrList &args_spec_list) { // statement: isconstant(x) // Inputs: x diff --git a/mindspore/core/abstract/primitive_infer_map.cc b/mindspore/core/abstract/primitive_infer_map.cc index d1d110bbe14..7209b41889a 100644 --- a/mindspore/core/abstract/primitive_infer_map.cc +++ b/mindspore/core/abstract/primitive_infer_map.cc @@ -70,8 +70,8 @@ std::vector GetDependsFormMap(const CNodePtr &cnode) { MS_EXCEPTION_IF_NULL(ms_context); auto device = ms_context->get_param(MS_CTX_DEVICE_TARGET); if (device == kAscendDevice) { - dynamic_shape_depends.insert({kReduceSum, {1}}); - dynamic_shape_depends.insert({kTranspose, {1}}); + (void)dynamic_shape_depends.insert({kReduceSum, {1}}); + (void)dynamic_shape_depends.insert({kTranspose, {1}}); } MS_EXCEPTION_IF_NULL(cnode); diff --git a/mindspore/core/gvar/log_adapter_common.cc b/mindspore/core/gvar/log_adapter_common.cc index 6ac348fcc21..6db14e5e788 100644 --- a/mindspore/core/gvar/log_adapter_common.cc +++ b/mindspore/core/gvar/log_adapter_common.cc @@ -54,9 +54,7 @@ static const std::vector sub_module_names = { "GE", // SM_GE }; -const std::string GetSubModuleName(SubModuleId module_id) { - return sub_module_names[static_cast(module_id % NUM_SUBMODUES)]; -} +const std::string GetSubModuleName(SubModuleId module_id) { return sub_module_names[(module_id % NUM_SUBMODUES)]; } // export GetTimeString for all sub modules std::string GetTimeString() {