diff --git a/mindspore/ccsrc/kernel/kernel.h b/mindspore/ccsrc/kernel/kernel.h index f530d2c8694..e370f46da37 100644 --- a/mindspore/ccsrc/kernel/kernel.h +++ b/mindspore/ccsrc/kernel/kernel.h @@ -240,7 +240,7 @@ enum class KernelModType { HostKernelMod, }; -enum KernelErrorCode { KRET_OK = 0, KRET_RESIZE_FAILED = 1, KRET_UNKNOWN_SHAPE = 2, KRET_UNKNOWN_OUT_SHAPE = 3 }; +enum KernelErrorCode : int { KRET_OK = 0, KRET_RESIZE_FAILED = 1, KRET_UNKNOWN_SHAPE = 2, KRET_UNKNOWN_OUT_SHAPE = 3 }; class KernelMod { public: diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/host/reshape_kernel.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/host/reshape_kernel.cc index f5fbbd94b78..4af87b62807 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/host/reshape_kernel.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/host/reshape_kernel.cc @@ -184,5 +184,24 @@ void ReshapeKernelMod::Execute(const std::vector &inputs, const std: } MS_LOG(INFO) << "Execute host ReshapeKernel End"; } + +bool ReshapeKernelMod::Launch(const std::vector &inputs, const std::vector &, + const std::vector &outputs, void *stream_ptr) { + auto node = anf_node_.lock(); + MS_EXCEPTION_IF_NULL(node); + auto cnode = node->cast(); + MS_EXCEPTION_IF_NULL(cnode); + if (stream_ == nullptr) { + stream_ = stream_ptr; + } + try { + Execute(inputs, outputs); + } catch (const std::exception &e) { + MS_LOG(ERROR) << "ReshapeKernelMod Launch failed. node: " << cnode->fullname_with_scope() << ", Error message is " + << e.what(); + return false; + } + return true; +} } // namespace kernel } // namespace mindspore diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/host/reshape_kernel.h b/mindspore/ccsrc/plugin/device/ascend/kernel/host/reshape_kernel.h index dec681ff603..48505940b8a 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/host/reshape_kernel.h +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/host/reshape_kernel.h @@ -26,23 +26,7 @@ class ReshapeKernelMod : public HostKernelMod { ReshapeKernelMod() = default; ~ReshapeKernelMod() override = default; bool Launch(const std::vector &inputs, const std::vector &workspace, - const std::vector &outputs, void *stream_ptr) override { - auto node = anf_node_.lock(); - MS_EXCEPTION_IF_NULL(node); - auto cnode = node->cast(); - MS_EXCEPTION_IF_NULL(cnode); - if (stream_ == nullptr) { - stream_ = stream_ptr; - } - try { - Execute(inputs, outputs); - } catch (const std::exception &e) { - MS_LOG(ERROR) << "ReshapeKernelMod Launch failed. node: " << cnode->fullname_with_scope() << ", Error message is " - << e.what(); - return false; - } - return true; - } + const std::vector &outputs, void *stream_ptr) override; private: void Execute() const; diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/getnext_dynamic.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/getnext_dynamic.cc index 2687671e80d..93c97eeaa97 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/getnext_dynamic.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/getnext_dynamic.cc @@ -37,8 +37,8 @@ GetNextDynamic::GetNextDynamic() {} GetNextDynamic::~GetNextDynamic() {} -bool GetNextDynamic::Launch(const std::vector &inputs, const std::vector &, - const std::vector &outputs, void *stream_ptr) { +bool GetNextDynamic::Launch(const std::vector &, const std::vector &, + const std::vector &, void *) { return true; } @@ -53,9 +53,8 @@ bool GetNextDynamic::Init(const mindspore::AnfNodePtr &anf_node) { return true; } -int GetNextDynamic::Resize(const BaseOperatorPtr &base_operator, const std::vector &inputs, - const std::vector &outputs, - const std::map &others) { +int GetNextDynamic::Resize(const BaseOperatorPtr &, const std::vector &, + const std::vector &, const std::map &) { auto data_kernel = anf_node_.lock(); bool ret = device::PopDataFromDataQueue(data_kernel); if (!ret) { @@ -77,8 +76,8 @@ std::vector> GetNextDynamicDesc::GetKer std::vector output_type; for (size_t idx = 0; idx < output_num; ++idx) { auto data_type = common::AnfAlgo::GetOutputInferDataType(kernel_node, idx); - output_type.push_back(data_type); - output_format.push_back(kOpFormat_DEFAULT); + output_type.emplace_back(data_type); + output_format.emplace_back(kOpFormat_DEFAULT); } auto builder = KernelBuildInfo::KernelBuildInfoBuilder(); builder.SetOutputsFormat(output_format); diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/getnext_dynamic.h b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/getnext_dynamic.h index 59519e4f734..6e664abdc84 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/rts/getnext_dynamic.h +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/rts/getnext_dynamic.h @@ -35,9 +35,9 @@ class GetNextDynamic : public RtKernel { const std::vector &outputs, void *stream_ptr) override; int Resize(const BaseOperatorPtr &base_operator, const std::vector &inputs, const std::vector &outputs, - const std::map &others = std::map()); + const std::map &others = std::map()) override; std::vector GenTask(const std::vector &, const std::vector &, - const std::vector &, uint32_t) { + const std::vector &, uint32_t) override { std::vector res; return res; } @@ -47,7 +47,7 @@ class GetNextDynamicDesc : public RtKerDesc { public: GetNextDynamicDesc(); ~GetNextDynamicDesc() override; - std::vector> GetKernelInfo(const CNodePtr &kernel_node = nullptr) override; + std::vector> GetKernelInfo(const CNodePtr &kernel_node) override; }; MS_REG_RTKERNEL_DESC(getnext, GetNextDynamicDesc); diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/dynamic_tbe_kernel_mod.h b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/dynamic_tbe_kernel_mod.h index 18e0ca98cd6..b2debda2472 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/dynamic_tbe_kernel_mod.h +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/dynamic_tbe_kernel_mod.h @@ -20,7 +20,6 @@ #include #include #include -#include #include #include "plugin/device/ascend/kernel/tbe/tbe_kernel_mod.h" #include "plugin/device/ascend/kernel/tbe/tbe_utils.h" 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 a7693dd33b5..8b92efc0822 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 @@ -123,7 +123,7 @@ bool FusionBuildTbeJsonCreator::CheckInput(const FusionScopeInfo &fusion_scope_i void FusionBuildTbeJsonCreator::GenDataJson(const std::vector &compute_nodes, const std::vector &compute_json, std::vector *op_list_json, - const ANodeFusionDataTypeMap &spec_data_input) { + const ANodeFusionDataTypeMap &spec_data_input) const { MS_EXCEPTION_IF_NULL(op_list_json); MS_LOG(DEBUG) << "Start."; std::vector compute_nodes_fullname; @@ -280,7 +280,7 @@ bool FusionBuildTbeJsonCreator::GenOutputsJson(const AnfNodePtr &anf_node, nlohm } void FusionBuildTbeJsonCreator::GenReusedOutputDesc(const AnfNodePtr &anf_node, size_t index, size_t output_index, - nlohmann::json *output_desc, size_t out_size) { + nlohmann::json *output_desc, size_t out_size) const { GenDesJsonCommon(output_desc); std::string output_desc_name = anf_node->fullname_with_scope() + "_" + std::to_string(index); (*output_desc)[kJName] = output_desc_name; diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/fusion_tbe_json_creator.h b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/fusion_tbe_json_creator.h index f153cf96364..e69564c1833 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/fusion_tbe_json_creator.h +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/fusion_tbe_json_creator.h @@ -33,9 +33,9 @@ class FusionBuildTbeJsonCreator : public TbeJsonCreator { bool GenOutputsJson(const AnfNodePtr &anf_node, nlohmann::json *compute_json) override; std::vector GetDescOutputIndex(const std::vector &output_used_nums) const; void GenReusedOutputDesc(const AnfNodePtr &anf_node, size_t index, size_t output_index, nlohmann::json *output_desc, - size_t out_size); + size_t out_size) const; void GenDataJson(const std::vector &compute_nodes, const std::vector &compute_json, - std::vector *op_list_json, const ANodeFusionDataTypeMap &spec_data_input); + std::vector *op_list_json, const ANodeFusionDataTypeMap &spec_data_input) const; bool AttrsJsonPostProcessing(const AnfNodePtr &, const OpInfoPtr &, nlohmann::json *) override; void GenOtherJson(const AnfNodePtr &anf_node, nlohmann::json *compute_json) override;