diff --git a/mindspore/ccsrc/common/debug/anf_ir_dump.cc b/mindspore/ccsrc/common/debug/anf_ir_dump.cc index be52819da59..5c0b7093d92 100644 --- a/mindspore/ccsrc/common/debug/anf_ir_dump.cc +++ b/mindspore/ccsrc/common/debug/anf_ir_dump.cc @@ -218,7 +218,6 @@ void DumpOperator(const AnfNodePtr &node, const std::shared_ptr auto cnode = dyn_cast(node); if (cnode == nullptr) { MS_LOG(EXCEPTION) << "Parameter \'node\' should be a CNode"; - return; } AnfNodePtr op = cnode->input(0); MS_EXCEPTION_IF_NULL(op); diff --git a/mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc b/mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc index 61245523d29..2545aa22ca7 100644 --- a/mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc +++ b/mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc @@ -33,8 +33,8 @@ namespace mindspore { namespace { API_FACTORY_REG(GraphCell::GraphImpl, AscendGraphImpl); -constexpr const char *kHcclEnable = "MS_ENABLE_HCCL"; -constexpr const char *kHcclGroupFile = "PARA_GROUP_FILE"; +constexpr auto kHcclEnable = "MS_ENABLE_HCCL"; +constexpr auto kHcclGroupFile = "PARA_GROUP_FILE"; void InitHccl() { auto ms_context = MsContext::GetInstance(); diff --git a/mindspore/ccsrc/include/common/debug/common.h b/mindspore/ccsrc/include/common/debug/common.h index ff79c74f10d..5f8b68fa8fa 100644 --- a/mindspore/ccsrc/include/common/debug/common.h +++ b/mindspore/ccsrc/include/common/debug/common.h @@ -47,13 +47,13 @@ class COMMON_EXPORT Common { static bool FileExists(const std::string &filepath); static bool CommonFuncForConfigPath(const std::string &default_path, const std::string &env_path, std::string *value); static std::string GetCompilerCachePath(); + static std::string GetUserDefineCachePath(); static bool GetDebugTerminate(); static bool GetDebugExitSuccess(); static void DebugTerminate(bool val, bool exit_success); private: static bool IsEveryFilenameValid(const std::string &path, size_t length_limit, const std::string &error_message); - static std::string GetUserDefineCachePath(); inline static bool debugger_terminate_ = false; inline static bool exit_success_ = false; diff --git a/mindspore/ccsrc/kernel/common_utils.cc b/mindspore/ccsrc/kernel/common_utils.cc index a66062c14ec..05babef1024 100644 --- a/mindspore/ccsrc/kernel/common_utils.cc +++ b/mindspore/ccsrc/kernel/common_utils.cc @@ -146,23 +146,7 @@ FusionType GetFusionTypeByName(const std::string &name) { return iter->first; } -std::string GetCompilerCachePath() { - static std::string config_path = ""; - if (config_path != "") { - return config_path; - } - const char *value = ::getenv(kCOMPILER_CACHE_PATH); - if (value == nullptr) { - config_path = "./"; - } else { - config_path = std::string(value); - (void)FileUtils::CreateNotExistDirs(config_path); - if (config_path[config_path.length() - 1] != '/') { - config_path += "/"; - } - } - return config_path; -} +std::string GetCompilerCachePath() { return Common::GetUserDefineCachePath(); } void KernelMeta::Initialize() { auto config_path = GetCompilerCachePath(); @@ -1003,12 +987,12 @@ size_t UnitSizeInBytes(const mindspore::TypeId &t) { } KernelAttr &KernelAttr::AddInputAttr(const TypeId &ms_type, const std::string &format) { - input_type_.emplace_back(ms_type, format); + (void)input_type_.emplace_back(ms_type, format); return *this; } KernelAttr &KernelAttr::AddOutputAttr(const TypeId &ms_type, const std::string &format) { - output_type_.emplace_back(ms_type, format); + (void)output_type_.emplace_back(ms_type, format); return *this; } @@ -1106,10 +1090,10 @@ KernelAttr GetKernelAttrFromBuildInfo(const KernelBuildInfoPtr &build_info) { MS_EXCEPTION_IF_NULL(build_info); KernelAttr kernel_attr; for (size_t i = 0; i < build_info->GetInputNum(); i++) { - kernel_attr.AddInputAttr(build_info->GetInputDeviceType(i), build_info->GetInputFormat(i)); + (void)kernel_attr.AddInputAttr(build_info->GetInputDeviceType(i), build_info->GetInputFormat(i)); } for (size_t j = 0; j < build_info->GetOutputNum(); j++) { - kernel_attr.AddOutputAttr(build_info->GetOutputDeviceType(j), build_info->GetOutputFormat(j)); + (void)kernel_attr.AddOutputAttr(build_info->GetOutputDeviceType(j), build_info->GetOutputFormat(j)); } return kernel_attr; } diff --git a/mindspore/ccsrc/kernel/kernel_build_info.cc b/mindspore/ccsrc/kernel/kernel_build_info.cc index 58fc110f2fe..90c1e3b2c43 100644 --- a/mindspore/ccsrc/kernel/kernel_build_info.cc +++ b/mindspore/ccsrc/kernel/kernel_build_info.cc @@ -91,8 +91,9 @@ size_t KernelBuildInfo::GetInputNum() const { return inputs_format_.size(); } size_t KernelBuildInfo::GetOutputNum() const { return outputs_format_.size(); } size_t KernelBuildInfo::GetOutputNumWithoutMonad() const { - return std::count_if(outputs_device_type_.begin(), outputs_device_type_.end(), - [](TypeId type) { return type != TypeId::kObjectTypeUMonad; }); + const auto count = std::count_if(outputs_device_type_.begin(), outputs_device_type_.end(), + [](TypeId type) { return type != TypeId::kObjectTypeUMonad; }); + return static_cast(count); } std::string KernelBuildInfo::GetInputReshapeType(size_t input_index) const { diff --git a/mindspore/ccsrc/kernel/kernel_fusion.h b/mindspore/ccsrc/kernel/kernel_fusion.h index 4979db9afb4..deb81550395 100644 --- a/mindspore/ccsrc/kernel/kernel_fusion.h +++ b/mindspore/ccsrc/kernel/kernel_fusion.h @@ -27,11 +27,11 @@ namespace kernel { * @brief fuse op and return a callable mod */ struct FusionScopeInfo { - FusionScopeInfo(int64_t id, const std::string &f_name, std::string core_type, std::vector in, + FusionScopeInfo(int64_t id, std::string f_name, std::string core_type, std::vector in, std::vector comp, std::vector out) : scope_id(id), - full_name(f_name), - core_type(core_type), + full_name(std::move(f_name)), + core_type(std::move(core_type)), input_nodes(std::move(in)), compute_nodes(std::move(comp)), output_nodes(std::move(out)) {}