已合并
fix: 清理clean code告警 #4673
likun104创建于 9月1日
fix: 清理clean code告警 #4673
已合并
共 50 个文件变更+133-117
| @@ -11,8 +11,8 @@ | |||
| 11 | #ifndef ACL_MODEL_SRC_MODEL_ACL_MODEL_IMPL_H_ | 11 | #ifndef ACL_MODEL_SRC_MODEL_ACL_MODEL_IMPL_H_ |
| 12 | #define ACL_MODEL_SRC_MODEL_ACL_MODEL_IMPL_H_ | 12 | #define ACL_MODEL_SRC_MODEL_ACL_MODEL_IMPL_H_ |
| 13 | 13 | ||
| 14 | -#include <stddef.h> | 14 | +#include <cstddef> |
| 15 | -#include <stdint.h> | 15 | +#include <cstdint> |
| 16 | 16 | ||
| 17 | #include "acl_base_rt.h" | 17 | #include "acl_base_rt.h" |
| 18 | #include "acl_rt.h" | 18 | #include "acl_rt.h" |
| @@ -11,7 +11,7 @@ | |||
| 11 | #ifndef ACL_TYPES_DATA_BUFFER_INTERNAL_H | 11 | #ifndef ACL_TYPES_DATA_BUFFER_INTERNAL_H |
| 12 | #define ACL_TYPES_DATA_BUFFER_INTERNAL_H | 12 | #define ACL_TYPES_DATA_BUFFER_INTERNAL_H |
| 13 | 13 | ||
| 14 | -#include <stdint.h> | 14 | +#include <cstdint> |
| 15 | 15 | ||
| 16 | struct aclDataBuffer { | 16 | struct aclDataBuffer { |
| 17 | aclDataBuffer(void *const dataIn, const uint64_t len) : data(dataIn), length(len) {} | 17 | aclDataBuffer(void *const dataIn, const uint64_t len) : data(dataIn), length(len) {} |
| @@ -11,7 +11,7 @@ | |||
| 11 | #ifndef ACL_TYPES_DATA_BUFFER_INTERNAL_H | 11 | #ifndef ACL_TYPES_DATA_BUFFER_INTERNAL_H |
| 12 | #define ACL_TYPES_DATA_BUFFER_INTERNAL_H | 12 | #define ACL_TYPES_DATA_BUFFER_INTERNAL_H |
| 13 | 13 | ||
| 14 | -#include <stdint.h> | 14 | +#include <cstdint> |
| 15 | 15 | ||
| 16 | struct aclDataBuffer { | 16 | struct aclDataBuffer { |
| 17 | aclDataBuffer(void *const dataIn, const uint64_t len) : data(dataIn), length(len) {} | 17 | aclDataBuffer(void *const dataIn, const uint64_t len) : data(dataIn), length(len) {} |
| @@ -11,7 +11,7 @@ | |||
| 11 | #ifndef ACL_ERROR_CODES_INNER_H_ | 11 | #ifndef ACL_ERROR_CODES_INNER_H_ |
| 12 | #define ACL_ERROR_CODES_INNER_H_ | 12 | #define ACL_ERROR_CODES_INNER_H_ |
| 13 | 13 | ||
| 14 | -#include <stdint.h> | 14 | +#include <cstdint> |
| 15 | 15 | ||
| 16 | namespace acl { | 16 | namespace acl { |
| 17 | constexpr const int32_t MIN_GE_ERROR_CODE = 145000; | 17 | constexpr const int32_t MIN_GE_ERROR_CODE = 145000; |
| @@ -138,8 +138,8 @@ def generate_stub_file( | |||
| 138 | 138 | ||
| 139 | def generate_function(header_files, inc_dir): | 139 | def generate_function(header_files, inc_dir): |
| 140 | includes = [] | 140 | includes = [] |
| 141 | - includes.append("#include <stdio.h>\n") | 141 | + includes.append("#include <cstdio>\n") |
| 142 | - includes.append("#include <stdint.h>\n") | 142 | + includes.append("#include <cstdint>\n") |
| 143 | # generate includes | 143 | # generate includes |
| 144 | for header in header_files: | 144 | for header in header_files: |
| 145 | if not header.endswith(".h"): | 145 | if not header.endswith(".h"): |
| @@ -77,8 +77,8 @@ def generate_stub_file(acl_mdl_headers): | |||
| 77 | 77 | ||
| 78 | def generate_function(header_files): | 78 | def generate_function(header_files): |
| 79 | includes = [] | 79 | includes = [] |
| 80 | - includes.append("#include <stdio.h>\n") | 80 | + includes.append("#include <cstdio>\n") |
| 81 | - includes.append("#include <stdint.h>\n") | 81 | + includes.append("#include <cstdint>\n") |
| 82 | includes.append('#include "model/acl_model_impl.h"\n') | 82 | includes.append('#include "model/acl_model_impl.h"\n') |
| 83 | 83 | ||
| 84 | content = includes | 84 | content = includes |
| @@ -255,7 +255,7 @@ Status AddGeneratedMakefileOption(const std::string &makefile_path, std::string | |||
| 255 | // command 已通过 CheckBuildConfigValue 校验,白名单中唯一允许的空白字符是空格,不含 tab,因此用 find(' ') 即可 | 255 | // command 已通过 CheckBuildConfigValue 校验,白名单中唯一允许的空白字符是空格,不含 tab,因此用 find(' ') 即可 |
| 256 | const auto first_space = command.find(' '); | 256 | const auto first_space = command.find(' '); |
| 257 | const auto insert_pos = (first_space == std::string::npos) ? command.size() : first_space; | 257 | const auto insert_pos = (first_space == std::string::npos) ? command.size() : first_space; |
| 258 | - command.insert(insert_pos, " -f " + makefile_path); | 258 | + (void)command.insert(insert_pos, " -f " + makefile_path); |
| 259 | return SUCCESS; | 259 | return SUCCESS; |
| 260 | } | 260 | } |
| 261 | 261 | ||
| @@ -144,7 +144,7 @@ Status SerializeVarResource(const gert::Om2ModelData &model_data, const std::sha | |||
| 144 | if (!entry.init_data.empty()) { | 144 | if (!entry.init_data.empty()) { |
| 145 | init_data_offset = weight_buffer.size(); | 145 | init_data_offset = weight_buffer.size(); |
| 146 | init_data_size = entry.init_data.size(); | 146 | init_data_size = entry.init_data.size(); |
| 147 | - weight_buffer.insert(weight_buffer.end(), entry.init_data.begin(), entry.init_data.end()); | 147 | + (void)weight_buffer.insert(weight_buffer.end(), entry.init_data.begin(), entry.init_data.end()); |
| 148 | } | 148 | } |
| 149 | (void)entry_json.Set("init_data_offset", init_data_offset); | 149 | (void)entry_json.Set("init_data_offset", init_data_offset); |
| 150 | (void)entry_json.Set("init_data_size", init_data_size); | 150 | (void)entry_json.Set("init_data_size", init_data_size); |
| @@ -244,7 +244,7 @@ void SerializeAippMeta(const gert::Om2ModelMeta &model_meta, JsonFile &model_met | |||
| 244 | const std::string fmt_str = ge::TypeUtils::FormatToSerialString(meta.orig_input_info.format); | 244 | const std::string fmt_str = ge::TypeUtils::FormatToSerialString(meta.orig_input_info.format); |
| 245 | const std::string dt_str = ge::TypeUtils::DataTypeToSerialString(meta.orig_input_info.data_type); | 245 | const std::string dt_str = ge::TypeUtils::DataTypeToSerialString(meta.orig_input_info.data_type); |
| 246 | JsonFile entry; | 246 | JsonFile entry; |
| 247 | - entry.Set("index", i) | 247 | + (void)entry.Set("index", i) |
| 248 | .Set("aipp_type", static_cast<int32_t>(meta.aipp_type)) | 248 | .Set("aipp_type", static_cast<int32_t>(meta.aipp_type)) |
| 249 | .Set("aipp_data_index", meta.aipp_data_index) | 249 | .Set("aipp_data_index", meta.aipp_data_index) |
| 250 | .Set("aipp_mode", static_cast<int32_t>(meta.aipp_config_info.aipp_mode)) | 250 | .Set("aipp_mode", static_cast<int32_t>(meta.aipp_config_info.aipp_mode)) |
| @@ -449,7 +449,7 @@ Status SerializeManifest(const gert::Om2ModelData &model_data, const std::shared | |||
| 449 | 449 | ||
| 450 | } // namespace | 450 | } // namespace |
| 451 | 451 | ||
| 452 | -Status Om2ZipSaver::Save(const gert::Om2ModelData &model_data, ModelBufferData &model, const bool is_offline, | 452 | +Status Om2ZipSaver::Save(const gert::Om2ModelData &model_data, ModelBufferData &model, bool is_offline, |
| 453 | const std::string &writer_path) { | 453 | const std::string &writer_path) { |
| 454 | GELOGI( | 454 | GELOGI( |
| 455 | "[OM2] Begin to serialize Om2ModelData to ZIP, model_name:%s, " | 455 | "[OM2] Begin to serialize Om2ModelData to ZIP, model_name:%s, " |
| @@ -424,8 +424,8 @@ Status GeRootModel::CollectCustomOpTypesForRootModel(std::set<std::string> &used | |||
| 424 | return SUCCESS; | 424 | return SUCCESS; |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | -Status GeRootModel::CollectPortableCustomOpSo(const std::set<std::string> &used_custom_op_types, | 427 | +Status GeRootModel::CollectPortableCustomOpSo(const std::set<std::string> &used_custom_op_types, bool is_cross_compile, |
| 428 | - const bool is_cross_compile, bool &has_portable_custom_op) { | 428 | + bool &has_portable_custom_op) { |
| 429 | for (const auto &op_type : used_custom_op_types) { | 429 | for (const auto &op_type : used_custom_op_types) { |
| 430 | auto *portable_op = CustomOpCast<PortableOp>( | 430 | auto *portable_op = CustomOpCast<PortableOp>( |
| 431 | custom_op_registry_->GetCustomOpCommonCapability(AscendString(op_type.c_str()), CustomOpCapability::kPortable)); | 431 | custom_op_registry_->GetCustomOpCommonCapability(AscendString(op_type.c_str()), CustomOpCapability::kPortable)); |
| @@ -36,7 +36,7 @@ class ModelTensorDescsValue : public BaseTlvBlock { | |||
| 36 | size_t Size() override; | 36 | size_t Size() override; |
| 37 | bool Serilize(uint8_t **const addr, size_t &left_size) override; | 37 | bool Serilize(uint8_t **const addr, size_t &left_size) override; |
| 38 | bool NeedSave() override; | 38 | bool NeedSave() override; |
| 39 | - virtual ~ModelTensorDescsValue() = default; | 39 | + ~ModelTensorDescsValue() override = default; |
| 40 | 40 | ||
| 41 | private: | 41 | private: |
| 42 | uint32_t tensor_desc_size = 0U; | 42 | uint32_t tensor_desc_size = 0U; |
| @@ -22,7 +22,7 @@ class vecIntIntValue : public BaseTlvBlock { | |||
| 22 | size_t Size() override; | 22 | size_t Size() override; |
| 23 | bool Serilize(uint8_t **const addr, size_t &left_size) override; | 23 | bool Serilize(uint8_t **const addr, size_t &left_size) override; |
| 24 | bool NeedSave() override; | 24 | bool NeedSave() override; |
| 25 | - virtual ~vecIntIntValue() = default; | 25 | + ~vecIntIntValue() override = default; |
| 26 | 26 | ||
| 27 | private: | 27 | private: |
| 28 | uint32_t vec_size = 0U; | 28 | uint32_t vec_size = 0U; |
| @@ -22,7 +22,7 @@ class vecIntValue : public BaseTlvBlock { | |||
| 22 | size_t Size() override; | 22 | size_t Size() override; |
| 23 | bool Serilize(uint8_t **const addr, size_t &left_size) override; | 23 | bool Serilize(uint8_t **const addr, size_t &left_size) override; |
| 24 | bool NeedSave() override; | 24 | bool NeedSave() override; |
| 25 | - virtual ~vecIntValue() = default; | 25 | + ~vecIntValue() override = default; |
| 26 | 26 | ||
| 27 | private: | 27 | private: |
| 28 | uint32_t vec_size = 0U; | 28 | uint32_t vec_size = 0U; |
| @@ -22,7 +22,7 @@ class vecStrValue : public BaseTlvBlock { | |||
| 22 | size_t Size() override; | 22 | size_t Size() override; |
| 23 | bool Serilize(uint8_t **const addr, size_t &left_size) override; | 23 | bool Serilize(uint8_t **const addr, size_t &left_size) override; |
| 24 | bool NeedSave() override; | 24 | bool NeedSave() override; |
| 25 | - virtual ~vecStrValue() = default; | 25 | + ~vecStrValue() override = default; |
| 26 | 26 | ||
| 27 | private: | 27 | private: |
| 28 | uint32_t vec_size = 0U; | 28 | uint32_t vec_size = 0U; |
| @@ -504,10 +504,10 @@ std::vector<DeclNode *> LoadAndRunFileCodeGenerator::BuildQueryResourceApis( | |||
| 504 | ast_.Return("ACL_ERROR_FAILURE")}), | 504 | ast_.Return("ACL_ERROR_FAILURE")}), |
| 505 | }; | 505 | }; |
| 506 | for (uint32_t i = 0U; i < runtime.stream_num; ++i) { | 506 | for (uint32_t i = 0U; i < runtime.stream_num; ++i) { |
| 507 | - stream_desc_body.emplace_back( | 507 | + (void)stream_desc_body.emplace_back( |
| 508 | ast_.Assign(stream_flags[ast_.UInt(static_cast<uint64_t>(i))], runtime.stream_flag_values[i])); | 508 | ast_.Assign(stream_flags[ast_.UInt(static_cast<uint64_t>(i))], runtime.stream_flag_values[i])); |
| 509 | } | 509 | } |
| 510 | - stream_desc_body.emplace_back(ast_.Return(ast_.UInt(0U))); | 510 | + (void)stream_desc_body.emplace_back(ast_.Return(ast_.UInt(0U))); |
| 511 | items.push_back(ast_.DefineFunction("GertModelGetStreamDesc", {stream_flags, stream_num, stream_ext}, "int32_t", | 511 | items.push_back(ast_.DefineFunction("GertModelGetStreamDesc", {stream_flags, stream_num, stream_ext}, "int32_t", |
| 512 | ast_.Body(stream_desc_body))); | 512 | ast_.Body(stream_desc_body))); |
| 513 | 513 | ||
| @@ -528,11 +528,11 @@ std::vector<DeclNode *> LoadAndRunFileCodeGenerator::BuildQueryResourceApis( | |||
| 528 | ast_.Return("ACL_ERROR_FAILURE")}), | 528 | ast_.Return("ACL_ERROR_FAILURE")}), |
| 529 | }; | 529 | }; |
| 530 | for (uint32_t i = 0U; i < runtime.event_num; ++i) { | 530 | for (uint32_t i = 0U; i < runtime.event_num; ++i) { |
| 531 | - event_desc_body.emplace_back( | 531 | + (void)event_desc_body.emplace_back( |
| 532 | ast_.Assign(event_flags[ast_.UInt(static_cast<uint64_t>(i))], | 532 | ast_.Assign(event_flags[ast_.UInt(static_cast<uint64_t>(i))], |
| 533 | "ACL_EVENT_SYNC | ACL_EVENT_CAPTURE_STREAM_PROGRESS | ACL_EVENT_TIME_LINE")); | 533 | "ACL_EVENT_SYNC | ACL_EVENT_CAPTURE_STREAM_PROGRESS | ACL_EVENT_TIME_LINE")); |
| 534 | } | 534 | } |
| 535 | - event_desc_body.emplace_back(ast_.Return(ast_.UInt(0U))); | 535 | + (void)event_desc_body.emplace_back(ast_.Return(ast_.UInt(0U))); |
| 536 | items.push_back(ast_.DefineFunction("GertModelGetEventDesc", {event_flags, event_num, event_ext}, "int32_t", | 536 | items.push_back(ast_.DefineFunction("GertModelGetEventDesc", {event_flags, event_num, event_ext}, "int32_t", |
| 537 | ast_.Body(event_desc_body))); | 537 | ast_.Body(event_desc_body))); |
| 538 | 538 | ||
| @@ -557,10 +557,10 @@ std::vector<DeclNode *> LoadAndRunFileCodeGenerator::BuildQueryResourceApis( | |||
| 557 | ast_.Return("ACL_ERROR_FAILURE")}), | 557 | ast_.Return("ACL_ERROR_FAILURE")}), |
| 558 | }; | 558 | }; |
| 559 | for (uint32_t i = 0U; i < runtime.notify_num; ++i) { | 559 | for (uint32_t i = 0U; i < runtime.notify_num; ++i) { |
| 560 | - notify_desc_body.emplace_back( | 560 | + (void)notify_desc_body.emplace_back( |
| 561 | ast_.Assign(notify_flags[ast_.UInt(static_cast<uint64_t>(i))], "ACL_NOTIFY_DEVICE_USE_ONLY")); | 561 | ast_.Assign(notify_flags[ast_.UInt(static_cast<uint64_t>(i))], "ACL_NOTIFY_DEVICE_USE_ONLY")); |
| 562 | } | 562 | } |
| 563 | - notify_desc_body.emplace_back(ast_.Return(ast_.UInt(0U))); | 563 | + (void)notify_desc_body.emplace_back(ast_.Return(ast_.UInt(0U))); |
| 564 | items.push_back(ast_.DefineFunction("GertModelGetNotifyDesc", {notify_flags, notify_num, notify_ext}, "int32_t", | 564 | items.push_back(ast_.DefineFunction("GertModelGetNotifyDesc", {notify_flags, notify_num, notify_ext}, "int32_t", |
| 565 | ast_.Body(notify_desc_body))); | 565 | ast_.Body(notify_desc_body))); |
| 566 | 566 | ||
| @@ -150,8 +150,8 @@ void ResourcesFileCodeGenerator::BuildInitStreamResources(std::vector<BodyItem> | |||
| 150 | std::vector<BodyItem> create_items; | 150 | std::vector<BodyItem> create_items; |
| 151 | for (uint32_t i = 0U; i < runtime.stream_num; ++i) { | 151 | for (uint32_t i = 0U; i < runtime.stream_num; ++i) { |
| 152 | const auto stream_flag = ast_.Var("uint32_t", "stream" + std::to_string(i) + "_flag"); | 152 | const auto stream_flag = ast_.Var("uint32_t", "stream" + std::to_string(i) + "_flag"); |
| 153 | - create_items.emplace_back(ast_.VarDecl(stream_flag, runtime.stream_flag_values[i])); | 153 | + (void)create_items.emplace_back(ast_.VarDecl(stream_flag, runtime.stream_flag_values[i])); |
| 154 | - create_items.emplace_back(ChkRt(RtStreamCreateWithFlags(stream_list_[i].Addr(), priority_, stream_flag))); | 154 | + (void)create_items.emplace_back(ChkRt(RtStreamCreateWithFlags(stream_list_[i].Addr(), priority_, stream_flag))); |
| 155 | } | 155 | } |
| 156 | (void)body.emplace_back(ast_.If(ext_stream_num != ast_.UInt(0U), ext_items, create_items)); | 156 | (void)body.emplace_back(ast_.If(ext_stream_num != ast_.UInt(0U), ext_items, create_items)); |
| 157 | for (uint32_t i = 0U; i < runtime.stream_num; ++i) { | 157 | for (uint32_t i = 0U; i < runtime.stream_num; ++i) { |
| @@ -11,6 +11,12 @@ | |||
| 11 | #ifndef AIR_CXX_BASE_COMMON_OM2_AICPU_EXT_INFO_HANDLER_H_ | 11 | #ifndef AIR_CXX_BASE_COMMON_OM2_AICPU_EXT_INFO_HANDLER_H_ |
| 12 | #define AIR_CXX_BASE_COMMON_OM2_AICPU_EXT_INFO_HANDLER_H_ | 12 | #define AIR_CXX_BASE_COMMON_OM2_AICPU_EXT_INFO_HANDLER_H_ |
| 13 | 13 | ||
| 14 | +#include <cstddef> | ||
| 15 | +#include <cstdint> | ||
| 16 | +#include <memory> | ||
| 17 | +#include <string> | ||
| 18 | +#include <vector> | ||
| 19 | + | ||
| 14 | #include "fwk_adpt_struct.h" | 20 | #include "fwk_adpt_struct.h" |
| 15 | #include "ge/ge_api_error_codes.h" | 21 | #include "ge/ge_api_error_codes.h" |
| 16 | #include "aicpu_engine_struct.h" | 22 | #include "aicpu_engine_struct.h" |
| @@ -221,8 +221,7 @@ Status Om2ModelUtils::ConstructAddrSemanticForCommon(const TaskSemanticContribut | |||
| 221 | return SUCCESS; | 221 | return SUCCESS; |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | -bool Om2ModelUtils::FindVarAddress(const VarAddrRangeMap &var_addr_ranges, const uint64_t effective, | 224 | +bool Om2ModelUtils::FindVarAddress(const VarAddrRangeMap &var_addr_ranges, uint64_t effective, VarAddressMatch &match) { |
| 225 | - VarAddressMatch &match) { | ||
| 226 | const auto iter = var_addr_ranges.upper_bound(effective); | 225 | const auto iter = var_addr_ranges.upper_bound(effective); |
| 227 | if (iter == var_addr_ranges.begin()) { | 226 | if (iter == var_addr_ranges.begin()) { |
| 228 | return false; | 227 | return false; |
| @@ -202,8 +202,8 @@ Status ProgramGenerator::GenerateLoadAndRunSource(Om2CodePrinter &code_printer) | |||
| 202 | load_and_run_handler.SetHasCustomKernel(has_custom_kernel_); | 202 | load_and_run_handler.SetHasCustomKernel(has_custom_kernel_); |
| 203 | auto anonymous_items = load_and_run_handler.BuildAnonymousNamespaceItems(codegen_model_, task_code_builder_list_); | 203 | auto anonymous_items = load_and_run_handler.BuildAnonymousNamespaceItems(codegen_model_, task_code_builder_list_); |
| 204 | if (has_custom_kernel_) { | 204 | if (has_custom_kernel_) { |
| 205 | - anonymous_items.insert(anonymous_items.begin(), | 205 | + (void)anonymous_items.insert(anonymous_items.begin(), |
| 206 | - ast_.StablePart(StablePartId::kCustomTaskHelpers, StablePartPlacement::kNamespace)); | 206 | + ast_.StablePart(StablePartId::kCustomTaskHelpers, StablePartPlacement::kNamespace)); |
| 207 | } | 207 | } |
| 208 | (void)anonymous_items.insert(anonymous_items.begin(), | 208 | (void)anonymous_items.insert(anonymous_items.begin(), |
| 209 | ast_.StablePart(StablePartId::kLoadAndRunDumpHelpers, StablePartPlacement::kNamespace)); | 209 | ast_.StablePart(StablePartId::kLoadAndRunDumpHelpers, StablePartPlacement::kNamespace)); |
| @@ -213,13 +213,13 @@ Status ProgramGenerator::GenerateLoadAndRunSource(Om2CodePrinter &code_printer) | |||
| 213 | body_items.emplace_back(ast_.Include("graph/custom_op.h")); | 213 | body_items.emplace_back(ast_.Include("graph/custom_op.h")); |
| 214 | body_items.emplace_back(ast_.Include("exe_graph/runtime/gert_mem_allocator.h")); | 214 | body_items.emplace_back(ast_.Include("exe_graph/runtime/gert_mem_allocator.h")); |
| 215 | } | 215 | } |
| 216 | - body_items.emplace_back(ast_.Space()); | 216 | + (void)body_items.emplace_back(ast_.Space()); |
| 217 | if (has_custom_kernel_) { | 217 | if (has_custom_kernel_) { |
| 218 | - body_items.emplace_back(ast_.Namespace( | 218 | + (void)body_items.emplace_back(ast_.Namespace( |
| 219 | "ge", {ast_.StablePart(StablePartId::kCreateClassCustomOpFactory, StablePartPlacement::kNamespace)})); | 219 | "ge", {ast_.StablePart(StablePartId::kCreateClassCustomOpFactory, StablePartPlacement::kNamespace)})); |
| 220 | body_items.emplace_back(ast_.Space()); | 220 | body_items.emplace_back(ast_.Space()); |
| 221 | } | 221 | } |
| 222 | - body_items.emplace_back( | 222 | + (void)body_items.emplace_back( |
| 223 | ast_.Namespace("om2", { | 223 | ast_.Namespace("om2", { |
| 224 | ast_.Namespace("", anonymous_items), | 224 | ast_.Namespace("", anonymous_items), |
| 225 | load_and_run_handler.BuildGetRtModelHandleMethod(), | 225 | load_and_run_handler.BuildGetRtModelHandleMethod(), |
| @@ -227,8 +227,8 @@ Status ProgramGenerator::GenerateLoadAndRunSource(Om2CodePrinter &code_printer) | |||
| 227 | load_and_run_handler.BuildRunAsyncMethod(codegen_model_), | 227 | load_and_run_handler.BuildRunAsyncMethod(codegen_model_), |
| 228 | load_and_run_handler.BuildRunMethod(codegen_model_), | 228 | load_and_run_handler.BuildRunMethod(codegen_model_), |
| 229 | })); | 229 | })); |
| 230 | - body_items.emplace_back(ast_.StablePart(StablePartId::kLoadAndRunExternalApis)); | 230 | + (void)body_items.emplace_back(ast_.StablePart(StablePartId::kLoadAndRunExternalApis)); |
| 231 | - body_items.emplace_back(ast_.ExternBlock("C", load_and_run_handler.BuildQueryResourceApis(codegen_model_))); | 231 | + (void)body_items.emplace_back(ast_.ExternBlock("C", load_and_run_handler.BuildQueryResourceApis(codegen_model_))); |
| 232 | auto *translation_unit = ast_.File(body_items); | 232 | auto *translation_unit = ast_.File(body_items); |
| 233 | GE_ASSERT_SUCCESS(EmitFile(GeneratedFileIndex::kLoadingAndRunningFile, translation_unit, code_printer)); | 233 | GE_ASSERT_SUCCESS(EmitFile(GeneratedFileIndex::kLoadingAndRunningFile, translation_unit, code_printer)); |
| 234 | GELOGD("[OM2] Load and run source file code is generated."); | 234 | GELOGD("[OM2] Load and run source file code is generated."); |
| @@ -410,7 +410,7 @@ struct CopyHostInputInfo { | |||
| 410 | void *host_addr; | 410 | void *host_addr; |
| 411 | uint64_t device_addr; | 411 | uint64_t device_addr; |
| 412 | uint64_t tensor_size; | 412 | uint64_t tensor_size; |
| 413 | - CopyHostInputInfo() : input_index(0), host_addr(nullptr), device_addr(0u), tensor_size(0U) {} | 413 | + CopyHostInputInfo() : input_index(0), host_addr(nullptr), device_addr(0U), tensor_size(0U) {} |
| 414 | }; | 414 | }; |
| 415 | 415 | ||
| 416 | struct ModelArgsSemantic { | 416 | struct ModelArgsSemantic { |
| @@ -180,7 +180,7 @@ Status ModelAdapter::GenInputOutputInfo(const std::map<uint32_t, OpDescPtr> &ind | |||
| 180 | for (auto &item : index_to_data) { | 180 | for (auto &item : index_to_data) { |
| 181 | const auto output_addrs = ModelUtils::GetOutputAddrsValue(runtime_param_, item.second); | 181 | const auto output_addrs = ModelUtils::GetOutputAddrsValue(runtime_param_, item.second); |
| 182 | GELOGD("[OM2] Data node is: %s, output addr size: %zu", item.second->GetName().c_str(), output_addrs.size()); | 182 | GELOGD("[OM2] Data node is: %s, output addr size: %zu", item.second->GetName().c_str(), output_addrs.size()); |
| 183 | - input_addrs_list_.emplace_back(output_addrs); | 183 | + (void)input_addrs_list_.emplace_back(output_addrs); |
| 184 | GE_CHK_STATUS_RET(InitInputDescInfo(item.second), "[OM2] InitInputDescInfo failed, node: %s", | 184 | GE_CHK_STATUS_RET(InitInputDescInfo(item.second), "[OM2] InitInputDescInfo failed, node: %s", |
| 185 | item.second->GetName().c_str()); | 185 | item.second->GetName().c_str()); |
| 186 | } | 186 | } |
| @@ -191,7 +191,7 @@ Status ModelAdapter::GenInputOutputInfo(const std::map<uint32_t, OpDescPtr> &ind | |||
| 191 | for (const auto &op_desc : output_op_list) { | 191 | for (const auto &op_desc : output_op_list) { |
| 192 | const auto input_addrs = ModelUtils::GetInputAddrsValue(runtime_param_, op_desc); | 192 | const auto input_addrs = ModelUtils::GetInputAddrsValue(runtime_param_, op_desc); |
| 193 | GELOGD("[OM2] NetOutput node is: %s, input addr size: %zu", op_desc->GetName().c_str(), input_addrs.size()); | 193 | GELOGD("[OM2] NetOutput node is: %s, input addr size: %zu", op_desc->GetName().c_str(), input_addrs.size()); |
| 194 | - output_addrs_list_.emplace_back(input_addrs); | 194 | + (void)output_addrs_list_.emplace_back(input_addrs); |
| 195 | 195 | ||
| 196 | bool getnext_sink_dynamic = false; | 196 | bool getnext_sink_dynamic = false; |
| 197 | if (AttrUtils::GetBool(op_desc, ATTR_GETNEXT_SINK_DYNMAIC, getnext_sink_dynamic) && getnext_sink_dynamic) { | 197 | if (AttrUtils::GetBool(op_desc, ATTR_GETNEXT_SINK_DYNMAIC, getnext_sink_dynamic) && getnext_sink_dynamic) { |
| @@ -237,7 +237,7 @@ Status ModelAdapter::GenMemAllocations(const std::map<uint32_t, OpDescPtr> &inde | |||
| 237 | 0UL, | 237 | 0UL, |
| 238 | 0UL}; | 238 | 0UL}; |
| 239 | GELOGI("[OM2][mem allocation][absolute] model name %s, %s.", name_.c_str(), not_change_mem_item.ToString().c_str()); | 239 | GELOGI("[OM2][mem allocation][absolute] model name %s, %s.", name_.c_str(), not_change_mem_item.ToString().c_str()); |
| 240 | - logical_mem_allocations_.emplace_back(not_change_mem_item); | 240 | + (void)logical_mem_allocations_.emplace_back(not_change_mem_item); |
| 241 | return SUCCESS; | 241 | return SUCCESS; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| @@ -284,7 +284,7 @@ Status ModelAdapter::GenSliceOutputMemAllocations(const std::vector<OpDescPtr> & | |||
| 284 | continue; | 284 | continue; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | - refreshable_output_index_and_allocation_ids_.emplace_back( | 287 | + (void)refreshable_output_index_and_allocation_ids_.emplace_back( |
| 288 | std::make_pair(output_index, static_cast<uint32_t>(logical_mem_allocations_.size()))); | 288 | std::make_pair(output_index, static_cast<uint32_t>(logical_mem_allocations_.size()))); |
| 289 | MemAllocation mem_allocation = {static_cast<uint32_t>(logical_mem_allocations_.size()), | 289 | MemAllocation mem_allocation = {static_cast<uint32_t>(logical_mem_allocations_.size()), |
| 290 | logical_addr, | 290 | logical_addr, |
| @@ -296,7 +296,7 @@ Status ModelAdapter::GenSliceOutputMemAllocations(const std::vector<OpDescPtr> & | |||
| 296 | 0UL}; | 296 | 0UL}; |
| 297 | GELOGI("[OM2][mem allocation][output][slice] model name %s, %s.", name_.c_str(), | 297 | GELOGI("[OM2][mem allocation][output][slice] model name %s, %s.", name_.c_str(), |
| 298 | mem_allocation.ToString().c_str()); | 298 | mem_allocation.ToString().c_str()); |
| 299 | - logical_mem_allocations_.emplace_back(mem_allocation); | 299 | + (void)logical_mem_allocations_.emplace_back(mem_allocation); |
| 300 | output_index_to_allocation_ids_[output_index] = mem_allocation.id; | 300 | output_index_to_allocation_ids_[output_index] = mem_allocation.id; |
| 301 | zero_copy_output_indexes_.push_back(output_index); | 301 | zero_copy_output_indexes_.push_back(output_index); |
| 302 | output_index++; | 302 | output_index++; |
| @@ -310,7 +310,7 @@ Status ModelAdapter::GenFmMemAllocations() { | |||
| 310 | fm_mem_allocations_start_id_ = logical_mem_allocations_.size(); | 310 | fm_mem_allocations_start_id_ = logical_mem_allocations_.size(); |
| 311 | 311 | ||
| 312 | for (const auto &mem_info : runtime_param_.fm_memory_infos) { | 312 | for (const auto &mem_info : runtime_param_.fm_memory_infos) { |
| 313 | - refreshable_fm_index_and_allocation_ids_.emplace_back( | 313 | + (void)refreshable_fm_index_and_allocation_ids_.emplace_back( |
| 314 | std::make_pair(static_cast<uint32_t>(logical_fm_mem_allocations_size_), | 314 | std::make_pair(static_cast<uint32_t>(logical_fm_mem_allocations_size_), |
| 315 | static_cast<uint32_t>(logical_mem_allocations_.size()))); | 315 | static_cast<uint32_t>(logical_mem_allocations_.size()))); |
| 316 | 316 | ||
| @@ -324,7 +324,7 @@ Status ModelAdapter::GenFmMemAllocations() { | |||
| 324 | 0UL}; | 324 | 0UL}; |
| 325 | GELOGI("[OM2][mem allocation][feature map] model name %s, %s.", name_.c_str(), | 325 | GELOGI("[OM2][mem allocation][feature map] model name %s, %s.", name_.c_str(), |
| 326 | fm_mem_allocation.ToString().c_str()); | 326 | fm_mem_allocation.ToString().c_str()); |
| 327 | - logical_mem_allocations_.emplace_back(fm_mem_allocation); | 327 | + (void)logical_mem_allocations_.emplace_back(fm_mem_allocation); |
| 328 | ++logical_fm_mem_allocations_size_; | 328 | ++logical_fm_mem_allocations_size_; |
| 329 | } | 329 | } |
| 330 | return SUCCESS; | 330 | return SUCCESS; |
| @@ -333,7 +333,7 @@ Status ModelAdapter::GenFmMemAllocations() { | |||
| 333 | Status ModelAdapter::GenFixedFmMemAllocations() { | 333 | Status ModelAdapter::GenFixedFmMemAllocations() { |
| 334 | fixed_fm_mem_allocations_start_id_ = logical_mem_allocations_.size(); | 334 | fixed_fm_mem_allocations_start_id_ = logical_mem_allocations_.size(); |
| 335 | for (const auto &mem_info : runtime_param_.fixed_fm_memory_infos) { | 335 | for (const auto &mem_info : runtime_param_.fixed_fm_memory_infos) { |
| 336 | - fixed_fm_index_and_allocation_ids_.emplace_back( | 336 | + (void)fixed_fm_index_and_allocation_ids_.emplace_back( |
| 337 | std::make_pair(static_cast<uint32_t>(logical_fixed_fm_mem_allocations_size_), | 337 | std::make_pair(static_cast<uint32_t>(logical_fixed_fm_mem_allocations_size_), |
| 338 | static_cast<uint32_t>(logical_mem_allocations_.size()))); | 338 | static_cast<uint32_t>(logical_mem_allocations_.size()))); |
| 339 | MemAllocation fm_mem_allocation = {static_cast<uint32_t>(logical_mem_allocations_.size()), | 339 | MemAllocation fm_mem_allocation = {static_cast<uint32_t>(logical_mem_allocations_.size()), |
| @@ -346,7 +346,7 @@ Status ModelAdapter::GenFixedFmMemAllocations() { | |||
| 346 | 0UL}; | 346 | 0UL}; |
| 347 | GELOGI("[OM2][mem allocation][fixed feature map] model name %s, %s.", name_.c_str(), | 347 | GELOGI("[OM2][mem allocation][fixed feature map] model name %s, %s.", name_.c_str(), |
| 348 | fm_mem_allocation.ToString().c_str()); | 348 | fm_mem_allocation.ToString().c_str()); |
| 349 | - logical_mem_allocations_.emplace_back(fm_mem_allocation); | 349 | + (void)logical_mem_allocations_.emplace_back(fm_mem_allocation); |
| 350 | ++logical_fixed_fm_mem_allocations_size_; | 350 | ++logical_fixed_fm_mem_allocations_size_; |
| 351 | } | 351 | } |
| 352 | return SUCCESS; | 352 | return SUCCESS; |
| @@ -423,7 +423,7 @@ Status ModelAdapter::GenInputMemAllocations(const std::map<uint32_t, OpDescPtr> | |||
| 423 | continue; | 423 | continue; |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | - refreshable_input_index_and_allocation_ids_.emplace_back( | 426 | + (void)refreshable_input_index_and_allocation_ids_.emplace_back( |
| 427 | std::make_pair(input_index, static_cast<uint32_t>(logical_mem_allocations_.size()))); | 427 | std::make_pair(input_index, static_cast<uint32_t>(logical_mem_allocations_.size()))); |
| 428 | 428 | ||
| 429 | uint64_t tensor_size = data_size; | 429 | uint64_t tensor_size = data_size; |
| @@ -447,7 +447,7 @@ Status ModelAdapter::GenInputMemAllocations(const std::map<uint32_t, OpDescPtr> | |||
| 447 | "[OM2][mem allocation][input] model_name %s, input_index %u, op_name %s op_type %s, %s, tensor_size %" PRIu64, | 447 | "[OM2][mem allocation][input] model_name %s, input_index %u, op_name %s op_type %s, %s, tensor_size %" PRIu64, |
| 448 | name_.c_str(), input_index, item.second->GetName().c_str(), item.second->GetType().c_str(), | 448 | name_.c_str(), input_index, item.second->GetName().c_str(), item.second->GetType().c_str(), |
| 449 | mem_allocation.ToString().c_str(), tensor_size); | 449 | mem_allocation.ToString().c_str(), tensor_size); |
| 450 | - logical_mem_allocations_.emplace_back(mem_allocation); | 450 | + (void)logical_mem_allocations_.emplace_back(mem_allocation); |
| 451 | input_index_to_allocation_ids_[input_index] = mem_allocation.id; | 451 | input_index_to_allocation_ids_[input_index] = mem_allocation.id; |
| 452 | zero_copy_input_indexes_.push_back(input_index); | 452 | zero_copy_input_indexes_.push_back(input_index); |
| 453 | if (copy_host_input_indexes_.count(input_index) > 0U) { | 453 | if (copy_host_input_indexes_.count(input_index) > 0U) { |
| @@ -536,7 +536,7 @@ Status ModelAdapter::GenOutputMemAllocations(const std::vector<OpDescPtr> &outpu | |||
| 536 | continue; | 536 | continue; |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | - refreshable_output_index_and_allocation_ids_.emplace_back( | 539 | + (void)refreshable_output_index_and_allocation_ids_.emplace_back( |
| 540 | std::make_pair(output_index, static_cast<uint32_t>(logical_mem_allocations_.size()))); | 540 | std::make_pair(output_index, static_cast<uint32_t>(logical_mem_allocations_.size()))); |
| 541 | MemAllocation mem_allocation = {static_cast<uint32_t>(logical_mem_allocations_.size()), | 541 | MemAllocation mem_allocation = {static_cast<uint32_t>(logical_mem_allocations_.size()), |
| 542 | virtual_addr_list[i], | 542 | virtual_addr_list[i], |
| @@ -547,7 +547,7 @@ Status ModelAdapter::GenOutputMemAllocations(const std::vector<OpDescPtr> &outpu | |||
| 547 | 0UL, | 547 | 0UL, |
| 548 | 0UL}; | 548 | 0UL}; |
| 549 | GELOGI("[OM2] [mem allocation][output] model_name=%s, %s.", name_.c_str(), mem_allocation.ToString().c_str()); | 549 | GELOGI("[OM2] [mem allocation][output] model_name=%s, %s.", name_.c_str(), mem_allocation.ToString().c_str()); |
| 550 | - logical_mem_allocations_.emplace_back(mem_allocation); | 550 | + (void)logical_mem_allocations_.emplace_back(mem_allocation); |
| 551 | output_index_to_allocation_ids_[output_index] = mem_allocation.id; | 551 | output_index_to_allocation_ids_[output_index] = mem_allocation.id; |
| 552 | zero_copy_output_indexes_.push_back(output_index); | 552 | zero_copy_output_indexes_.push_back(output_index); |
| 553 | output_index++; | 553 | output_index++; |
| @@ -755,8 +755,8 @@ Status ModelAdapter::InitOutputTensorInfo(const OpDescPtr &op_desc) { | |||
| 755 | (void)AttrUtils::GetBool(input_desc, ATTR_NAME_TENSOR_NO_TILING_MEM_TYPE, is_no_tiling); | 755 | (void)AttrUtils::GetBool(input_desc, ATTR_NAME_TENSOR_NO_TILING_MEM_TYPE, is_no_tiling); |
| 756 | GELOGI("[OM2] Output size is %" PRId64 ", output shape is %s, no tiling is %d.", size, | 756 | GELOGI("[OM2] Output size is %" PRId64 ", output shape is %s, no tiling is %d.", size, |
| 757 | ToString(shape.GetDims()).c_str(), static_cast<int32_t>(is_no_tiling)); | 757 | ToString(shape.GetDims()).c_str(), static_cast<int32_t>(is_no_tiling)); |
| 758 | - output_buffer_size_.emplace_back(size); | 758 | + (void)output_buffer_size_.emplace_back(size); |
| 759 | - output_shape_info_.emplace_back(shape); | 759 | + (void)output_shape_info_.emplace_back(shape); |
| 760 | output_no_tiling_flag_.push_back(is_no_tiling); | 760 | output_no_tiling_flag_.push_back(is_no_tiling); |
| 761 | if (is_no_tiling) { | 761 | if (is_no_tiling) { |
| 762 | has_no_tiling_output_ = true; | 762 | has_no_tiling_output_ = true; |
| @@ -200,15 +200,15 @@ Status ModelArgsLayoutPlanner::PlanTasks( | |||
| 200 | } | 200 | } |
| 201 | Status ModelArgsLayoutPlanner::LogPartitionLengths( | 201 | Status ModelArgsLayoutPlanner::LogPartitionLengths( |
| 202 | const PlacementsToPartitionsToLenType &placements_to_partitions_to_len, const char_t *desc) { | 202 | const PlacementsToPartitionsToLenType &placements_to_partitions_to_len, const char_t *desc) { |
| 203 | - for (size_t i = 0u; i < static_cast<size_t>(ArgsPlacement::kEnd); ++i) { | 203 | + for (size_t i = 0U; i < static_cast<size_t>(ArgsPlacement::kEnd); ++i) { |
| 204 | std::stringstream ss; | 204 | std::stringstream ss; |
| 205 | ss << desc << "Model args placement " << GetArgsPlacementStr(static_cast<ArgsPlacement>(i)); | 205 | ss << desc << "Model args placement " << GetArgsPlacementStr(static_cast<ArgsPlacement>(i)); |
| 206 | int64_t total_len = 0; | 206 | int64_t total_len = 0; |
| 207 | - for (size_t j = 0u; j < static_cast<size_t>(UpdateTriggerType::kEnd); ++j) { | 207 | + for (size_t j = 0U; j < static_cast<size_t>(UpdateTriggerType::kEnd); ++j) { |
| 208 | GE_ASSERT_TRUE(!AddOverflow(total_len, placements_to_partitions_to_len[i][j], total_len)); | 208 | GE_ASSERT_TRUE(!AddOverflow(total_len, placements_to_partitions_to_len[i][j], total_len)); |
| 209 | } | 209 | } |
| 210 | ss << " total length " << total_len << ", partition lengths "; | 210 | ss << " total length " << total_len << ", partition lengths "; |
| 211 | - for (size_t j = 0u; j < static_cast<size_t>(UpdateTriggerType::kEnd); ++j) { | 211 | + for (size_t j = 0U; j < static_cast<size_t>(UpdateTriggerType::kEnd); ++j) { |
| 212 | ss << placements_to_partitions_to_len[i][j] << '/'; | 212 | ss << placements_to_partitions_to_len[i][j] << '/'; |
| 213 | } | 213 | } |
| 214 | GELOGD("[OM2] %s", ss.str().c_str()); | 214 | GELOGD("[OM2] %s", ss.str().c_str()); |
| @@ -125,14 +125,15 @@ ModelArgsManager::ModelArgsManager() = default; | |||
| 125 | 125 | ||
| 126 | ModelArgsManager::~ModelArgsManager() noexcept = default; | 126 | ModelArgsManager::~ModelArgsManager() noexcept = default; |
| 127 | 127 | ||
| 128 | -Status ModelArgsManager::Init(const GeModelPtr &model, const std::vector<TaskCodeBuilderPtr> *task_list_ptr) { | 128 | +Status ModelArgsManager::Init(const GeModelPtr &model, |
| 129 | + const std::vector<TaskCodeBuilderPtr> *task_code_builder_list_ptr) { | ||
| 129 | logLevel_ = dlog_getlevel(GE_MODULE_NAME, nullptr); | 130 | logLevel_ = dlog_getlevel(GE_MODULE_NAME, nullptr); |
| 130 | GE_ASSERT_NOTNULL(model); | 131 | GE_ASSERT_NOTNULL(model); |
| 131 | const auto &model_task_def = model->GetModelTaskDefPtr(); | 132 | const auto &model_task_def = model->GetModelTaskDefPtr(); |
| 132 | GE_ASSERT_NOTNULL(model_task_def); | 133 | GE_ASSERT_NOTNULL(model_task_def); |
| 133 | 134 | ||
| 134 | - GE_ASSERT_NOTNULL(task_list_ptr); | 135 | + GE_ASSERT_NOTNULL(task_code_builder_list_ptr); |
| 135 | - task_list_ptr_ = task_list_ptr; | 136 | + task_list_ptr_ = task_code_builder_list_ptr; |
| 136 | if (static_cast<size_t>(model_task_def->task_size()) != task_list_ptr_->size()) { | 137 | if (static_cast<size_t>(model_task_def->task_size()) != task_list_ptr_->size()) { |
| 137 | GELOGE(INTERNAL_ERROR, "[OM2] mode_task_def size do not match task_list size"); | 138 | GELOGE(INTERNAL_ERROR, "[OM2] mode_task_def size do not match task_list size"); |
| 138 | return FAILED; | 139 | return FAILED; |
| @@ -167,11 +168,11 @@ Status ModelArgsManager::GenModelArgsRefreshInfosForTask(std::vector<TaskArgsRef | |||
| 167 | PtrToValue(pls_to_args[pls].host_addr), pls_to_args[pls].dev_addr, info.ToString().c_str(), | 168 | PtrToValue(pls_to_args[pls].host_addr), pls_to_args[pls].dev_addr, info.ToString().c_str(), |
| 168 | m_info.ToString().c_str()); | 169 | m_info.ToString().c_str()); |
| 169 | if (info.args_format_policy == ArgsFormatPolicy::kAddrAll) { | 170 | if (info.args_format_policy == ArgsFormatPolicy::kAddrAll) { |
| 170 | - allocation_ids_to_model_args_refresh_infos_addr_all[m_info.id].emplace_back(std::move(m_info)); | 171 | + (void)allocation_ids_to_model_args_refresh_infos_addr_all[m_info.id].emplace_back(std::move(m_info)); |
| 171 | } else if (info.args_format_policy == ArgsFormatPolicy::kAddrLow32Bit) { | 172 | } else if (info.args_format_policy == ArgsFormatPolicy::kAddrLow32Bit) { |
| 172 | - allocation_ids_to_model_args_refresh_infos_addr_low_32bit[m_info.id].emplace_back(std::move(m_info)); | 173 | + (void)allocation_ids_to_model_args_refresh_infos_addr_low_32bit[m_info.id].emplace_back(std::move(m_info)); |
| 173 | } else if (info.args_format_policy == ArgsFormatPolicy::kAddrHigh32Bit) { | 174 | } else if (info.args_format_policy == ArgsFormatPolicy::kAddrHigh32Bit) { |
| 174 | - allocation_ids_to_model_args_refresh_infos_addr_high_32bit[m_info.id].emplace_back(std::move(m_info)); | 175 | + (void)allocation_ids_to_model_args_refresh_infos_addr_high_32bit[m_info.id].emplace_back(std::move(m_info)); |
| 175 | } | 176 | } |
| 176 | } | 177 | } |
| 177 | return SUCCESS; | 178 | return SUCCESS; |
| @@ -298,8 +299,8 @@ Status ModelArgsManager::AllocModelArgs(const ModelArgsLayoutPlannedResult &layo | |||
| 298 | GELOGI("[OM2] Alloc model args built_in=%zu, reserved=%zu, placement=%s, addr=0x%llx for model_name=%s", | 299 | GELOGI("[OM2] Alloc model args built_in=%zu, reserved=%zu, placement=%s, addr=0x%llx for model_name=%s", |
| 299 | built_in_len, reserved_len, GetArgsPlacementStr(placed_model_args.placement), | 300 | built_in_len, reserved_len, GetArgsPlacementStr(placed_model_args.placement), |
| 300 | placed_model_args.model_args_device_addr, model_adapter_.GetOmName().c_str()); | 301 | placed_model_args.model_args_device_addr, model_adapter_.GetOmName().c_str()); |
| 301 | - model_args.emplace_back(std::move(placed_model_args)); | 302 | + (void)model_args.emplace_back(std::move(placed_model_args)); |
| 302 | - model_args_len.emplace_back(static_cast<size_t>(len)); | 303 | + (void)model_args_len.emplace_back(static_cast<size_t>(len)); |
| 303 | pls = placed_model_args.placement; | 304 | pls = placed_model_args.placement; |
| 304 | } | 305 | } |
| 305 | return SUCCESS; | 306 | return SUCCESS; |
| @@ -393,7 +394,8 @@ Status ModelArgsManager::ConstructOneTaskUpdateData( | |||
| 393 | offset = static_cast<uint64_t>(task_arg_ret.offset); | 394 | offset = static_cast<uint64_t>(task_arg_ret.offset); |
| 394 | } | 395 | } |
| 395 | 396 | ||
| 396 | - task_update_data.update_data.host_args.emplace_back(HostArg{host_addr, args_desc.args_len, require_placement}); | 397 | + (void)task_update_data.update_data.host_args.emplace_back( |
| 398 | + HostArg{host_addr, args_desc.args_len, require_placement}); | ||
| 397 | (*task_update_data.task_indexes_to_args)[task_index][static_cast<size_t>(require_placement)] = { | 399 | (*task_update_data.task_indexes_to_args)[task_index][static_cast<size_t>(require_placement)] = { |
| 398 | device_addr, host_addr, args_desc.args_len, offset}; | 400 | device_addr, host_addr, args_desc.args_len, offset}; |
| 399 | 401 | ||
| @@ -424,7 +426,7 @@ Status ModelArgsManager::AddToTaskUpdateDataToPolicies( | |||
| 424 | GE_ASSERT_NOTNULL(update_policies_to_model_data_[upi]); | 426 | GE_ASSERT_NOTNULL(update_policies_to_model_data_[upi]); |
| 425 | } | 427 | } |
| 426 | auto model_update_data = update_policies_to_model_data_[upi].get(); | 428 | auto model_update_data = update_policies_to_model_data_[upi].get(); |
| 427 | - model_update_data->update_datas.emplace_back(one_task_update_data.update_data); | 429 | + (void)model_update_data->update_datas.emplace_back(one_task_update_data.update_data); |
| 428 | } | 430 | } |
| 429 | return SUCCESS; | 431 | return SUCCESS; |
| 430 | } | 432 | } |
| @@ -542,7 +544,7 @@ Status ModelArgsManager::ConstructTaskInitParams( | |||
| 542 | addr.memory_type = static_cast<uint64_t>( | 544 | addr.memory_type = static_cast<uint64_t>( |
| 543 | logical_addrs_to_mem_app_type.at(std::pair<uint64_t, uint64_t>(addr.memory_type, addr.logic_addr))); | 545 | logical_addrs_to_mem_app_type.at(std::pair<uint64_t, uint64_t>(addr.memory_type, addr.logic_addr))); |
| 544 | } | 546 | } |
| 545 | - task_indexes_to_init_param.emplace_back(std::move(init_param)); | 547 | + (void)task_indexes_to_init_param.emplace_back(std::move(init_param)); |
| 546 | } | 548 | } |
| 547 | 549 | ||
| 548 | for (const auto &fap : fixed_addr_bulk_.pieces) { | 550 | for (const auto &fap : fixed_addr_bulk_.pieces) { |
| @@ -632,7 +634,7 @@ Status ModelArgsManager::GenerateArgsDataForProgramGenerator(Om2CodegenModel &co | |||
| 632 | model_args_semantic.clear(); | 634 | model_args_semantic.clear(); |
| 633 | model_args_semantic.reserve(model_args_.size()); | 635 | model_args_semantic.reserve(model_args_.size()); |
| 634 | for (size_t i = 0UL; i < model_args_.size(); ++i) { | 636 | for (size_t i = 0UL; i < model_args_.size(); ++i) { |
| 635 | - model_args_semantic.emplace_back( | 637 | + (void)model_args_semantic.emplace_back( |
| 636 | ModelArgsSemantic{model_args_[i].placement, model_args_len_[i], model_args_[i].model_args_partitions}); | 638 | ModelArgsSemantic{model_args_[i].placement, model_args_len_[i], model_args_[i].model_args_partitions}); |
| 637 | } | 639 | } |
| 638 | 640 | ||
| @@ -742,7 +742,7 @@ Status ModelUtils::GetHbmFeatureMapMemInfo(const GeModelPtr &ge_model, std::vect | |||
| 742 | default_mem_info.memory_size -= zero_copy_size; | 742 | default_mem_info.memory_size -= zero_copy_size; |
| 743 | default_mem_info.memory_type = RT_MEMORY_HBM; | 743 | default_mem_info.memory_type = RT_MEMORY_HBM; |
| 744 | GELOGD("[OM2] Get feature map memory info with details: [%s]", default_mem_info.ToString().c_str()); | 744 | GELOGD("[OM2] Get feature map memory info with details: [%s]", default_mem_info.ToString().c_str()); |
| 745 | - all_mem_info.emplace_back(std::move(default_mem_info)); | 745 | + (void)all_mem_info.emplace_back(std::move(default_mem_info)); |
| 746 | return SUCCESS; | 746 | return SUCCESS; |
| 747 | } | 747 | } |
| 748 | 748 | ||
| @@ -761,7 +761,7 @@ Status ModelUtils::GetHbmFeatureMapMemInfo(const GeModelPtr &ge_model, std::vect | |||
| 761 | one_fm_mem_info.memory_base = reinterpret_cast<uint8_t *>(one_fm_mem_info.logic_memory_base); | 761 | one_fm_mem_info.memory_base = reinterpret_cast<uint8_t *>(one_fm_mem_info.logic_memory_base); |
| 762 | one_fm_mem_info.is_fixed_addr_prior = ((sub_memory_info.size() > 3U) ? sub_memory_info[3U] : false); | 762 | one_fm_mem_info.is_fixed_addr_prior = ((sub_memory_info.size() > 3U) ? sub_memory_info[3U] : false); |
| 763 | GELOGD("[OM2] Get one sub feature map memory info with details: [%s]", one_fm_mem_info.ToString().c_str()); | 763 | GELOGD("[OM2] Get one sub feature map memory info with details: [%s]", one_fm_mem_info.ToString().c_str()); |
| 764 | - all_mem_info.emplace_back(std::move(one_fm_mem_info)); | 764 | + (void)all_mem_info.emplace_back(std::move(one_fm_mem_info)); |
| 765 | } | 765 | } |
| 766 | std::sort(all_mem_info.begin(), all_mem_info.end()); | 766 | std::sort(all_mem_info.begin(), all_mem_info.end()); |
| 767 | return SUCCESS; | 767 | return SUCCESS; |
| @@ -775,32 +775,32 @@ std::vector<MemInfo> ModelUtils::GetAllMemoryTypeSize(const GeModelPtr &ge_model | |||
| 775 | (void)AttrUtils::GetInt(ge_model, ATTR_MODEL_P2P_MEMORY_SIZE, p2p_mem_info.memory_size); | 775 | (void)AttrUtils::GetInt(ge_model, ATTR_MODEL_P2P_MEMORY_SIZE, p2p_mem_info.memory_size); |
| 776 | p2p_mem_info.memory_type = RT_MEMORY_P2P_DDR; | 776 | p2p_mem_info.memory_type = RT_MEMORY_P2P_DDR; |
| 777 | p2p_mem_info.memory_key = "_p"; | 777 | p2p_mem_info.memory_key = "_p"; |
| 778 | - all_mem_info.emplace_back(std::move(p2p_mem_info)); | 778 | + (void)all_mem_info.emplace_back(std::move(p2p_mem_info)); |
| 779 | 779 | ||
| 780 | MemInfo session_scope_mem_info{}; | 780 | MemInfo session_scope_mem_info{}; |
| 781 | (void)AttrUtils::GetInt(ge_model, ATTR_MODEL_SESSION_SCOPE_MEMORY_SIZE, session_scope_mem_info.memory_size); | 781 | (void)AttrUtils::GetInt(ge_model, ATTR_MODEL_SESSION_SCOPE_MEMORY_SIZE, session_scope_mem_info.memory_size); |
| 782 | session_scope_mem_info.memory_type = (kSessionScopeMemoryMask | RT_MEMORY_HBM); | 782 | session_scope_mem_info.memory_type = (kSessionScopeMemoryMask | RT_MEMORY_HBM); |
| 783 | - all_mem_info.emplace_back(std::move(session_scope_mem_info)); | 783 | + (void)all_mem_info.emplace_back(std::move(session_scope_mem_info)); |
| 784 | 784 | ||
| 785 | MemInfo host_mem_info{}; | 785 | MemInfo host_mem_info{}; |
| 786 | (void)AttrUtils::GetInt(ge_model, MODEL_ATTR_HOST_MEMORY_SIZE, host_mem_info.memory_size); | 786 | (void)AttrUtils::GetInt(ge_model, MODEL_ATTR_HOST_MEMORY_SIZE, host_mem_info.memory_size); |
| 787 | (void)AttrUtils::GetInt(ge_model, MODEL_ATTR_TASK_GEN_HOST_BASE_ADDR, host_mem_info.logic_memory_base); | 787 | (void)AttrUtils::GetInt(ge_model, MODEL_ATTR_TASK_GEN_HOST_BASE_ADDR, host_mem_info.logic_memory_base); |
| 788 | host_mem_info.memory_type = RT_MEMORY_HOST; | 788 | host_mem_info.memory_type = RT_MEMORY_HOST; |
| 789 | host_mem_info.memory_key = "_h"; | 789 | host_mem_info.memory_key = "_h"; |
| 790 | - all_mem_info.emplace_back(std::move(host_mem_info)); | 790 | + (void)all_mem_info.emplace_back(std::move(host_mem_info)); |
| 791 | 791 | ||
| 792 | MemInfo host_svm_mem_info{}; | 792 | MemInfo host_svm_mem_info{}; |
| 793 | (void)AttrUtils::GetInt(ge_model, MODEL_ATTR_HOST_SVM_SIZE, host_svm_mem_info.memory_size); | 793 | (void)AttrUtils::GetInt(ge_model, MODEL_ATTR_HOST_SVM_SIZE, host_svm_mem_info.memory_size); |
| 794 | (void)AttrUtils::GetInt(ge_model, MODEL_ATTR_TASK_GEN_HOST_SVM_BASE_ADDR, host_svm_mem_info.logic_memory_base); | 794 | (void)AttrUtils::GetInt(ge_model, MODEL_ATTR_TASK_GEN_HOST_SVM_BASE_ADDR, host_svm_mem_info.logic_memory_base); |
| 795 | host_svm_mem_info.memory_type = RT_MEMORY_HOST_SVM; | 795 | host_svm_mem_info.memory_type = RT_MEMORY_HOST_SVM; |
| 796 | host_svm_mem_info.memory_key = "_svm"; | 796 | host_svm_mem_info.memory_key = "_svm"; |
| 797 | - all_mem_info.emplace_back(std::move(host_svm_mem_info)); | 797 | + (void)all_mem_info.emplace_back(std::move(host_svm_mem_info)); |
| 798 | return all_mem_info; | 798 | return all_mem_info; |
| 799 | } | 799 | } |
| 800 | 800 | ||
| 801 | -bool ModelUtils::IsSuppoprtAddrRefreshable(const uint64_t mem_type) { | 801 | +bool ModelUtils::IsSuppoprtAddrRefreshable(const uint64_t mem_types) { |
| 802 | - return (mem_type == static_cast<uint64_t>(MemoryAppType::kMemoryTypeFeatureMap)) || | 802 | + return (mem_types == static_cast<uint64_t>(MemoryAppType::kMemoryTypeFeatureMap)) || |
| 803 | - (mem_type == static_cast<uint64_t>(MemoryAppType::kMemoryTypeModelIo)); | 803 | + (mem_types == static_cast<uint64_t>(MemoryAppType::kMemoryTypeModelIo)); |
| 804 | } | 804 | } |
| 805 | 805 | ||
| 806 | void ModelUtils::GetAddrRefreshableFlagsByMemTypes(const std::vector<uint64_t> &mem_types, | 806 | void ModelUtils::GetAddrRefreshableFlagsByMemTypes(const std::vector<uint64_t> &mem_types, |
| @@ -55,7 +55,7 @@ Status ArgsIoAddrsUpdater::Init(std::vector<MemAllocation> &logical_mem_allocati | |||
| 55 | 55 | ||
| 56 | MemAllocationAndOffset id_and_offset = {id, (addr - logical_mem_allocations[id].logical_addr), | 56 | MemAllocationAndOffset id_and_offset = {id, (addr - logical_mem_allocations[id].logical_addr), |
| 57 | logical_mem_allocations[id_addr_matched].type}; | 57 | logical_mem_allocations[id_addr_matched].type}; |
| 58 | - v_mem_allocation_id_and_offset_.emplace_back(id_and_offset); | 58 | + (void)v_mem_allocation_id_and_offset_.emplace_back(id_and_offset); |
| 59 | GELOGI("[OM2][Args][Init] op_name:%s, op_type:%s, logical_addr[%zu]:0x%" PRIx64 | 59 | GELOGI("[OM2][Args][Init] op_name:%s, op_type:%s, logical_addr[%zu]:0x%" PRIx64 |
| 60 | ", id:%zu, " | 60 | ", id:%zu, " |
| 61 | "offset:0x%" PRIx64 ", refreshable:%hhu.", | 61 | "offset:0x%" PRIx64 ", refreshable:%hhu.", |
| @@ -96,7 +96,7 @@ void ArgsIoAddrsUpdater::GenArgsRefreshInfos(std::vector<TaskArgsRefreshInfo> &i | |||
| 96 | info.args_offset = host_args_bas_offset + static_cast<uint64_t>(i * sizeof(uint64_t)); | 96 | info.args_offset = host_args_bas_offset + static_cast<uint64_t>(i * sizeof(uint64_t)); |
| 97 | info.placement = pls; | 97 | info.placement = pls; |
| 98 | info.args_format_policy = ArgsFormatPolicy::kAddrAll; | 98 | info.args_format_policy = ArgsFormatPolicy::kAddrAll; |
| 99 | - infos.emplace_back(info); | 99 | + (void)infos.emplace_back(info); |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
| 102 | } // namespace om2 | 102 | } // namespace om2 |
| @@ -210,9 +210,9 @@ class FixedAddrInferrer { | |||
| 210 | "%s, but get %s(%s)", | 210 | "%s, but get %s(%s)", |
| 211 | node->GetName().c_str(), addr_desc.iow_index, IDENTITY, peer_node->GetType().c_str(), | 211 | node->GetName().c_str(), addr_desc.iow_index, IDENTITY, peer_node->GetType().c_str(), |
| 212 | peer_node->GetName().c_str()); | 212 | peer_node->GetName().c_str()); |
| 213 | - peers.emplace_back(FixedAddrPeerNodeDesc{peer_node->GetOpDesc()->GetId(), peer_node, | 213 | + (void)peers.emplace_back(FixedAddrPeerNodeDesc{peer_node->GetOpDesc()->GetId(), peer_node, |
| 214 | - static_cast<size_t>(peer_anchor->GetIdx()), | 214 | + static_cast<size_t>(peer_anchor->GetIdx()), |
| 215 | - TaskArgsRefreshTypeClassifier::kOutput}); | 215 | + TaskArgsRefreshTypeClassifier::kOutput}); |
| 216 | break; | 216 | break; |
| 217 | } | 217 | } |
| 218 | case TaskArgsRefreshTypeClassifier::kOutput: { | 218 | case TaskArgsRefreshTypeClassifier::kOutput: { |
| @@ -50,7 +50,7 @@ Status TaskNodeMap::AddRelation(size_t task_index, int64_t node_id) { | |||
| 50 | task_index, node_id, iter->second->GetName().c_str()); | 50 | task_index, node_id, iter->second->GetName().c_str()); |
| 51 | return PARAM_INVALID; | 51 | return PARAM_INVALID; |
| 52 | } | 52 | } |
| 53 | - node_ids_to_task_indexes_[node_id].emplace_back(task_index); | 53 | + (void)node_ids_to_task_indexes_[node_id].emplace_back(task_index); |
| 54 | 54 | ||
| 55 | task_indexes_to_node_[task_index] = {node_id, iter->second}; | 55 | task_indexes_to_node_[task_index] = {node_id, iter->second}; |
| 56 | return SUCCESS; | 56 | return SUCCESS; |
| @@ -530,7 +530,7 @@ Status KernelExTaskCodeBuilder::RenderDispatchFuncLaunch(std::vector<BodyItem> & | |||
| 530 | } | 530 | } |
| 531 | 531 | ||
| 532 | Status KernelExTaskCodeBuilder::RenderDispatchFuncTaskInfo(std::vector<BodyItem> &body, const VarRef &op, | 532 | Status KernelExTaskCodeBuilder::RenderDispatchFuncTaskInfo(std::vector<BodyItem> &body, const VarRef &op, |
| 533 | - const VarRef &ctx) { | 533 | + const VarRef &ctx) const { |
| 534 | auto io_tensors = ast_.Var("std::vector<gert::Tensor>", "io_tensors"); | 534 | auto io_tensors = ast_.Var("std::vector<gert::Tensor>", "io_tensors"); |
| 535 | (void)body.emplace_back(ast_.VarDecl(io_tensors)); | 535 | (void)body.emplace_back(ast_.VarDecl(io_tensors)); |
| 536 | (void)body.emplace_back(io_tensors.Attr("reserve")(ast_.Var("", "num_io"))); | 536 | (void)body.emplace_back(io_tensors.Attr("reserve")(ast_.Var("", "num_io"))); |
| @@ -53,7 +53,7 @@ class KernelExTaskCodeBuilder : public TaskCodeBuilder { | |||
| 53 | Status RenderDispatchFuncLaunchConfig(std::vector<BodyItem> &body, const VarRef &op) const; | 53 | Status RenderDispatchFuncLaunchConfig(std::vector<BodyItem> &body, const VarRef &op) const; |
| 54 | Status RenderDispatchFuncAssembleExInfo(std::vector<BodyItem> &body, const VarRef &op, const VarRef &ctx); | 54 | Status RenderDispatchFuncAssembleExInfo(std::vector<BodyItem> &body, const VarRef &op, const VarRef &ctx); |
| 55 | Status RenderDispatchFuncLaunchTask(std::vector<BodyItem> &body, const VarRef &op, const VarRef &ctx); | 55 | Status RenderDispatchFuncLaunchTask(std::vector<BodyItem> &body, const VarRef &op, const VarRef &ctx); |
| 56 | - Status RenderDispatchFuncTaskInfo(std::vector<BodyItem> &body, const VarRef &op, const VarRef &ctx); | 56 | + Status RenderDispatchFuncTaskInfo(std::vector<BodyItem> &body, const VarRef &op, const VarRef &ctx) const; |
| 57 | static std::string SerializeBytesToOctalString(const std::vector<uint8_t> &buffer); | 57 | static std::string SerializeBytesToOctalString(const std::vector<uint8_t> &buffer); |
| 58 | Status InitIowAddrRefreshInfo(uint64_t current_offset); | 58 | Status InitIowAddrRefreshInfo(uint64_t current_offset); |
| 59 | Status InitLaunchInfo(const TaskSemanticContributeContext &context); | 59 | Status InitLaunchInfo(const TaskSemanticContributeContext &context); |
| @@ -263,10 +263,10 @@ Status MemcpyAsyncTaskCodeBuilder::ParseTaskRunParam(const domi::TaskDef &task_d | |||
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | Status MemcpyAsyncTaskCodeBuilder::SetIoAddrs(const om2::IowAddrs &iow_addrs) { | 265 | Status MemcpyAsyncTaskCodeBuilder::SetIoAddrs(const om2::IowAddrs &iow_addrs) { |
| 266 | - io_addrs_.emplace_back(ValueToPtr(iow_addrs.input_logic_addrs[0U].logic_addr)); | 266 | + (void)io_addrs_.emplace_back(ValueToPtr(iow_addrs.input_logic_addrs[0U].logic_addr)); |
| 267 | - io_addrs_.emplace_back(ValueToPtr(iow_addrs.output_logic_addrs[0U].logic_addr)); | 267 | + (void)io_addrs_.emplace_back(ValueToPtr(iow_addrs.output_logic_addrs[0U].logic_addr)); |
| 268 | - io_addr_mem_types_.emplace_back(iow_addrs.input_logic_addrs[0U].memory_type); | 268 | + (void)io_addr_mem_types_.emplace_back(iow_addrs.input_logic_addrs[0U].memory_type); |
| 269 | - io_addr_mem_types_.emplace_back(iow_addrs.output_logic_addrs[0U].memory_type); | 269 | + (void)io_addr_mem_types_.emplace_back(iow_addrs.output_logic_addrs[0U].memory_type); |
| 270 | return SUCCESS; | 270 | return SUCCESS; |
| 271 | } | 271 | } |
| 272 | 272 | ||
| @@ -11,7 +11,9 @@ | |||
| 11 | #ifndef GE_GRAPH_COMMON_OPTION_SUPPORTION_CHECKER_H_ | 11 | #ifndef GE_GRAPH_COMMON_OPTION_SUPPORTION_CHECKER_H_ |
| 12 | #define GE_GRAPH_COMMON_OPTION_SUPPORTION_CHECKER_H_ | 12 | #define GE_GRAPH_COMMON_OPTION_SUPPORTION_CHECKER_H_ |
| 13 | 13 | ||
| 14 | +#include <cstdint> | ||
| 14 | #include <map> | 15 | #include <map> |
| 16 | +#include <string> | ||
| 15 | #include <unordered_set> | 17 | #include <unordered_set> |
| 16 | #include "graph/types.h" | 18 | #include "graph/types.h" |
| 17 | 19 | ||
| @@ -3230,7 +3230,7 @@ bool GraphManager::IsBroadCastOpData(const ge::NodePtr &var_node) const { | |||
| 3230 | return false; | 3230 | return false; |
| 3231 | } | 3231 | } |
| 3232 | 3232 | ||
| 3233 | -void GraphManager::SetAttrForHcomBroadCastOp(ge::ComputeGraphPtr &compute_graph) { | 3233 | +void GraphManager::SetAttrForHcomBroadCastOp(ge::ComputeGraphPtr &compute_graph) const { |
| 3234 | GE_RT_VOID_CHECK_NOTNULL(compute_graph); | 3234 | GE_RT_VOID_CHECK_NOTNULL(compute_graph); |
| 3235 | // add variable attr for hccl broadcast,need to be removed after variable pass online | 3235 | // add variable attr for hccl broadcast,need to be removed after variable pass online |
| 3236 | for (const ge::NodePtr &node : compute_graph->GetDirectNode()) { | 3236 | for (const ge::NodePtr &node : compute_graph->GetDirectNode()) { |
| @@ -361,7 +361,7 @@ class GraphManager { | |||
| 361 | 361 | ||
| 362 | Status SetSubgraph(uint64_t session_id, ComputeGraphPtr compute_graph, EnginePartitioner &partitioner); | 362 | Status SetSubgraph(uint64_t session_id, ComputeGraphPtr compute_graph, EnginePartitioner &partitioner); |
| 363 | 363 | ||
| 364 | - void SetAttrForHcomBroadCastOp(ComputeGraphPtr &compute_graph); | 364 | + void SetAttrForHcomBroadCastOp(ComputeGraphPtr &compute_graph) const; |
| 365 | 365 | ||
| 366 | bool IsBroadCastOpData(const NodePtr &var_node) const; | 366 | bool IsBroadCastOpData(const NodePtr &var_node) const; |
| 367 | 367 | ||
| @@ -103,7 +103,7 @@ Status GetTensorSize(const GeTensorDesc &desc, size_t &size) { | |||
| 103 | return SUCCESS; | 103 | return SUCCESS; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | -std::string IntExpression(const int64_t value) { | 106 | +std::string IntExpression(int64_t value) { |
| 107 | if (value == std::numeric_limits<int64_t>::min()) { | 107 | if (value == std::numeric_limits<int64_t>::min()) { |
| 108 | return "(-9223372036854775807LL - 1LL)"; | 108 | return "(-9223372036854775807LL - 1LL)"; |
| 109 | } | 109 | } |
| @@ -55,6 +55,11 @@ static void ConvertShape2Nhwc(Format &format, std::vector<int64_t> &shape_vec) { | |||
| 55 | return; | 55 | return; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | +InsertAippOpUtil &InsertAippOpUtil::Instance() { | ||
| 59 | + thread_local InsertAippOpUtil instance; | ||
| 60 | + return instance; | ||
| 61 | +} | ||
| 62 | + | ||
| 58 | Status InsertAippOpUtil::Init() { | 63 | Status InsertAippOpUtil::Init() { |
| 59 | insert_op_conf_.reset((new (std::nothrow) domi::InsertNewOps())); | 64 | insert_op_conf_.reset((new (std::nothrow) domi::InsertNewOps())); |
| 60 | GE_CHECK_NOTNULL(insert_op_conf_); | 65 | GE_CHECK_NOTNULL(insert_op_conf_); |
| @@ -24,10 +24,7 @@ enum class AippType { OLD_TYPE, NEW_TYPE }; | |||
| 24 | 24 | ||
| 25 | class InsertAippOpUtil { | 25 | class InsertAippOpUtil { |
| 26 | public: | 26 | public: |
| 27 | - static InsertAippOpUtil &Instance() { | 27 | + static InsertAippOpUtil &Instance(); |
| 28 | - thread_local InsertAippOpUtil instance; | ||
| 29 | - return instance; | ||
| 30 | - } | ||
| 31 | 28 | ||
| 32 | Status Init(); | 29 | Status Init(); |
| 33 | 30 | ||
| @@ -16,9 +16,9 @@ | |||
| 16 | 16 | ||
| 17 | namespace llm { | 17 | namespace llm { |
| 18 | template <typename _Tp, typename... _Args> | 18 | template <typename _Tp, typename... _Args> |
| 19 | -static inline std::shared_ptr<_Tp> MakeShared(_Args &&...__args) { | 19 | +static inline std::shared_ptr<_Tp> MakeShared(_Args &&...args) { |
| 20 | using _Tp_nc = typename std::remove_const<_Tp>::type; | 20 | using _Tp_nc = typename std::remove_const<_Tp>::type; |
| 21 | - const std::shared_ptr<_Tp> ret(new (std::nothrow) _Tp_nc(std::forward<_Args>(__args)...)); | 21 | + const std::shared_ptr<_Tp> ret(new (std::nothrow) _Tp_nc(std::forward<_Args>(args)...)); |
| 22 | return ret; | 22 | return ret; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| @@ -13,6 +13,8 @@ | |||
| 13 | # 支持传入shape和执行次数,验证开启融合pass的性能 | 13 | # 支持传入shape和执行次数,验证开启融合pass的性能 |
| 14 | # 用法: ./quick_verify.sh [batch] [m] [k] [n] [test_rounds] | 14 | # 用法: ./quick_verify.sh [batch] [m] [k] [n] [test_rounds] |
| 15 | 15 | ||
| 16 | +set -euo pipefail | ||
| 17 | + | ||
| 16 | SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) | 18 | SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) |
| 17 | PASS_DIR=$(dirname "$SCRIPT_DIR") | 19 | PASS_DIR=$(dirname "$SCRIPT_DIR") |
| 18 | 20 | ||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include "parser/common/acl_graph_parser_util.h" | 20 | #include "parser/common/acl_graph_parser_util.h" |
| 21 | #include "framework/omg/parser/parser_types.h" | 21 | #include "framework/omg/parser/parser_types.h" |
| 22 | #include "framework/common/debug/ge_log.h" | 22 | #include "framework/common/debug/ge_log.h" |
| 23 | -#include "omg/omg_inner_types.h" | ||
| 24 | #include "graph_metadef/register/graph_register.h" | 23 | #include "graph_metadef/register/graph_register.h" |
| 25 | 24 | ||
| 26 | namespace ge { | 25 | namespace ge { |
| @@ -11,6 +11,7 @@ | |||
| 11 | #ifndef PARSER_COMMON_PARSER_MODEL_SAVER_H_ | 11 | #ifndef PARSER_COMMON_PARSER_MODEL_SAVER_H_ |
| 12 | #define PARSER_COMMON_PARSER_MODEL_SAVER_H_ | 12 | #define PARSER_COMMON_PARSER_MODEL_SAVER_H_ |
| 13 | 13 | ||
| 14 | +#include <cstdint> | ||
| 14 | #include <string> | 15 | #include <string> |
| 15 | 16 | ||
| 16 | #include "ge/ge_api_error_codes.h" | 17 | #include "ge/ge_api_error_codes.h" |
| @@ -13,7 +13,6 @@ | |||
| 13 | #include <securec.h> | 13 | #include <securec.h> |
| 14 | 14 | ||
| 15 | #include <cmath> | 15 | #include <cmath> |
| 16 | -#include <cstring> | ||
| 17 | #include <functional> | 16 | #include <functional> |
| 18 | #include <sstream> | 17 | #include <sstream> |
| 19 | #include <string> | 18 | #include <string> |
| @@ -11,6 +11,8 @@ | |||
| 11 | #ifndef INC_OM2_REGISTER_REGISTER_FORMAT_TRANSFER_H_ | 11 | #ifndef INC_OM2_REGISTER_REGISTER_FORMAT_TRANSFER_H_ |
| 12 | #define INC_OM2_REGISTER_REGISTER_FORMAT_TRANSFER_H_ | 12 | #define INC_OM2_REGISTER_REGISTER_FORMAT_TRANSFER_H_ |
| 13 | 13 | ||
| 14 | +#include <cstddef> | ||
| 15 | +#include <cstdint> | ||
| 14 | #include <memory> | 16 | #include <memory> |
| 15 | #include <vector> | 17 | #include <vector> |
| 16 | #include <functional> | 18 | #include <functional> |
| @@ -62,7 +62,7 @@ ge::Status Om2RTVarManager::Init(const RTVarResource &resource, void *const exte | |||
| 62 | return ge::SUCCESS; | 62 | return ge::SUCCESS; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | -ge::Status Om2RTVarManager::AllocDevAddr(const RTVarEntry &entry, void *&dev_addr) { | 65 | +ge::Status Om2RTVarManager::AllocDevAddr(const RTVarEntry &entry, void *&dev_addr) const { |
| 66 | void *new_addr = nullptr; | 66 | void *new_addr = nullptr; |
| 67 | const auto malloc_ret = Om2Malloc(&new_addr, entry.size, entry.memory_type, 0); | 67 | const auto malloc_ret = Om2Malloc(&new_addr, entry.size, entry.memory_type, 0); |
| 68 | if (malloc_ret != ACL_SUCCESS) { | 68 | if (malloc_ret != ACL_SUCCESS) { |
| @@ -50,7 +50,7 @@ class Om2RTVarManager { | |||
| 50 | void Finalize() noexcept; | 50 | void Finalize() noexcept; |
| 51 | 51 | ||
| 52 | private: | 52 | private: |
| 53 | - ge::Status AllocDevAddr(const RTVarEntry &entry, void *&dev_addr); | 53 | + ge::Status AllocDevAddr(const RTVarEntry &entry, void *&dev_addr) const; |
| 54 | ge::Status CopyVarFromDevice(const RTVarEntry &entry, const RTVarRuntimeState &state, const uint32_t device_id, | 54 | ge::Status CopyVarFromDevice(const RTVarEntry &entry, const RTVarRuntimeState &state, const uint32_t device_id, |
| 55 | std::vector<uint8_t> &host_buf); | 55 | std::vector<uint8_t> &host_buf); |
| 56 | ge::Status CopyVarToDevice(const RTVarEntry &entry, const RTVarRuntimeState &state, const uint32_t device_id, | 56 | ge::Status CopyVarToDevice(const RTVarEntry &entry, const RTVarRuntimeState &state, const uint32_t device_id, |
Mruntime/v2/core/executor/multi_thread_topological/executor/schedule/scheduler/task_schedule_data.cc+5-5
| @@ -10,15 +10,15 @@ | |||
| 10 | #include "task_schedule_data.h" | 10 | #include "task_schedule_data.h" |
| 11 | #include "core/execution_data.h" | 11 | #include "core/execution_data.h" |
| 12 | namespace gert { | 12 | namespace gert { |
| 13 | -TaskScheduleData::TaskScheduleData(const void *exec_data) | 13 | +TaskScheduleData::TaskScheduleData(const void *execution_data) |
| 14 | - : execution_data(exec_data), schedule_limit(0), free_launch_relation_csr() { | 14 | + : execution_data(execution_data), schedule_limit(0), free_launch_relation_csr() { |
| 15 | if (execution_data != nullptr) { | 15 | if (execution_data != nullptr) { |
| 16 | schedule_limit = reinterpret_cast<const ExecutionData *>(execution_data)->base_ed.node_num; | 16 | schedule_limit = reinterpret_cast<const ExecutionData *>(execution_data)->base_ed.node_num; |
| 17 | } | 17 | } |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | -TaskScheduleData::TaskScheduleData(const void *exec_data, const FreeLaunchRelationCsr &relation_csr) | 20 | +TaskScheduleData::TaskScheduleData(const void *execution_data, const FreeLaunchRelationCsr &free_launch_relation_csr) |
| 21 | - : TaskScheduleData(exec_data) { | 21 | + : TaskScheduleData(execution_data) { |
| 22 | - free_launch_relation_csr = relation_csr; | 22 | + this->free_launch_relation_csr = free_launch_relation_csr; |
| 23 | } | 23 | } |
| 24 | } // namespace gert | 24 | } // namespace gert |
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <cstddef> | 14 | #include <cstddef> |
| 15 | #include <cstdint> | 15 | #include <cstdint> |
| 16 | #include <new> | 16 | #include <new> |
| 17 | +#include <utility> | ||
| 17 | #include "kernel/memory/util/link_node.h" | 18 | #include "kernel/memory/util/link_node.h" |
| 18 | 19 | ||
| 19 | namespace gert { | 20 | namespace gert { |
| @@ -274,7 +274,7 @@ const uint32_t *DfxExtendInfo::GetWbackCmoCtxIdAddr(size_t index) { | |||
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | // 获取集合的尺寸,后续根据尺寸获取属性值, 对空集合,返回0 | 276 | // 获取集合的尺寸,后续根据尺寸获取属性值, 对空集合,返回0 |
| 277 | -size_t DfxExtendInfo::GetCtxIdsNum() { | 277 | +size_t DfxExtendInfo::GetCtxIdsNum() const { |
| 278 | if (GetCtxSizeAddr() == nullptr) { | 278 | if (GetCtxSizeAddr() == nullptr) { |
| 279 | return 0U; | 279 | return 0U; |
| 280 | } | 280 | } |
| @@ -50,7 +50,7 @@ class DfxExtendInfo { | |||
| 50 | const uint32_t *GetWbackCmoCtxSizeAddr(); | 50 | const uint32_t *GetWbackCmoCtxSizeAddr(); |
| 51 | const uint32_t *GetWbackCmoCtxTypeAddr(); | 51 | const uint32_t *GetWbackCmoCtxTypeAddr(); |
| 52 | const uint32_t *GetWbackCmoCtxIdAddr(size_t index); | 52 | const uint32_t *GetWbackCmoCtxIdAddr(size_t index); |
| 53 | - size_t GetCtxIdsNum(); | 53 | + size_t GetCtxIdsNum() const; |
| 54 | size_t GetPreCmoCtxNum(); | 54 | size_t GetPreCmoCtxNum(); |
| 55 | size_t GetInvalCmoCtxNum(); | 55 | size_t GetInvalCmoCtxNum(); |
| 56 | size_t GetWbackCmoCtxNum(); | 56 | size_t GetWbackCmoCtxNum(); |
| @@ -326,7 +326,7 @@ TEST_F(UTEST_ACL_OpCompiler, SetCompileStrategyTest) { | |||
| 326 | service.creators_.clear(); | 326 | service.creators_.clear(); |
| 327 | EXPECT_EQ(service.SetCompileStrategy(CompileStrategy::NATIVE_COMPILER, options), ACL_ERROR_COMPILER_NOT_REGISTERED); | 327 | EXPECT_EQ(service.SetCompileStrategy(CompileStrategy::NATIVE_COMPILER, options), ACL_ERROR_COMPILER_NOT_REGISTERED); |
| 328 | 328 | ||
| 329 | - CompileStrategy strategy = CompileStrategy(3); | 329 | + CompileStrategy strategy = static_cast<CompileStrategy>(3); |
| 330 | EXPECT_EQ(service.SetCompileStrategy(strategy, options), ACL_ERROR_INVALID_PARAM); | 330 | EXPECT_EQ(service.SetCompileStrategy(strategy, options), ACL_ERROR_INVALID_PARAM); |
| 331 | } | 331 | } |
| 332 | 332 | ||