diff --git a/build.sh b/build.sh index 7b1c0792..5931bbaa 100644 --- a/build.sh +++ b/build.sh @@ -173,7 +173,7 @@ build_graphengine() TARGET="ge_runner fwk_atc.bin ${TARGET}" elif [ "x${PLATFORM}" = "xinference" ] then - TARGET="ge_compiler atc_atc.bin opensrc_ascendcl ${TARGET}" + TARGET="ge_compiler atc_atc.bin ge_executor_shared ${TARGET}" elif [ "X$ENABLE_GE_UT" = "Xon" ] then TARGET="ut_libgraph ut_libge_multiparts_utest ut_libge_others_utest ut_libge_kernel_utest ut_libge_distinct_load_utest" @@ -183,7 +183,7 @@ build_graphengine() elif [ "x${PLATFORM}" = "xall" ] then # build all the target - TARGET="ge_runner ge_compiler fwk_atc.bin atc_atc.bin opensrc_ascendcl ${TARGET}" + TARGET="ge_runner ge_compiler fwk_atc.bin atc_atc.bin ge_executor_shared ${TARGET}" fi make ${VERBOSE} ${TARGET} -j${THREAD_NUM} && make install @@ -250,6 +250,7 @@ generate_package() NNENGINE_PATH="plugin/nnengine/ge_config" OPSKERNEL_PATH="plugin/opskernel" + ACL_LIB=("libge_common.so" "libgraph.so" "libregister.so" "liberror_manager.so" "libge_executor.so") ATC_LIB=("libc_sec.so" "libge_common.so" "libge_compiler.so" "libgraph.so" "libregister.so" "liberror_manager.so") FWK_LIB=("libge_common.so" "libge_runner.so" "libgraph.so" "libregister.so" "liberror_manager.so") PLUGIN_OPSKERNEL=("libge_local_engine.so" "libge_local_opskernel_builder.so" "libhost_cpu_engine.so" "libhost_cpu_opskernel_builder.so" "optimizer_priority.pbtxt") @@ -303,6 +304,11 @@ generate_package() find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \; done + for lib in "${ACL_LIB[@]}"; + do + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; + done + for lib in "${ATC_LIB[@]}"; do find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH} \; @@ -310,7 +316,6 @@ generate_package() find ./lib/atclib -name atc.bin -exec cp {} "${OUTPUT_PATH}/${ATC_BIN_PATH}" \; find ./lib/fwkacl -name atc.bin -exec cp {} "${OUTPUT_PATH}/${FWK_BIN_PATH}" \; - find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "libascendcl.so" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; cp -r ${OUTPUT_PATH}/../metadef/inc/external/* ${ATC_INCLUDE_PATH} cp -r ${OUTPUT_PATH}/../parser/inc/external/* ${ATC_INCLUDE_PATH} diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 89745019..1698710e 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -25,7 +25,7 @@ set(PROTO_HEADER_LIST "${METADEF_DIR}/proto/insert_op.proto" "${METADEF_DIR}/proto/ge_ir.proto" "${METADEF_DIR}/proto/fwk_adapter.proto" - "${METADEF_DIR}/proto/op_mapping_info.proto" + "${METADEF_DIR}/proto/op_mapping.proto" ) protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) @@ -340,7 +340,6 @@ set(TRAIN_SRC_LIST "init/gelib.cc" "model/ge_model.cc" "model/ge_root_model.cc" - "omm/csa_interact.cc" "opskernel_manager/ops_kernel_manager.cc" "opskernel_manager/ops_kernel_builder_manager.cc" "session/inner_session.cc" @@ -402,7 +401,7 @@ set(TRAIN_SRC_LIST "ir_build/attr_options/utils.cc" "ir_build/attr_options/keep_dtype_option.cc" "ir_build/attr_options/weight_compress_option.cc" - "ir_build/atc_ir_common.cc" + "ir_build/option_utils.cc" "graph/build/memory/memory_assigner.cc" "graph/build/memory/graph_mem_assigner.cc" "graph/build/memory/binary_block_mem_assigner.cc" @@ -415,7 +414,6 @@ set(TRAIN_SRC_LIST set(INFER_SRC_LIST "graph/manager/trans_var_data_utils.cc" - "omm/csa_interact.cc" "common/fp16_t.cc" "common/formats/utils/formats_trans_utils.cc" "common/formats/format_transfers/datatype_transfer.cc" @@ -663,7 +661,7 @@ set(INFER_SRC_LIST "ir_build/attr_options/utils.cc" "ir_build/attr_options/keep_dtype_option.cc" "ir_build/attr_options/weight_compress_option.cc" - "ir_build/atc_ir_common.cc" + "ir_build/option_utils.cc" "graph/preprocess/insert_op/ge_aipp_op.cc" "graph/preprocess/insert_op/util_insert_aipp_op.cc" "hybrid/node_executor/aicpu/aicpu_ext_info.cc" diff --git a/ge/analyzer/analyzer.cc b/ge/analyzer/analyzer.cc index 528a0265..95036267 100755 --- a/ge/analyzer/analyzer.cc +++ b/ge/analyzer/analyzer.cc @@ -104,6 +104,7 @@ ge::Status Analyzer::Initialize() { string real_path = RealPath(kFilePath.c_str()); if (real_path.empty()) { GELOGE(FAILED, "[Check][AnalyzeFilePath]File path is empty, Path invalid."); + REPORT_CALL_ERROR("E19999", "Analyze file path check invalid, it is empty"); return FAILED; } json_file_name_ = real_path + "/" + kAnalyzeFile; @@ -155,12 +156,18 @@ std::shared_ptr Analyzer::GetJsonObject(uint64_t session_id, uint64_t std::lock_guard lg(mutex_); auto iter = graph_infos_.find(session_id); if (iter == graph_infos_.end()) { - GELOGE(PARAM_INVALID, "[Check][SessionId]session_id:%lu does not exist! graph_id:%lu", session_id, graph_id); + GELOGE(PARAM_INVALID, "[Check][SessionId]session_id:%lu does not exist! " + "graph_id:%lu", session_id, graph_id); + REPORT_INNER_ERROR("E19999", "Sessin_id %lu does not exist, graph_id %lu", + session_id, graph_id); return nullptr; } else { auto iter1 = (iter->second).find(graph_id); if (iter1 == (iter->second).end()) { - GELOGE(PARAM_INVALID, "[Check][GraphId]graph_id:%lu does not exist! session_id:%lu.", graph_id, session_id); + GELOGE(PARAM_INVALID, "[Check][GraphId]graph_id:%lu does not exist! " + "session_id:%lu.", graph_id, session_id); + REPORT_INNER_ERROR("E19999", "Graph_id %lu does not exist, session_id %lu", + graph_id, session_id); return nullptr; } GELOGI("GetJsonObject Success!session_id:%lu graph_id:%lu", session_id, graph_id); @@ -186,11 +193,15 @@ ge::Status Analyzer::CreateAnalyzerFile() { std::lock_guard lg(file_mutex_); int fd = open(json_file_name_.c_str(), O_WRONLY | O_CREAT | O_TRUNC, kFileAuthority); if (fd < 0) { - GELOGE(INTERNAL_ERROR, "[FileOpen][AnalyzeFile]Fail to open the analyze file: %s.", json_file_name_.c_str()); + GELOGE(INTERNAL_ERROR, "[FileOpen][AnalyzeFile]Fail to open the analyze file: %s.", + json_file_name_.c_str()); + REPORT_INNER_ERROR("E19999", "Failed to open analyze file %s", json_file_name_.c_str()); return INTERNAL_ERROR; } if (close(fd) != 0) { - GELOGE(INTERNAL_ERROR, "[FileClose][AnalyzeFile]Fail to close the analyze file: %s.", json_file_name_.c_str()); + GELOGE(INTERNAL_ERROR, "[FileClose][AnalyzeFile]Fail to close the analyze file: %s.", + json_file_name_.c_str()); + REPORT_INNER_ERROR("E19999", "Failed to clsoe analyze file %s", json_file_name_.c_str()); return INTERNAL_ERROR; } is_json_file_create_ = true; @@ -211,7 +222,9 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_ std::lock_guard lg(file_mutex_); json_file_.open(json_file_name_, std::ios::app); if (!json_file_.is_open()) { - GELOGE(FAILED, "[Check][AnalyzeFile]analyze file does not exist[%s]", json_file_name_.c_str()); + GELOGE(FAILED, "[Check][AnalyzeFile]analyze file does not exist[%s]", + json_file_name_.c_str()); + REPORT_INNER_ERROR("E19999", "Analyze file %s dose not exist", json_file_name_.c_str()); return PARAM_INVALID; } @@ -221,10 +234,13 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_ try { json_file_ << jsn.dump(kJsonDumpLevel) << std::endl; } catch (nlohmann::detail::type_error &e) { - GELOGE(FAILED, - "[Json.dump][GraphInfo]json.dump to analyze file [%s] failed because [%s]," - "session_id:%lu, graph_id:%lu", + GELOGE(FAILED, + "[Json.dump][GraphInfo]Dump analyze file [%s] failed because [%s]," + "session_id:%lu, graph_id:%lu", json_file_name_.c_str(), e.what(), session_id, graph_id); + REPORT_INNER_ERROR("E19999", "Dump analyze file %s failed because %s, " + "session_id %lu, graph_id %lu", + json_file_name_.c_str(), e.what(), session_id, graph_id); ret_failed = true; } json_file_.close(); @@ -244,9 +260,11 @@ ge::Status Analyzer::DoAnalyze(DataInfo &data_info) { GE_CHECK_NOTNULL(graph_info); auto status = SaveOpInfo(desc, data_info, graph_info); if (status != SUCCESS) { - GELOGE(status, + GELOGE(status, "[Check][SaveOpInfo]save op info: desc_name [%s] desc_type [%s] failed!", desc->GetName().c_str(), desc->GetType().c_str()); + REPORT_CALL_ERROR("E19999", "Save op info: desc_name %s, desc_type %s failed", + desc->GetName().c_str(), desc->GetType().c_str()); return FAILED; } // create json file diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index 0c63c6e3..8f6fba95 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -73,7 +73,8 @@ Status CheckOptionsValid(const std::map &options) { "the job_id [%s] string length: %zu > max string length: %d", job_id_iter->second.c_str(), job_id_iter->second.length(), kMaxStrLen); REPORT_INPUT_ERROR("E10051", std::vector({"id","length"}), - std::vector({job_id_iter->second, std::to_string(kMaxStrLen)})); + std::vector({job_id_iter->second, + std::to_string(kMaxStrLen)})); return FAILED; } } @@ -90,6 +91,7 @@ Status GEInitializeImpl(const std::map &options) { if (ret != SUCCESS) { GELOGE(GE_CLI_INIT_FAILED, "[Init][PathBase]Init failed when pass param path_base:%s", path_base.c_str()); + REPORT_CALL_ERROR("E19999", "Init failed when pass param path_base:%s", path_base.c_str()); return ret; } @@ -98,7 +100,7 @@ Status GEInitializeImpl(const std::map &options) { GELOGW("GEInitialize is called more than once"); return SUCCESS; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsProtoInit); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsProtoInit); // Load OpsProto lib plugin std::string opsproto_path; GetOpsProtoPath(opsproto_path); @@ -111,11 +113,13 @@ Status GEInitializeImpl(const std::map &options) { if (!is_proto_init) { GELOGE(GE_CLI_INIT_FAILED, "[Init][OpsProtoPath]Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid.", - opsproto_path.c_str()); + opsproto_path.c_str()); + REPORT_CALL_ERROR("E19999", "Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid", + opsproto_path.c_str()); return FAILED; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); // check options is valid GE_TIMESTAMP_START(CheckOptionsValid); if (CheckOptionsValid(options) != SUCCESS) { @@ -123,13 +127,13 @@ Status GEInitializeImpl(const std::map &options) { } GE_TIMESTAMP_END(CheckOptionsValid, "GEInitialize::CheckOptionsValid"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsProtoInit); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsProtoInit); GE_TIMESTAMP_START(InitPreparation); TBEPluginManager::Instance().InitPreparation(options); GE_TIMESTAMP_END(InitPreparation, "GEInitialize::InitPreparation"); // call Initialize GELOGT(TRACE_RUNNING, "Initializing environment"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); GE_TIMESTAMP_START(GELibInitialize); ret = ge::GELib::Initialize(options); GE_TIMESTAMP_END(GELibInitialize, "GEInitialize::GELibInitialize"); @@ -150,7 +154,7 @@ Status GEInitializeImpl(const std::map &options) { // Initialize GE, prepare for execution, call GELib::Initialize Status GEInitialize(const std::map &options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); if (DlogReportInitialize() != SUCCESS) { GELOGW("Dlog report device log initialize failed."); } @@ -158,7 +162,7 @@ Status GEInitialize(const std::map &options) { } Status GEInitialize(const std::map &options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); std::map str_options; for (auto &option : options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { @@ -187,7 +191,7 @@ Status GEFinalize() { return SUCCESS; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); + ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); ErrorManager::GetInstance().GenWorkStreamIdDefault(); GELOGT(TRACE_INIT, "GEFinalize start"); @@ -239,7 +243,7 @@ std::string GEGetWarningMsg() { // Initialize session,which calls innerSession Session::Session(const std::map &options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); GELOGT(TRACE_INIT, "Session Constructor start"); ErrorManager::GetInstance().GenWorkStreamIdDefault(); @@ -255,7 +259,7 @@ Session::Session(const std::map &options) { // call Initialize std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Construct][Session]Failed, GELib instance is nullptr or it is not InitFlag"); return; } @@ -276,7 +280,7 @@ Session::Session(const std::map &options) { } Session::Session(const std::map &options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); GELOGT(TRACE_INIT, "Session Constructor start"); ErrorManager::GetInstance().GenWorkStreamIdDefault(); @@ -319,6 +323,7 @@ Session::Session(const std::map &options) { sessionId_ = session_id; } else { GELOGE(ret, "[Construct][Session]Failed, error code:%u.", ret); + REPORT_CALL_ERROR("E19999", "Construct session failed, error code:%u.", ret); return; } GELOGT(TRACE_STOP, "Session Constructor finished"); @@ -326,7 +331,7 @@ Session::Session(const std::map &options) { // session destructor Session::~Session() { - ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); + ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); GELOGT(TRACE_INIT, "Session Destructor start"); // 0.check init status if (!g_ge_initialized) { @@ -350,12 +355,15 @@ Session::~Session() { ret = instance_ptr->SessionManagerObj().DestroySession(session_id); } catch (google::protobuf::FatalException &e) { - GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed because get fatalException."); + GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed " + "because get fatalException."); + REPORT_CALL_ERROR("E19999", "Destruct session failed, get fatal exception"); } // check return status, return, update session id if success if (ret != SUCCESS) { GELOGE(ret, "[Destruct][Session]Failed, error code:%u.", ret); + REPORT_CALL_ERROR("E19999", "Destruct session failed, error code:%u.", ret); } GELOGT(TRACE_STOP, "Session Destructor finished"); @@ -363,7 +371,7 @@ Session::~Session() { // Add Graph Status Session::AddGraph(uint32_t graph_id, const Graph &graph) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); std::map options; ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); return AddGraph(graph_id, graph, options); @@ -371,7 +379,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph) { // Add Graph Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::map &options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGT(TRACE_INIT, "Start to add graph in Session. graph_id: %u, session_id: %lu.", graph_id, sessionId_); ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); std::shared_ptr instance_ptr = ge::GELib::GetInstance(); @@ -385,7 +393,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::mapSessionManagerObj().AddGraph(sessionId_, graph_id, graph, options); if (ret != SUCCESS) { - GELOGE(ret, + GELOGE(ret, "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); return FAILED; @@ -397,7 +405,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::map &options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGT(TRACE_INIT, "Start to add graph in Session. graph_id: %u, session_id: %lu.", graph_id, sessionId_); ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); std::shared_ptr instance_ptr = ge::GELib::GetInstance(); @@ -433,7 +441,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, } Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); std::map options; return AddGraphWithCopy(graph_id, graph, options); @@ -442,7 +450,7 @@ Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph) { // Add Graph With Copy Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph, const std::map &options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGT(TRACE_INIT, "Start to add graph in Session. graph_id: %u, session_id: %lu.", graph_id, sessionId_); ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); std::shared_ptr instance_ptr = ge::GELib::GetInstance(); @@ -471,7 +479,7 @@ Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph, // Remove Graph Status Session::RemoveGraph(uint32_t graph_id) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGT(TRACE_INIT, "Session RemoveGraph start"); ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); @@ -479,9 +487,11 @@ Status Session::RemoveGraph(uint32_t graph_id) { std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (!instance_ptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag "); + "[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %u", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag."); + "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %u", sessionId_, graph_id); return FAILED; } @@ -491,7 +501,9 @@ Status Session::RemoveGraph(uint32_t graph_id) { if (ret != SUCCESS) { GELOGE(ret, "[Remove][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + ret, sessionId_, graph_id); + REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " + "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; } GELOGT(TRACE_STOP, "Session RemoveGraph finished"); @@ -548,7 +560,7 @@ void PrintOutputResult(std::vector &outputs) { // Run Graph Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, std::vector &outputs) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGT(TRACE_INIT, "Session RunGraph start"); ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); @@ -557,9 +569,11 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag."); + "[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %u", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RunGraph Failed, GELib instance is nullptr or is not InitFlag."); + "RunGraph Failed, GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %u", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Running Graph"); @@ -568,7 +582,9 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s if (ret != SUCCESS) { GELOGE(ret, "[Run][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + ret, sessionId_, graph_id); + REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " + "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; } @@ -599,14 +615,16 @@ Status Session::RegisterCallBackFunc(const char *key, const session::pCallBackFu // Build Graph Status Session::BuildGraph(uint32_t graph_id, const std::vector &inputs) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag."); + GELOGE(GE_CLI_GE_NOT_INITIALIZED, + "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %u", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "Build graph failed, the GELib instance is nullptr or is not InitFlag."); + "Build graph failed, the GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %u", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Building Graph"); @@ -614,7 +632,9 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector if (ret != SUCCESS) { GELOGE(ret, "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + ret, sessionId_, graph_id); + REPORT_CALL_ERROR("E19999", "Build graph failed , error code:%u, " + "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; } return SUCCESS; @@ -623,14 +643,16 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector // Run Graph Asynchronously Status Session::RunGraphAsync(uint32_t graph_id, const std::vector &inputs, RunAsyncCallback callback) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag."); + "[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %u", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag."); + "RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %u", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Run Graph Asynchronously"); @@ -641,6 +663,8 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector &var_names, std::vector &var_values) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); ErrorManager::GetInstance().GenWorkStreamIdDefault(); auto instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][Variables]Failed, the GELib instance is nullptr or is not InitFlag."); REPORT_INNER_ERROR("E19999", "GetVariables failed, the GELib instance is nullptr or is not InitFlag."); @@ -669,7 +693,7 @@ Status Session::GetVariables(const std::vector &var_names, std::vec // Get Variables Status Session::GetVariables(const std::vector &var_names, std::vector &var_values) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); ErrorManager::GetInstance().GenWorkStreamIdDefault(); auto instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { @@ -692,6 +716,8 @@ Status Session::GetVariables(const std::vector &var_names, std::ve Status ret = ge::GELib::GetInstance()->SessionManagerObj().GetVariables(sessionId_, str_var_names, var_values); if (ret != SUCCESS) { GELOGE(ret, "[Get][Variables]Failed, error code:%u, session_id:%lu.", ret, sessionId_); + REPORT_CALL_ERROR("E19999", "Get variables failed, error code:%u, session_id:%lu.", + ret, sessionId_); return FAILED; } return SUCCESS; diff --git a/ge/client/proto/ge_ir.proto b/ge/client/proto/ge_ir.proto index 12989a54..c0ef3071 100644 --- a/ge/client/proto/ge_ir.proto +++ b/ge/client/proto/ge_ir.proto @@ -31,6 +31,8 @@ enum DataType DT_STRING_REF = 24; // string_ref type DT_DUAL = 25; /**< dual output type */ DT_VARIANT = 26; // variant type + DT_BF16 = 27; // bf16 type + DT_INT4 = 28; // int4 type } message AttrDef diff --git a/ge/common/auth/file_saver.cc b/ge/common/auth/file_saver.cc index 3c3b6197..50dcf776 100755 --- a/ge/common/auth/file_saver.cc +++ b/ge/common/auth/file_saver.cc @@ -33,8 +33,10 @@ const int kFileOpSuccess = 0; namespace ge { Status FileSaver::OpenFile(int32_t &fd, const std::string &file_path) { if (CheckPath(file_path) != SUCCESS) { - GELOGE(FAILED, "[Check][FilePath]Check output file failed, file_path:%s.", file_path.c_str()); - REPORT_CALL_ERROR("E19999", "Check output file failed, file_path:%s.", file_path.c_str()); + GELOGE(FAILED, "[Check][FilePath]Check output file failed, file_path:%s.", + file_path.c_str()); + REPORT_CALL_ERROR("E19999", "Check output file failed, file_path:%s.", + file_path.c_str()); return FAILED; } @@ -46,8 +48,9 @@ Status FileSaver::OpenFile(int32_t &fd, const std::string &file_path) { fd = mmOpen2(real_path, M_RDWR | M_CREAT | O_TRUNC, mode); if (fd == EN_INVALID_PARAM || fd == EN_ERROR) { // -1: Failed to open file; - 2: Illegal parameter - GELOGE(FAILED, "[Open][File]Failed. mmpa_errno = %d, %s", fd, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Open file failed, mmpa_errno = %d, error:%s.", fd, strerror(errno)); + GELOGE(FAILED, "[Open][File]Failed. errno:%d, errmsg:%s", fd, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Open file failed, errno:%d, errmsg:%s.", + fd, strerror(errno)); return FAILED; } return SUCCESS; @@ -64,9 +67,10 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { while (size > size_1g) { write_count = mmWrite(fd, reinterpret_cast(seek), size_1g); if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { - GELOGE(FAILED, "[Write][Data]Failed, mmpa_errorno = %ld, error:%s", write_count, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", - write_count, strerror(errno)); + GELOGE(FAILED, "[Write][Data]Failed, errno:%ld, errmsg:%s", + write_count, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Write data failed, errno:%ld, errmsg:%s.", + write_count, strerror(errno)); return FAILED; } size -= size_1g; @@ -79,7 +83,8 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { // -1: Failed to write to file; - 2: Illegal parameter if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { - GELOGE(FAILED, "[Write][Data]Failed. mmpa_errorno = %ld, error:%s", write_count, strerror(errno)); + GELOGE(FAILED, "[Write][Data]Failed. mmpa_errorno = %ld, error:%s", + write_count, strerror(errno)); REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", write_count, strerror(errno)); return FAILED; @@ -91,8 +96,10 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFileHeader &file_header, const void *data, int len) { if (data == nullptr || len <= 0) { - GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the length[%d] is less than 1.", len); - REPORT_INNER_ERROR("E19999", "Save file failed, model_data is null or the length:%d is less than 1.", len); + GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the " + "length[%d] is less than 1.", len); + REPORT_INNER_ERROR("E19999", "Save file failed, model_data is null or the " + "length:%d is less than 1.", len); return FAILED; } @@ -112,7 +119,8 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi // Close file if (mmClose(fd) != 0) { // mmClose 0: success GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", + ret, strerror(errno)); ret = FAILED; } return ret; @@ -150,7 +158,8 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi // Close file if (mmClose(fd) != EN_OK) { GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); - REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); + REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", + ret, strerror(errno)); ret = FAILED; } return ret; @@ -235,8 +244,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::CheckPath(con if (file_path.size() >= MMPA_MAX_PATH) { GELOGE(FAILED, "[Check][FilePath]Failed, file path's length:%zu > mmpa_max_path:%d", file_path.size(), MMPA_MAX_PATH); - REPORT_INNER_ERROR("E19999", "Check file path failed, file path's length:%zu > mmpa_max_path:%d", - file_path.size(), MMPA_MAX_PATH); + REPORT_INNER_ERROR("E19999", "Check file path failed, file path's length:%zu > " + "mmpa_max_path:%d", file_path.size(), MMPA_MAX_PATH); return FAILED; } @@ -266,8 +275,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::CheckPath(con FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(const string &file_path, const ge::ModelData &model, const ModelFileHeader *model_file_header) { if (file_path.empty() || model.model_data == nullptr || model.model_len == 0) { - GELOGE(FAILED, "[Save][File]Incorrect input param, file_path is empty or model_data is nullptr or model_len is 0"); - REPORT_INNER_ERROR("E19999", "Save file failed, at least one of the input parameters(file_path, model_data, model_len) is incorrect"); + GELOGE(FAILED, "[Save][File]Incorrect input param, " + "file_path is empty or model_data is nullptr or model_len is 0"); + REPORT_INNER_ERROR("E19999", "Save file failed, at least one of the " + "input parameters(file_path, model_data, model_len) is incorrect"); return FAILED; } @@ -360,7 +371,8 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi // Close file if (mmClose(fd) != 0) { // mmClose 0: success GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); - REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); + REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", + ret, strerror(errno)); ret = FAILED; } return ret; @@ -369,8 +381,10 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(const string &file_path, const void *data, int len) { if (data == nullptr || len <= 0) { - GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the length[%d] is less than 1.", len); - REPORT_INNER_ERROR("E19999", "Save file failed, the model_data is null or its length:%d is less than 1.", len); + GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the " + "length[%d] is less than 1.", len); + REPORT_INNER_ERROR("E19999", "Save file failed, the model_data is null or " + "its length:%d is less than 1.", len); return FAILED; } @@ -386,7 +400,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(co // Close file if (mmClose(fd) != 0) { // mmClose 0: success GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); - REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); + REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", + ret, strerror(errno)); ret = FAILED; } return ret; diff --git a/ge/common/debug/memory_dumper.cc b/ge/common/debug/memory_dumper.cc index 668cf2ae..78ef2daa 100644 --- a/ge/common/debug/memory_dumper.cc +++ b/ge/common/debug/memory_dumper.cc @@ -59,15 +59,17 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::DumpToFile int32_t mmpa_ret = mmWrite(fd, data, len); // mmWrite return -1:Failed to write data to file;return -2:Invalid parameter if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { - GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Write data failed, errno = %d, error:%s.", mmpa_ret, strerror(errno)); + GELOGE(FAILED, "[Write][Data]Failed, errno:%d, errmsg:%s", mmpa_ret, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Write data failed, errno:%d, errmsg:%s.", + mmpa_ret, strerror(errno)); ret = FAILED; } // Close the file if (mmClose(fd) != EN_OK) { // mmClose return 0: success - GELOGE(FAILED, "[Close][File]Failed, error_code:%u, filename:%s.", ret, filename); - REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u, filename:%s.", ret, filename); + GELOGE(FAILED, "[Close][File]Failed, error_code:%u, filename:%s errmsg:%s.", ret, filename, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u, filename:%s errmsg:%s.", + ret, filename, strerror(errno)); ret = FAILED; } @@ -109,8 +111,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Dump(void int32_t mmpa_ret = mmWrite(fd_, data, len); // mmWrite return -1:failed to write data to file;return -2:invalid parameter if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { - GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Write data to file failed, errno = %d, error:%s.", mmpa_ret, strerror(errno)); + GELOGE(FAILED, "[Write][Data]Failed, errno:%d, errmsg:%s", mmpa_ret, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Write data to file failed, errno:%d, errmsg:%s.", + mmpa_ret, strerror(errno)); return FAILED; } @@ -125,7 +128,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Dump(void void MemoryDumper::Close() noexcept { // Close file if (fd_ != kInvalidFd && mmClose(fd_) != EN_OK) { - GELOGW("Close file failed."); + GELOGW("Close file failed, errmsg:%s.", strerror(errno)); } fd_ = kInvalidFd; } @@ -148,7 +151,7 @@ int MemoryDumper::OpenFile(const char *filename) { GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(prefix_path.length() >= MMPA_MAX_PATH, return kInvalidFd, "Prefix path is too long!"); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(mmRealPath(prefix_path.c_str(), tmp_path, MMPA_MAX_PATH) != EN_OK, return kInvalidFd, - "Dir %s does not exit.", prefix_path.c_str()); + "Dir %s does not exit, errmsg:%s.", prefix_path.c_str(), strerror(errno)); real_path = std::string(tmp_path) + last_path;) GE_IF_BOOL_EXEC( path_split_pos == -1 || path_split_pos == 0, @@ -163,7 +166,7 @@ int MemoryDumper::OpenFile(const char *filename) { int32_t fd = mmOpen2(real_path.c_str(), M_RDWR | M_CREAT | M_APPEND, mode); if (fd == EN_ERROR || fd == EN_INVALID_PARAM) { - GELOGE(kInvalidFd, "[Open][File]Failed. errno = %d, error:%s, filename:%s.", + GELOGE(kInvalidFd, "[Open][File]Failed. errno:%d, errmsg:%s, filename:%s.", fd, strerror(errno), filename); return kInvalidFd; } diff --git a/ge/common/dump/dump_manager.cc b/ge/common/dump/dump_manager.cc index 61a60afd..51936260 100644 --- a/ge/common/dump/dump_manager.cc +++ b/ge/common/dump/dump_manager.cc @@ -56,7 +56,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf dump_properties.SetDumpOpSwitch(dump_op_switch); if (dump_op_switch == kDumpoff && dump_config.dump_list.empty()) { dump_properties_map_.emplace(kInferSessionId, dump_properties); - GELOGE(PARAM_INVALID, "Dump list is invalid,dump_op_switch is %s", dump_op_switch.c_str()); + GELOGE(PARAM_INVALID, "[Check][DumpList]Invalid, dump_op_switch is %s", + dump_op_switch.c_str()); + REPORT_INNER_ERROR("E19999", "Dump list check invalid, dump_op_switch is %s", + dump_op_switch.c_str()); return PARAM_INVALID; } @@ -82,7 +85,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf dump_path = dump_config.dump_path; if (dump_path.empty()) { - GELOGE(PARAM_INVALID, "Dump path is empty"); + GELOGE(PARAM_INVALID, "[Check][DumpPath]It is empty"); + REPORT_INNER_ERROR("E19999", "Dump path check is empty"); return PARAM_INVALID; } diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index 1ce37b02..e9414b2f 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -26,7 +26,7 @@ #include "graph/op_desc.h" #include "graph/utils/tensor_utils.h" #include "proto/ge_ir.pb.h" -#include "proto/op_mapping_info.pb.h" +#include "proto/op_mapping.pb.h" #include "runtime/mem.h" #include "aicpu/common/aicpu_task_struct.h" @@ -64,7 +64,7 @@ void DumpOp::SetDynamicModelInfo(const string &dynamic_model_name, const string } static void SetOpMappingLoopAddr(uintptr_t step_id, uintptr_t loop_per_iter, uintptr_t loop_cond, - aicpu::dump::OpMappingInfo &op_mapping_info) { + toolkit::aicpu::dump::OpMappingInfo &op_mapping_info) { if (step_id != 0) { GELOGI("step_id exists."); op_mapping_info.set_step_id_addr(static_cast(step_id)); @@ -87,11 +87,11 @@ static void SetOpMappingLoopAddr(uintptr_t step_id, uintptr_t loop_per_iter, uin } } -Status DumpOp::DumpOutput(aicpu::dump::Task &task) { +Status DumpOp::DumpOutput(toolkit::aicpu::dump::Task &task) { GELOGI("Start dump output in Launch dump op"); const auto &output_descs = op_desc_->GetAllOutputsDesc(); for (size_t i = 0; i < output_descs.size(); ++i) { - aicpu::dump::Output output; + toolkit::aicpu::dump::Output output; output.set_data_type(static_cast(DataTypeUtil::GetIrDataType(output_descs.at(i).GetDataType()))); output.set_format(static_cast(output_descs.at(i).GetFormat())); for (auto dim : output_descs.at(i).GetShape().GetDims()) { @@ -102,7 +102,10 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) { } int64_t output_size = 0; if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Get output size filed"); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output %zu, node %s(%s),", + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); + REPORT_CALL_ERROR("E19999", "Get output %zu tensor size of node %s(%s) failed", + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get output size in lanch dump op is %ld", output_size); @@ -113,11 +116,11 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) { return SUCCESS; } -Status DumpOp::DumpInput(aicpu::dump::Task &task) { +Status DumpOp::DumpInput(toolkit::aicpu::dump::Task &task) { GELOGI("Start dump input in Launch dump op"); const auto &input_descs = op_desc_->GetAllInputsDesc(); for (size_t i = 0; i < input_descs.size(); ++i) { - aicpu::dump::Input input; + toolkit::aicpu::dump::Input input; input.set_data_type(static_cast(DataTypeUtil::GetIrDataType(input_descs.at(i).GetDataType()))); input.set_format(static_cast(input_descs.at(i).GetFormat())); @@ -129,7 +132,10 @@ Status DumpOp::DumpInput(aicpu::dump::Task &task) { } int64_t input_size = 0; if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Get output size filed"); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, input %zu, node %s(%s)", + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); + REPORT_CALL_ERROR("E19999", "Get input %zu tensor size of node %s(%s) failed", + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get input size in lanch dump op is %ld", input_size); @@ -149,35 +155,41 @@ void DumpOp::SetDumpInfo(const DumpProperties &dump_properties, const OpDescPtr stream_ = stream; } -Status DumpOp::ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info) { +Status DumpOp::ExecutorDumpOp(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info) { std::string proto_msg; size_t proto_size = op_mapping_info.ByteSizeLong(); bool ret = op_mapping_info.SerializeToString(&proto_msg); if (!ret || proto_size == 0) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Protobuf serialize failed, proto_size is %zu", proto_size); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Serialize][Protobuf]Failed, proto_size is %zu", + proto_size); + REPORT_CALL_ERROR("E19999", "[Serialize][Protobuf]Failed, proto_size is %zu", proto_size); return ACL_ERROR_GE_INTERNAL_ERROR; } rtError_t rt_ret = rtMalloc(&proto_dev_mem_, proto_size, RT_MEMORY_HBM); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtMalloc failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMalloc]Failed, ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret: 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } rt_ret = rtMemcpy(proto_dev_mem_, proto_size, proto_msg.c_str(), proto_size, RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtMemcpy failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMemcpy]Failed, ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret: 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } rt_ret = rtMalloc(&proto_size_dev_mem_, sizeof(size_t), RT_MEMORY_HBM); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtMalloc failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMalloc]Failed, ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret: 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } rt_ret = rtMemcpy(proto_size_dev_mem_, sizeof(size_t), &proto_size, sizeof(size_t), RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtMemcpy failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMemcpy]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } @@ -196,14 +208,15 @@ Status DumpOp::ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info) { nullptr, // no need smDesc stream_); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtCpuKernelLaunch failed,rt_ret:0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtCpuKernelLaunch]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtCpuKernelLaunch failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } GELOGI("Kernel launch dump op success"); return SUCCESS; } -Status DumpOp::SetDumpModelName(aicpu::dump::OpMappingInfo &op_mapping_info) { +Status DumpOp::SetDumpModelName(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info) { if (dynamic_model_name_.empty() && dynamic_om_name_.empty()) { GELOGI("Single op dump, no need set model name"); return SUCCESS; @@ -234,15 +247,16 @@ Status DumpOp::LaunchDumpOp() { int32_t device_id = 0; rtError_t rt_ret = rtGetDevice(&device_id); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtGetDevice failed, ret = 0x%X, device_id = %d.", rt_ret, device_id); + GELOGE(rt_ret, "[Call][rtGetDevice]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "[Call][rtGetDevice]Failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } if (device_id < 0) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Check device_id failed, device_id = %d, which should be not less than 0.", - device_id); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][DeviceId]Failed, device_id %d", device_id); + REPORT_INNER_ERROR("E19999","Check device_id %d failed", device_id); return ACL_ERROR_GE_INTERNAL_ERROR; } - aicpu::dump::OpMappingInfo op_mapping_info; + toolkit::aicpu::dump::OpMappingInfo op_mapping_info; auto dump_path = dump_properties_.GetDumpPath() + std::to_string(device_id) + "/"; op_mapping_info.set_dump_path(dump_path); op_mapping_info.set_flag(kAicpuLoadFlag); @@ -261,7 +275,7 @@ Status DumpOp::LaunchDumpOp() { if (rt_ret != RT_ERROR_NONE) { GELOGW("call rtGetTaskIdAndStreamID failed, ret = 0x%X", rt_ret); } - aicpu::dump::Task task; + toolkit::aicpu::dump::Task task; task.set_task_id(task_id); task.set_stream_id(stream_id); task.mutable_op()->set_op_name(op_desc_->GetName()); @@ -269,7 +283,10 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpOutput) { auto ret = DumpOutput(task); if (ret != SUCCESS) { - GELOGE(ret, "Dump output failed"); + GELOGE(ret, "[Dump][Output]Failed, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Output failed, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); @@ -277,7 +294,10 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpInput) { auto ret = DumpInput(task); if (ret != SUCCESS) { - GELOGE(ret, "Dump input failed"); + GELOGE(ret, "[Dump][Input]Failed, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Input failed, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); @@ -285,19 +305,26 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpAll || dump_properties_.IsOpDebugOpen()) { auto ret = DumpOutput(task); if (ret != SUCCESS) { - GELOGE(ret, "Dump output failed when in dumping all"); + GELOGE(ret, "[Dump][Output]Failed when in dumping all, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Output failed when in dumping all, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } ret = DumpInput(task); if (ret != SUCCESS) { - GELOGE(ret, "Dump input failed when in dumping all"); + GELOGE(ret, "[Dump][Input]Failed when in dumping all, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Input failed when in dumping all, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); } auto ret = ExecutorDumpOp(op_mapping_info); if (ret != SUCCESS) { - GELOGE(ret, "Executor dump op failed"); + GELOGE(ret, "[Dump][Op]Failed, ret 0x%X", ret); + REPORT_CALL_ERROR("E19999", "Executor dump op failed, ret 0x%X", ret); return ret; } return SUCCESS; diff --git a/ge/common/dump/dump_op.h b/ge/common/dump/dump_op.h index 4d322bee..b664495a 100755 --- a/ge/common/dump/dump_op.h +++ b/ge/common/dump/dump_op.h @@ -21,7 +21,7 @@ #include "common/ge_inner_error_codes.h" #include "common/properties_manager.h" -#include "proto/op_mapping_info.pb.h" +#include "proto/op_mapping.pb.h" #include "runtime/stream.h" namespace ge { @@ -37,10 +37,10 @@ class DumpOp { void SetDynamicModelInfo(const string &dynamic_model_name, const string &dynamic_om_name, uint32_t dynamic_model_id); private: - Status ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info); - Status DumpOutput(aicpu::dump::Task &task); - Status DumpInput(aicpu::dump::Task &task); - Status SetDumpModelName(aicpu::dump::OpMappingInfo &op_mapping_info); + Status ExecutorDumpOp(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info); + Status DumpOutput(toolkit::aicpu::dump::Task &task); + Status DumpInput(toolkit::aicpu::dump::Task &task); + Status SetDumpModelName(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info); DumpProperties dump_properties_; OpDescPtr op_desc_; diff --git a/ge/common/dump/exception_dumper.cc b/ge/common/dump/exception_dumper.cc index bed389a7..c8ec3d35 100644 --- a/ge/common/dump/exception_dumper.cc +++ b/ge/common/dump/exception_dumper.cc @@ -43,15 +43,15 @@ static void ReplaceStringElem(std::string &str) { }); } -static void SetDumpData(const ge::OpDescInfo &op_desc_info, toolkit::dumpdata::DumpData &dump_data) { +static void SetDumpData(const ge::OpDescInfo &op_desc_info, toolkit::dump::DumpData &dump_data) { dump_data.set_version("2.0"); dump_data.set_dump_time(GetNowTime()); dump_data.set_op_name(op_desc_info.op_name); for (size_t i = 0; i < op_desc_info.input_format.size(); ++i) { - toolkit::dumpdata::OpInput input; - input.set_data_type(toolkit::dumpdata::OutputDataType( + toolkit::dump::OpInput input; + input.set_data_type(toolkit::dump::OutputDataType( ge::DataTypeUtil::GetIrDataType(op_desc_info.input_data_type[i]))); - input.set_format(toolkit::dumpdata::OutputFormat(op_desc_info.input_format[i])); + input.set_format(toolkit::dump::OutputFormat(op_desc_info.input_format[i])); for (auto dim : op_desc_info.input_shape[i]) { input.mutable_shape()->add_dim(dim); } @@ -61,10 +61,10 @@ static void SetDumpData(const ge::OpDescInfo &op_desc_info, toolkit::dumpdata::D } for (size_t j = 0; j < op_desc_info.output_format.size(); ++j) { - toolkit::dumpdata::OpOutput output; - output.set_data_type(toolkit::dumpdata::OutputDataType( + toolkit::dump::OpOutput output; + output.set_data_type(toolkit::dump::OutputDataType( ge::DataTypeUtil::GetIrDataType(op_desc_info.output_data_type[j]))); - output.set_format(toolkit::dumpdata::OutputFormat(op_desc_info.output_format[j])); + output.set_format(toolkit::dump::OutputFormat(op_desc_info.output_format[j])); for (auto dim : op_desc_info.output_shape[j]) { output.mutable_shape()->add_dim(dim); } @@ -148,7 +148,7 @@ Status ExceptionDumper::DumpExceptionInfo(const std::vector &ex for (const rtExceptionInfo &iter : exception_infos) { OpDescInfo op_desc_info; if (GetOpDescInfo(iter.streamid, iter.taskid, op_desc_info)) { - toolkit::dumpdata::DumpData dump_data; + toolkit::dump::DumpData dump_data; SetDumpData(op_desc_info, dump_data); uint64_t now_time = GetNowTime(); std::string op_name = op_desc_info.op_name; diff --git a/ge/common/dump/opdebug_register.cc b/ge/common/dump/opdebug_register.cc index aae80cb0..816455a0 100644 --- a/ge/common/dump/opdebug_register.cc +++ b/ge/common/dump/opdebug_register.cc @@ -27,7 +27,9 @@ Status OpdebugRegister::RegisterDebugForModel(rtModel_t model_handle, uint32_t o GELOGD("Start to register debug for model in overflow"); auto ret = MallocMemForOpdebug(); if (ret != SUCCESS) { - GELOGE(ret, "Malloc memory for opdebug in model overflow failed ,ret:0x%X", ret); + GELOGE(ret, "[Malloc][MemForOpdebug]Failed when debug for model overflow, ret:0x%X", ret); + REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed when debug " + "for model in overflow, ret 0x%X", ret); return ret; } uint32_t debug_stream_id = 0; @@ -74,7 +76,9 @@ Status OpdebugRegister::RegisterDebugForStream(rtStream_t stream, uint32_t op_de GELOGD("Start to register debug for stream in stream overflow"); auto ret = MallocMemForOpdebug(); if (ret != SUCCESS) { - GELOGE(ret, "Malloc memory for opdebug in stream overflow ,ret:0x%X", ret); + GELOGE(ret, "[Malloc][MemForOpdebug]Failed when debug for stream in overflow, ret:0x%X", ret); + REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed when debug " + "for stream in overflow, ret:0x%X", ret); return ret; } @@ -82,7 +86,8 @@ Status OpdebugRegister::RegisterDebugForStream(rtStream_t stream, uint32_t op_de uint32_t debug_task_id = 0; auto rt_ret = rtDebugRegisterForStream(stream, op_debug_mode, op_debug_addr_, &debug_stream_id, &debug_task_id); if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtDebugRegisterForStream error, ret: 0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtDebugRegisterForStream]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtDebugRegisterForStream failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } GELOGD("debug_task_id:%u, debug_stream_id:%u in stream overflow.", debug_task_id, debug_stream_id); @@ -121,7 +126,8 @@ void OpdebugRegister::UnregisterDebugForStream(rtStream_t stream) { Status OpdebugRegister::MallocMemForOpdebug() { rtError_t rt_ret = rtMalloc(&op_debug_addr_, kOpDebugMemorySize, RT_MEMORY_DDR); if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtMalloc error, ret: 0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtMalloc]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } @@ -129,12 +135,14 @@ Status OpdebugRegister::MallocMemForOpdebug() { // For data dump, aicpu needs the pointer to pointer that save the real debug address. rt_ret = rtMalloc(&p2p_debug_addr_, kDebugP2pSize, RT_MEMORY_HBM); if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtMalloc error, ret: 0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtMalloc]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } rt_ret = rtMemcpy(p2p_debug_addr_, sizeof(uint64_t), &debug_addrs_tmp, sizeof(uint64_t), RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtMemcpy to p2p_addr error: 0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtMemcpy]To p2p_addr error 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy to p2p_addr error 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } diff --git a/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc b/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc index 3f2b72c5..1e7f4f19 100755 --- a/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc +++ b/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc @@ -187,7 +187,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in } } } - } + } } } } diff --git a/ge/common/ge/op_tiling_manager.cc b/ge/common/ge/op_tiling_manager.cc index db959368..4064cd72 100644 --- a/ge/common/ge/op_tiling_manager.cc +++ b/ge/common/ge/op_tiling_manager.cc @@ -33,7 +33,9 @@ void OpTilingManager::ClearHandles() noexcept { if (mmDlclose(handle.second) != 0) { const char *error = mmDlerror(); GE_IF_BOOL_EXEC(error == nullptr, error = ""); - GELOGE(FAILED, "Failed to close handle of %s: %s", handle.first.c_str(), error); + GELOGE(FAILED, "[Close][Handle]Failed, handle of %s: %s", handle.first.c_str(), error); + REPORT_CALL_ERROR("E19999", "Failed to close handle of %s: %s", + handle.first.c_str(), error); } } handles_.clear(); @@ -50,7 +52,8 @@ std::string OpTilingManager::GetPath() { if (mmRealPath(opp_path_env, resolved_path, MMPA_MAX_PATH) != EN_OK) { ErrorManager::GetInstance().ATCReportErrMessage( "E19024", {"env", "value", "situation"}, {"ASCEND_OPP_PATH", opp_path_env, "loading the tiling lib"}); - GELOGE(PARAM_INVALID, "Failed load tiling lib as env 'ASCEND_OPP_PATH'[%s] is invalid path.", opp_path_env); + GELOGE(PARAM_INVALID, "[Load][TilingLib]Failed, as env 'ASCEND_OPP_PATH'[%s] " + "is invalid path. errmsg:%s", opp_path_env, strerror(errno)); return std::string(); } opp_path = resolved_path; @@ -73,7 +76,7 @@ void OpTilingManager::LoadSo() { if (handle_bi == nullptr) { const char *error = mmDlerror(); GE_IF_BOOL_EXEC(error == nullptr, error = ""); - GELOGW("Failed to dlopen %s!", error); + GELOGW("Failed to dlopen %s! errmsg:%s", built_in_tiling_lib.c_str(), error); } else { handles_[built_in_name] = handle_bi; } @@ -82,7 +85,7 @@ void OpTilingManager::LoadSo() { if (handle_ct == nullptr) { const char *error = mmDlerror(); GE_IF_BOOL_EXEC(error == nullptr, error = ""); - GELOGW("Failed to dlopen %s!", error); + GELOGW("Failed to dlopen %s! errmsg:%s", custom_tiling_lib.c_str(), error); } else { handles_[custom_name] = handle_ct; } diff --git a/ge/common/ge/plugin_manager.cc b/ge/common/ge/plugin_manager.cc index 4e588f29..09a9b870 100644 --- a/ge/common/ge/plugin_manager.cc +++ b/ge/common/ge/plugin_manager.cc @@ -39,7 +39,7 @@ void PluginManager::ClearHandles_() noexcept { if (mmDlclose(handle.second) != 0) { const char *error = mmDlerror(); GE_IF_BOOL_EXEC(error == nullptr, error = ""); - GELOGW("Failed to close handle of %s: %s", handle.first.c_str(), error); + GELOGW("Failed to close handle of %s, errmsg:%s", handle.first.c_str(), error); } } handles_.clear(); @@ -50,7 +50,9 @@ PluginManager::~PluginManager() { ClearHandles_(); } string PluginManager::GetPath() { mmDlInfo dl_info; if (mmDladdr(reinterpret_cast(&PluginManager::GetPath), &dl_info) != EN_OK) { - GELOGW("Failed to read the shared library file path!"); + const char *error = mmDlerror(); + GE_IF_BOOL_EXEC(error == nullptr, error = ""); + GELOGW("Failed to read the shared library file path! errmsg:%s", error); return string(); } else { GE_IF_BOOL_EXEC(dl_info.dli_fname == nullptr, return string()); @@ -61,7 +63,7 @@ string PluginManager::GetPath() { return string(); } if (mmRealPath(so_path.c_str(), path, MMPA_MAX_PATH) != EN_OK) { - GELOGW("Failed to get realpath of %s", so_path.c_str()); + GELOGW("Failed to get realpath of %s, errmsg:%s", so_path.c_str(), strerror(errno)); return string(); } @@ -127,7 +129,7 @@ Status PluginManager::LoadSo(const string &path, const vector &func_chec ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, {"mmDlopen", "shared library path is " + FmtToStr(file_path_dlopen) + ". Errormessage" + FmtToStr(error)}); GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, - "Failed to dlopen the shared library path[%s]. Errormessage[%s]!", + "[DLOpen][SharedLibraryPath]Failed, path[%s]. Errormessage[%s]!", file_path_dlopen.c_str(), error); continue; } @@ -137,17 +139,24 @@ Status PluginManager::LoadSo(const string &path, const vector &func_chec for (const auto &func_name : func_check_list) { auto real_fn = (void (*)())mmDlsym(handle, const_cast(func_name.c_str())); if (real_fn == nullptr) { + const char *error = mmDlerror(); + GE_IF_BOOL_EXEC(error == nullptr, error = ""); ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, {"mmDlsym", FmtToStr(func_name) + " is skipped since function" + FmtToStr(func_name) + " is not existed!"}); - GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, "%s is skipped since function %s is not existed!", - func_name.c_str(), func_name.c_str()); + GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, + "[Check][So]%s is skipped since function %s is not existed! errmsg:%s", + func_name.c_str(), func_name.c_str(), error); is_valid = false; break; } } if (!is_valid) { - GE_LOGE_IF(mmDlclose(handle), "Failed to dlclose."); + if (mmDlclose(handle) != 0) { + const char *error = mmDlerror(); + GE_IF_BOOL_EXEC(error == nullptr, error = ""); + GELOGE(FAILED, "[DLClose][Handle]Failed. errmsg:%s", error); + } continue; } @@ -211,21 +220,21 @@ Status PluginManager::Load(const string &path, const vector &func_check_ GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(path.length() >= MMPA_MAX_PATH, GELOGW("File path is too long!"); return FAILED, "File path is too long!"); if (mmRealPath(path.c_str(), canonical_path, MMPA_MAX_PATH) != EN_OK) { - GELOGW("Failed to get realpath of %s", path.c_str()); + GELOGW("Failed to get realpath of %s, errmsg:%s", path.c_str(), strerror(errno)); return SUCCESS; } INT32 is_dir = mmIsDir(canonical_path); // Lib plugin path not exist if (is_dir != EN_OK) { - GELOGW("Invalid path for load: %s", path.c_str()); + GELOGW("Invalid path for load: %s, errmsg:%s", path.c_str(), strerror(errno)); return SUCCESS; } mmDirent **entries = nullptr; auto ret = mmScandir(canonical_path, &entries, nullptr, nullptr); if (ret < EN_OK) { - GELOGW("scan dir failed. path = %s, ret = %d", canonical_path, ret); + GELOGW("scan dir failed. path = %s, ret = %d, errmsg = %s", canonical_path, ret, strerror(errno)); return FAILED; } for (int i = 0; i < ret; ++i) { @@ -282,13 +291,20 @@ Status PluginManager::Load(const string &path, const vector &func_check_ for (const auto &func_name : func_check_list) { auto real_fn = (void (*)())mmDlsym(handle, const_cast(func_name.c_str())); if (real_fn == nullptr) { - GELOGW("The %s is skipped since function %s is not existed!", file_name.c_str(), func_name.c_str()); + const char *error = mmDlerror(); + GE_IF_BOOL_EXEC(error == nullptr, error = ""); + GELOGW("The %s is skipped since function %s is not existed! errmsg:%s", + file_name.c_str(), func_name.c_str(), error); is_valid = false; break; } } if (!is_valid) { - GE_LOGE_IF(mmDlclose(handle), "Failed to dlclose."); + if (mmDlclose(handle) != 0) { + const char *error = mmDlerror(); + GE_IF_BOOL_EXEC(error == nullptr, error = ""); + GELOGE(FAILED, "[DLClose][Handle]Failed. errmsg:%s", error); + } continue; } diff --git a/ge/common/ge/plugin_manager.h b/ge/common/ge/plugin_manager.h index 7ef0f81a..8c351e62 100755 --- a/ge/common/ge/plugin_manager.h +++ b/ge/common/ge/plugin_manager.h @@ -59,7 +59,11 @@ class PluginManager { for (const auto &handle : handles_) { auto real_fn = (R(*)(Types...))mmDlsym(handle.second, const_cast(func_name.c_str())); if (real_fn == nullptr) { - GELOGW("Failed to get function %s in %s!", func_name.c_str(), handle.first.c_str()); + const char *error = mmDlerror(); + if (error == nullptr) { + error = ""; + } + GELOGW("Failed to get function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); return GE_PLGMGR_FUNC_NOT_EXIST; } else { funcs[handle.first] = real_fn; @@ -74,7 +78,11 @@ class PluginManager { // If the funcName is existed, signature of realFn can be casted to any type auto real_fn = (void (*)(Types...))mmDlsym(handle.second, const_cast(func_name.c_str())); if (real_fn == nullptr) { - GELOGW("Failed to invoke function %s in %s!", func_name.c_str(), handle.first.c_str()); + const char *error = mmDlerror(); + if (error == nullptr) { + error = ""; + } + GELOGW("Failed to invoke function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); return GE_PLGMGR_INVOKE_FAILED; } else { real_fn(args...); @@ -89,7 +97,11 @@ class PluginManager { // If the funcName is existed, signature of realFn can be casted to any type auto real_fn = (void (*)(T))mmDlsym(handle.second, const_cast(func_name.c_str())); if (real_fn == nullptr) { - GELOGW("Failed to invoke function %s in %s!", func_name.c_str(), handle.first.c_str()); + const char *error = mmDlerror(); + if (error == nullptr) { + error = ""; + } + GELOGW("Failed to invoke function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); return GE_PLGMGR_INVOKE_FAILED; } typename std::remove_reference::type arg_temp; @@ -114,7 +126,11 @@ class PluginManager { // If the funcName is existed, signature of realFn can be casted to any type auto real_fn = (T2(*)(T1))mmDlsym(handle.second, const_cast(func_name.c_str())); if (real_fn == nullptr) { - GELOGW("Failed to invoke function %s in %s!", func_name.c_str(), handle.first.c_str()); + const char *error = mmDlerror(); + if (error == nullptr) { + error = ""; + } + GELOGW("Failed to invoke function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); return GE_PLGMGR_INVOKE_FAILED; } else { T2 res = real_fn(arg); @@ -132,7 +148,11 @@ class PluginManager { // If the funcName is existed, signature of realFn can be casted to any type auto real_fn = (T(*)())mmDlsym(handle.second, const_cast(func_name.c_str())); if (real_fn == nullptr) { - GELOGW("Failed to invoke function %s in %s!", func_name.c_str(), handle.first.c_str()); + const char *error = mmDlerror(); + if (error == nullptr) { + error = ""; + } + GELOGW("Failed to invoke function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); return GE_PLGMGR_INVOKE_FAILED; } else { T res = real_fn(); diff --git a/ge/common/ge/tbe_plugin_manager.cc b/ge/common/ge/tbe_plugin_manager.cc index 0cc7d553..94ba8a9a 100755 --- a/ge/common/ge/tbe_plugin_manager.cc +++ b/ge/common/ge/tbe_plugin_manager.cc @@ -69,7 +69,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status TBEPluginManager::Finali string TBEPluginManager::GetPath() { mmDlInfo dl_info; if (mmDladdr(reinterpret_cast(&TBEPluginManager::GetPath), &dl_info) != EN_OK) { - GELOGW("Failed to read so path!"); + const char *error = mmDlerror(); + GE_IF_BOOL_EXEC(error == nullptr, error = ""); + GELOGW("Failed to read so path! errmsg:%s", error); return string(); } else { string so_path = dl_info.dli_fname; @@ -79,7 +81,7 @@ string TBEPluginManager::GetPath() { return string(); } if (mmRealPath(so_path.c_str(), path, MMPA_MAX_PATH) != EN_OK) { - GELOGW("Failed to get realpath of %s", so_path.c_str()); + GELOGW("Failed to get realpath of %s, errmsg:%s", so_path.c_str(), strerror(errno)); return string(); } @@ -113,14 +115,14 @@ void TBEPluginManager::FindParserSo(const string &path, vector &file_lis INT32 is_dir = mmIsDir(real_path.c_str()); // Lib plugin path not exist if (is_dir != EN_OK) { - GELOGW("%s is not a dir.", real_path.c_str()); + GELOGW("%s is not a dir. errmsg:%s", real_path.c_str(), strerror(errno)); return; } mmDirent **entries = nullptr; auto ret = mmScandir(real_path.c_str(), &entries, nullptr, nullptr); if (ret < EN_OK) { - GELOGW("scan dir failed. path = %s, ret = %d", real_path.c_str(), ret); + GELOGW("scan dir failed. path = %s, ret = %d, errmsg = %s", real_path.c_str(), ret, strerror(errno)); return; } for (int i = 0; i < ret; ++i) { diff --git a/ge/common/helper/model_cache_helper.cc b/ge/common/helper/model_cache_helper.cc index 41ad6d59..78ca697f 100755 --- a/ge/common/helper/model_cache_helper.cc +++ b/ge/common/helper/model_cache_helper.cc @@ -441,11 +441,11 @@ Status ModelCacheHelper::SaveJsonToFile(const string &file_name, const Json &jso const int FILE_AUTHORITY = 0600; int fd = mmOpen2(path.c_str(), M_WRONLY | M_CREAT | O_TRUNC, FILE_AUTHORITY); if (fd < 0) { - GELOGW("Fail to open the file: %s.", path.c_str()); + GELOGW("Fail to open the file:%s. errmsg:%s", path.c_str(), strerror(errno)); return INTERNAL_ERROR; } if (mmClose(fd) != 0) { - GELOGW("Fail to close the file: %s.", path.c_str()); + GELOGW("Fail to close the file:%s. errmsg:%s", path.c_str(), strerror(errno)); return INTERNAL_ERROR; } diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index e95c3429..ac3343ed 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -37,7 +37,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelHelper::~ModelHelper() { ( Status ModelHelper::SaveModelPartition(std::shared_ptr &om_file_save_helper, ModelPartitionType type, const uint8_t *data, size_t size, size_t model_index) { if (size < 1 || size > UINT32_MAX) { - GELOGE(PARAM_INVALID, "Add model partition failed, partition size %zu invalid", size); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, partition size %zu invalid", size); + REPORT_INNER_ERROR("E19999", "Add model partition failed, partition size %zu " + "invalid", size); if (size > UINT32_MAX) { string item = "item"; if (type == MODEL_DEF) { @@ -57,7 +59,8 @@ Status ModelHelper::SaveModelPartition(std::shared_ptr &om_fil return PARAM_INVALID; } if (data == nullptr) { - GELOGE(PARAM_INVALID, "Add model partition failed, data is null"); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, data is null"); + REPORT_INNER_ERROR("E19999", "Add model partition failed, data is null"); return PARAM_INVALID; } ModelPartition partition_model; @@ -65,7 +68,8 @@ Status ModelHelper::SaveModelPartition(std::shared_ptr &om_fil partition_model.size = static_cast(size); partition_model.type = type; if (om_file_save_helper->AddPartition(partition_model, model_index) != SUCCESS) { - GELOGE(PARAM_INVALID, "Add model partition failed, partition size %zu", size); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, partition size %zu", size); + REPORT_CALL_ERROR("E19999", "Add model partition failed, partition size %zu", size); return PARAM_INVALID; } return SUCCESS; @@ -106,7 +110,8 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save const GeModelPtr &ge_model, ge::Buffer &model_buffer, size_t model_index) { ModelPtr model_tmp = ge::MakeShared(ge_model->GetName(), ge_model->GetPlatformVersion()); if (model_tmp == nullptr) { - GELOGE(FAILED, "Create Model %s Ptr failed", ge_model->GetName().c_str()); + GELOGE(FAILED, "[Creat][Model]Failed, Model %s Ptr", ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Create Model %s Ptr failed", ge_model->GetName().c_str()); return FAILED; } model_tmp->SetGraph(ge_model->GetGraph()); @@ -114,7 +119,10 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save model_tmp->SetAttr(ge_model->MutableAttrMap()); Status ret = SaveSizeToModelDef(ge_model); if (ret != SUCCESS) { - GELOGE(ret, "SaveSizeToModelDef failed"); + GELOGE(ret, "[Save][SizeToModelDef]Failed, model %s, error_code %u", + ge_model->GetName().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Save SizeToModelDef failed, model %s, error_code %u", + ge_model->GetName().c_str(), ret); return ret; } @@ -123,7 +131,10 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save if (model_buffer.GetSize() > 0) { if (SaveModelPartition(om_file_save_helper, ModelPartitionType::MODEL_DEF, model_buffer.GetData(), model_buffer.GetSize(), model_index) != SUCCESS) { - GELOGE(PARAM_INVALID, "Add model graph partition failed"); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, model %s, model_def size %zu, model_index %zu", + ge_model->GetName().c_str(), model_buffer.GetSize(), model_index); + REPORT_CALL_ERROR("E19999", "Add model graph partititon failed, model %s, model_def %zu, " + "model_index %zu", ge_model->GetName().c_str(), model_buffer.GetSize(), model_index); return PARAM_INVALID; } } @@ -178,17 +189,26 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ const GeModelPtr &ge_model, ge::Buffer &task_buffer, size_t model_index) { std::shared_ptr model_task_def = ge_model->GetModelTaskDefPtr(); if (model_task_def == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Create model task def ptr failed"); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Creat][ModelTaskDef]Failed, it is nullptr, " + "model %s", ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Creat model task def failed, it is nullptr, model %s", + ge_model->GetName().c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; } size_t partition_task_size = model_task_def->ByteSizeLong(); GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX, - GELOGE(FAILED, "Model_def's byte size (%zu) is invalid!", partition_task_size); + GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu, model %s", + partition_task_size, ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid, model %s", + partition_task_size, ge_model->GetName().c_str()); return FAILED); task_buffer = ge::Buffer(partition_task_size); if (task_buffer.GetSize() == 0) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Alloc model task def buffer failed"); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][ModelTaskDefBuffer]Failed, " + "model def size %zu, model %s", partition_task_size, ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Allocate model task def buffer failed, model def size %zu " + "model %s", partition_task_size, ge_model->GetName().c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; } (void)model_task_def->SerializePartialToArray(task_buffer.GetData(), static_cast(partition_task_size)); @@ -198,7 +218,12 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ if (SaveModelPartition(om_file_save_helper, ModelPartitionType::TASK_INFO, task_buffer.GetData(), partition_task_size, model_index) != SUCCESS) { - GELOGE(PARAM_INVALID, "Add model task def partition failed"); + GELOGE(PARAM_INVALID, "[Add][ModelTaskDefPartition]Failed, model def size %zu, " + "model_index %zu, model %s", + partition_task_size, model_index, ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Add model task def partition failed, model def size %zu " + "model_index %zu, model %s", + partition_task_size, model_index, ge_model->GetName().c_str()); return PARAM_INVALID; } return SUCCESS; @@ -218,7 +243,11 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s platform_version.size() + 1); if (err != EOK) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, - "ModelHelper SaveModel failed while allocating memory for platform_version."); + "[Save][Model]Failed while allocating memory for platform_version %s, model %s, " + "errno %d", platform_version.c_str(), ge_model->GetName().c_str(), err); + REPORT_CALL_ERROR("E19999", "ModelHelper save model %s failed while " + "allocating memory for platform_version %s, errno %d", + ge_model->GetName().c_str(), platform_version.c_str(), err); return ACL_ERROR_GE_MEMORY_ALLOCATION; } string version = reinterpret_cast(model_header.platform_version); @@ -228,7 +257,11 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s name_size = name_size > (MODEL_NAME_LENGTH - 1) ? (MODEL_NAME_LENGTH - 1) : name_size; err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, ge_model->GetName().c_str(), name_size); if (err != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "ModelHelper SaveModel failed while allocating memory for name"); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, + "[Save][Model]Failed while allocating memory for model %s, errno %d", + ge_model->GetName().c_str(), err); + REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while allocating memory " + "for model %s,errno %d", ge_model->GetName().c_str(), err); return ACL_ERROR_GE_MEMORY_ALLOCATION; } string model_name = reinterpret_cast(model_header.name); @@ -240,28 +273,43 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_f const GeModelPtr &ge_model, ge::Buffer &model_buffer, ge::Buffer &task_buffer, size_t model_index) { if (SaveModelDef(om_file_save_helper, ge_model, model_buffer, model_index) != SUCCESS) { - GELOGE(FAILED, "save model def failed"); + GELOGE(FAILED, "[Save][ModelDef]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save model def failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelWeights(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "save model weights failed"); + GELOGE(FAILED, "[Save][ModelWeights]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999","ModelHelper save mode weights failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelTbeKernel(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "save model tbe kernel failed"); + GELOGE(FAILED, "[Save][ModelTbeKernel]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save model tbe kernel failed, model %s, " + "model index %zu", ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelCustAICPU(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "save model cust ai cpu failed"); + GELOGE(FAILED, "[Save][ModelCustAICPU]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save model cust aicpu failed, model %s " + "model index %zu", ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelTaskDef(om_file_save_helper, ge_model, task_buffer, model_index) != SUCCESS) { - GELOGE(FAILED, "save task def failed"); + GELOGE(FAILED, "[Save][TaskDef]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save task def failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); return FAILED; } return SUCCESS; @@ -272,7 +320,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod const std::string &output_file, ModelBufferData& model) { if (output_file.empty()) { - GELOGE(FAILED, "GraphBuilder SaveModel received invalid file name prefix"); + GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix, " + "model %s", ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix, " + "model %s", ge_model->GetName().c_str()); return FAILED; } @@ -284,19 +335,28 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffer, task_buffer); if (ret != SUCCESS) { - GELOGE(ret, "save all model partition failed"); + GELOGE(ret, "[Save][AllModelPartition]Failed, model %s, error_code %u", + ge_model->GetName().c_str(), ret); + REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save all model partition failed, model %s " + "error_code %u", ge_model->GetName().c_str(), ret); return ret; } ret = SaveModelHeader(om_file_save_helper, ge_model); if (ret != SUCCESS) { - GELOGE(ret, "save model header failed"); + GELOGE(ret, "[Save][ModelHeader]Failed, model %s, error_code %u", + ge_model->GetName().c_str(), ret); + REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model header failed, model %s " + "error_code %u", ge_model->GetName().c_str(), ret); return ret; } ret = om_file_save_helper->SaveModel(save_param, output_file.c_str(), model, is_offline_); if (ret != SUCCESS) { - GELOGE(FAILED, "OmFileSaveHelper SaveModel return fail."); + GELOGE(FAILED, "[Save][Model]Failed, model %s, output file %s", + ge_model->GetName().c_str(), output_file.c_str()); + REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model failed, model %s, " + "output file %s", ge_model->GetName().c_str(), output_file.c_str()); return ret; } return SUCCESS; @@ -310,12 +370,21 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo bool is_unknown_shape) { GE_CHECK_NOTNULL(ge_root_model); - GE_IF_BOOL_EXEC(ge_root_model == nullptr, GELOGE(FAILED, "Ge_root_model is nullptr"); return FAILED); + GE_IF_BOOL_EXEC(ge_root_model == nullptr, + GELOGE(FAILED, "[Check][GERootModel]Ge_root_model is nullptr"); + REPORT_INNER_ERROR("E19999", "Ge_root_model check failed, it is nullptr"); + return FAILED); auto &name_to_ge_model = ge_root_model->GetSubgraphInstanceNameToModel(); - GE_IF_BOOL_EXEC(name_to_ge_model.empty(), GELOGE(FAILED, "Ge_root_model has no sub model"); return FAILED); + GE_IF_BOOL_EXEC(name_to_ge_model.empty(), + GELOGE(FAILED, "[Get][SubModel]Ge_root_model has no sub model"); + REPORT_INNER_ERROR("E19999", "Ge_root_model has no sub model"); + return FAILED); GE_IF_BOOL_EXEC(output_file.empty(), - GELOGE(FAILED, "GraphBuilder SaveModel received invalid file name prefix"); + GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid " + "file name prefix"); + REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid " + "file name prefix"); return FAILED); if (!is_unknown_shape) { @@ -344,7 +413,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo if (model_names.size() > 1) { GELOGD("only save first model MODEL_DEF"); if (SaveModelDef(om_file_save_helper, first_ge_model, model_buffers[cur_index], cur_index) != SUCCESS) { - GELOGE(FAILED, "save model def failed"); + GELOGE(FAILED, "[Save][ModelDef]Failed, cur_index %zu", cur_index); + REPORT_INNER_ERROR("E19999", "Save model def failed, cur_index %zu", cur_index); return FAILED; } ++cur_index; @@ -357,20 +427,28 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffers[cur_index], task_buffers[cur_index], cur_index); if (ret != SUCCESS) { - GELOGE(INTERNAL_ERROR, "Save model %s failed", model_name.c_str()); + GELOGE(INTERNAL_ERROR, "[Save][AllModelPartition]Failed, model name %s, cur_index %zu", + model_name.c_str(), cur_index); + REPORT_CALL_ERROR("E19999", "Save all model %s partition failed, cur_index %zu", + model_name.c_str(), cur_index); return INTERNAL_ERROR; } } auto ret = SaveModelHeader(om_file_save_helper, first_ge_model, model_names.size()); if (ret != SUCCESS) { - GELOGE(INTERNAL_ERROR, "Save model %s header failed", first_ge_model->GetName().c_str()); + GELOGE(INTERNAL_ERROR, "[Save][ModelHeader]Failed, model name %s", + first_ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Save model %s header failed", first_ge_model->GetName().c_str()); return INTERNAL_ERROR; } ret = om_file_save_helper->SaveRootModel(save_param, output_file.c_str(), model, is_offline_); if (ret != SUCCESS) { - GELOGE(FAILED, "OmFileSaveHelper SaveModel return fail."); + GELOGE(FAILED, "[Save][Model]OmFileSaveHelper save model eturn fail, output_file %s", + output_file.c_str()); + REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model return fail, output_file %s", + output_file.c_str()); return FAILED; } return SUCCESS; @@ -379,13 +457,17 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::string &output_file) { if (output_file.empty()) { - GELOGE(FAILED, "SaveModel received invalid file name prefix"); + GELOGE(FAILED, "[Save][Model]Received invalid file name prefix, output_file %s", + output_file.c_str()); + REPORT_INNER_ERROR("E19999", "Save model received invalid file name prefix, output_file %s", + output_file.c_str()); return FAILED; } // Get computegraph from graph auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); if (compute_graph == nullptr) { - GELOGE(FAILED, "SaveModel fail for compute_graph null"); + GELOGE(FAILED, "[Save][Model]Failed for compute_graph null"); + REPORT_INNER_ERROR("E19999", "Save model failed for compute_graph null"); return FAILED; } GE_DUMP(compute_graph, "OriginalGraph"); @@ -407,7 +489,10 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin ge::Buffer model_buffer; ge::graphStatus status = model_ptr->Save(model_buffer); if (status != ge::GRAPH_SUCCESS) { - GELOGE(FAILED, "SaveModel fail for save buffer fail"); + GELOGE(FAILED, "[Save][Model]Failed for save buffer fail, model %s", + model_ptr->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Save model %s failed for save buffer fail", + model_ptr->GetName().c_str()); return FAILED; } std::shared_ptr om_file_save_helper = ge::MakeShared(); @@ -429,14 +514,20 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin errno_t err = memcpy_s(model_header.platform_version, PLATFORM_VERSION_LEN, platform_version.c_str(), platform_version.size() + 1); if (err != EOK) { - GELOGE(FAILED, "ModelHelper SaveModel failed for platform_version"); + GELOGE(FAILED, "[Save][Model]Failed for platform_version %s, model %s, errno %d", + platform_version.c_str(), model_ptr->GetName().c_str(), err); + REPORT_CALL_ERROR("E19999", "Save model %s failed for platform_version %s, errno %d", + model_ptr->GetName().c_str(), platform_version.c_str(), err); return FAILED; } size_t name_size = model_ptr->GetName().size(); name_size = name_size > (MODEL_NAME_LENGTH - 1) ? (MODEL_NAME_LENGTH - 1) : name_size; err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, model_ptr->GetName().c_str(), name_size); if (err != EOK) { - GELOGE(FAILED, "ModelHelper SaveModel memory copy failed"); + GELOGE(FAILED, "[Save][Model]Failed for memory copy %s failed, errno %d", + model_ptr->GetName().c_str(), err); + REPORT_CALL_ERROR("E19999", "Save model failed for memory copy %s failed, errno %d", + model_ptr->GetName().c_str(), err); return FAILED; } ModelBufferData model; @@ -446,23 +537,26 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(const ge::ModelData &model_data) { if (model_data.model_data == nullptr || model_data.model_len == 0) { - GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Model_data is nullptr, or model_data_size is 0"); + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, + "[Load][Model]Model_data is nullptr or model_data_size is 0"); + REPORT_INNER_ERROR("E19999", "Load model failed, " + "Model_data is nullptr or model_data_size is 0"); return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; } if (is_assign_model_) { - GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "Model helper has already loaded!"); + GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "[Load][Model]Model helper has already loaded!"); return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; } if (ReleaseLocalModelData() != SUCCESS) { - GELOGE(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "ReleaseLocalModelData failed."); + GELOGE(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "[Release][ModelData]Failed."); return ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA; } Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][ModelContent]Failed!"); return ACL_ERROR_GE_PARAM_INVALID; } @@ -470,14 +564,14 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c OmFileLoadHelper om_load_helper; status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { - GELOGE(status, "Om_load_helper init failed"); + GELOGE(status, "[Init][OmLoadHelper]Failed"); model_addr_tmp_ = nullptr; return status; } auto partition_table = reinterpret_cast(model_addr_tmp_); if (partition_table->num == kOriginalOmPartitionNum) { model_addr_tmp_ = nullptr; - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "om model is error,please use executable om model"); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][OmModel]Error, please use executable om model"); return ACL_ERROR_GE_PARAM_INVALID; } // Encrypt model need to del temp model/no encrypt model don't need to del model @@ -485,7 +579,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c status = GenerateGeModel(om_load_helper); if (status != SUCCESS) { - GELOGE(status, "GenerateGeModel failed"); + GELOGE(status, "[Generate][GEModel]Failed"); return status; } GELOGD("in ModelHelper::LoadModel, is_assign_model_ is setted to true!"); @@ -495,23 +589,26 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootModel(const ge::ModelData &model_data) { if (model_data.model_data == nullptr || model_data.model_len == 0) { - GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Model_data is nullptr, or model_data_size is 0"); + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "[Load][RootModel] " + "Model_data is nullptr or model_data_size is 0"); + REPORT_INNER_ERROR("E19999", "Load root model failed, model_data is nullptr or its size is 0"); return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; } if (is_assign_model_) { - GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "Model helper has already loaded!"); + GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, + "[Load][RootModel]Model helper has already loaded!"); return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; } if (ReleaseLocalModelData() != SUCCESS) { - GELOGE(INTERNAL_ERROR, "ReleaseLocalModelData failed."); + GELOGE(INTERNAL_ERROR, "[Release][ModelData]Failed."); return INTERNAL_ERROR; } Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][RootModelContent]Failed!"); return ACL_ERROR_GE_PARAM_INVALID; } @@ -530,7 +627,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); } if (status != SUCCESS) { - GELOGE(status, "Om_load_helper init failed"); + GELOGE(status, "[Init][OmLoadHelper]Failed"); model_addr_tmp_ = nullptr; return status; } @@ -539,7 +636,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod status = GenerateGeRootModel(om_load_helper); if (status != SUCCESS) { - GELOGE(status, "GenerateGeRootModel failed"); + GELOGE(status, "[Generate][GERootModel]Failed"); return status; } GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!"); @@ -579,7 +676,8 @@ Status ModelHelper::GenerateGeRootModel(OmFileLoadHelper &om_load_helper) { GE_CHECK_NOTNULL(root_model_); if (!is_unknown_shape_model_) { if (GenerateGeModel(om_load_helper) != SUCCESS) { - GELOGE(FAILED, "GenerateGeModel failed"); + GELOGE(FAILED, "[Generate][GERootModel]Failed"); + REPORT_CALL_ERROR("E19999", "Generate GE root model failed"); return FAILED; } GE_CHECK_NOTNULL(model_); @@ -637,7 +735,10 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper) { ge::Model model; if (ge::Model::Load(partition_model_def.data, partition_model_def.size, model) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "Load model failed."); + GELOGE(INTERNAL_ERROR, "[Load][Model]Failed, model_def partition addr:%p, size:%u", + partition_model_def.data, partition_model_def.size); + REPORT_CALL_ERROR("E19999", "Load model failed, model_def partition addr:%p, size:%u", + partition_model_def.data, partition_model_def.size); return INTERNAL_ERROR; } @@ -661,7 +762,10 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper, GeModelPtr & ge::Model model; if (ge::Model::Load(partition_model_def.data, partition_model_def.size, model) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "Load model failed."); + GELOGE(INTERNAL_ERROR, "[Load][Model]Failed, model_def partition addr:%p, size:%u", + partition_model_def.data, partition_model_def.size); + REPORT_CALL_ERROR("E19999", "Load model failed, model_def partition addr:%p, size:%u", + partition_model_def.data, partition_model_def.size); return INTERNAL_ERROR; } @@ -673,7 +777,9 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper, GeModelPtr & Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { ModelPartition partition; if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition) != SUCCESS) { - GELOGE(FAILED, "Get weight model partition failed."); + GELOGE(FAILED, "[Get][ModelWeightPartition]Failed, GetWeight size:%u", partition.size); + REPORT_CALL_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", + partition.size); return FAILED; } ge::Buffer weight = ge::Buffer::CopyFrom(partition.data, partition.size); @@ -686,7 +792,9 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index) { ModelPartition partition; if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition, mode_index) != SUCCESS) { - GELOGE(FAILED, "Get weight model partition failed."); + GELOGE(FAILED, "[Get][ModelPartition]Failed, GetWeight size:%u", partition.size); + REPORT_CALL_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", + partition.size); return FAILED; } ge::Buffer weight = ge::Buffer::CopyFrom(partition.data, partition.size); @@ -699,14 +807,19 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cu FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(OmFileLoadHelper &om_load_helper) { ModelPartition task_partition; if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) { - GELOGE(FAILED, "Get task model partition failed."); + GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size:%u", task_partition.size); + REPORT_CALL_ERROR("E19999", "Get model task partition failed, task_partition size %u", + task_partition.size); return FAILED; } std::shared_ptr task = ge::MakeShared(); GE_CHECK_NOTNULL(task); if (task_partition.size != 0) { if (!ReadProtoFromArray(task_partition.data, task_partition.size, task.get())) { - GELOGE(INTERNAL_ERROR, "ReadProtoFromArray failed."); + GELOGE(INTERNAL_ERROR, "[Read][ProtoFromArray]Failed, task_partition size %u", + task_partition.size); + REPORT_CALL_ERROR("E19999", "Read proto from array failed, task_partition size %u", + task_partition.size); return INTERNAL_ERROR; } GELOGD("TASK_INFO op_size:%d, stream_num:%u", task->op().size(), task->stream_num()); @@ -721,13 +834,20 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(Om ModelPartition task_partition; if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition, mode_index) != SUCCESS) { GELOGE(FAILED, "Get task model partition failed."); + GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size %u, mode_index %zu", + task_partition.size, mode_index); + REPORT_CALL_ERROR("E19999", "Get model task partition failed, " + "task_partition size %u, mode_index %zu", task_partition.size, mode_index); return FAILED; } std::shared_ptr task = ge::MakeShared(); GE_CHECK_NOTNULL(task); if (task_partition.size != 0) { if (!ReadProtoFromArray(task_partition.data, task_partition.size, task.get())) { - GELOGE(INTERNAL_ERROR, "ReadProtoFromArray failed."); + GELOGE(INTERNAL_ERROR, "[Read][ProtoFromArray]Failed, task_partition size %u", + task_partition.size); + REPORT_CALL_ERROR("E19999", "Read proto from array failed, task_partition size %u", + task_partition.size); return INTERNAL_ERROR; } GELOGD("TASK_INFO op_size:%d, stream_num:%u", task->op().size(), task->stream_num()); @@ -835,7 +955,8 @@ Status ModelHelper::ReleaseLocalModelData() noexcept { if (model_addr_tmp_ != nullptr) { errno_t ret = memset_s(static_cast(model_addr_tmp_), model_len_tmp_, 0, model_len_tmp_); if (ret != EOK) { - GELOGE(FAILED, "Failed to memset memory, error-code %d", ret); + GELOGE(FAILED, "[Memset][Memory]Failed, error-code %d", ret); + REPORT_CALL_ERROR("E19999", "Failed to memset memory, error-code %d", ret); result = FAILED; } delete[] model_addr_tmp_; @@ -884,7 +1005,9 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef Status ret = ModelParserBase::LoadFromFile(model_file, "", priority, model); if (ret != SUCCESS) { - GELOGE(ret, "LoadFromFile failed."); + GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file, ret); + REPORT_CALL_ERROR("E19999", "Load model info failed from file %s, error_code %u", + model_file, ret); return ret; } std::function callback = [&]() { @@ -902,31 +1025,32 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ErrorManager::GetInstance().ATCReportErrMessage("E10003", {"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); GELOGE(ACL_ERROR_GE_PARAM_INVALID, - "ParseModelContent failed because of invalid om file. Please check --om param."); + "[Parse][ModelContent]Failed because of invalid om file %s, please check om param", + model_file); return ret; } OmFileLoadHelper om_load_helper; ret = om_load_helper.Init(model_data, model_len); if (ret != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Om file init failed"}); - GELOGE(ge::FAILED, "Om file init failed."); + REPORT_INNER_ERROR("E19999", "Init om file %s failed", model_file); + GELOGE(ge::FAILED, "[Init][OmFile]Failed, model_file %s", model_file); return ret; } ModelPartition ir_part; ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part); if (ret != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"}); - GELOGE(ge::FAILED, "Get model part failed."); + REPORT_INNER_ERROR("E19999", "Get model partition failed, model_file %s", model_file); + GELOGE(ge::FAILED, "[Get][ModelPart]Failed, model_file %s", model_file); return ret; } bool flag = ReadProtoFromArray(ir_part.data, ir_part.size, &model_def); if (!flag) { ret = INTERNAL_ERROR; - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); - GELOGE(ret, "ReadProtoFromArray failed."); + REPORT_INNER_ERROR("E19999", "Read proto from array failed, model_file %s", model_file); + GELOGE(ret, "[Read][ProtoFromArray]Failed, model_file %s", model_file); return ret; } modeldef_size = ir_part.size; @@ -947,7 +1071,9 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model }; if (ret != SUCCESS) { free_model_data(&model.model_data); - GELOGE(ret, "LoadFromFile failed."); + GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file, ret); + REPORT_CALL_ERROR("E19999", "Load model info failed from file %s, error_code %u", + model_file, ret); return ret; } @@ -955,17 +1081,18 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model bool flag = google::protobuf::TextFormat::ParseFromString(reinterpret_cast(model.model_data), &model_def); if (!flag) { free_model_data(&model.model_data); - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"}); - GELOGE(FAILED, "ParseFromString failed."); + REPORT_INNER_ERROR("E19999", "Parse model info failed from string, model_file %s", model_file); + GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, model_file %s", model_file); return FAILED; } free_model_data(&model.model_data); return SUCCESS; } catch (google::protobuf::FatalException &e) { free_model_data(&model.model_data); - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" - + std::string(e.what()) + "]"}); - GELOGE(FAILED, "ParseFromString failed. exception message : %s", e.what()); + REPORT_INNER_ERROR("E19999", "Parse model info failed from string, exception message %s, model_file %s", + e.what(), model_file); + GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, exception message %s, model_file %s", + e.what(), model_file); return FAILED; } } diff --git a/ge/common/model_saver.cc b/ge/common/model_saver.cc index b8442948..49382e7f 100755 --- a/ge/common/model_saver.cc +++ b/ge/common/model_saver.cc @@ -59,7 +59,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi int32_t fd = mmOpen2(real_path, M_RDWR | M_CREAT | O_TRUNC, mode); if (fd == EN_ERROR || fd == EN_INVALID_PARAM) { ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {file_path, strerror(errno)}); - GELOGE(FAILED, "Open file[%s] failed. %s", file_path, strerror(errno)); + GELOGE(FAILED, "Open file[%s] failed. errmsg:%s", file_path, strerror(errno)); return FAILED; } const char *model_char = model_str.c_str(); @@ -70,12 +70,12 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi ErrorManager::GetInstance().ATCReportErrMessage( "E19004", {"file", "errmsg"}, {file_path, strerror(errno)}); // Need to both print the error info of mmWrite and mmClose, so return ret after mmClose - GELOGE(FAILED, "Write to file failed. errno = %ld, %s", mmpa_ret, strerror(errno)); + GELOGE(FAILED, "Write to file failed. errno:%ld, errmsg:%s", mmpa_ret, strerror(errno)); ret = FAILED; } // Close file if (mmClose(fd) != EN_OK) { - GELOGE(FAILED, "Close file failed."); + GELOGE(FAILED, "Close file failed. errmsg:%s", strerror(errno)); ret = FAILED; } return ret; diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index fbbf1f04..443f5213 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -355,6 +355,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportDa reporter_data.deviceId = device_id; ret = memcpy_s(reporter_data.tag, MSPROF_ENGINE_MAX_TAG_LEN + 1, tag_name.c_str(), tag_name.size()); GE_IF_BOOL_EXEC(ret != EOK, GELOGE(ret, "Report data tag [%s] memcpy error!", tag_name.c_str()); return;); + std::lock_guard lock(mutex_report_); for (size_t i = 0; i < index; ++i) { reporter_data.data = (unsigned char *)data.c_str() + report_max_len * i; reporter_data.dataLen = report_max_len; @@ -375,7 +376,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportDa reporter_data.dataLen = data.size(); ret = memcpy_s(reporter_data.tag, MSPROF_ENGINE_MAX_TAG_LEN + 1, tag_name.c_str(), tag_name.size()); GE_IF_BOOL_EXEC(ret != EOK, GELOGE(ret, "Report data tag [%s] memcpy error!", tag_name.c_str()); return;); - + std::lock_guard lock(mutex_report_); cb_ret = CallMsprofReport(reporter_data); GE_IF_BOOL_EXEC(cb_ret != 0, GELOGE(cb_ret, "Reporter data [%s] failed, ret:%d", tag_name.c_str(), cb_ret); return;); diff --git a/ge/common/profiling/profiling_manager.h b/ge/common/profiling/profiling_manager.h index ab344204..af9fce06 100755 --- a/ge/common/profiling/profiling_manager.h +++ b/ge/common/profiling/profiling_manager.h @@ -118,6 +118,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager { map subs_dev_module_; // key: device_id, value: profiling on module uint32_t subscribe_count_; std::mutex mutex_; + std::mutex mutex_report_; MsprofCallback prof_cb_; std::string fp_point_; std::string bp_point_; diff --git a/ge/common/proto/ge_ir.proto b/ge/common/proto/ge_ir.proto index 12989a54..c0ef3071 100644 --- a/ge/common/proto/ge_ir.proto +++ b/ge/common/proto/ge_ir.proto @@ -31,6 +31,8 @@ enum DataType DT_STRING_REF = 24; // string_ref type DT_DUAL = 25; /**< dual output type */ DT_VARIANT = 26; // variant type + DT_BF16 = 27; // bf16 type + DT_INT4 = 28; // int4 type } message AttrDef diff --git a/ge/common/proto/op_mapping_info.proto b/ge/common/proto/op_mapping.proto similarity index 97% rename from ge/common/proto/op_mapping_info.proto rename to ge/common/proto/op_mapping.proto index 7fb6f84b..d626eb49 100644 --- a/ge/common/proto/op_mapping_info.proto +++ b/ge/common/proto/op_mapping.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package aicpu.dump; +package toolkit.aicpu.dump; message Shape { repeated uint64 dim = 1; diff --git a/ge/common/util.cc b/ge/common/util.cc index 0a343a83..63d75de1 100644 --- a/ge/common/util.cc +++ b/ge/common/util.cc @@ -122,7 +122,7 @@ long GetFileLength(const std::string &input_file) { GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( mmGetFileSize(input_file.c_str(), &file_length) != EN_OK, ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {input_file, strerror(errno)}); - return kFileSizeOutLimitedOrOpenFailed, "Open file[%s] failed. %s", input_file.c_str(), strerror(errno)); + return kFileSizeOutLimitedOrOpenFailed, "Open file[%s] failed. errmsg:%s", input_file.c_str(), strerror(errno)); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_length == 0), ErrorManager::GetInstance().ATCReportErrMessage("E19015", {"filepath"}, {input_file}); @@ -226,7 +226,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int CreateDirectory(const std:: if (ret != 0) { if (errno != EEXIST) { ErrorManager::GetInstance().ATCReportErrMessage("E19006", {"path"}, {directory_path}); - GELOGW("Can not create directory %s. Make sure the directory exists and writable.", directory_path.c_str()); + GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", + directory_path.c_str(), strerror(errno)); return ret; } } @@ -237,7 +238,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int CreateDirectory(const std:: if (ret != 0) { if (errno != EEXIST) { ErrorManager::GetInstance().ATCReportErrMessage("E19006", {"path"}, {directory_path}); - GELOGW("Can not create directory %s. Make sure the directory exists and writable.", directory_path.c_str()); + GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", + directory_path.c_str(), strerror(errno)); return ret; } } @@ -310,7 +312,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromMem(const cha FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t GetCurrentTimestamp() { mmTimeval tv{}; int ret = mmGetTimeOfDay(&tv, nullptr); - GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed: ret=%d", ret); + GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed, ret:%d, errmsg:%s", ret, strerror(errno)); auto total_use_time = tv.tv_usec + tv.tv_sec * 1000000; // 1000000: seconds to microseconds return static_cast(total_use_time); } @@ -318,7 +320,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t GetCurrentTimestamp() FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint32_t GetCurrentSecondTimestap() { mmTimeval tv{}; int ret = mmGetTimeOfDay(&tv, nullptr); - GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed: ret=%d", ret); + GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed, ret:%d, errmsg:%s", ret, strerror(errno)); auto total_use_time = tv.tv_sec; // seconds return static_cast(total_use_time); } @@ -568,7 +570,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status CheckPath(const char *pa INT32 is_dir = mmIsDir(path); if (is_dir != EN_OK) { - GELOGE(PATH_INVALID, "Open directory %s failed, maybe it is not exit or not a dir", path); + GELOGE(PATH_INVALID, "Open directory %s failed, maybe it is not exit or not a dir. errmsg:%s", + path, strerror(errno)); return PATH_INVALID; } diff --git a/ge/engine_manager/dnnengine_manager.cc b/ge/engine_manager/dnnengine_manager.cc index 7ff5ed42..2bd9b3e5 100644 --- a/ge/engine_manager/dnnengine_manager.cc +++ b/ge/engine_manager/dnnengine_manager.cc @@ -435,7 +435,7 @@ Status DNNEngineManager::ReadJsonFile(const std::string &file_path, JsonHandle h const char *file = file_path.data(); if ((mmAccess2(file, M_F_OK)) != EN_OK) { if (engines_map_.size() != 0) { - GELOGE(FAILED, "The json file %s is not exist, %s", file_path.c_str(), strerror(errno)); + GELOGE(FAILED, "The json file %s is not exist, errmsg:%s", file_path.c_str(), strerror(errno)); return FAILED; } else { GELOGW("The json file %s is not needed.", file_path.c_str()); diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 2fca1aa6..1782d497 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -3,7 +3,7 @@ set(PROTO_LIST "${METADEF_DIR}/proto/ge_ir.proto" "${METADEF_DIR}/proto/insert_op.proto" "${METADEF_DIR}/proto/task.proto" - "${METADEF_DIR}/proto/op_mapping_info.proto" + "${METADEF_DIR}/proto/op_mapping.proto" "${METADEF_DIR}/proto/dump_task.proto" ) @@ -23,7 +23,6 @@ set(SRC_LIST "../common/profiling/ge_profiling.cc" "../graph/load/graph_loader.cc" "../graph/execute/graph_execute.cc" - "../omm/csa_interact.cc" "../graph/manager/graph_manager_utils.cc" "../graph/manager/graph_var_manager.cc" "../graph/manager/graph_mem_allocator.cc" @@ -250,12 +249,11 @@ target_include_directories(ge_executor_shared PRIVATE target_link_options(ge_executor_shared PRIVATE -Wl,-Bsymbolic + -Wl,--exclude-libs,ALL ) target_link_libraries(ge_executor_shared PRIVATE $ - msprofiler - static_mmpa -Wl,--no-as-needed ge_common runtime diff --git a/ge/executor/module.mk b/ge/executor/module.mk index 4966eeb5..7a7e2b51 100644 --- a/ge/executor/module.mk +++ b/ge/executor/module.mk @@ -11,7 +11,6 @@ local_ge_executor_src_files := \ ../common/profiling/ge_profiling.cc \ ../graph/load/graph_loader.cc \ ../graph/execute/graph_execute.cc \ - ../omm/csa_interact.cc \ ../graph/manager/graph_manager_utils.cc \ ../graph/manager/graph_var_manager.cc \ ../graph/manager/rdma_pool_allocator.cc \ diff --git a/ge/executor/proto/dump_task.proto b/ge/executor/proto/dump_task.proto index ee1c6f47..a2411ddb 100644 --- a/ge/executor/proto/dump_task.proto +++ b/ge/executor/proto/dump_task.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package toolkit.dumpdata; +package toolkit.dump; enum OutputDataType { DT_UNDEFINED = 0; diff --git a/ge/executor/proto/ge_ir.proto b/ge/executor/proto/ge_ir.proto index 12989a54..c0ef3071 100644 --- a/ge/executor/proto/ge_ir.proto +++ b/ge/executor/proto/ge_ir.proto @@ -31,6 +31,8 @@ enum DataType DT_STRING_REF = 24; // string_ref type DT_DUAL = 25; /**< dual output type */ DT_VARIANT = 26; // variant type + DT_BF16 = 27; // bf16 type + DT_INT4 = 28; // int4 type } message AttrDef diff --git a/ge/executor/proto/op_mapping_info.proto b/ge/executor/proto/op_mapping.proto similarity index 97% rename from ge/executor/proto/op_mapping_info.proto rename to ge/executor/proto/op_mapping.proto index 7fb6f84b..d626eb49 100644 --- a/ge/executor/proto/op_mapping_info.proto +++ b/ge/executor/proto/op_mapping.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package aicpu.dump; +package toolkit.aicpu.dump; message Shape { repeated uint64 dim = 1; diff --git a/ge/ge_inference.mk b/ge/ge_inference.mk index 32fc206d..ae1288f5 100755 --- a/ge/ge_inference.mk +++ b/ge/ge_inference.mk @@ -4,7 +4,6 @@ COMMON_LOCAL_SRC_FILES := \ proto/fusion_model.proto \ proto/optimizer_priority.proto \ graph/manager/trans_var_data_utils.cc \ - omm/csa_interact.cc \ common/fp16_t.cc \ common/formats/utils/formats_trans_utils.cc \ common/formats/format_transfers/datatype_transfer.cc \ @@ -73,7 +72,7 @@ BUILER_SRC_FILES := \ ir_build/attr_options/utils.cc \ ir_build/attr_options/keep_dtype_option.cc \ ir_build/attr_options/weight_compress_option.cc \ - ir_build/atc_ir_common.cc \ + ir_build/option_utils.cc \ ANALYZER_SRC_FILES:= \ analyzer/analyzer.cc \ diff --git a/ge/ge_local_engine/engine/host_cpu_engine.cc b/ge/ge_local_engine/engine/host_cpu_engine.cc index 4aebffb4..8bc159dc 100755 --- a/ge/ge_local_engine/engine/host_cpu_engine.cc +++ b/ge/ge_local_engine/engine/host_cpu_engine.cc @@ -82,7 +82,9 @@ Status GetDataNumber(const GeTensorDesc &out_desc, uint64_t &data_num) { void HostCpuEngine::CloseSo() { for (auto handle : lib_handles_) { if (mmDlclose(handle) != 0) { - GELOGW("failed to close handle, message: %s", mmDlerror()); + const char *error = mmDlerror(); + error = (error == nullptr) ? "" : error; + GELOGW("failed to close handle, message: %s", error); } } lib_handles_.clear(); @@ -284,7 +286,7 @@ Status HostCpuEngine::ListSoFiles(const std::string &base_dir, std::vector &options, OmgContext &o return MEMALLOC_FAILED; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsProtoInit); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsProtoInit); string opsproto_path; GetOpsProtoPath(opsproto_path); GELOGI("Get opsproto path is %s", opsproto_path.c_str()); @@ -426,7 +426,7 @@ Status GeGenerator::Initialize(const map &options, OmgContext &o } Status GeGenerator::Finalize() { - ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); + ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); GE_CHECK_NOTNULL_EXEC(impl_, return PARAM_INVALID); Status ret = impl_->graph_manager_.Finalize(); if (ret != SUCCESS) { @@ -438,14 +438,14 @@ Status GeGenerator::Finalize() { Status GeGenerator::GenerateOfflineModel(const Graph &graph, const string &file_name_prefix, const vector &inputs) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGI("Start to generate offline model."); ModelBufferData model; return GenerateModel(graph, file_name_prefix, inputs, model, true); } Status GeGenerator::GenerateOnlineModel(const Graph &graph, const vector &inputs, ModelBufferData &model) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); return GenerateModel(graph, "online", inputs, model, false); } @@ -783,9 +783,7 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector &in GELOGD("Inputs size is %zu, outputs size is %zu.", inputs.size(), outputs.size()); GE_CHECK_NOTNULL_EXEC(impl_, return PARAM_INVALID); impl_->is_offline_ = is_offline; - if (!is_offline) { - (void)AttrUtils::SetBool(op_desc, ATTR_SINGLE_OP_SCENE, true); - } + (void)AttrUtils::SetBool(op_desc, ATTR_SINGLE_OP_SCENE, true); if (CheckForSingleOp(op_desc, inputs, outputs) != SUCCESS) { GELOGE(PARAM_INVALID, "input param is invalid when build single op!"); @@ -824,7 +822,7 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector &in auto node = comp_graph->FindNode(op_desc->GetName()); Status ret = CheckEngineTypeSupport(node, engine_type); if (ret != SUCCESS) { - GELOGE(ret, "[Check][EngineType]value:%d for node:%s not support", engine_type, node->GetName().c_str()); + GELOGE(ret, "[Check][EngineType]not support node:%s with engine of %d.", node->GetName().c_str(), engine_type); return ret; } } @@ -850,6 +848,11 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector &in bool all_shape = false; (void)AttrUtils::GetBool(op_desc, kAicpuAllshape, all_shape); + GELOGD("Node: %s, all_shape is %d, compile_flag is %d.", op_desc->GetName().c_str(), all_shape, compile_flag); + (void)AttrUtils::SetInt(ge_model, ATTR_NAME_BUILD_MODE, fuzz_compile_flag); + if (all_shape) { + (void)AttrUtils::SetBool(ge_model, kAicpuAllshape, all_shape); + } if (all_shape && CheckNoAicore(root_graph)) { GELOGD("Get aicpu all_shape kernel!"); vector inputs_dynamic; @@ -859,8 +862,6 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector &in GE_CHK_STATUS_RET_NOLOG( impl_->SaveParams(ge_model, op_desc_tmp->GetType(), op_attrs, inputs_dynamic, outputs_dynamic)); } else if (fuzz_compile_flag) { - GELOGD("Get fuzz build result of %s.", op_desc->GetName().c_str()); - (void)AttrUtils::SetInt(ge_model, ATTR_NAME_BUILD_MODE, fuzz_compile_flag); GeAttrValue::LIST_NAMED_ATTRS fuzz_build_attrs; if (GetFuzzBuildAttrs(op_desc, ge_root_model, fuzz_build_attrs) != SUCCESS) { GELOGE(FAILED, "[Get][FuzzRet]Failed to get fuzz build result of %s.", op_desc->GetName().c_str()); @@ -892,7 +893,7 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector &in Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector &inputs, const vector &outputs, const string &model_file_name, int32_t compile_flag) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGI("Start to build single op offline model, input size: %zu, output size: %zu", inputs.size(), outputs.size()); ModelBufferData model_buff; OpEngineType engine_type = ENGINE_SYS; @@ -916,7 +917,7 @@ Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector &inputs, const vector &outputs, OpEngineType engine_type, ModelBufferData &model_buff) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGI("Start to build single op online, input size: %zu, output size: %zu", inputs.size(), outputs.size()); Status status = BuildSingleOp(op_desc, inputs, outputs, kFileNameSuffix, engine_type, model_buff, false); GELOGI("Finish build single online model, status: %u", status); @@ -926,7 +927,7 @@ Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector &inputs, const vector &outputs, OpEngineType engine_type, int32_t compile_flag, ModelBufferData &model_buff) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGI("Start to build single op online, input size: %zu, output size: %zu", inputs.size(), outputs.size()); Status status = BuildSingleOp(op_desc, inputs, outputs, kFileNameSuffix, engine_type, model_buff, false, compile_flag); @@ -1072,7 +1073,7 @@ Status GeGenerator::Impl::BuildModel(const Graph &graph, const vector ret = graph_manager_.BuildGraph(graph_id, inputs, ge_root_model, session_id); } - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); if (ret != SUCCESS) { GELOGE(GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED, "GraphManager build graph fail, graph id: %u", graph_id); ret = GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED; diff --git a/ge/graph/build/graph_builder.cc b/ge/graph/build/graph_builder.cc index 591c8d02..bcd80b0c 100644 --- a/ge/graph/build/graph_builder.cc +++ b/ge/graph/build/graph_builder.cc @@ -233,7 +233,7 @@ Status GraphBuilder::BuildForKnownShapeGraph(ComputeGraphPtr &comp_graph, return SUCCESS; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kPreBuild); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kPreBuild); GELOGI("Begin to build known shape graph[%s].", comp_graph->GetName().c_str()); Status ret = SecondPartition(comp_graph); GE_CHK_STATUS_RET(ret, "Graph[%s] second partition Failed.", comp_graph->GetName().c_str()); @@ -264,7 +264,7 @@ Status GraphBuilder::BuildForKnownShapeGraph(ComputeGraphPtr &comp_graph, GE_TIMESTAMP_END(BuildModelForGetTask, "GraphBuilder::BuildModelForGetTask"); GE_DUMP(comp_graph, "AfterBuildModel"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kTaskGenerate); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kTaskGenerate); GE_TIMESTAMP_START(GetTaskInfo); ret = GetTaskInfo(builder, model_ptr, comp_graph, subgraph_map, session_id); GE_TIMESTAMP_END(GetTaskInfo, "GraphBuilder::GetTaskInfo"); @@ -274,7 +274,7 @@ Status GraphBuilder::BuildForKnownShapeGraph(ComputeGraphPtr &comp_graph, return ret; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); ge_model_ptr = MakeShared(); if (ge_model_ptr == nullptr) { return MEMALLOC_FAILED; @@ -336,7 +336,7 @@ Status GraphBuilder::SetConstantInputOffset(ComputeGraphPtr &comp_graph) { Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeModelPtr &ge_model_ptr, uint64_t session_id) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kPreBuild); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kPreBuild); GELOGI("Begin to build unknown shape graph[%s].", comp_graph->GetName().c_str()); Graph2SubGraphInfoList subgraph_map; ge::ModelBuilder builder(session_id, comp_graph, subgraph_map, stream_max_parallel_num_, hcom_parallel_, build_mode_); @@ -369,11 +369,11 @@ Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeMo GE_CHK_STATUS_RET(builder.BuildModelForGetDynShapeTask(*model_ptr), "Graph[%s] builder BuildModelForGetDynShapeTask() return fail.", comp_graph->GetName().c_str()); GE_TIMESTAMP_END(BuildModelForGetDynShapeTask, "GraphBuilder::BuildModelForGetDynShapeTask"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kTaskGenerate); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kTaskGenerate); GE_TIMESTAMP_START(GetTaskInfo); Status ret = GetTaskInfo(builder, model_ptr, comp_graph, subgraph_map, session_id); GE_TIMESTAMP_END(GetTaskInfo, "GraphBuilder::GetTaskInfo"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GraphUtils::DumpGEGraph(comp_graph, "AfterGetTask"); GraphUtils::DumpGEGraphToOnnx(*comp_graph, "AfterGetTask"); diff --git a/ge/graph/build/memory/graph_mem_assigner.cc b/ge/graph/build/memory/graph_mem_assigner.cc index 540626bb..b9f80070 100755 --- a/ge/graph/build/memory/graph_mem_assigner.cc +++ b/ge/graph/build/memory/graph_mem_assigner.cc @@ -427,6 +427,86 @@ bool IsContinuousInputConflict(const ge::NodePtr &node, const OpDescPtr &peer_op return false; } +/// op1 -> node -> op2 +/// return true when node is ref from input, and op1 or op2 is reuse input from output +bool GraphMemoryAssigner::IsRefFromInputOpCascade(const NodePtr &node) { + bool ref_from_input = false; + int32_t reuse_in_index = -1; + for (const auto &out_anchor : node->GetAllOutDataAnchors()) { + ref_from_input = GraphUtils::IsRefFromInput(out_anchor, reuse_in_index); + if (ref_from_input) { + GELOGD("IsRefFromInputOpCascade: cur node:%s:%d is ref", node->GetName().c_str(), reuse_in_index); + break; + } + } + + for (const auto &in_anchor : node->GetAllInDataAnchors()) { + const auto &peer_out_anchor = in_anchor->GetPeerOutAnchor(); + GE_IF_BOOL_EXEC(peer_out_anchor == nullptr, continue); + if (ref_from_input && GraphUtils::IsRefFromInput(peer_out_anchor, reuse_in_index)) { + GELOGD("IsRefFromInputOpCascade: in node[%s] is ref, reuse index is:%d", + peer_out_anchor->GetOwnerNode()->GetName().c_str(), reuse_in_index); + return true; + } + } + + for (const auto &out_anchor : node->GetAllOutDataAnchors()) { + const auto &peer_in_anchors = out_anchor->GetPeerInDataAnchors(); + for (const auto &peer_in_anchor : peer_in_anchors) { + auto peer_in_node = peer_in_anchor->GetOwnerNode(); + GE_IF_BOOL_EXEC(peer_in_node == nullptr, continue); + for (const auto &peer_in_node_out_anchor : peer_in_node->GetAllOutDataAnchors()) { + if (ref_from_input && GraphUtils::IsRefFromInput(peer_in_node_out_anchor, reuse_in_index)) { + GELOGD("IsRefFromInputOpCascade: out node[%s] is ref, reuse index is:%d", + peer_in_node_out_anchor->GetOwnerNode()->GetName().c_str(), reuse_in_index); + return true; + } + } + } + } + return false; +} + +/// node:in0(in0 reuse out0) -> peer_node:out0 +/// update peer_node's 0th output offset with node's 0th output offset +Status GraphMemoryAssigner::UpdateRefOpOffsetReverse(const NodePtr &node) { + map out2ins; + GE_CHK_STATUS_RET(TryGetNodeRefIndexes(node, out2ins), "[Get][RefIndexes]fail for node:%s", + node->GetName().c_str()); + auto op_desc = node->GetOpDesc(); + GE_CHECK_NOTNULL(op_desc); + vector output_list = op_desc->GetOutputOffset(); + for (const auto &out2in : out2ins) { + auto reuse_in_anchor = node->GetInDataAnchor(out2in.second); + GE_CHECK_NOTNULL(reuse_in_anchor); + auto peer_out_anchor = reuse_in_anchor->GetPeerOutAnchor(); + GE_CHECK_NOTNULL(peer_out_anchor); + auto peer_node = peer_out_anchor->GetOwnerNode(); + GE_CHECK_NOTNULL(peer_node); + auto peer_op_desc = peer_node->GetOpDesc(); + GE_CHECK_NOTNULL(peer_op_desc); + vector peer_output_list = peer_op_desc->GetOutputOffset(); + if ((peer_out_anchor->GetIdx() >= static_cast(peer_output_list.size())) + || (out2in.first >= static_cast(output_list.size()))) { + GELOGW("out of range, peer_out_anchor:%d, peer_output_list size:%zu, out2in:%d, output_list size:%zu", + peer_out_anchor->GetIdx(), + peer_output_list.size(), + out2in.first, + output_list.size()); + continue; + } + peer_output_list.at(peer_out_anchor->GetIdx()) = output_list.at(out2in.first); + peer_op_desc->SetOutputOffset(peer_output_list); + GELOGD("UpdateRefOpOffsetReverse: Node[%s] output[%d] is set from node[%s] output index[%d] offset[%ld]", + peer_node->GetName().c_str(), + peer_out_anchor->GetIdx(), + node->GetName().c_str(), + out2in.first, + output_list.at(out2in.first)); + } + return SUCCESS; +} + Status GraphMemoryAssigner::ReAssignContinuousMemory(bool is_loop_graph) { Status ret; // Stored nodes which need assign continuous input memory in `reverse topo order` @@ -446,12 +526,16 @@ Status GraphMemoryAssigner::ReAssignContinuousMemory(bool is_loop_graph) { } // Assign continuous input memory bool continuous_input = ((continuous_type & kTypeInput) != 0) || ((continuous_type & kTypeInputNoPadding) != 0); - if (continuous_input) { + if (IsRefFromInputOpCascade(node)) { + nodes_stack.push_back(node); + GELOGD("Ref: Push node:%s to stack", node->GetName().c_str()); + } else if (continuous_input) { if (AssignContinuousInputMemoryWithAtomicProcessDirectly(node, node_2_continuous_type)) { GE_CHK_STATUS_RET(AssignContinuousInputMemoryWithAtomicProcess(node, continuous_type), "[Assign][Memory:Continuous:Input]fail for node:%s", node->GetName().c_str()) } else { nodes_stack.push_back(node); + GELOGD("Continuous: Push node:%s to stack", node->GetName().c_str()); } } // Assign continuous output memory @@ -478,8 +562,13 @@ Status GraphMemoryAssigner::ReAssignContinuousMemory(bool is_loop_graph) { GELOGE(FAILED, "[Get][ContinuousType] find fail for node:%s", node->GetName().c_str()); return FAILED; } - GE_CHK_STATUS_RET(AssignContinuousInputMemoryWithAtomicProcess(node, iter->second, true), - "[Assign][Memory:Continuous:Input]fail for node:%s.", node->GetName().c_str()) + if (((iter->second & kTypeInput) != 0) || ((iter->second & kTypeInputNoPadding) != 0)) { + GE_CHK_STATUS_RET(AssignContinuousInputMemoryWithAtomicProcess(node, iter->second, true), + "[Assign][Memory:Continuous:Input]fail for node:%s.", node->GetName().c_str()) + } else { + GE_CHK_STATUS_RET(UpdateRefOpOffsetReverse(node), + "[Update][Memory:Reference:Output]fail for node:%s", node->GetName().c_str()) + } } for (auto pair : memory_offset_) { GELOGD("[Reassign][Memory:Continuous]At last, memory type = %ld, mem offset = %zu", pair.first, @@ -1258,6 +1347,7 @@ Status GraphMemoryAssigner::CheckOffset() { } ge::Status GraphMemoryAssigner::CheckRefNodeOffset(const NodePtr &node) { + GE_CHECK_NOTNULL(node); std::map out2ins; GE_CHK_STATUS_RET(TryGetNodeRefIndexes(node, out2ins), "[Get][RefIndexes]fail for node: %s", node->GetName().c_str()); auto opdesc = node->GetOpDesc(); @@ -1382,6 +1472,7 @@ ge::Status GraphMemoryAssigner::UpdateOpInputOffset(const NodePtr &node, vector< output_list = last_peer_out_op_desc->GetOutputOffset(); auto out_index = static_cast(peer_out_anchor->GetIdx()); if (output_list.size() > static_cast(out_index)) { + bool is_l1_type = false; int64_t input_offset = output_list.at(out_index); if (has_mem_type_attr && !origin_input_list.empty()) { auto input_size = tmp_op_desc->GetInputsSize(); @@ -1398,14 +1489,12 @@ ge::Status GraphMemoryAssigner::UpdateOpInputOffset(const NodePtr &node, vector< GELOGD("Node[%s] input[%d] has origin offset[%ld]", tmp_op_desc->GetName().c_str(), anchor->GetIdx(), origin_input_list[valid_input_index]); // L1 keep original input_offset - if (memory_type[valid_input_index] == RT_MEMORY_L1) { + is_l1_type = (memory_type[valid_input_index] == RT_MEMORY_L1); + if (is_l1_type) { input_offset = origin_input_list[valid_input_index]; } else { // hbm input_offset = original input_offset + output_offset input_offset = origin_input_list[valid_input_index] + output_list.at(out_index); - // update ref output_offset when input change - GE_CHK_STATUS_RET(UpdateRefOpOutputOffset(node, out2ins, anchor->GetIdx(), input_offset), - "[Update][RefOffset]fail for node: %s", node->GetName().c_str()); } } const auto &in_node = GetKnownInputNode(peer_out_anchor->GetOwnerNode()); @@ -1414,6 +1503,11 @@ ge::Status GraphMemoryAssigner::UpdateOpInputOffset(const NodePtr &node, vector< GE_CHK_STATUS(TensorUtils::GetDataOffset(tensor_desc, input_offset)); } + if (!is_l1_type) { + // update ref output_offset when input change + GE_CHK_STATUS_RET(UpdateRefOpOutputOffset(node, out2ins, anchor->GetIdx(), input_offset), + "[Update][RefOffset]fail for node: %s", node->GetName().c_str()); + } GELOGD("Node[%s] input[%d] is set from node[%s] out index[%lu] offset[%ld]", tmp_op_desc->GetName().c_str(), anchor->GetIdx(), peer_out_anchor->GetOwnerNode()->GetOpDesc()->GetName().c_str(), out_index, input_offset); @@ -1693,8 +1787,18 @@ void GraphMemoryAssigner::PrintMemoryOffset() { } ge::Status GraphMemoryAssigner::TryGetNodeRefIndexes(const NodePtr &node, map &out2ins) const{ + // data and netoutput no need check because only data's output or netoutput's input is used + if (node->GetType() == DATA || node->GetType() == NETOUTPUT) { + return ge::SUCCESS; + } for (const auto &out_data_anchor : node->GetAllOutDataAnchors()) { int32_t reuse_in_index = -1; + // nopadding means output[0] reuse input[0], but as history reason, + // other output index also return true for mem assign in block_mem_assigner + if (GraphUtils::IsNoPaddingRefFromInput(out_data_anchor, reuse_in_index)) { + out2ins.emplace(out_data_anchor->GetIdx(), reuse_in_index); + return ge::SUCCESS; + } bool reuse_input_flag = GraphUtils::IsRefFromInput(out_data_anchor, reuse_in_index); if (reuse_input_flag) { if (node->GetInDataAnchor(reuse_in_index) != nullptr) { diff --git a/ge/graph/build/memory/graph_mem_assigner.h b/ge/graph/build/memory/graph_mem_assigner.h index 773df4e6..33a5b6d3 100755 --- a/ge/graph/build/memory/graph_mem_assigner.h +++ b/ge/graph/build/memory/graph_mem_assigner.h @@ -193,6 +193,10 @@ class GraphMemoryAssigner { Status AssignBufferPoolMemory(); + bool IsRefFromInputOpCascade(const NodePtr &node); + + Status UpdateRefOpOffsetReverse(const NodePtr &node); + MemoryOffsetMap memory_offset_; ge::ComputeGraphPtr compute_graph_; HybridMemAssignerPtr mem_assigner_; diff --git a/ge/graph/build/model_builder.cc b/ge/graph/build/model_builder.cc index 6f427683..56cd5b5a 100755 --- a/ge/graph/build/model_builder.cc +++ b/ge/graph/build/model_builder.cc @@ -243,7 +243,7 @@ Status ModelBuilder::SetInputOutputDesc() { } // if user set input node format ND, the expected node for data and netoutput format is ND in // final graph. - if ((GetLocalOmgContext().format == domi::DOMI_TENSOR_ND) && (!node_op_desc->HasAttr("_is_single_op")) && + if ((compute_graph_->GetParentGraph() == nullptr) && (GetLocalOmgContext().format == domi::DOMI_TENSOR_ND) && (!node_op_desc->HasAttr("_is_single_op")) && ((node_op_desc->GetType() == DATA_TYPE) || (node_op_desc->GetType() == NETOUTPUT))) { auto inputDescsPtr = node_op_desc->GetAllInputsDescPtr(); auto outputDescsPtr = node_op_desc->GetAllOutputsDescPtr(); @@ -794,7 +794,7 @@ Status ModelBuilder::PreBuildModel() { Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { GE_CHK_STATUS_RET(AdjustInputTensorFlag(), "AdjustInputTensorFlag failed!"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kStreamAlloc); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kStreamAlloc); // Assign logical streams. StreamAllocator stream_allocator(compute_graph_, subgraphs_); GE_TIMESTAMP_START(AssignLogicalStreams); @@ -802,7 +802,7 @@ Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { "Assign logical streams failed."); GE_TIMESTAMP_END(AssignLogicalStreams, "GraphBuilder::AssignLogicalStreams"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kMemoryAlloc); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kMemoryAlloc); // Assign functional op labels. auto root_graph = GraphUtils::FindRootGraph(compute_graph_); (void)AttrUtils::GetInt(*root_graph, ATTR_MODEL_LABEL_NUM, label_num_); @@ -813,7 +813,7 @@ Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { "Assign Memory Failed!"); GE_TIMESTAMP_END(AssignMemory, "GraphBuilder::AssignMemory"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GE_TIMESTAMP_START(SetInputOutputOffset); SetInputOutputOffsetPass input_output_offset; GE_CHK_STATUS_RET(input_output_offset.Run(compute_graph_), "Set input output offset failed."); @@ -824,14 +824,14 @@ Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { GE_CHK_STATUS_RET(CompileSingleOp(), "ATC builder CompileSingleOp() return fail."); GE_TIMESTAMP_EVENT_END(CompileSingleOp, "GraphBuilder::CompileSingleOp"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kStreamAlloc); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kStreamAlloc); // Refresh real streams and insert event nodes. GE_TIMESTAMP_START(RefreshRealStream); GE_CHK_STATUS_RET(stream_allocator.RefreshRealStream(stream_num_, event_num_), "RefreshRealStream failed."); huge_streams_ = stream_allocator.GetHugeStreams(); GE_TIMESTAMP_END(RefreshRealStream, "GraphBuilder::RefreshRealStream"); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GE_TIMESTAMP_START(MergeWeights); GE_CHK_STATUS_RET(MergeWeights(), "MergeWeights Failed!"); GE_TIMESTAMP_END(MergeWeights, "GraphBuilder::MergeWeights"); diff --git a/ge/graph/execute/graph_execute.cc b/ge/graph/execute/graph_execute.cc index 5142e347..1d22016e 100755 --- a/ge/graph/execute/graph_execute.cc +++ b/ge/graph/execute/graph_execute.cc @@ -21,7 +21,6 @@ #include "graph/load/model_manager/model_manager.h" #include "graph/load/model_manager/davinci_model.h" -#include "omm/csa_interact.h" namespace ge { using Uint32Pair = pair; @@ -490,12 +489,10 @@ Status GraphExecutor::AsyncExecuteModel(const GeRootModelPtr &ge_root_model, con } catch (std::bad_alloc &) { REPORT_INNER_ERROR("E19999", "Bad memory allocation exception occur failed"); GELOGE(MEMALLOC_FAILED, "RunAsync failed, bad memory allocation occur !"); - CsaInteract::GetInstance().WriteErrorCode(FAILED, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return MEMALLOC_FAILED; } catch (...) { REPORT_INNER_ERROR("E19999", "Some exceptions occur failed"); GELOGE(FAILED, "RunAsync failed, some exceptions occur !"); - CsaInteract::GetInstance().WriteErrorCode(FAILED, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return FAILED; } @@ -509,18 +506,15 @@ Status GraphExecutor::DataInput(const InputData &input_data, OutputData &output_ Status ret = model_manager->DataInput(input_data, output_data); if (ret != SUCCESS) { GELOGE(ret, "DataInput: DataInput failed."); - CsaInteract::GetInstance().WriteErrorCode(ret, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return ret; } } catch (std::bad_alloc &) { REPORT_INNER_ERROR("E19999", "Bad memory allocation exception occur failed"); GELOGE(MEMALLOC_FAILED, "DataInput failed, bad memory allocation occur !"); - CsaInteract::GetInstance().WriteErrorCode(FAILED, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return MEMALLOC_FAILED; } catch (...) { REPORT_INNER_ERROR("E19999", "Some exceptions occur failed"); GELOGE(FAILED, "DataInput failed, some exceptions occur !"); - CsaInteract::GetInstance().WriteErrorCode(FAILED, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return FAILED; } @@ -535,18 +529,15 @@ Status GraphExecutor::GetInputOutputDescInfo(const uint32_t model_id, vectorGetInputOutputDescInfo(model_id, input_desc, output_desc); if (ret != SUCCESS) { GELOGE(ret, "GetInputOutputDescInfo failed."); - CsaInteract::GetInstance().WriteErrorCode(ret, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return ret; } } catch (std::bad_alloc &) { REPORT_INNER_ERROR("E19999", "Bad memory allocation exception occur failed"); GELOGE(MEMALLOC_FAILED, "GetInputOutputDescInfo failed, bad memory allocation occur !"); - CsaInteract::GetInstance().WriteErrorCode(FAILED, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return MEMALLOC_FAILED; } catch (...) { REPORT_INNER_ERROR("E19999", "Some exceptions occur failed"); GELOGE(FAILED, "GetInputOutputDescInfo failed, some exceptions occur !"); - CsaInteract::GetInstance().WriteErrorCode(FAILED, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return FAILED; } @@ -564,18 +555,15 @@ Status GraphExecutor::GetInputOutputDescInfo(const uint32_t model_id, vectorUnload(model_id); if (ret != SUCCESS) { GELOGE(ret, "UnloadModel: Unload failed. model id:%u", model_id); - CsaInteract::GetInstance().WriteErrorCode(ret, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_UNLOAD); return ret; } GELOGI("UnLoad model success, model id:%u.", model_id); @@ -55,7 +53,6 @@ Status GraphLoader::LoadModelOnline(uint32_t &model_id, const std::shared_ptrLoadModelOnline(model_id, ge_root_model_ptr, listener); if (ret != SUCCESS) { GELOGE(ret, "LoadModel: Load failed. ret = %u", ret); - CsaInteract::GetInstance().WriteErrorCode(ret, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_LOAD); - rt_ret = rtDeviceReset(GetContext().DeviceId()); if (rt_ret != RT_ERROR_NONE) { REPORT_CALL_ERROR("E19999", "Call rtDeviceReset failed, device_id:%u, ret:0x%X", @@ -94,7 +89,6 @@ Status GraphLoader::LoadModelOnline(uint32_t &model_id, const std::shared_ptr(step_id)); @@ -234,7 +234,8 @@ static void SetOpMappingLoopAddr(uintptr_t step_id, uintptr_t loop_per_iter, uin } } -Status DataDumper::GenerateOutput(aicpu::dump::Output &output, const OpDesc::Vistor &tensor_descs, +Status DataDumper::GenerateOutput(toolkit::aicpu::dump::Output &output, + const OpDesc::Vistor &tensor_descs, const uintptr_t &addr, size_t index) { output.set_data_type(static_cast(GetIrDataType(tensor_descs.at(index).GetDataType()))); output.set_format(static_cast(tensor_descs.at(index).GetFormat())); @@ -265,7 +266,8 @@ Status DataDumper::GenerateOutput(aicpu::dump::Output &output, const OpDesc::Vis return SUCCESS; } -Status DataDumper::DumpRefOutput(const DataDumper::InnerDumpInfo &inner_dump_info, aicpu::dump::Output &output, +Status DataDumper::DumpRefOutput(const DataDumper::InnerDumpInfo &inner_dump_info, + toolkit::aicpu::dump::Output &output, size_t i, const std::string &node_name_index) { std::string dump_op_name; std::string input_or_output; @@ -306,17 +308,9 @@ Status DataDumper::DumpRefOutput(const DataDumper::InnerDumpInfo &inner_dump_inf return SUCCESS; } -Status DataDumper::DumpOutputWithTask(const InnerDumpInfo &inner_dump_info, aicpu::dump::Task &task) { +Status DataDumper::DumpOutputWithTask(const InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Task &task) { const auto &output_descs = inner_dump_info.op->GetAllOutputsDesc(); const std::vector output_addrs = ModelUtils::GetOutputDataAddrs(*runtime_param_, inner_dump_info.op); - if (output_descs.size() != output_addrs.size()) { - REPORT_INNER_ERROR("E19999", "output_desc size:%zu != output addr size:%zu in op:%s(%s)", - output_descs.size(), output_addrs.size(), - inner_dump_info.op->GetName().c_str(), inner_dump_info.op->GetType().c_str()); - GELOGE(PARAM_INVALID, "Invalid output desc addrs size %zu, op %s has %zu output desc.", output_addrs.size(), - inner_dump_info.op->GetName().c_str(), output_descs.size()); - return PARAM_INVALID; - } std::vector v_memory_type; bool has_mem_type_attr = ge::AttrUtils::GetListInt(inner_dump_info.op, ATTR_NAME_OUTPUT_MEM_TYPE_LIST, v_memory_type); GE_RT_PARAM_INVALID_WITH_LOG_IF_TRUE(has_mem_type_attr && (v_memory_type.size() != output_descs.size()), @@ -324,10 +318,33 @@ Status DataDumper::DumpOutputWithTask(const InnerDumpInfo &inner_dump_info, aicp inner_dump_info.op->GetName().c_str(), output_descs.size(), v_memory_type.size()); + size_t no_need_dump_output_num = 0; for (size_t i = 0; i < output_descs.size(); ++i) { - aicpu::dump::Output output; + toolkit::aicpu::dump::Output output; std::string node_name_index; const auto &output_desc = output_descs.at(i); + int32_t calc_type = 0; + bool has_calc_type = ge::AttrUtils::GetInt(output_desc, ATTR_NAME_MEMORY_SIZE_CALC_TYPE, calc_type); + if (has_calc_type && (calc_type == static_cast(ge::MemorySizeCalcType::ALWAYS_EMPTY))) { + GELOGD("Node[%s] output[index:%zu] [name:%s] is an optional output, don't need to dump this output.", + inner_dump_info.op->GetName().c_str(), i, output_desc.GetName().c_str()); + ++no_need_dump_output_num; + continue; + } + + if (output_descs.size() - no_need_dump_output_num < output_addrs.size()) { + REPORT_INNER_ERROR("E19999", "The number of output does not match in op:%s(%s). The size[%zu] of output which is " + "no need to dump should not greater than the size[%zu] of output descs minus the size[%zu] of " + "output which is need to dump.", inner_dump_info.op->GetName().c_str(), + inner_dump_info.op->GetType().c_str(), no_need_dump_output_num, output_descs.size(), + output_addrs.size()); + GELOGE(PARAM_INVALID, "The number of output does not match in op:%s(%s). The size[%zu] of output which is no need" + " to dump should not greater than the size[%zu] of output descs minus the size[%zu] of output which is " + "need to dump.", inner_dump_info.op->GetName().c_str(), inner_dump_info.op->GetType().c_str(), + no_need_dump_output_num, output_descs.size(), output_addrs.size()); + return PARAM_INVALID; + } + // check dump output tensor desc is redirected by attr ATTR_DATA_DUMP_REF if (AttrUtils::GetStr(&output_desc, ATTR_DATA_DUMP_REF, node_name_index)) { GE_CHK_STATUS_RET(DumpRefOutput(inner_dump_info, output, i, node_name_index), "DumpRefOutput failed"); @@ -355,14 +372,14 @@ Status DataDumper::DumpOutputWithTask(const InnerDumpInfo &inner_dump_info, aicp return SUCCESS; } -Status DataDumper::DumpOutput(const InnerDumpInfo &inner_dump_info, aicpu::dump::Task &task) { +Status DataDumper::DumpOutput(const InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Task &task) { GELOGI("Start dump output"); if (inner_dump_info.is_task) { // tbe or aicpu op, these ops are with task return DumpOutputWithTask(inner_dump_info, task); } // else data, const or variable op - aicpu::dump::Output output; + toolkit::aicpu::dump::Output output; auto output_tensor = inner_dump_info.op->GetOutputDescPtr(inner_dump_info.output_anchor_index); const std::vector output_addrs = ModelUtils::GetOutputDataAddrs(*runtime_param_, inner_dump_info.op); if (output_tensor == nullptr) { @@ -407,7 +424,7 @@ Status DataDumper::DumpOutput(const InnerDumpInfo &inner_dump_info, aicpu::dump: return SUCCESS; } -Status DataDumper::GenerateInput(aicpu::dump::Input &input, const OpDesc::Vistor &tensor_descs, +Status DataDumper::GenerateInput(toolkit::aicpu::dump::Input &input, const OpDesc::Vistor &tensor_descs, const uintptr_t &addr, size_t index) { input.set_data_type(static_cast(GetIrDataType(tensor_descs.at(index).GetDataType()))); input.set_format(static_cast(tensor_descs.at(index).GetFormat())); @@ -432,8 +449,8 @@ Status DataDumper::GenerateInput(aicpu::dump::Input &input, const OpDesc::Vistor return SUCCESS; } -Status DataDumper::DumpRefInput(const DataDumper::InnerDumpInfo &inner_dump_info, aicpu::dump::Input &input, size_t i, - const std::string &node_name_index) { +Status DataDumper::DumpRefInput(const DataDumper::InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Input &input, + size_t i, const std::string &node_name_index) { std::string dump_op_name; std::string input_or_output; size_t index; @@ -473,7 +490,7 @@ Status DataDumper::DumpRefInput(const DataDumper::InnerDumpInfo &inner_dump_info return SUCCESS; } -Status DataDumper::DumpInput(const InnerDumpInfo &inner_dump_info, aicpu::dump::Task &task) { +Status DataDumper::DumpInput(const InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Task &task) { GELOGI("Start dump input"); const auto &input_descs = inner_dump_info.op->GetAllInputsDesc(); const std::vector input_addrs = ModelUtils::GetInputDataAddrs(*runtime_param_, inner_dump_info.op); @@ -492,7 +509,7 @@ Status DataDumper::DumpInput(const InnerDumpInfo &inner_dump_info, aicpu::dump:: inner_dump_info.op->GetName().c_str(), input_descs.size(), v_memory_type.size()); for (size_t i = 0; i < input_descs.size(); ++i) { - aicpu::dump::Input input; + toolkit::aicpu::dump::Input input; std::string node_name_index; // check dump input tensor desc is redirected by attr ATTR_DATA_DUMP_REF if (AttrUtils::GetStr(&input_descs.at(i), ATTR_DATA_DUMP_REF, node_name_index)) { @@ -523,15 +540,15 @@ Status DataDumper::DumpInput(const InnerDumpInfo &inner_dump_info, aicpu::dump:: return SUCCESS; } -void DataDumper::GenerateOpBuffer(const int64_t &size, aicpu::dump::Task &task) { - aicpu::dump::OpBuffer op_buffer; - op_buffer.set_buffer_type(aicpu::dump::BufferType::L1); +void DataDumper::GenerateOpBuffer(const int64_t &size, toolkit::aicpu::dump::Task &task) { + toolkit::aicpu::dump::OpBuffer op_buffer; + op_buffer.set_buffer_type(toolkit::aicpu::dump::BufferType::L1); op_buffer.set_address(reinterpret_cast(l1_fusion_addr_)); op_buffer.set_size(size); task.mutable_buffer()->Add(std::move(op_buffer)); } -Status DataDumper::ExecuteLoadDumpInfo(aicpu::dump::OpMappingInfo &op_mapping_info) { +Status DataDumper::ExecuteLoadDumpInfo(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info) { std::string proto_str; size_t proto_size = op_mapping_info.ByteSizeLong(); bool ret = op_mapping_info.SerializeToString(&proto_str); @@ -575,7 +592,7 @@ Status DataDumper::ExecuteLoadDumpInfo(aicpu::dump::OpMappingInfo &op_mapping_in return SUCCESS; } -Status DataDumper::ExecuteUnLoadDumpInfo(aicpu::dump::OpMappingInfo &op_mapping_info) { +Status DataDumper::ExecuteUnLoadDumpInfo(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info) { std::string proto_str; size_t proto_size = op_mapping_info.ByteSizeLong(); bool ret = op_mapping_info.SerializeToString(&proto_str); @@ -626,7 +643,7 @@ Status DataDumper::LoadDumpInfo() { GELOGD("op_list_ is empty"); } - aicpu::dump::OpMappingInfo op_mapping_info; + toolkit::aicpu::dump::OpMappingInfo op_mapping_info; auto dump_path = dump_properties_.GetDumpPath() + std::to_string(device_id_) + "/"; op_mapping_info.set_dump_path(dump_path); @@ -655,11 +672,11 @@ Status DataDumper::LoadDumpInfo() { return SUCCESS; } -Status DataDumper::BuildTaskInfo(aicpu::dump::OpMappingInfo &op_mapping_info) { +Status DataDumper::BuildTaskInfo(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info) { for (const auto &op_iter : op_list_) { auto op_desc = op_iter.op; GELOGD("Op %s in model begin to add task in op_mapping_info", op_desc->GetName().c_str()); - aicpu::dump::Task task; + toolkit::aicpu::dump::Task task; task.set_end_graph(false); task.set_task_id(op_iter.task_id); task.set_stream_id(op_iter.stream_id); @@ -707,10 +724,10 @@ Status DataDumper::BuildTaskInfo(aicpu::dump::OpMappingInfo &op_mapping_info) { } void DataDumper::SetEndGraphIdToAicpu(uint32_t task_id, uint32_t stream_id, - aicpu::dump::OpMappingInfo &op_mapping_info) { + toolkit::aicpu::dump::OpMappingInfo &op_mapping_info) { if (dump_properties_.GetDumpMode() == kDumpOutput || dump_properties_.GetDumpMode() == kDumpInput || dump_properties_.GetDumpMode() == kDumpAll) { - aicpu::dump::Task task; + toolkit::aicpu::dump::Task task; task.set_end_graph(true); task.set_task_id(end_graph_task_id_); task.set_stream_id(end_graph_stream_id_); @@ -719,7 +736,7 @@ void DataDumper::SetEndGraphIdToAicpu(uint32_t task_id, uint32_t stream_id, op_mapping_info.mutable_task()->Add(std::move(task)); is_end_graph_ = true; - if (op_mapping_info.model_name_param_case() == aicpu::dump::OpMappingInfo::kModelName) { + if (op_mapping_info.model_name_param_case() == toolkit::aicpu::dump::OpMappingInfo::kModelName) { GELOGI("Add end_graph_info to aicpu, model_name is %s, task_id is %u, stream_id is %u", op_mapping_info.model_name().c_str(), end_graph_task_id_, end_graph_stream_id_); return; @@ -729,10 +746,10 @@ void DataDumper::SetEndGraphIdToAicpu(uint32_t task_id, uint32_t stream_id, } void DataDumper::SetOpDebugIdToAicpu(uint32_t task_id, uint32_t stream_id, void *op_debug_addr, - aicpu::dump::OpMappingInfo &op_mapping_info) { + toolkit::aicpu::dump::OpMappingInfo &op_mapping_info) { if (is_op_debug_) { GELOGI("add op_debug_info to aicpu, task_id is %u, stream_id is %u", task_id, stream_id); - aicpu::dump::Task task; + toolkit::aicpu::dump::Task task; task.set_end_graph(false); task.set_task_id(task_id); task.set_stream_id(stream_id); @@ -740,7 +757,7 @@ void DataDumper::SetOpDebugIdToAicpu(uint32_t task_id, uint32_t stream_id, void task.mutable_op()->set_op_type(OP_TYPE_OP_DEBUG); // set output - aicpu::dump::Output output; + toolkit::aicpu::dump::Output output; output.set_data_type(DT_UINT8); output.set_format(FORMAT_ND); @@ -766,12 +783,12 @@ Status DataDumper::UnloadDumpInfo() { } GELOGI("UnloadDumpInfo start."); - aicpu::dump::OpMappingInfo op_mapping_info; + toolkit::aicpu::dump::OpMappingInfo op_mapping_info; op_mapping_info.set_model_id(model_id_); op_mapping_info.set_flag(kAicpuUnloadFlag); for (const auto &op_iter : op_list_) { - aicpu::dump::Task task; + toolkit::aicpu::dump::Task task; task.set_task_id(op_iter.task_id); task.set_stream_id(op_iter.stream_id); op_mapping_info.mutable_task()->Add(std::move(task)); diff --git a/ge/graph/load/model_manager/data_dumper.h b/ge/graph/load/model_manager/data_dumper.h index 8af07d86..d1714950 100755 --- a/ge/graph/load/model_manager/data_dumper.h +++ b/ge/graph/load/model_manager/data_dumper.h @@ -27,7 +27,7 @@ #include "graph/node.h" #include "graph/compute_graph.h" #include "proto/ge_ir.pb.h" -#include "proto/op_mapping_info.pb.h" +#include "proto/op_mapping.pb.h" #include "runtime/mem.h" #include "task_info/task_info.h" #include "framework/common/ge_types.h" @@ -128,24 +128,25 @@ class DataDumper { DumpProperties dump_properties_; // Build task info of op mapping info - Status BuildTaskInfo(aicpu::dump::OpMappingInfo &op_mapping_info); - Status DumpOutput(const InnerDumpInfo &inner_dump_info, aicpu::dump::Task &task); - Status DumpRefOutput(const DataDumper::InnerDumpInfo &inner_dump_info, aicpu::dump::Output &output, size_t i, - const std::string &node_name_index); - Status DumpOutputWithTask(const InnerDumpInfo &inner_dump_info, aicpu::dump::Task &task); - Status DumpInput(const InnerDumpInfo &inner_dump_info, aicpu::dump::Task &task); - Status DumpRefInput(const DataDumper::InnerDumpInfo &inner_dump_info, aicpu::dump::Input &input, size_t i, - const std::string &node_name_index); - Status ExecuteLoadDumpInfo(aicpu::dump::OpMappingInfo &op_mapping_info); - void SetEndGraphIdToAicpu(uint32_t task_id, uint32_t stream_id, aicpu::dump::OpMappingInfo &op_mapping_info); + Status BuildTaskInfo(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info); + Status DumpOutput(const InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Task &task); + Status DumpRefOutput(const DataDumper::InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Output &output, + size_t i, const std::string &node_name_index); + Status DumpOutputWithTask(const InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Task &task); + Status DumpInput(const InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Task &task); + Status DumpRefInput(const DataDumper::InnerDumpInfo &inner_dump_info, toolkit::aicpu::dump::Input &input, + size_t i, const std::string &node_name_index); + Status ExecuteLoadDumpInfo(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info); + void SetEndGraphIdToAicpu(uint32_t task_id, uint32_t stream_id, + toolkit::aicpu::dump::OpMappingInfo &op_mapping_info); void SetOpDebugIdToAicpu(uint32_t task_id, uint32_t stream_id, void *op_debug_addr, - aicpu::dump::OpMappingInfo &op_mapping_info); - Status ExecuteUnLoadDumpInfo(aicpu::dump::OpMappingInfo &op_mapping_info); - Status GenerateInput(aicpu::dump::Input &input, const OpDesc::Vistor &tensor_descs, + toolkit::aicpu::dump::OpMappingInfo &op_mapping_info); + Status ExecuteUnLoadDumpInfo(toolkit::aicpu::dump::OpMappingInfo &op_mapping_info); + Status GenerateInput(toolkit::aicpu::dump::Input &input, const OpDesc::Vistor &tensor_descs, const uintptr_t &addr, size_t index); - Status GenerateOutput(aicpu::dump::Output &output, const OpDesc::Vistor &tensor_descs, + Status GenerateOutput(toolkit::aicpu::dump::Output &output, const OpDesc::Vistor &tensor_descs, const uintptr_t &addr, size_t index); - void GenerateOpBuffer(const int64_t &size, aicpu::dump::Task &task); + void GenerateOpBuffer(const int64_t &size, toolkit::aicpu::dump::Task &task); }; struct DataDumper::InnerDumpInfo { uint32_t task_id; diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 0d4b5b84..81edd40b 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -50,7 +50,6 @@ #include "graph/utils/type_utils.h" #include "init/gelib.h" #include "mmpa/mmpa_api.h" -#include "omm/csa_interact.h" #include "runtime/base.h" #include "runtime/dev.h" #include "runtime/event.h" @@ -2718,7 +2717,6 @@ Status DavinciModel::ReturnNoOutput(uint32_t data_id) { void *DavinciModel::Run(DavinciModel *model) { GE_CHK_BOOL_EXEC(model != nullptr, - CsaInteract::GetInstance().WriteErrorCode(FAILED, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); return nullptr, "model_pointer is null!") bool seq_end_flag = false; uint32_t model_id = model->Id(); @@ -2735,14 +2733,13 @@ void *DavinciModel::Run(DavinciModel *model) { // DeviceReset before thread run finished! GE_MAKE_GUARD(not_used_var, [&] { GE_CHK_RT(rtDeviceReset(device_id)); }); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); while (model->RunFlag()) { // Model hasn't truly started runing before received data model->SetRunningFlag(false); bool rslt_flg = true; if (model->GetDataInputer() == nullptr) { GELOGW("Data inputer is nullptr."); - CsaInteract::GetInstance().StoreInternalErrorCode(FAILED, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); break; } @@ -2763,7 +2760,6 @@ void *DavinciModel::Run(DavinciModel *model) { ret = model->SyncVarData(); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( ret != SUCCESS, (void)model->ReturnResult(current_data.index, false, false, data_wrapper->GetOutput()); - CsaInteract::GetInstance().StoreInternalErrorCode(ret, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); continue, "Copy input data to model failed."); // [No need to check value] GE_IF_BOOL_EXEC(model->is_first_execute_, GE_TIMESTAMP_EVENT_END(Model_SyncVarData, "Model Run SyncVarData")); @@ -2773,7 +2769,6 @@ void *DavinciModel::Run(DavinciModel *model) { ret = model->CopyInputData(current_data, false); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( ret != SUCCESS, (void)model->ReturnResult(current_data.index, false, false, data_wrapper->GetOutput()); - CsaInteract::GetInstance().StoreInternalErrorCode(ret, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); continue, "Copy input data to model failed."); // [No need to check value] if (model->is_online_infer_dynamic_ && !model->is_getnext_sink_dynamic_) { model->cur_dynamic_dims_.clear(); @@ -2794,7 +2789,6 @@ void *DavinciModel::Run(DavinciModel *model) { rt_ret = rtModelExecute(model->rt_model_handle_, model->rt_model_stream_, 0); GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, rslt_flg = false; (void)model->ReturnResult(current_data.index, false, false, data_wrapper->GetOutput()); - CsaInteract::GetInstance().WriteErrorCode(rt_ret, ERROR_MODULE_RUNTIME, JOBSUBSTATE_GRAPH_EXEC); continue); GELOGI("rtModelExecute end"); GE_IF_BOOL_EXEC(model->is_first_execute_, GE_TIMESTAMP_EVENT_END(rtModelExecute, "GraphExcute::rtModelExecute")); @@ -2812,7 +2806,6 @@ void *DavinciModel::Run(DavinciModel *model) { rt_ret != RT_ERROR_NONE, rslt_flg = false; GELOGI("seq_end_flg: %d", seq_end_flag); (void)model->ReturnResult(current_data.index, false, seq_end_flag, data_wrapper->GetOutput()); // [No need to check value] - CsaInteract::GetInstance().StoreInternalErrorCode(rt_ret, ERROR_MODULE_RUNTIME, JOBSUBSTATE_GRAPH_EXEC); continue); } @@ -2841,7 +2834,6 @@ void *DavinciModel::Run(DavinciModel *model) { GELOGI("run iterator count is %lu, model_id:%u", model->iterator_count_, model->model_id_); } - CsaInteract::GetInstance().WriteInternalErrorCode(); GELOGI("Model run end, model id:%u", model->model_id_); return nullptr; } @@ -2894,7 +2886,7 @@ Status DavinciModel::ModelRunStart() { int64_t maxDumpOpNum = std::strtol(opt.c_str(), nullptr, kDecimal); maxDumpOpNum_ = maxDumpOpNum; - error_context_ = ErrorManager::GetInstance().GetErrorContext(); + error_context_ = ErrorManager::GetInstance().GetErrorManagerContext(); CREATE_STD_THREAD(thread_id_, DavinciModel::Run, this); GELOGI("model thread create success, model id:%u.", model_id_); return SUCCESS; diff --git a/ge/graph/load/model_manager/davinci_model.h b/ge/graph/load/model_manager/davinci_model.h index ac6169ad..736272f7 100755 --- a/ge/graph/load/model_manager/davinci_model.h +++ b/ge/graph/load/model_manager/davinci_model.h @@ -424,7 +424,7 @@ class DavinciModel { /// uint64_t GetSessionId() const { return session_id_; } - const struct ErrorMessage::Context &GetErrorContext() const { return error_context_; } + const struct error_message::Context &GetErrorContext() const { return error_context_; } /// /// @ingroup ge @@ -992,7 +992,7 @@ class DavinciModel { vector output_mbuf_list_; // output mbuf created by dequeue task. uint64_t session_id_; - struct ErrorMessage::Context error_context_; + struct error_message::Context error_context_; uint32_t device_id_; diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 6114467c..a288e14e 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -341,11 +341,7 @@ Status ModelManager::LoadModelOnline(uint32_t &model_id, const shared_ptr davinci_model = MakeShared(0, listener); - if (davinci_model == nullptr) { - REPORT_CALL_ERROR("E19999", "New DavinciModel fail, model_id:%u", model_id); - GELOGE(FAILED, "davinci_model is nullptr"); - return FAILED; - } + GE_CHECK_NOTNULL(davinci_model); davinci_model->SetProfileTime(MODEL_LOAD_START, (timespec.tv_sec * kTimeSpecNano + timespec.tv_nsec)); // 1000 ^ 3 converts second to nanosecond davinci_model->SetId(model_id); @@ -1096,7 +1092,7 @@ Status ModelManager::GenSessionId(uint64_t &session_id) { mmTimeval tv; if (mmGetTimeOfDay(&tv, nullptr) != 0) { - REPORT_CALL_ERROR("E19999", "Call mmGetTimeOfDay fail"); + REPORT_CALL_ERROR("E19999", "Call mmGetTimeOfDay fail. errmsg:%s", strerror(errno)); GELOGE(INTERNAL_ERROR, "Failed to get current time."); return INTERNAL_ERROR; } diff --git a/ge/graph/load/model_manager/model_utils.cc b/ge/graph/load/model_manager/model_utils.cc index 80bdec9b..058a538f 100755 --- a/ge/graph/load/model_manager/model_utils.cc +++ b/ge/graph/load/model_manager/model_utils.cc @@ -319,7 +319,7 @@ vector ModelUtils::GetInputDataAddrs(const RuntimeParam &model_param, Co const GeTensorDescPtr tensor_desc = op_desc->MutableInputDesc(static_cast(i)); GE_IF_BOOL_EXEC(tensor_desc == nullptr, GELOGD("Op: %s, Index: %zu, has no input", op_desc->GetName().c_str(), i); continue;) - if ((i < v_is_input_const.size()) && v_is_input_const[i] && (op_type != NETOUTPUT)) { + if ((i < v_is_input_const.size()) && v_is_input_const[i]) { // TBE: add weights address to input int64_t tensor_size = 0; GE_CHK_STATUS(TensorUtils::GetSize(*tensor_desc, tensor_size)); diff --git a/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc b/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc index 9ba62475..2a3e3a17 100644 --- a/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc +++ b/ge/graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc @@ -31,7 +31,9 @@ Status SuperKernelFactory::Init() { std::string skt_bin = "libcce_aicore.so"; handle_ = mmDlopen(skt_bin.c_str(), MMPA_RTLD_NOW | MMPA_RTLD_GLOBAL); if (handle_ == nullptr) { - GELOGE(FAILED, "SKT: open skt lib failed, please check LD_LIBRARY_PATH."); + const char* error = mmDlerror(); + GE_IF_BOOL_EXEC(error == nullptr, error = ""); + GELOGE(FAILED, "SKT: open skt lib failed, please check LD_LIBRARY_PATH. errmsg:%s", error); } rtError_t rt_ret; rt_ret = rtGetFunctionByName(this->sk_stub_name_.c_str(), &this->func_stub_); diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index f2b4211d..a1a7034b 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -101,7 +101,7 @@ #include "graph/utils/tensor_adapter.h" #include "inc/pass_manager.h" #include "init/gelib.h" -#include "ir_build/atc_ir_common.h" +#include "ir_build/option_utils.h" #include "graph/common/local_context.h" #include "graph/common/omg_util.h" #include "common/formats/utils/formats_trans_utils.h" @@ -125,6 +125,7 @@ const uint32_t kInitGraphCount = 1; const uint32_t kNotAdded = 0; const uint32_t kStartAdd = 1; const uint32_t kDoneAdded = 2; +const uint32_t kNeverLoaded = 0; bool IsTailingOptimization() { string is_tailing_optimization_option; @@ -164,7 +165,7 @@ GraphManager::GraphManager() } Status GraphManager::Initialize(const std::map &options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); if (init_flag_) { GELOGW("[Initialize] GraphManager already initialized."); return SUCCESS; @@ -494,7 +495,7 @@ Status GraphManager::AddGraph(const GraphId &graph_id, const Graph &graph, auto compute_graph = GraphUtils::GetComputeGraph(graph); GE_CHECK_NOTNULL(compute_graph); compute_graph->SetGraphID(graph_id); - + (void)AttrUtils::SetBool(*compute_graph, ATTR_NAME_GRAPH_HAS_BEEN_ADDED, true); SetSessionGraphId(compute_graph, graph_id); if (CreateGraphNode(graph_id, graph, options) != SUCCESS) { @@ -526,14 +527,7 @@ Status GraphManager::AddGraph(const GraphId &graph_id, const Graph &graph, return SUCCESS; } -Status GraphManager::AddGraphWithCopy(const GraphId &graph_id, const Graph &graph, - const std::map &options, - const OmgContext &omg_context) { - if (HasGraphNode(graph_id)) { - REPORT_INNER_ERROR("E19999", "graph_id:%u is exist, check invalid", graph_id); - GELOGE(GE_GRAPH_GRAPH_ALREADY_EXIST, "[GraphManager] graph exists, graph_id = %u.", graph_id); - return GE_GRAPH_GRAPH_ALREADY_EXIST; - } +Status GraphManager::CheckGraphAdded(const GraphId &graph_id, const Graph &graph) { auto compute_graph = GraphUtils::GetComputeGraph(graph); if (compute_graph != nullptr) { compute_graph->SetGraphID(graph_id); @@ -552,58 +546,44 @@ Status GraphManager::AddGraphWithCopy(const GraphId &graph_id, const Graph &grap GELOGE(FAILED, "compute graph is null"); return FAILED; } - std::vector input_nodes; - std::vector output_nodes; - auto new_compute_graph = GraphUtils::CloneGraph(compute_graph, "", input_nodes, output_nodes); - std::string session_graph_id; - if (!AttrUtils::GetStr(*new_compute_graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id) || - session_graph_id.empty()) { - session_graph_id = "-1_" + to_string(graph_id); - if (!AttrUtils::SetStr(*new_compute_graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id)) { - GELOGW("Set attribute of compute graph failed."); - } - for (auto &subgraph : new_compute_graph->GetAllSubgraphs()) { - (void)AttrUtils::SetStr(*subgraph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id); - } - GELOGD("Get graph session_graph_id attr failed, set session id to default value: [0]"); - } + return SUCCESS; +} - GraphNodePtr graph_node = MakeShared(graph_id); - if (graph_node == nullptr) { - REPORT_CALL_ERROR("E19999", "New GraphNode fail, graph_id:%u", - graph_id); - GELOGE(FAILED, "GraphNode make shared failed"); +Status GraphManager::AddGraphWithCopy(const GraphId &graph_id, const Graph &graph, + const std::map &options, + const OmgContext &omg_context) { + if (CheckGraphAdded(graph_id, graph) != SUCCESS) { + GELOGE(FAILED, "AddGraphWithCopy failed."); return FAILED; } - std::shared_ptr graph_ptr = GraphUtils::CreateGraphPtrFromComputeGraph(new_compute_graph); - if (graph_ptr == nullptr) { - REPORT_CALL_ERROR("E19999", "New Graph fail, graph_id:%u", - graph_id); - GELOGE(FAILED, "GraphPtr make shared failed"); + IncreaseGraphCount(graph_id); + // Do add graph + auto compute_graph = GraphUtils::GetComputeGraph(graph); + std::vector input_nodes; + std::vector output_nodes; + auto new_compute_graph = GraphUtils::CloneGraph(compute_graph, "", input_nodes, output_nodes); + GE_CHECK_NOTNULL(new_compute_graph); + new_compute_graph->SetGraphID(graph_id); + SetSessionGraphId(new_compute_graph, graph_id); + std::shared_ptr new_graph_ptr = GraphUtils::CreateGraphPtrFromComputeGraph(new_compute_graph); + if (CreateGraphNode(graph_id, *new_graph_ptr, options) != SUCCESS) { + GELOGE(FAILED, "Failed to create graph_node."); return FAILED; } - // update option about tuning graph - ParseOption(options, BUILD_MODE, options_.build_mode); - ParseOption(options, BUILD_STEP, options_.build_step); - ParseOption(options, TUNING_PATH, options_.tuning_path); - - graph_node->SetGraph(graph_ptr); - graph_node->SetOptions(options); - AddGraphNode(graph_id, graph_node); AddLocalOmgContext(graph_id, omg_context); if (!options_.output_datatype.empty()) { GetLocalOmgContext().output_type = options_.output_datatype; } + if (InitDynamicParams(new_compute_graph) != SUCCESS) { + GELOGE(GRAPH_PARAM_INVALID, "Failed to init params when online infer is dynamic."); + return GRAPH_PARAM_INVALID; + } - CompilerStages &stages = GetCompilerStages(graph_id); - stages.preparer.SetOptions(options_); - Status status = stages.optimizer.SetOptions(options_); - if (status != SUCCESS) { - GELOGE(status, "Graph optimizer set options failed."); - return status; + if (SetStagesOptions(graph_id, options_) != SUCCESS) { + GELOGE(INTERNAL_ERROR, "Set stage options failed."); + return INTERNAL_ERROR; } - stages.builder.SetOptions(options_); var_acc_ctrl_.AddGraph(graph_id, new_compute_graph); return SUCCESS; @@ -703,7 +683,7 @@ Status GraphManager::OptimizeSubGraphWithMultiThreads(ComputeGraphPtr compute_gr std::future f = executor.commit(GraphManager::ProcessSubGraphWithMultiThreads, this, compute_graph->GetGraphID(), subgraph, compute_graph->GetName(), session_id, - ErrorManager::GetInstance().GetErrorContext(), + ErrorManager::GetInstance().GetErrorManagerContext(), GetThreadLocalContext()); if (!f.valid()) { GELOGE(FAILED, "Future is invalid"); @@ -720,7 +700,7 @@ Status GraphManager::OptimizeSubGraphWithMultiThreads(ComputeGraphPtr compute_gr std::future f = executor.commit(GraphManager::ProcessSubGraphWithMultiThreads, this, compute_graph->GetGraphID(), subgraph, compute_graph->GetName(), session_id, - ErrorManager::GetInstance().GetErrorContext(), + ErrorManager::GetInstance().GetErrorManagerContext(), GetThreadLocalContext()); if (!f.valid()) { GELOGE(FAILED, "Future is invalid"); @@ -832,7 +812,7 @@ Status GraphManager::SetSubgraph(uint64_t session_id, ComputeGraphPtr compute_gr Status GraphManager::PreRunOptimizeOriginalGraph(const GraphNodePtr &graph_node, const std::vector &inputs, ge::ComputeGraphPtr &compute_graph, uint64_t session_id) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kPrepareOptimize); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kPrepareOptimize); GE_CHECK_NOTNULL(graph_node); GE_CHECK_NOTNULL(compute_graph); @@ -841,10 +821,10 @@ Status GraphManager::PreRunOptimizeOriginalGraph(const GraphNodePtr &graph_node, GM_RUN_AND_DUMP_PERF("HandleSummaryOp", stages.optimizer.HandleSummaryOp, compute_graph); GM_RUN_AND_DUMP_PERF("Prepare", stages.preparer.PrepareDynShape, graph_node, inputs, compute_graph, session_id); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOriginOptimize); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOriginOptimize); GM_RUN_AND_DUMP_PERF("OptimizeOriginalGraph", stages.optimizer.OptimizeOriginalGraph, compute_graph); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kPrepareOptimize); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kPrepareOptimize); GM_RUN_AND_DUMP_PERF("PrepareRunningFormatRefiner", stages.preparer.PrepareRunningFormatRefiner); GM_RUN_AND_DUMP_PERF("RefineRunningFormat", stages.optimizer.OptimizeOriginalGraphJudgeInsert, compute_graph); GM_RUN_AND_DUMP_PERF("SubexpressionMigration", SubexpressionMigration, compute_graph); @@ -887,7 +867,7 @@ Status GraphManager::PreRunAfterOptimizeSubGraph(const GraphNodePtr &graph_node, GE_CHECK_NOTNULL(graph_node); GE_CHECK_NOTNULL(compute_graph); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kMergeGraphOptimize); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kMergeGraphOptimize); CompilerStages &stages = GetCompilerStages(graph_node->GetGraphId()); GM_RUN_AND_DUMP_PERF("OptimizeWholeGraph", stages.optimizer.OptimizeWholeGraph, compute_graph); GM_RUN_AND_DUMP_PERF("Optimize2", OptimizeStage2, compute_graph); @@ -981,7 +961,7 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vectorGetGraphId(), compute_graph, ge_model); @@ -1053,7 +1033,7 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: // it will not execute graph prreprocess, optimize, parition, build if the graph has built successful. Status ret = SUCCESS; if (IsGraphNeedBuild(graph_node)) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); if (graph_node->GetBuildFlag()) { REPORT_INNER_ERROR("E19999", "Graph:%u has not build before, can't run directly, " "check invalid", graph_node->GetGraphId()); @@ -1075,11 +1055,10 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: return ret; } } - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelLoad, ErrorMessage::kModelLoad); + ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); if (!graph_node->IsAsync()) { ret = LoadGraph(ge_root_model, graph_node); } else { - GE_CHECK_NOTNULL(ge_root_model); ret = LoadGraphAsync(ge_root_model, graph_node); } if (ret != SUCCESS) { @@ -1089,12 +1068,11 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: graph_node->SetBuildFlag(true); var_acc_ctrl_.SetGraphBuildEnd(graph_node->GetGraphId()); } else if (!graph_node->GetLoadFlag()) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelLoad, ErrorMessage::kModelLoad); + ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); GeRootModelPtr ge_root_model_ptr = graph_node->GetGeRootModel(); if (!graph_node->IsAsync()) { ret = LoadGraph(ge_root_model_ptr, graph_node); } else { - GE_CHECK_NOTNULL(ge_root_model); ret = LoadGraphAsync(ge_root_model_ptr, graph_node); } if (ret != SUCCESS) { @@ -1249,7 +1227,7 @@ Status GraphManager::InnerRunGraph(GraphNodePtr &graph_node, const GraphId &grap Status GraphManager::RunGraph(const GraphId &graph_id, const std::vector &inputs, std::vector &outputs, uint64_t session_id) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); std::lock_guard lock(run_mutex_); GELOGI("[RunGraph] start to run graph, graph_id = %u, is_train_graph: %d", graph_id, GetTrainFlag()); @@ -1310,7 +1288,7 @@ Status GraphManager::RunGraph(const GraphId &graph_id, const std::vector &inputs, GeRootModelPtr &ge_root_model, uint64_t session_id, bool async) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGD("[BuildGraph] start to build graph, graph_id:%u", graph_id); if (inputs.empty()) { GELOGW("[BuildGraph] BuildGraph warning: empty GeTensor inputs"); @@ -2748,6 +2726,15 @@ void GraphManager::ReleaseMemory(const GeModelPtr &ge_model, GraphNodePtr &graph GELOGI("CheckAndReleaseMemory UnloadGraph[%u], model[%u] success.", graph_id, model_id); } graph_node->SetLoadFlag(false); + // Allow model to be loaded agagin without adding graph again + graph_node->SetLoadCount(graph_node->GetLoadRecord()); + graph_node->SetLoadRecord(kNeverLoaded); + GeRootModelPtr ge_root_model = graph_node->GetGeRootModel(); + if (ge_root_model == nullptr) { + GELOGW("ge_root_model is null, graph_id:%u", graph_id); + return; + } + ge_root_model->ClearAllModelId(); rt_ret = rtDeviceReset(GetContext().DeviceId()); if (rt_ret != RT_ERROR_NONE) { REPORT_CALL_ERROR("E19999", "Call rtDeviceReset failed, device_id:%u, when GraphManager %s", @@ -2825,10 +2812,10 @@ Status GraphManager::ProcessSubGraphWithMultiThreads(GraphManager *graph_manager const SubGraphInfoPtr &sub_graph_info_ptr, const std::string &root_graph_name, uint64_t session_id, - const struct ErrorMessage::Context &error_context, + const struct error_message::Context &error_context, const GEThreadLocalContext &ge_context) { + ErrorManager::GetInstance().SetErrorContext(error_context); if (sub_graph_info_ptr != nullptr && graph_manager != nullptr) { - ErrorManager::GetInstance().SetErrorContext(error_context); GetContext().SetSessionId(session_id); GetThreadLocalContext() = ge_context; graph_manager->UpdateLocalOmgContext(root_graph_id); @@ -2878,11 +2865,11 @@ Status GraphManager::ProcessSubGraphWithMultiThreads(GraphManager *graph_manager // run graph async on session Status GraphManager::RunGraphAsync(const GraphId &graph_id, const std::vector &inputs, uint64_t session_id, RunAsyncCallback callback) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); GELOGI("[GraphManager] Start to run graph async, graph_id=%u, inputsSize=%zu.", graph_id, inputs.size()); bool ret = prerun_args_q_.Push(PreRunArgs({graph_id, inputs, session_id, - ErrorManager::GetInstance().GetErrorContext(), + ErrorManager::GetInstance().GetErrorManagerContext(), GetThreadLocalContext(), callback})); if (!ret) { GELOGE(FAILED, "[GraphManager] Run graph async failed, graph_id=%u.", graph_id); @@ -3003,7 +2990,7 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { GELOGI("[PreRunThread] A new loop start, graph_id:%u.", args.graph_id); ErrorManager::GetInstance().SetErrorContext(args.error_context); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GetContext().SetSessionId(args.session_id); GetThreadLocalContext() = args.context; graph_manager->UpdateLocalOmgContext(args.graph_id); @@ -3173,7 +3160,7 @@ Status GraphManager::ParseInputsDims(const std::vector &input_t } void GraphManager::RunThread(GraphManager *graph_manager) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); if (prctl(PR_SET_NAME, ("GE_Run")) != 0) { GELOGW("Set thread name failed."); } @@ -3203,7 +3190,7 @@ void GraphManager::RunThread(GraphManager *graph_manager) { args.graph_node->UpdateLoadFlag(); if (!args.graph_node->GetLoadFlag()) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelLoad, ErrorMessage::kModelLoad); + ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); args.ge_root_model->SetTrainFlag(graph_manager->GetTrainFlag()); ret = graph_manager->LoadGraphAsync(args.ge_root_model, args.graph_node); if (ret != SUCCESS || args.ge_root_model == nullptr) { @@ -3221,7 +3208,7 @@ void GraphManager::RunThread(GraphManager *graph_manager) { args.ge_root_model->GetModelId()); } - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); + ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); if (graph_manager->GetTrainFlag()) { ret = graph_manager->graph_executor_.SetGraphContext(graph_manager->GetGraphContext()); if (ret != SUCCESS) { @@ -3519,7 +3506,7 @@ Status GraphManager::ConvertGraphToFile(ComputeGraphPtr &compute_graph, GraphPar Status GraphManager::Build(const GraphNodePtr &graph_node, ComputeGraphPtr &compute_graph, GeRootModelPtr &ge_root_model, uint64_t session_id) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); // build if (compute_graph != nullptr) { std::string graph_name = compute_graph->GetName(); diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index 0533a0b6..960c253c 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -210,7 +210,7 @@ class GraphManager { GraphId graph_id; std::vector input_tensor; uint64_t session_id; - struct ErrorMessage::Context error_context; + struct error_message::Context error_context; GEThreadLocalContext context; RunAsyncCallback callback; }; @@ -219,7 +219,7 @@ class GraphManager { GraphNodePtr graph_node; GraphId graph_id; uint64_t session_id; - struct ErrorMessage::Context error_context; + struct error_message::Context error_context; std::vector input_tensor; GeRootModelPtr ge_root_model; GEThreadLocalContext context; @@ -237,7 +237,7 @@ class GraphManager { const SubGraphInfoPtr &sub_graph_info_ptr, const std::string &root_graph_name, uint64_t session_id, - const struct ErrorMessage::Context &error_context, + const struct error_message::Context &error_context, const GEThreadLocalContext &ge_context); Status ParseInputsDims(const std::vector &input_tensor); void ParseInputsDimsForData(const std::vector &input_tensor); @@ -413,6 +413,8 @@ class GraphManager { void SetSessionGraphId(ComputeGraphPtr compute_graph, uint32_t graph_id); + static Status CheckGraphAdded(const GraphId &graph_id, const Graph &graph); + std::atomic_bool thread_run_flag_; BlockingQueue prerun_args_q_{}; BlockingQueue run_args_q_{}; diff --git a/ge/graph/manager/graph_manager_utils.h b/ge/graph/manager/graph_manager_utils.h index ffbc20cf..bebba93e 100644 --- a/ge/graph/manager/graph_manager_utils.h +++ b/ge/graph/manager/graph_manager_utils.h @@ -178,9 +178,12 @@ class GraphNode { void SetSemSize(uint32_t size) { sem_.SetMaxSize(size); } uint32_t GetLoadCount() const { return load_count_; } + void SetLoadCount(uint32_t count) { load_count_ = count; } + uint32_t GetLoadRecord() const { return load_record_; } + void SetLoadRecord(uint32_t record) { load_record_ = record; } + void IncreaseLoadRecord() { ++load_record_; } void IncreaseLoadCount(); void DecreaseLoadCount() { --load_count_; } - void IncreaseLoadRecord() { ++load_record_; } // run graph asynchronous listener std::shared_ptr graph_run_async_listener_; diff --git a/ge/graph/manager/graph_mem_allocator.h b/ge/graph/manager/graph_mem_allocator.h index d5e8cf8d..9f8b86b2 100644 --- a/ge/graph/manager/graph_mem_allocator.h +++ b/ge/graph/manager/graph_mem_allocator.h @@ -226,7 +226,7 @@ class MemManager { // Usually impossible if (allocator == nullptr) { - GELOGE(ge::INTERNAL_ERROR, "Get allocator failed, memory type is %u.", memory_type); + GELOGW("Get allocator failed, memory type is %u.", memory_type); static T default_allocator(RT_MEMORY_RESERVED); return default_allocator; } diff --git a/ge/graph/manager/trans_var_data_utils.cc b/ge/graph/manager/trans_var_data_utils.cc index 7c96eb95..9c1290fa 100644 --- a/ge/graph/manager/trans_var_data_utils.cc +++ b/ge/graph/manager/trans_var_data_utils.cc @@ -487,7 +487,7 @@ Status TransVarDataUtils::TransAllVarData(const vector &variable_nodes, std::future f = executor.commit( [](const ge::NodePtr &node, uint64_t session_id, rtContext_t ctx, uint32_t graph_id, - const struct ErrorMessage::Context &error_context) -> Status { + const struct error_message::Context &error_context) -> Status { ErrorManager::GetInstance().SetErrorContext(error_context); rtError_t rt_ret = rtCtxSetCurrent(ctx); if (rt_ret != RT_ERROR_NONE) { @@ -525,7 +525,7 @@ Status TransVarDataUtils::TransAllVarData(const vector &variable_nodes, } return SUCCESS; }, - node, session_id, context, graph_id, ErrorManager::GetInstance().GetErrorContext()); + node, session_id, context, graph_id, ErrorManager::GetInstance().GetErrorManagerContext()); if (!f.valid()) { GELOGE(FAILED, "Future is invalid"); return FAILED; diff --git a/ge/graph/manager/util/debug.cc b/ge/graph/manager/util/debug.cc index 65aa3192..1dd97bc1 100644 --- a/ge/graph/manager/util/debug.cc +++ b/ge/graph/manager/util/debug.cc @@ -35,14 +35,14 @@ void Debug::DumpProto(const Message &proto, const char *file) { int fd = mmOpen2(file_path.c_str(), M_WRONLY | M_CREAT | O_TRUNC, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD | M_UMASK_OTHREAD); if (fd == -1) { - GELOGW("Write %s failed", file_path.c_str()); + GELOGW("Write %s failed. errmsg:%s", file_path.c_str(), strerror(errno)); return; } auto output = ge::MakeShared(fd); if (output == nullptr) { GELOGW("create output failed."); if (mmClose(fd) != 0) { - GELOGW("close fd failed."); + GELOGW("close fd failed. errmsg:%s", strerror(errno)); } return; } @@ -51,7 +51,7 @@ void Debug::DumpProto(const Message &proto, const char *file) { GELOGW("dump proto failed."); } if (mmClose(fd) != 0) { - GELOGW("close fd failed."); + GELOGW("close fd failed. errmsg:%s", strerror(errno)); } } diff --git a/ge/graph/passes/link_gen_mask_nodes_pass.cc b/ge/graph/passes/link_gen_mask_nodes_pass.cc index 14f5dfc3..e00ede45 100755 --- a/ge/graph/passes/link_gen_mask_nodes_pass.cc +++ b/ge/graph/passes/link_gen_mask_nodes_pass.cc @@ -107,6 +107,16 @@ void LinkGenMaskNodesPass::GetAllGenMaskNodes(ComputeGraphPtr graph, vectorGetInDataNodes(); if (in_data_nodes.size() > kGenMaskInputIndex) { NodePtr &gen_mask = in_data_nodes.at(kGenMaskInputIndex); + for (auto &in_data_node : in_data_nodes) { + // node gen_mask is located at different place in the fused node + if (in_data_node->GetName().find(DROPOUTGENMASK) != in_data_node->GetName().npos) { + gen_mask = in_data_node; + GELOGD("The fused node type [%s], paired with the input node name [%s].", + node->GetType().c_str(), gen_mask->GetName().c_str()); + break; + } + } + if ((gen_mask->GetOpDesc() == nullptr) || (gen_mask->GetOpDesc()->HasAttr(ATTR_NAME_STREAM_LABEL))) { continue; } diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 4fb80646..2d06cd5d 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -27,6 +27,7 @@ #include "common/helper/model_helper.h" #include "common/math/math_util.h" #include "common/op/ge_op_utils.h" +#include "ir_build/option_utils.h" #include "graph/common/ge_call_wrapper.h" #include "graph/common/local_context.h" #include "graph/common/transop_util.h" @@ -991,101 +992,6 @@ Status ProcessNetoutputNodeDynShape(NodePtr &node) { } return SUCCESS; } -long StringToLongNoThrow(const string &str) { - try { - return std::stol(str); - } catch (const std::invalid_argument) { - GELOGE(PARAM_INVALID, - "Parse shape range of input failed when transfer from string to int64. Given %s, while correct example:" - "\"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\"", - str.c_str()); - return PARAM_INVALID; - } catch (const std::out_of_range) { - GELOGE(PARAM_INVALID, - "Parse shape range of input failed when transfer from string to int64. Given %s, while correct example:" - "\"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\"", - str.c_str()); - return PARAM_INVALID; - } -} -/** - * Parser shape_range from string to vector - * shape_range from option normally is "[1~20,3,3~6,-1],[1~20,3,3~6,-1]" - * @param shape_range - */ -Status ParseDynamicInputShapeRange(const std::string &shape_range, - std::vector>> &range) { - if (shape_range.size() < 2) { - REPORT_INNER_ERROR("E19999", "shape_range.size:%zu < 2, check invalid", shape_range.size()); - GELOGE(PARAM_INVALID, "Shape range %s is invalid.", shape_range.c_str()); - return PARAM_INVALID; - } - // different shape_range of single input are split by ']' - vector shape_range_set = ge::StringUtils::Split(shape_range, ']'); - if (shape_range_set.empty()) { - REPORT_INNER_ERROR("E19999", "Shape range %s is not valid. Correct example: \"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\"", - shape_range.c_str()); - GELOGE(PARAM_INVALID, "Shape range %s is not valid. Correct example: \"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\"", - shape_range.c_str()); - return PARAM_INVALID; - } - for (auto &shape_range_str : shape_range_set) { - if (shape_range_str.size() < 3) { - // shape_range_str should be "[2~3,1" - // or ",[2~3,1". because we should trim '[' or ',[' - // so shape_range_str.size() < 3 is invalid - continue; - } - // trim start bytes, after that, single input should be "1~20,3,3~6,-1" - if (ge::StringUtils::StartWith(shape_range_str, "[")) { - shape_range_str = shape_range_str.substr(1, shape_range_str.size()); - } - if (ge::StringUtils::StartWith(shape_range_str, ",")) { - shape_range_str = shape_range_str.substr(2, shape_range_str.size()); - } - - // parse shape_range of single input. eg. "1~20,3,3~6,-1" - std::vector> range_of_single_input; - vector dim_range_set = ge::StringUtils::Split(shape_range_str, ','); - for (const auto &range_pair_str : dim_range_set) { - vector range_pair_set = ge::StringUtils::Split(range_pair_str, '~'); - pair range_pair; - if (range_pair_set.size() == 1) { - // fix dim - auto range_value = StringToLongNoThrow(range_pair_set.at(0).c_str()); - if (range_value < 0) { - range_pair = std::make_pair(1, range_value); - } else { - range_pair = std::make_pair(range_value, range_value); - } - } else if (range_pair_set.size() == 2) { - // unknown dim, should get range. - auto range_left = StringToLongNoThrow(range_pair_set.at(0).c_str()); - auto range_right = StringToLongNoThrow(range_pair_set.at(1).c_str()); - if (range_left < 0 || range_right < 0) { - REPORT_INNER_ERROR("E19999", "Shape range of input is invalid. Given range pair [%ld,%ld], " - "while correct example: \"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\"", range_left, range_right); - GELOGE(PARAM_INVALID, - "Shape range of input is invalid. Given range pair [%ld,%ld], while correct example: " - "\"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\"", - range_left, range_right); - return PARAM_INVALID; - } - range_pair = std::make_pair(range_left, range_right); - } else { - REPORT_INNER_ERROR("E19999", "Shape range of input is invalid. Given %s, " - "while correct example: \"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\"", shape_range.c_str()); - GELOGE(PARAM_INVALID, - "Shape range of input is invalid. Given %s, while correct example: \"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\"", - shape_range.c_str()); - return PARAM_INVALID; - } - range_of_single_input.emplace_back(range_pair); - } - range.emplace_back(range_of_single_input); - } - return SUCCESS; -} Status GetDynamicInputShapeRange(const std::vector &user_input, const std::map &graph_option, vector>> &range_vec) { @@ -1114,9 +1020,10 @@ Status GetDynamicInputShapeRange(const std::vector &user_input, const OPTION_EXEC_DYNAMIC_EXECUTE_MODE, OPTION_EXEC_DATA_INPUTS_SHAPE_RANGE); return PARAM_INVALID; } - - auto ret = ParseDynamicInputShapeRange(iter->second, range_vec); - GE_CHK_STATUS_RET(ret, "Parse dynamic input shape range failed."); + if (ParseInputShapeRange(iter->second, range_vec) != SUCCESS) { + GELOGE(PARAM_INVALID, "[Parse][ShapeRange] Parse dynamic input shape range failed."); + return PARAM_INVALID; + } if (range_vec.size() != user_input.size()) { GELOGE(PARAM_INVALID, "Dynamic input shape range size is %zu, inputs size is %zu. Not match.", range_vec.size(), user_input.size()); diff --git a/ge/hybrid/executor/hybrid_model_async_executor.cc b/ge/hybrid/executor/hybrid_model_async_executor.cc index f3f1e1f5..3294a286 100644 --- a/ge/hybrid/executor/hybrid_model_async_executor.cc +++ b/ge/hybrid/executor/hybrid_model_async_executor.cc @@ -19,7 +19,6 @@ #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" #include "graph/ge_context.h" -#include "omm/csa_interact.h" namespace ge { namespace hybrid { @@ -150,10 +149,8 @@ Status HybridModelAsyncExecutor::RunInternal() { Status ret = data_inputer_->Pop(data_wrapper); // Model indeedly start running SetRunningFlag(true); - if (data_wrapper == nullptr || ret != SUCCESS) { - GELOGI("data_wrapper is null!, ret = %u", ret); - continue; - } + GE_IF_BOOL_EXEC(data_wrapper == nullptr || ret != SUCCESS, GELOGI("data_wrapper is null!, ret = %u", ret); + continue); GELOGI("Getting the input data, model_id:%u", model_id_); GE_IF_BOOL_EXEC(!run_flag_, break); @@ -165,7 +162,6 @@ Status HybridModelAsyncExecutor::RunInternal() { ret = PreRun(current_data, args); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( ret != SUCCESS, (void) HandleResult(ret, current_data.index, args, data_wrapper->GetOutput()); - CsaInteract::GetInstance().StoreInternalErrorCode(ret, ERROR_MODULE_FMK, JOBSUBSTATE_GRAPH_EXEC); continue, "[Invoke][PreRun] failed, model_id:%u.", model_id_); // [No need to check value] if (pipe_executor_ != nullptr) { @@ -183,7 +179,6 @@ Status HybridModelAsyncExecutor::RunInternal() { } ret = HandleResult(ret, current_data.index, args, data_wrapper->GetOutput()); if (ret != SUCCESS) { - CsaInteract::GetInstance().StoreInternalErrorCode(ret, ERROR_MODULE_RUNTIME, JOBSUBSTATE_GRAPH_EXEC); continue; } @@ -193,7 +188,6 @@ Status HybridModelAsyncExecutor::RunInternal() { GELOGI("run iterator count is %lu, model_id:%u", iterator_count_, model_id_); } - CsaInteract::GetInstance().WriteInternalErrorCode(); GELOGI("Model run end, model id:%u", model_id_); return SUCCESS; } diff --git a/ge/hybrid/executor/hybrid_model_executor.cc b/ge/hybrid/executor/hybrid_model_executor.cc index ea4e6912..2ab4ed5d 100755 --- a/ge/hybrid/executor/hybrid_model_executor.cc +++ b/ge/hybrid/executor/hybrid_model_executor.cc @@ -112,7 +112,12 @@ Status HybridModelExecutor::ExecuteGraphInternal(SubgraphExecutor &executor, HYBRID_CHK_STATUS_RET(context_.DumpExceptionInfo(exception_infos), "[Execute][GraphInternal] Dump exception info failed."); } - GELOGE(ret, "[Execute][GraphInternal] Synchronize failed."); + if (ret == ge::END_OF_SEQUENCE) { + GELOGD("Got end of sequence"); + } else { + GELOGE(ret, "[Execute][GraphInternal] Synchronize failed."); + } + return ret; } RECORD_MODEL_EXECUTION_EVENT(&context_, "[Synchronize] End"); } diff --git a/ge/hybrid/executor/worker/execution_engine.cc b/ge/hybrid/executor/worker/execution_engine.cc index dcb3f300..d6bbc36d 100755 --- a/ge/hybrid/executor/worker/execution_engine.cc +++ b/ge/hybrid/executor/worker/execution_engine.cc @@ -364,20 +364,28 @@ Status ExecutionEngine::ExecuteAsync(NodeState &node_state, GraphExecutionContext &execution_context) { GELOGI("[%s] Node is ready for execution", task_context->GetNodeName()); RECORD_EXECUTION_EVENT(&execution_context, task_context->GetNodeName(), "Start"); - auto cb = std::shared_ptr(new(std::nothrow) NodeDoneCallback(&execution_context, task_context)); - GE_CHECK_NOTNULL(cb); - auto callback = [task_context, cb]() { - auto ret = cb->OnNodeDone(); - if (ret != SUCCESS) { - task_context->OnError(ret); - } - }; - + std::function callback = nullptr; + GE_CHK_STATUS_RET_NOLOG(InitCallback(task_context, execution_context, callback)); GE_CHK_STATUS_RET_NOLOG(DoExecuteAsync(node_state, *task_context, execution_context, callback)); GE_CHK_STATUS_RET_NOLOG(PropagateOutputs(*node_state.GetNodeItem(), *task_context, execution_context)); return SUCCESS; } +Status ExecutionEngine::InitCallback(const std::shared_ptr &task_context, + GraphExecutionContext &execution_context, std::function &callback) { + if (task_context->NeedCallback()) { + auto cb = std::shared_ptr(new(std::nothrow) NodeDoneCallback(&execution_context, task_context)); + GE_CHECK_NOTNULL(cb); + callback = [task_context, cb]() { + auto ret = cb->OnNodeDone(); + if (ret != SUCCESS) { + task_context->OnError(ret); + } + }; + } + return SUCCESS; +} + Status ExecutionEngine::DoExecuteAsync(NodeState &node_state, TaskContext &task_context, GraphExecutionContext &context, @@ -385,7 +393,7 @@ Status ExecutionEngine::DoExecuteAsync(NodeState &node_state, const auto &task = node_state.GetKernelTask(); if (task == nullptr) { GELOGE(INTERNAL_ERROR, "[Get][KernelTask] of [%s] is null.", node_state.GetName().c_str()); - REPORT_INNER_ERROR("E19999", "GetKernelTask of %s is null.", node_state.GetName().c_str()); + REPORT_INNER_ERROR("E19999", "GetKernelTask of %s failed.", node_state.GetName().c_str()); return INTERNAL_ERROR; } diff --git a/ge/hybrid/executor/worker/execution_engine.h b/ge/hybrid/executor/worker/execution_engine.h index ad80d99b..c10ad729 100644 --- a/ge/hybrid/executor/worker/execution_engine.h +++ b/ge/hybrid/executor/worker/execution_engine.h @@ -35,6 +35,8 @@ class ExecutionEngine { TaskContext &task_context, GraphExecutionContext &context, const std::function &callback); + static Status InitCallback(const std::shared_ptr &task_context, + GraphExecutionContext &execution_context, std::function &callback); }; } // namespace hybrid } // namespace ge diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index 9b3cb692..a047a05b 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -1541,7 +1541,9 @@ Status HybridModelBuilder::IdentifyVariableOutputs(NodeItem &node_item) { src_node->GetName().c_str(), src_op_type.c_str()); uint32_t parent_index = 0; - GE_CHK_STATUS_RET_NOLOG(GetParentNodeOutputIndex(*net_output_desc, in_data_anchor->GetIdx(), parent_index)); + if (GetParentNodeOutputIndex(*net_output_desc, in_data_anchor->GetIdx(), parent_index) != SUCCESS) { + continue; + } GELOGD("Got parent output index = %u", parent_index); if (src_op_type == DATA) { int ref_i = 0; diff --git a/ge/hybrid/node_executor/task_context.cc b/ge/hybrid/node_executor/task_context.cc index 7fa89196..db8fe9fe 100644 --- a/ge/hybrid/node_executor/task_context.cc +++ b/ge/hybrid/node_executor/task_context.cc @@ -561,7 +561,8 @@ const DumpProperties &TaskContext::GetDumpProperties() const { } bool TaskContext::NeedCallback() { - return node_item_->has_observer || IsDumpEnabled() || execution_context_->profiling_level > 0; + return node_item_->has_observer || IsDumpEnabled() || execution_context_->profiling_level > 0 || + !execution_context_->model->IsSingleOp(); } Status TaskContext::Synchronize() { diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index ab7fbb29..39a18fd1 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -42,7 +42,6 @@ #include "graph/manager/graph_mem_allocator.h" #include "graph/manager/host_mem_manager.h" #include "graph/manager/graph_var_manager.h" -#include "omm/csa_interact.h" #include "runtime/kernel.h" #include "opskernel_manager/ops_kernel_builder_manager.h" #include "external/runtime/rt_error_codes.h" @@ -73,7 +72,7 @@ Status GELib::Initialize(const map &options) { return GE_CLI_INIT_FAILED; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kSystemInit); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kSystemInit); map new_options; Status ret = instancePtr_->SetRTSocVersion(options, new_options); if (ret != SUCCESS) { @@ -116,7 +115,7 @@ Status GELib::InnerInitialize(const map &options) { return SUCCESS; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kSystemInit); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kSystemInit); GELOGI("GE System initial."); GE_TIMESTAMP_START(SystemInitialize); Status initSystemStatus = SystemInitialize(options); @@ -127,7 +126,7 @@ Status GELib::InnerInitialize(const map &options) { return initSystemStatus; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kEngineInit); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kEngineInit); GELOGI("engineManager initial."); GE_TIMESTAMP_START(EngineInitialize); Status initEmStatus = engineManager_.Initialize(options); @@ -139,7 +138,7 @@ Status GELib::InnerInitialize(const map &options) { return initEmStatus; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsKernelInit); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsKernelInit); GELOGI("opsManager initial."); GE_TIMESTAMP_START(OpsManagerInitialize); Status initOpsStatus = opsManager_.Initialize(options); @@ -151,7 +150,7 @@ Status GELib::InnerInitialize(const map &options) { return initOpsStatus; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsKernelBuilderInit); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsKernelBuilderInit); GELOGI("opsBuilderManager initial."); GE_TIMESTAMP_START(OpsKernelBuilderManagerInitialize); Status initOpsBuilderStatus = OpsKernelBuilderManager::Instance().Initialize(options); @@ -163,7 +162,7 @@ Status GELib::InnerInitialize(const map &options) { return initOpsBuilderStatus; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); GELOGI("sessionManager initial."); GE_TIMESTAMP_START(SessionManagerInitialize); Status initSmStatus = sessionManager_.Initialize(options); @@ -376,10 +375,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt } GE_CHK_STATUS_RET(HostMemManager::Instance().Initialize()); - // Update CSA file - CsaInteract::GetInstance().Init(options.device_id, GetContext().TraceId()); - Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); - GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret:%u ", ret); // set device id GELOGI("set logical device id:%u", options.device_id); @@ -408,10 +403,6 @@ Status GELib::SystemShutdownWithOptions(const Options &options) { GE_CHK_RT(rtDeviceReset(options.device_id)); - // Update CSA file - Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_SUCCEED); - GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret:%u ", ret); - is_system_inited = false; is_shutdown = true; GELOGI("%s finalize GELib success.", mode.c_str()); @@ -447,7 +438,7 @@ string GELib::GetPath() { return PluginManager::GetPath(); } // Finalize all modules Status GELib::Finalize() { - ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); + ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); GELOGI("finalization start"); // Finalization is not allowed before initialization if (!init_flag_) { diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index 336102d4..c9dfac07 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -32,7 +32,7 @@ #include "graph/utils/type_utils.h" #include "graph/ge_global_options.h" #include "init/gelib.h" -#include "ir_build/atc_ir_common.h" +#include "ir_build/option_utils.h" #include "model/ge_model.h" #include "graph/shape_refiner.h" #include "graph/opsproto_manager.h" @@ -202,12 +202,12 @@ graphStatus aclgrphBuildInitializeImpl(std::map &globa } graphStatus aclgrphBuildInitialize(std::map global_options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); return aclgrphBuildInitializeImpl(global_options); } graphStatus aclgrphBuildInitialize(std::map &global_options) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); std::map tmp_global_options; for (auto &option : global_options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { @@ -222,7 +222,7 @@ graphStatus aclgrphBuildInitialize(std::map &global_ } void aclgrphBuildFinalize() { - ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); + ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); if (ge::GELib::GetInstance() != nullptr && ge::GELib::GetInstance()->InitFlag()) { (void)ge::GELib::GetInstance()->Finalize(); return; @@ -299,10 +299,19 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { GE_CHK_BOOL_EXEC(ParseInputShape(input_shape, shape_map, user_shape_map, true), return GRAPH_PARAM_INVALID, "[Parse][InputShape] failed!"); } - std::map>> shape_range_map; + std::map>> name_shape_range_map; + std::vector>> index_shape_range_map; if (!input_shape_range.empty()) { - GE_CHK_BOOL_EXEC(ParseInputShapeRange(input_shape_range, shape_range_map), - return GRAPH_PARAM_INVALID, "[Parse][InputShapeRange] failed."); + Status ret = GRAPH_PARAM_INVALID; + if (input_shape_range.find(":") != string::npos) { + ret = ParseInputShapeRange(input_shape_range, name_shape_range_map); + } else { + ret = ParseInputShapeRange(input_shape_range, index_shape_range_map); + } + if (ret != SUCCESS) { + GELOGE(GRAPH_PARAM_INVALID, "[Parse][InputShapeRange] parse shape range[%s] failed.", input_shape_range.c_str()); + return GRAPH_PARAM_INVALID; + } } auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); GE_CHECK_NOTNULL(compute_graph); @@ -315,10 +324,14 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { GELOGE(GRAPH_FAILED, "[Update][DataOpShape] fail for op:%s.", op->GetName().c_str()); return GRAPH_FAILED; } - if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { + if (UpdateDataOpShapeRange(op, name_shape_range_map) != SUCCESS) { GELOGE(GRAPH_FAILED, "[Update][DataOpShapeRange] fail for op:%s.", op->GetName().c_str()); return GRAPH_FAILED; - } + } + if (UpdateDataOpShapeRange(op, index_shape_range_map) != SUCCESS) { + GELOGE(GRAPH_FAILED, "[Update][DataOpShapeRange] fail for op:%s.", op->GetName().c_str()); + return GRAPH_FAILED; + } } } @@ -574,7 +587,7 @@ graphStatus Impl::InitDomiOmgContext(const string &input_shape, const string &in } if (!ParseInputShape(input_shape, omg_context_.input_dims, omg_context_.user_input_dims, is_dynamic_input)) { - GELOGE(GRAPH_PARAM_INVALID, "[Parse][InputShape:input_shape] Failed, shape: %s", input_shape.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Parse][InputShape:InputShape] Failed, shape: %s", input_shape.c_str()); return GRAPH_PARAM_INVALID; } return GRAPH_SUCCESS; @@ -582,7 +595,7 @@ graphStatus Impl::InitDomiOmgContext(const string &input_shape, const string &in graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, ModelBufferData &model) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGD("Enter aclmdlBuildModel process!"); Impl builder; return builder.BuildModel(graph, build_options, model); @@ -590,7 +603,7 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, ModelBufferData &model) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); GELOGD("Enter aclmdlBuildModel process!"); std::map tmp_build_options; for (auto &option : build_options) { @@ -608,7 +621,7 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map PATH_MAX || len != strlen(file) || strlen(file) == 0) { @@ -703,7 +716,7 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vector &inputs, const vector &outputs, Graph &graph) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); auto op_type_str = std::string(op_type.GetString()); auto op_name = op_type_str + "_" + std::to_string(ge::GetCurrentTimestamp()); auto op_desc = ge::MakeShared(op_name, op_type_str); @@ -763,7 +776,7 @@ static std::string AttrTypeToSerialString(aclgrphAttrType attr_type) { } graphStatus aclgrphSetOpAttr(Graph &graph, aclgrphAttrType attr_type, const char *cfg_path) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); auto compute_graph = GraphUtils::GetComputeGraph(graph); GE_CHECK_NOTNULL(compute_graph); if (cfg_path == nullptr) { diff --git a/ge/ir_build/atc_ir_common.cc b/ge/ir_build/option_utils.cc similarity index 77% rename from ge/ir_build/atc_ir_common.cc rename to ge/ir_build/option_utils.cc index 6ce6ce7b..1be996b2 100755 --- a/ge/ir_build/atc_ir_common.cc +++ b/ge/ir_build/option_utils.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "atc_ir_common.h" +#include "option_utils.h" #include "common/util/error_manager/error_manager.h" #include "external/ge/ge_api_types.h" #include "framework/common/string_util.h" @@ -22,6 +22,7 @@ #include "graph/compute_graph.h" #include "graph/utils/type_utils.h" #include "graph/utils/tensor_utils.h" +#include "graph/debug/ge_attr_define.h" using std::pair; using std::string; @@ -55,12 +56,15 @@ const char *const kDigitError = "is not digit"; const char *const kCompressWeightError = "it must be appointed when appoint parameter[--optypelist_for_implmode]"; const char *const kSelectImplmodeError = "only support high_performance, high_precision"; const char *const kDynamicBatchSizeError = "It can only contains digit, \",\", \" \""; +const char *const kDynamicImageSizeError = "It can only contains digit, \",\", \" \" and \";\""; const char *const kKeepDtypeError = "file not found"; const char *const kInputShapeRangeInvalid = "format of shape range is invalid"; +const char *const kInputShapeRangeSizeInvalid = " shape range size less than 2 is invalid"; const char *const kShapeRangeValueConvertError = "transfer from string to int64 error"; const char *const kInputShapeRangeSample1 = "\"input_name1:[n1~n2,c1,h1,w1]\""; const char *const kInputShapeRangeSample2 = "\"[1~20]\""; const char *const kInputShapeRangeSample3 = "\"[1~20,3,3~6,-1]\""; +const char *const kInputShapeRangeSample4 = "\"[1~20,3,3~6,-1],[1~20,3,3~6,-1]\""; vector SplitInputShape(const std::string &input_shape) { vector shape_pair_vec; @@ -71,6 +75,67 @@ vector SplitInputShape(const std::string &input_shape) { } return shape_pair_vec; } + +static bool StringToLongNoThrow(const string &str, long &val) { + try { + val = std::stol(str); + return true; + } catch (const std::invalid_argument) { + REPORT_INPUT_ERROR("E10048", std::vector({"shape_range", "reason", "sample"}), + std::vector({str, kShapeRangeValueConvertError, kInputShapeRangeSample3})); + GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s to long failed, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + } catch (const std::out_of_range) { + REPORT_INPUT_ERROR("E10048", std::vector({"shape_range", "reason", "sample"}), + std::vector({str, kShapeRangeValueConvertError, kInputShapeRangeSample3})); + GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s to long failed, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + } + return false; +} + +static bool ParseShapeRangePair(const string &shape_range, + const vector &range_pair_set, + std::pair &range_pair) { + if (range_pair_set.size() == 1) { + long range_value = 0; + if (!StringToLongNoThrow(range_pair_set.at(0), range_value)) { + return false; + } + if (range_value < 0) { + range_pair = std::make_pair(1, range_value); + } else { + range_pair = std::make_pair(range_value, range_value); + } + } else if (range_pair_set.size() == kRangePairSize) { + // unknown dim, should get range. + long range_left = 0; + if (!StringToLongNoThrow(range_pair_set.at(0), range_left)) { + return false; + } + long range_right = 0; + if (!StringToLongNoThrow(range_pair_set.at(1), range_right)) { + return false; + } + if ((range_left < 0) || (range_right < 0)) { + REPORT_INPUT_ERROR("E10048", std::vector({"shape_range", "reason", "sample"}), + std::vector({shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample3})); + GELOGE(PARAM_INVALID, + "[Parse][InputParameter] [--input_shape_range]'s shape range[%s] failed," + "reason: %s, correct sample is %s.", + shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample3); + return false; + } + range_pair = std::make_pair(range_left, range_right); + } else { + REPORT_INPUT_ERROR("E10048", std::vector({"shape_range", "reason", "sample"}), + std::vector({shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample3})); + GELOGE(PARAM_INVALID, "[Parse][Parameter]shape_range:%s invalid, reason: %s, correct sample is %s.", + shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample3); + return false; + } + return true; +} } // namespace Status CheckInputFormat(const string &input_format) { @@ -93,7 +158,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map vector shape = iter->second; if (shape.empty()) { ErrorManager::GetInstance().ATCReportErrMessage("E10012"); - GELOGE(ge::PARAM_INVALID, + GELOGE(ge::PARAM_INVALID, "[Check][DynamicBatchSizeInputShape] shape size can not be less than 1 when set --dynamic_batch_size."); return false; } @@ -110,7 +175,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map if (size == 0) { ErrorManager::GetInstance().ATCReportErrMessage("E10031"); - GELOGE(ge::PARAM_INVALID, + GELOGE(ge::PARAM_INVALID, "[Check][DynamicBatchSizeInputShape]At least one batch n must be equal to -1 when set dynamic_batch_size."); return false; } @@ -170,6 +235,16 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map } EraseEndSemicolon(dynamic_image_size); + for (char c : dynamic_image_size) { + bool is_char_valid = isdigit(c) || (c == ',') || (c == ' ') || (c == ';'); + if (!is_char_valid) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E10033", {"value", "reason"}, {dynamic_image_size, kDynamicImageSizeError}); + GELOGE(ge::PARAM_INVALID, "[Check][DynamicImageSizeInputShape] --dynamic_image_size:%s is invalid. reason: %s", + dynamic_image_size.c_str(), kDynamicImageSizeError); + return false; + } + } // Different parameter sets are split string by ';' std::vector split_set = StringUtils::Split(dynamic_image_size, ';'); // Different dimensions are split by ',' @@ -244,7 +319,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims if (split_set.size() > kMaxDynamicDimNum) { ErrorManager::GetInstance().ATCReportErrMessage( "E10042", {"parameter", "reason"}, {"dynamic_dims", "dynamic_dims's num of parameter set can not exceed 100"}); - GELOGE(ge::PARAM_INVALID, + GELOGE(ge::PARAM_INVALID, "[CheckAndParse][DynamicDims]dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); return false; } @@ -265,7 +340,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--dynamic_dims's parameter", dim.c_str(), "must be positive integer"}); - GELOGE(ge::PARAM_INVALID, + GELOGE(ge::PARAM_INVALID, "[CheckAndParse][DynamicDims]--dynamic_dims:%s parameter must be positive integer.", dynamic_dims.c_str()); return false; @@ -276,24 +351,6 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims return true; } -bool StringToLongNoThrow(const string &str, long &val) { - try { - val = std::stol(str); - return true; - } catch (const std::invalid_argument) { - ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, - {str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); - GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s invalid, reason: %s, correct sample is %s.", - str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); - } catch (const std::out_of_range) { - ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, - {str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); - GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s invalid, reason: %s, correct sample is %s.", - str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); - } - return false; -} - bool ParseSingleShapeRange(std::string &shape_range, vector> &shape_range_vec) { vector square_brackets; for (auto ch : shape_range) { @@ -320,41 +377,8 @@ bool ParseSingleShapeRange(std::string &shape_range, vector range_pair_set = ge::StringUtils::Split(range_pair_str, '~'); pair range_pair; - if (range_pair_set.size() == 1) { - long range_value = 0; - if (!StringToLongNoThrow(range_pair_set.at(0), range_value)) { - return false; - } - if (range_value < 0) { - range_pair = std::make_pair(1, range_value); - } else { - range_pair = std::make_pair(range_value, range_value); - } - } else if (range_pair_set.size() == kRangePairSize) { - // unknown dim, should get range. - long range_left = 0; - if (!StringToLongNoThrow(range_pair_set.at(0), range_left)) { - return false; - } - long range_right = 0; - if (!StringToLongNoThrow(range_pair_set.at(1), range_right)) { - return false; - } - if (range_left < 0 || (range_right < 0)) { - ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, - {shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample3}); - GELOGE(PARAM_INVALID, - "[Parse][InputParameter] [--input_shape_range]'s shape range[%s] failed," - "reason: %s, correct sample is %s.", - shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample3); - return false; - } - range_pair = std::make_pair(range_left, range_right); - } else { - ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, - {shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample3}); - GELOGE(PARAM_INVALID, "[Parse][Parameter]shape_range:%s invalid, reason: %s, correct sample is %s.", - shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample3); + if (!ParseShapeRangePair(shape_range, range_pair_set, range_pair)) { + GELOGE(PARAM_INVALID, "[Parse][RangePair] parse range pair failed."); return false; } shape_range_vec.emplace_back(range_pair); @@ -362,8 +386,13 @@ bool ParseSingleShapeRange(std::string &shape_range, vector>> &shape_range_map) { +/** + * Parser shape_range from string to map + * shape_range from option normally is "input1:[1~20,3,3~6,-1];input2:[1~20,3,3~6,-1]" + * @param shape_range + */ +Status ParseInputShapeRange(const std::string &shape_range, + std::map>> &shape_range_map) { GELOGD("Input shape range %s", shape_range.c_str()); vector shape_range_vec = StringUtils::Split(shape_range, ';'); @@ -373,27 +402,84 @@ bool ParseInputShapeRange(const std::string &shape_range, if (shape_range_pair_vec.size() != DEFAULT_SHAPE_RANGE_PAIR_SIZE) { ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, {shape_range, kSplitError1, kInputShapeRangeSample1}); - GELOGE(PARAM_INVALID, "[Parse][Parameter]--input shape_range:%s invalid, reason: %s, correct sample is %s.", + GELOGE(PARAM_INVALID, "[Parse][Parameter]--input shape_range:%s invalid, reason: %s, correct sample is %s.", shape_range.c_str(), kSplitError1, kInputShapeRangeSample1); - return false; + return PARAM_INVALID; } if (shape_range_pair_vec[1].empty()) { ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape", "reason", "sample"}, {shape_range, kEmptyError, kInputShapeRangeSample1}); GELOGE(PARAM_INVALID, "[Parse][Parameter]shape_range:%s invalid,reason: %s, correct sample is %s.", shape_range.c_str(), kEmptyError, kInputShapeRangeSample1); - return false; + return PARAM_INVALID; } string shape_range_str = shape_range_pair_vec[1]; vector> shape_range_val; if (!ParseSingleShapeRange(shape_range_str, shape_range_val)) { GELOGE(PARAM_INVALID, "[Parse][Parameter] shape_range_str: %s invalid.", shape_range_str.c_str()); - return false; + return PARAM_INVALID; } shape_range_map.emplace(make_pair(StringUtils::Trim(shape_range_pair_vec[0]), shape_range_val)); } - return true; + return SUCCESS; +} + +/** + * Parser shape_range from string to vector + * shape_range from option normally is "[1~20,3,3~6,-1],[1~20,3,3~6,-1]" + * @param shape_range + */ +Status ParseInputShapeRange(const std::string &shape_range, + std::vector>> &range) { + GELOGD("Input shape range %s", shape_range.c_str()); + + if (shape_range.size() < 2) { + REPORT_INPUT_ERROR("E10048", std::vector({"shape_range", "reason", "sample"}), + std::vector({shape_range, kInputShapeRangeSizeInvalid, kInputShapeRangeSample4})); + GELOGE(PARAM_INVALID, "[Parse][ShapeRange] str:%s invalid, reason: %s, correct sample is %s.", + shape_range.c_str(), kInputShapeRangeSizeInvalid, kInputShapeRangeSample4); + return PARAM_INVALID; + } + // different shape_range of single input are split by ']' + vector shape_range_set = ge::StringUtils::Split(shape_range, ']'); + if (shape_range_set.empty()) { + REPORT_INPUT_ERROR("E10048", std::vector({"shape_range", "reason", "sample"}), + std::vector({shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample4})); + GELOGE(PARAM_INVALID, "[Parse][ShapeRange] str:%s invalid, reason: %s, correct sample is %s.", + shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample4); + return PARAM_INVALID; + } + for (auto &shape_range_str : shape_range_set) { + if (shape_range_str.size() < 3) { + // shape_range_str should be "[2~3,1" + // or ",[2~3,1". because we should trim '[' or ',[' + // so shape_range_str.size() < 3 is invalid + continue; + } + // trim start bytes, after that, single input should be "1~20,3,3~6,-1" + if (ge::StringUtils::StartWith(shape_range_str, "[")) { + shape_range_str = shape_range_str.substr(1, shape_range_str.size()); + } + if (ge::StringUtils::StartWith(shape_range_str, ",")) { + shape_range_str = shape_range_str.substr(2, shape_range_str.size()); + } + + // parse shape_range of single input. eg. "1~20,3,3~6,-1" + std::vector> range_of_single_input; + vector dim_range_set = ge::StringUtils::Split(shape_range_str, ','); + for (const auto &range_pair_str : dim_range_set) { + vector range_pair_set = ge::StringUtils::Split(range_pair_str, '~'); + pair range_pair; + if (!ParseShapeRangePair(shape_range_str, range_pair_set, range_pair)) { + GELOGE(PARAM_INVALID, "[Parse][RangePair] Parse range pair failed."); + return PARAM_INVALID; + } + range_of_single_input.emplace_back(range_pair); + } + range.emplace_back(range_of_single_input); + } + return SUCCESS; } Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_image_size, string &dynamic_dims, @@ -409,11 +495,13 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i } if (param_size == 0) { - if (!input_shape_range.empty()) { - std::map>> shape_range_map; - if (!ParseInputShapeRange(input_shape_range, shape_range_map)) { - GELOGE(ge::PARAM_INVALID, "[Parse][InputShapeRange] failed, range: %s", input_shape_range.c_str()); - return ge::PARAM_INVALID; + if (input_shape_range.find(":") != string::npos) { + if (!input_shape_range.empty()) { + std::map>> shape_range_map; + if (ParseInputShapeRange(input_shape_range, shape_range_map) != SUCCESS) { + GELOGE(ge::PARAM_INVALID, "[Parse][InputShapeRange] failed, range: %s", input_shape_range.c_str()); + return ge::PARAM_INVALID; + } } } return ge::SUCCESS; @@ -608,6 +696,11 @@ Status CheckKeepTypeParamValid(const std::string &keep_dtype) { int CheckLogParamValidAndSetLogLevel(const std::string log) { int ret = -1; + char *npu_collect_path = std::getenv("NPU_COLLECT_PATH"); + if (npu_collect_path != nullptr && log == "null") { + return 0; + } + if (log == "default") { ret = 0; } else if (log == "null") { @@ -733,10 +826,10 @@ Status UpdateDataOpShape(const OpDescPtr &op, map> &shap } Status UpdateDataOpShapeRange(const OpDescPtr &op, - map>> &shape_range_map) { + const map>> &name_shape_range_map) { GE_CHECK_NOTNULL(op); - if (shape_range_map.empty()) { - GELOGI("Shape range map of data op [%s] is empty.", op->GetName().c_str()); + if (name_shape_range_map.empty()) { + GELOGI("Shape range name map of data op [%s] is empty.", op->GetName().c_str()); return SUCCESS; } @@ -746,8 +839,8 @@ Status UpdateDataOpShapeRange(const OpDescPtr &op, GE_CHECK_NOTNULL(tensor_output); string data_op_name = op->GetName(); auto origin_shape = tensor_input->GetShape(); - auto iter = shape_range_map.find(data_op_name); - if (iter != shape_range_map.end()) { + auto iter = name_shape_range_map.find(data_op_name); + if (iter != name_shape_range_map.end()) { auto cur_shape_range = iter->second; if (TensorUtils::CheckShapeByShapeRange(origin_shape, cur_shape_range) != SUCCESS) { GELOGE(PARAM_INVALID, "[Check][OpDescPtr] Check shape by shape range failed for op:%s.", data_op_name.c_str()); @@ -772,6 +865,56 @@ Status UpdateDataOpShapeRange(const OpDescPtr &op, return SUCCESS; } +Status UpdateDataOpShapeRange(const OpDescPtr &op, + const vector>> &index_shape_range_map) { + GE_CHECK_NOTNULL(op); + if (index_shape_range_map.empty()) { + GELOGI("Shape range index map of data op [%s] is empty.", op->GetName().c_str()); + return SUCCESS; + } + + GeAttrValue::INT index = 0; + if (!AttrUtils::GetInt(op, ATTR_NAME_INDEX, index)) { + GELOGW("[%s] Get index from data attr failed.", op->GetName().c_str()); + return SUCCESS; + } + + if ((index < 0) || (static_cast(index) >= index_shape_range_map.size())) { + std::string situation = "data op index[" + std::to_string(index) + "]"; + std::string reason = "it must less than user_input size[" + std::to_string(index_shape_range_map.size()) + "]"; + REPORT_INPUT_ERROR("E19025", std::vector({"situation", "reason"}), + std::vector({situation, reason})); + GELOGE(PARAM_INVALID, "user_input size = %zu, graph data op index = %ld.", index_shape_range_map.size(), index); + return FAILED; + } + + auto tensor_input = op->MutableInputDesc(0); + auto tensor_output = op->MutableOutputDesc(0); + GE_CHECK_NOTNULL(tensor_input); + GE_CHECK_NOTNULL(tensor_output); + string data_op_name = op->GetName(); + auto origin_shape = tensor_input->GetShape(); + auto cur_shape_range = index_shape_range_map[index]; + if (TensorUtils::CheckShapeByShapeRange(origin_shape, cur_shape_range) != SUCCESS) { + GELOGE(PARAM_INVALID, "[Check][OpDescPtr] Check shape by shape range failed for op:%s.", data_op_name.c_str()); + return PARAM_INVALID; + } + for (size_t idx = 0; idx < cur_shape_range.size(); ++idx) { + auto left_range = cur_shape_range[idx].first; + auto right_range = cur_shape_range[idx].second; + if (left_range != right_range) { + origin_shape.SetDim(idx, UNKNOWN_DIM); + } + } + tensor_input->SetShape(origin_shape); + tensor_input->SetShapeRange(cur_shape_range); + tensor_output->SetShape(origin_shape); + tensor_output->SetShapeRange(cur_shape_range); + GELOGI("Update input [%s] shape range info success.", data_op_name.c_str()); + + return SUCCESS; +} + static Status CheckInputShapeRangeNode(const ComputeGraphPtr &compute_graph, const map>> &shape_range_map) { for (const auto &it : shape_range_map) { @@ -802,7 +945,7 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co GE_CHECK_NOTNULL(compute_graph); map>> shape_range_map; - if (!ParseInputShapeRange(input_shape_range, shape_range_map)) { + if (ParseInputShapeRange(input_shape_range, shape_range_map) != SUCCESS) { GELOGE(PARAM_INVALID, "[Parse][InputShapeRange] input_shape_range:%s invalid.", input_shape_range.c_str()); return PARAM_INVALID; } diff --git a/ge/ir_build/atc_ir_common.h b/ge/ir_build/option_utils.h similarity index 87% rename from ge/ir_build/atc_ir_common.h rename to ge/ir_build/option_utils.h index 6ff40547..44504e35 100644 --- a/ge/ir_build/atc_ir_common.h +++ b/ge/ir_build/option_utils.h @@ -64,8 +64,10 @@ Status CheckDynamicInputParamValid(std::string &dynamic_batch_size, std::string bool ParseInputShape(const std::string &input_shape, std::map> &shape_map, std::vector>> &user_shape_map, bool is_dynamic_input = false); -bool ParseInputShapeRange(const std::string &shape_range, - std::map>> &shape_range_map); +Status ParseInputShapeRange(const std::string &shape_range, + std::map>> &shape_range_map); +Status ParseInputShapeRange(const std::string &shape_range, + std::vector>> &range); Status CheckOutputTypeParamValid(const std::string output_type); Status CheckBufferOptimizeParamValid(const std::string buffer_optimize); @@ -80,8 +82,10 @@ Status CheckKeepTypeParamValid(const std::string &keep_dtype); void PrintOptionMap(std::map &options, std::string tips); void EraseEndSemicolon(std::string ¶m); Status UpdateDataOpShape(const OpDescPtr &op, std::map> &shape_map); +Status UpdateDataOpShapeRange( + const OpDescPtr &op, const std::map>> &name_shape_range_map); Status UpdateDataOpShapeRange(const OpDescPtr &op, - std::map>> &shape_range_map); + const std::vector>> &index_shape_range_map); Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, const string &input_shape_range); } #endif // FRAMEWORK_DOMI_ATC_IR_COMMON_H_ diff --git a/ge/model/ge_root_model.h b/ge/model/ge_root_model.h index 8c44272d..b8ff7b7a 100755 --- a/ge/model/ge_root_model.h +++ b/ge/model/ge_root_model.h @@ -40,12 +40,14 @@ class GeRootModel { } uint32_t GetModelId() const { return model_id_; } - std::vector GetAllModelId() const { return model_ids_; } - void SetModelName(const std::string &model_name) { model_name_ = model_name; } - + const std::string &GetModelName() const { return model_name_; } - + + std::vector GetAllModelId() const { return model_ids_; } + + void ClearAllModelId() { model_ids_.clear(); } + Status CheckIsUnknownShape(bool &is_dynamic_shape); void SetRootGraph(ComputeGraphPtr graph) { root_graph_ = graph; } diff --git a/ge/offline/CMakeLists.txt b/ge/offline/CMakeLists.txt index 87589859..2a0f0ff0 100644 --- a/ge/offline/CMakeLists.txt +++ b/ge/offline/CMakeLists.txt @@ -11,7 +11,7 @@ set(SRC_LIST "main.cc" "single_op_parser.cc" "../session/omg.cc" - "../ir_build/atc_ir_common.cc" + "../ir_build/option_utils.cc" ) ############ atc_atc.bin ############ diff --git a/ge/offline/main.cc b/ge/offline/main.cc index 54a1d8fb..6603a3f5 100755 --- a/ge/offline/main.cc +++ b/ge/offline/main.cc @@ -36,7 +36,7 @@ #include "graph/utils/graph_utils.h" #include "graph/utils/type_utils.h" #include "init/gelib.h" -#include "ir_build/atc_ir_common.h" +#include "ir_build/option_utils.h" #include "omg/omg.h" #include "omg/parser/parser_factory.h" #include "omg/parser/parser_inner_ctx.h" @@ -220,6 +220,8 @@ DEFINE_string(performance_mode, "", "Optional; express high compile performance "normal: no need to compile, used saved .o files directly;" "high: need to recompile, high execute performance mode."); +DEFINE_string(device_id, "0", "Optional; user device id"); + class GFlagUtils { public: /** @@ -579,7 +581,7 @@ class GFlagUtils { if (fileName.size() > static_cast(PATH_MAX)) { ErrorManager::GetInstance().ATCReportErrMessage( "E10021", {"parameter", "size"}, {"output", std::to_string(PATH_MAX)}); - GELOGE(ge::FAILED, + GELOGE(ge::FAILED, "[Check][Path]Input parameter[--output]'s path is too long, it must be less than %d", PATH_MAX); return false; } @@ -638,7 +640,7 @@ static bool CheckInputFormat() { // only support NCHW ND ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", FLAGS_input_format, kCaffeFormatSupport}); - GELOGE(ge::FAILED, "[Check][InputFormat]Invalid value for --input_format[%s], %s.", + GELOGE(ge::FAILED, "[Check][InputFormat]Invalid value for --input_format[%s], %s.", FLAGS_input_format.c_str(), kCaffeFormatSupport); return false; } else if ((FLAGS_framework == static_cast(domi::TENSORFLOW))) { // tf @@ -648,7 +650,7 @@ static bool CheckInputFormat() { // only support NCHW NHWC ND NCDHW NDHWC ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", FLAGS_input_format, kTFFormatSupport}); - GELOGE(ge::FAILED, "[Check][InputFormat]Invalid value for --input_format[%s], %s.", + GELOGE(ge::FAILED, "[Check][InputFormat]Invalid value for --input_format[%s], %s.", FLAGS_input_format.c_str(), kTFFormatSupport); return false; } else if (FLAGS_framework == static_cast(domi::ONNX)) { @@ -658,7 +660,7 @@ static bool CheckInputFormat() { // only support NCHW ND ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", FLAGS_input_format, kONNXFormatSupport}); - GELOGE(ge::FAILED, "[Check][InputFormat]Invalid value for --input_format[%s], %s.", + GELOGE(ge::FAILED, "[Check][InputFormat]Invalid value for --input_format[%s], %s.", FLAGS_input_format.c_str(), kONNXFormatSupport); return false; } @@ -903,7 +905,7 @@ static Status ConvertModelToJson(int fwk_type, const string &model_file, const s ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--framework", std::to_string(fwk_type), kModelToJsonSupport}); - GELOGE(ge::FAILED, "[Convert][ModelToJson]Invalid value for --framework[%d], %s.", + GELOGE(ge::FAILED, "[Convert][ModelToJson]Invalid value for --framework[%d], %s.", fwk_type, kModelToJsonSupport); ret = ge::FAILED; } @@ -969,7 +971,7 @@ domi::Status GenerateModel(std::map &options, std::string output ge::Graph graph; std::vector inputs; if (FLAGS_framework == domi::MINDSPORE) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); // load model from file ge::Model load_model = ge::Model("loadmodel", "version2"); auto ret1 = load_model.LoadFromFile(FLAGS_model); @@ -1010,12 +1012,12 @@ domi::Status GenerateModel(std::map &options, std::string output atc_params.insert(std::pair(string(ge::OUTPUT_DATATYPE), FLAGS_output_type)); atc_params.insert(std::pair("output", output)); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); Status ret = ParseGraph(graph, atc_params, FLAGS_model.c_str(), FLAGS_weight.c_str(), (domi::FrameworkType)FLAGS_framework, FLAGS_op_name_map.c_str(), FLAGS_target.c_str(), (ge::RunMode)FLAGS_mode, is_dynamic_input); - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); // in ONLY_PRE_CHECK mode, pre-checking report has already saved in ParseGraph if (FLAGS_mode == ge::ONLY_PRE_CHECK) { (void)ge_generator.Finalize(); @@ -1084,6 +1086,7 @@ static void SetEnvForSingleOp(std::map &options) { options.emplace(ge::MDL_BANK_PATH_FLAG, FLAGS_mdl_bank_path); options.emplace(ge::OP_BANK_PATH_FLAG, FLAGS_op_bank_path); options.emplace(ge::PERFORMANCE_MODE, FLAGS_performance_mode); + options.emplace(ge::TUNE_DEVICE_IDS, FLAGS_device_id); } domi::Status GenerateSingleOp(const std::string& json_file_path) { @@ -1114,7 +1117,7 @@ domi::Status GenerateSingleOp(const std::string& json_file_path) { return domi::FAILED; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); vector build_params; if (ge::SingleOpParser::ParseSingleOpList(json_file_path, build_params) != ge::SUCCESS) { DOMI_LOGE("parse single op json file failed"); @@ -1176,6 +1179,7 @@ domi::Status GenerateOmModel() { options.insert(std::pair(string(ge::OUTPUT_NODE_NAME), FLAGS_out_nodes)); options.insert(std::pair(string(ge::INSERT_OP_FILE), FLAGS_insert_op_conf)); options.insert(std::pair(string(ge::PRECISION_MODE), FLAGS_precision_mode)); + options.insert(std::pair(string(ge::TUNE_DEVICE_IDS), FLAGS_device_id)); options.insert(std::pair(string(ge::RUN_FLAG), to_string(0))); options.insert(std::pair(string(ge::TRAIN_FLAG), to_string(0))); @@ -1249,7 +1253,7 @@ domi::Status GenerateOmModel() { return domi::FAILED; } - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); if (FLAGS_display_model_info == "1") { GELOGI("need to display model info."); return ge::ConvertOm(FLAGS_output.c_str(), "", false); @@ -1259,7 +1263,7 @@ domi::Status GenerateOmModel() { } domi::Status ConvertModelToJson() { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); Status ret = GFlagUtils::CheckConverJsonParamFlags(); GE_CHK_BOOL_EXEC(ret == domi::SUCCESS, return domi::FAILED, "[CheckConver][JsonParamFlags] failed!"); @@ -1270,7 +1274,7 @@ domi::Status ConvertModelToJson() { } domi::Status DisplayModelInfo() { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); // No model path passed in GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(FLAGS_om == "", ErrorManager::GetInstance().ATCReportErrMessage("E10004", {"parameter"}, {"om"}); @@ -1319,7 +1323,7 @@ bool CheckRet(domi::Status ret) { } domi::Status ConvertPbtxtToJson() { - ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); Status ret = GFlagUtils::CheckConverJsonParamFlags(); if (ret != domi::SUCCESS) { GELOGE(ge::FAILED, "[CheckConver][JsonParamFlags] failed!"); @@ -1409,7 +1413,7 @@ bool CheckMemInfo() { } int main(int argc, char* argv[]) { - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); + ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); Status ret = domi::SUCCESS; std::cout << "ATC start working now, please wait for a moment." << std::endl; @@ -1450,7 +1454,7 @@ int main(int argc, char* argv[]) { } } while (0); - ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); + ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); if (!CheckRet(ret)) { std::cout << "ATC run failed, Please check the detail log, Try \'atc --help\' for more information" << std::endl; int result = ErrorManager::GetInstance().OutputErrMessage(STDOUT_FILENO); diff --git a/ge/offline/module.mk b/ge/offline/module.mk index 5c7a919c..27c5863a 100755 --- a/ge/offline/module.mk +++ b/ge/offline/module.mk @@ -12,7 +12,7 @@ LOCAL_SRC_FILES := \ main.cc \ single_op_parser.cc \ ../session/omg.cc \ - ../ir_build/atc_ir_common.cc \ + ../ir_build/option_utils.cc \ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../ ./ \ @@ -65,7 +65,7 @@ LOCAL_SRC_FILES := \ main.cc \ single_op_parser.cc \ ../session/omg.cc \ - ../ir_build/atc_ir_common.cc \ + ../ir_build/option_utils.cc \ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../ ./ \ @@ -118,7 +118,7 @@ LOCAL_SRC_FILES := \ main.cc \ single_op_parser.cc \ ../session/omg.cc \ - ../ir_build/atc_ir_common.cc \ + ../ir_build/option_utils.cc \ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../ ./ \ diff --git a/ge/offline/proto/ge_ir.proto b/ge/offline/proto/ge_ir.proto index 12989a54..c0ef3071 100644 --- a/ge/offline/proto/ge_ir.proto +++ b/ge/offline/proto/ge_ir.proto @@ -31,6 +31,8 @@ enum DataType DT_STRING_REF = 24; // string_ref type DT_DUAL = 25; /**< dual output type */ DT_VARIANT = 26; // variant type + DT_BF16 = 27; // bf16 type + DT_INT4 = 28; // int4 type } message AttrDef diff --git a/ge/omm/csa_interact.cc b/ge/omm/csa_interact.cc deleted file mode 100644 index 15bca075..00000000 --- a/ge/omm/csa_interact.cc +++ /dev/null @@ -1,265 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "omm/csa_interact.h" - -#include "framework/common/debug/ge_log.h" -#include "framework/common/debug/log.h" -#include "framework/common/util.h" -#include "graph/ge_context.h" -#include "graph/manager/graph_var_manager.h" -#include "graph/utils/tensor_utils.h" -#include "mmpa/mmpa_api.h" -#include "nlohmann/json.hpp" - -namespace ge { -namespace { -const char FMK_STATUS_FILE_DIR_ENV[] = "FMK_STATUS_FILE_DIR"; -const char JOBSTATE_FILE_NAME[] = "jobstateupdate_framework"; -const char HCOM_DETECT_FILE_NAME[] = "hcom_detection_result"; -const char FILE_SEPARATE[] = "/"; -} // namespace - -/// -/// @brief Obtain CsaInteract instance -/// @return CsaInteract instance -/// -CsaInteract &CsaInteract::GetInstance() { - static CsaInteract instance; - return instance; -} - -/// -/// @brief CsaInteract instance initialization -/// @param [in] dev_index device index -/// @param [in] job_id job id -/// @return void -/// -void CsaInteract::Init(int32_t dev_index, int64_t job_id) { - if (!is_init_) { - dev_index_ = dev_index; - job_id_ = job_id; - - char file_dir_env[MMPA_MAX_PATH] = { 0x00 }; - INT32 res = mmGetEnv(FMK_STATUS_FILE_DIR_ENV, file_dir_env, MMPA_MAX_PATH); - string csa_path_prefix; - if (res == EN_OK) { - csa_path_prefix = file_dir_env; - } - if (!csa_path_prefix.empty()) { - job_state_file_ = csa_path_prefix + std::to_string(dev_index_) + FILE_SEPARATE + JOBSTATE_FILE_NAME; - hcom_detect_file_ = csa_path_prefix + std::to_string(dev_index_) + FILE_SEPARATE + HCOM_DETECT_FILE_NAME; - } - is_init_ = true; - } -} - -/// -/// @brief Update job state file -/// @param [in] job_state job state -/// @param [in] job_sub_state detailed job state -/// @param [in] module_ret_errcode sub module training failure error code -/// @param [in] error_module error module identified by FMK -/// @return Status -/// -Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, uint32_t module_ret_errcode, - ErrorModule error_module) { - if (!is_init_) { - GELOGE(INTERNAL_ERROR, "[Init][CsaInteract] obj has not init, can't WriteJobState"); - REPORT_INNER_ERROR("E19999", "WriteJobState failed before init. "); - return INTERNAL_ERROR; - } - if ((curr_state_ == JOBSTATE_FAILED) || (curr_state_ == JOBSTATE_KILLED)) { - return SUCCESS; - } - - if (job_state_file_.empty()) { - return SUCCESS; - } - - std::string content; - try { - nlohmann::json content_json; - content_json["job_id"] = job_id_; - content_json["jobstate"] = job_state; - // Only the running or running failure state has a job sub state - if ((job_state == JOBSTATE_RUNNING) || (job_state == JOBSTATE_FAILED)) { - content_json["job_sub_state"] = job_sub_state; - } - content_json["time"] = CurrentTimeInStr(); - // Write error code only if run failed - if (job_state == JOBSTATE_FAILED) { - content_json["errorcode"] = module_ret_errcode; - content_json["errmodule"] = error_module; - } - - content = content_json.dump(); - } catch (const nlohmann::json::exception &e) { - GELOGE(INTERNAL_ERROR, "[Create][JsonObject] exception:%s job_state:%u job_sub_state:%u.", - e.what(), job_state, job_sub_state); - REPORT_INNER_ERROR("E19999", "Create json object failed. exception:%s job_state:%u job_sub_state:%u.", - e.what(), job_state, job_sub_state); - return INTERNAL_ERROR; - } - - if (WriteFile(job_state_file_, content) != SUCCESS) { - // The error log subfunction has been printed and will not print again - return INTERNAL_ERROR; - } - - curr_state_ = job_state; - return SUCCESS; -} - -/// -/// @brief Update error code in the job state file -/// @param [in] module_ret_errcode sub module training failure error code -/// @param [in] error_module error module identified by FMK -/// @param [in] job_sub_state detailed job state -/// @return void -/// -void CsaInteract::WriteErrorCode(uint32_t module_ret_errcode, ErrorModule error_module, JobSubState job_sub_state) { - // The error log subfunction has been printed and will not print again - Status ret = WriteJobState(JOBSTATE_FAILED, job_sub_state, module_ret_errcode, error_module); - if (ret != SUCCESS) { - GELOGW("write error code fail. ret_code: %u, status: %u", module_ret_errcode, job_sub_state); - } -} - -/// -/// @brief Record errors that occurred durning the training -/// @param [in] module_ret_errcode sub module training failure error code -/// @param [in] error_module error module identified by FMK -/// @param [in] job_sub_state detailed job state -/// @return void -/// -void CsaInteract::StoreInternalErrorCode(uint32_t module_ret_errcode, ErrorModule error_module, - JobSubState job_sub_state) { - is_have_internal_error_ = true; - - csa_error_code_.module_ret_errcode = module_ret_errcode; - csa_error_code_.error_module = error_module; - csa_error_code_.job_sub_state = job_sub_state; -} - -/// -/// @brief Update training error code in the job state file -/// @return void -/// -void CsaInteract::WriteInternalErrorCode() { - if (is_have_internal_error_) { - WriteErrorCode(csa_error_code_.module_ret_errcode, csa_error_code_.error_module, csa_error_code_.job_sub_state); - } -} - -/// -/// @brief Update network connectivity detect file -/// @param [in] content network connectivity content -/// @return Status -/// -Status CsaInteract::WriteHcomDetection(const std::string &content) { - if (!is_init_) { - GELOGE(INTERNAL_ERROR, "[Init][CsaInteract] obj has not init, can't WriteJobState"); - REPORT_INNER_ERROR("E19999", "WriteHcomDetection failed before init."); - return INTERNAL_ERROR; - } - - if (hcom_detect_file_.empty()) { - return SUCCESS; - } - - return WriteFile(hcom_detect_file_, content); -} - -/// -/// @ingroup WriteFile -/// @brief Write the content into the file. If the file does not exist, create the file -/// @param [in] file_name: File name to be written -/// @param [in] content: Contents to be written -/// @return Status -/// -Status CsaInteract::WriteFile(const std::string &file_name, const std::string &content) { - // if file path is not exist, then make path - INT32 flags = M_WRONLY | O_TRUNC | M_CREAT; - int32_t fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); - if (fd == EN_ERROR) { - if (MakePath(file_name) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "[Create][File Path] errno is %d", errno); - REPORT_CALL_ERROR("E19999", "MakePath failed. errno is %d", errno); - return INTERNAL_ERROR; - } - fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); - if (fd == EN_ERROR) { - GELOGE(INTERNAL_ERROR, "[Open][File] errno is %d file_name: %s", errno, file_name.c_str()); - REPORT_CALL_ERROR("E19999", "mmOpen2 failed. errno is %d file_name: %s", errno, file_name.c_str()); - return INTERNAL_ERROR; - } - } - - mmSsize_t ret = mmWrite(fd, reinterpret_cast(const_cast(content.c_str())), content.length()); - if (ret == EN_ERROR) { - GELOGE(INTERNAL_ERROR, "[Write][File] errno is %d", errno); - REPORT_CALL_ERROR("E19999", "mmWrite failed. errno is %d", errno); - ret = mmClose(fd); - if (ret == EN_ERROR) { - GELOGE(INTERNAL_ERROR, "[Close][File] error is %d", errno); - REPORT_CALL_ERROR("E19999", "mmClose failed. error is %d", errno); - } - return INTERNAL_ERROR; - } - ret = mmClose(fd); - if (ret == EN_ERROR) { - GELOGE(INTERNAL_ERROR, "[Close][File] error is %d", errno); - REPORT_CALL_ERROR("E19999", "mmClose failed. error is %d", errno); - return INTERNAL_ERROR; - } - - return SUCCESS; -} - -/// -/// @ingroup MakePath -/// @brief Verify whether the file path exists, if not, recursively create the folder -/// @param [in] file_name: File name to be verified -/// @return Status -/// -Status CsaInteract::MakePath(const std::string &file_name) { - std::size_t found = file_name.find_last_of("/"); - if (found == std::string::npos) { - return PARAM_INVALID; - } - - std::string file_path = file_name.substr(0, found + 1); - if (mmAccess(file_path.c_str()) == EN_OK) { - return SUCCESS; - } - - found = file_path.find_first_of("/"); - while (found != std::string::npos) { - std::string pre_path = file_path.substr(0, found + 1); - if (mmAccess(pre_path.c_str()) != EN_OK) { - if (mmMkdir(pre_path.c_str(), M_IRWXU) != EN_OK) { - GELOGE(INTERNAL_ERROR, "[Create][FileDir] fail, errno is %d, pre_path:%s", errno, pre_path.c_str()); - REPORT_CALL_ERROR("E19999", "mmMkdir failed. errno is %d pre_path:%s", errno, pre_path.c_str()); - return INTERNAL_ERROR; - } - } - found = file_path.find_first_of("/", found + 1); - } - - return SUCCESS; -} -} // namespace ge diff --git a/ge/omm/csa_interact.h b/ge/omm/csa_interact.h deleted file mode 100644 index 0a609e09..00000000 --- a/ge/omm/csa_interact.h +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef GE_OMM_CSA_INTERACT_H_ -#define GE_OMM_CSA_INTERACT_H_ - -#include - -#include "framework/common/ge_inner_error_codes.h" - -namespace ge { -enum JobState { - JOBSTATE_WAITING = 1, - JOBSTATE_RUNNING, - JOBSTATE_KILLING, - JOBSTATE_SUCCEED, - JOBSTATE_FAILED, - JOBSTATE_KILLED, - JOBSTATE_UNKOWN -}; - -enum JobSubState { - JOBSUBSTATE_ENV_INIT = 201, - JOBSUBSTATE_ENV_FIN, - JOBSUBSTATE_RESOUCE_ALLOC, - JOBSUBSTATE_MODEL_COMPILE, - JOBSUBSTATE_GRAPH_PREPARE, - JOBSUBSTATE_GRAPH_SPLIT, - JOBSUBSTATE_GRAPH_OPTIMIZE, - JOBSUBSTATE_GRAPH_BUILD, - JOBSUBSTATE_GRAPH_LOAD, - JOBSUBSTATE_GRAPH_EXEC, - JOBSUBSTATE_GRAPH_UNLOAD, - JOBSUBSTATE_OTHER -}; - -enum ErrorModule { - ERROR_MODULE_DRIVER = 0x01, - ERROR_MODULE_RUNTIME = 0x04, - ERROR_MODULE_CCE = 0x06, - ERROR_MODULE_FMK = 0x08, - ERROR_MODULE_HCCL = 0x12 -}; - -struct CsaErrorCode { - CsaErrorCode() - : module_ret_errcode(0), - error_module(ERROR_MODULE_FMK), - job_sub_state(JOBSUBSTATE_OTHER) {} - ~CsaErrorCode() {} - uint32_t module_ret_errcode; - ErrorModule error_module; - JobSubState job_sub_state; -}; -class CsaInteract { - public: - /// - /// @brief Obtain CsaInteract instance - /// @return CsaInteract instance - /// - static CsaInteract& GetInstance(); - - /// - /// @brief CsaInteract instance initialization - /// @param [in] dev_index device index - /// @param [in] job_id job id - /// @return void - /// - void Init(int32_t dev_index, int64_t job_id); - - /// - /// @brief Update job state file - /// @param [in] job_state job state - /// @param [in] job_sub_state detailed job state - /// @param [in] module_ret_errcode sub module training failure error code - /// @param [in] error_module error module identified by FMK - /// @return Status - /// - Status WriteJobState(JobState job_state, - JobSubState job_sub_state = JOBSUBSTATE_OTHER, - uint32_t module_ret_errcode = SUCCESS, - ErrorModule error_module = ERROR_MODULE_FMK); - - /// - /// @brief Update error code in the job state file - /// @param [in] module_ret_errcode sub module training failure error code - /// @param [in] error_module error module identified by FMK - /// @param [in] job_sub_state detailed job state - /// @return void - /// - void WriteErrorCode(uint32_t module_ret_errcode, ErrorModule error_module, - JobSubState job_sub_state); - - /// - /// @brief Record errors that occurred durning the training - /// @param [in] module_ret_errcode sub module training failure error code - /// @param [in] error_module error module identified by FMK - /// @param [in] job_sub_state detailed job state - /// @return void - /// - void StoreInternalErrorCode(uint32_t module_ret_errcode, - ErrorModule error_module, - JobSubState job_sub_state); - - /// - /// @brief Update training error code in the job state file - /// @return void - /// - void WriteInternalErrorCode(); - - /// - /// @brief Update network connectivity detect file - /// @param [in] content network connectivity content - /// @return Status - /// - Status WriteHcomDetection(const std::string& content); - - private: - CsaInteract() - : dev_index_(0), - job_id_(0), - is_init_(false), - curr_state_(JOBSTATE_UNKOWN), - is_have_internal_error_(false) {} - - ~CsaInteract() {} - - CsaInteract(const CsaInteract&) = delete; - CsaInteract(CsaInteract&&) = delete; - CsaInteract& operator=(const CsaInteract&) = delete; - CsaInteract& operator=(CsaInteract&&) = delete; - - /// - /// @ingroup WriteFile - /// @brief Write the content into the file. If the file does not exist, create the file - /// @param [in] file_name: File name to be written - /// @param [in] content: Contents to be written - /// @return Status - /// - Status WriteFile(const std::string& file_name, const std::string& content); - - /// - /// @ingroup MakePath - /// @brief Verify whether the file path exists, if not, recursively create the folder - /// @param [in] file_name: File name to be verified - /// @return Status - /// - Status MakePath(const std::string& file_name); - - // device index - int32_t dev_index_; - // job id - int64_t job_id_; - // is initialization complete - bool is_init_; - // current job state - JobState curr_state_; - // job state file - std::string job_state_file_; - // network connectivity detect file - std::string hcom_detect_file_; - // identification of internal errors that occurred during the training - bool is_have_internal_error_; - // error code information - CsaErrorCode csa_error_code_; -}; -} // namespace ge - -#endif // GE_OMM_CSA_INTERACT_H_ - diff --git a/ge/proto/dump_task.proto b/ge/proto/dump_task.proto index ee1c6f47..a2411ddb 100644 --- a/ge/proto/dump_task.proto +++ b/ge/proto/dump_task.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package toolkit.dumpdata; +package toolkit.dump; enum OutputDataType { DT_UNDEFINED = 0; diff --git a/ge/proto/ge_ir.proto b/ge/proto/ge_ir.proto index 12989a54..c0ef3071 100644 --- a/ge/proto/ge_ir.proto +++ b/ge/proto/ge_ir.proto @@ -31,6 +31,8 @@ enum DataType DT_STRING_REF = 24; // string_ref type DT_DUAL = 25; /**< dual output type */ DT_VARIANT = 26; // variant type + DT_BF16 = 27; // bf16 type + DT_INT4 = 28; // int4 type } message AttrDef diff --git a/ge/proto/op_mapping_info.proto b/ge/proto/op_mapping.proto similarity index 97% rename from ge/proto/op_mapping_info.proto rename to ge/proto/op_mapping.proto index 7fb6f84b..d626eb49 100644 --- a/ge/proto/op_mapping_info.proto +++ b/ge/proto/op_mapping.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package aicpu.dump; +package toolkit.aicpu.dump; message Shape { repeated uint64 dim = 1; diff --git a/ge/session/omg.cc b/ge/session/omg.cc index 961bc8c7..ca5043b1 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -38,7 +38,7 @@ #include "graph/debug/ge_attr_define.h" #include "graph/optimize/common/params.h" #include "graph/utils/type_utils.h" -#include "ir_build/atc_ir_common.h" +#include "ir_build/option_utils.h" #include "omg/omg_inner_types.h" #include "omg/parser/model_parser.h" #include "omg/parser/parser_factory.h" @@ -86,7 +86,8 @@ static bool CheckInputTrueOrFalse(const std::string &s, const std::string &atc_p return true; } else { ErrorManager::GetInstance().ATCReportErrMessage("E10005", {"parameter", "value"}, {atc_param, s}); - GELOGE(PARAM_INVALID, "Input parameter[--%s]'s value[%s] must be true or false.", atc_param.c_str(), s.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--%s]'s value[%s] must be true or false.", + atc_param.c_str(), s.c_str()); return false; } } @@ -110,9 +111,8 @@ static Status CheckInputShapeNode(const ComputeGraphPtr &graph, bool is_dynamic_ GE_CHECK_NOTNULL(tensor_desc); for (auto dim : tensor_desc->GetShape().GetDims()) { if (dim < 0) { - GELOGE(PARAM_INVALID, - "Input op [%s] shape %ld is negative, maybe you should set input_shape to specify its shape", - node->GetName().c_str(), dim); + GELOGE(PARAM_INVALID, "[Check][Param]Input op [%s] shape %ld is negative, " + "maybe you should set input_shape to specify its shape", node->GetName().c_str(), dim); const string reason = "maybe you should set input_shape to specify its shape"; ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {node->GetName(), to_string(dim), reason}); @@ -127,12 +127,14 @@ static Status CheckInputShapeNode(const ComputeGraphPtr &graph, bool is_dynamic_ ge::NodePtr node = graph->FindNode(node_name); if (node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage("E10016", {"parameter", "opname"}, {"input_shape", node_name}); - GELOGE(PARAM_INVALID, "Input parameter[--input_shape]'s opname[%s] is not exist in model", node_name.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--input_shape]'s opname[%s] is not exist in model", + node_name.c_str()); return PARAM_INVALID; } if (node->GetType() != DATA) { ErrorManager::GetInstance().ATCReportErrMessage("E10017", {"parameter", "opname"}, {"input_shape", node_name}); - GELOGE(PARAM_INVALID, "Input parameter[--input_shape]'s opname[%s] is not a input opname", node_name.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--input_shape]'s opname[%s] is not a input opname", + node_name.c_str()); return PARAM_INVALID; } } @@ -160,8 +162,8 @@ static Status CheckInputFp16Nodes(const ComputeGraphPtr &graph, const string &in for (auto &s : adjust_fp16_format_vec) { StringUtils::Trim(s); if (!CheckInputTrueOrFalse(s, "is_input_adjust_hw_layout")) { - GELOGE(PARAM_INVALID, "Invalid Param, is_input_adjust_hw_layout only support true/false: but is [%s]", - is_input_adjust_hw_layout.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid Param, is_input_adjust_hw_layout only support true/false:" + "but is [%s]", is_input_adjust_hw_layout.c_str()); return PARAM_INVALID; } } @@ -176,7 +178,7 @@ static Status CheckInputFp16Nodes(const ComputeGraphPtr &graph, const string &in if (node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage("E10016", {"parameter", "opname"}, {"input_fp16_nodes", input_fp16_nodes_vec[i]}); - GELOGE(PARAM_INVALID, "Input parameter[--input_fp16_nodes]'s opname[%s] is not exist in model", + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--input_fp16_nodes]'s opname[%s] is not exist in model", input_fp16_nodes_vec[i].c_str()); return PARAM_INVALID; } @@ -185,7 +187,7 @@ static Status CheckInputFp16Nodes(const ComputeGraphPtr &graph, const string &in if (op_desc->GetType() != DATA) { ErrorManager::GetInstance().ATCReportErrMessage("E10017", {"parameter", "opname"}, {"input_fp16_nodes", input_fp16_nodes_vec[i]}); - GELOGE(PARAM_INVALID, "Input parameter[--input_fp16_nodes]'s opname[%s] is not a input opname", + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--input_fp16_nodes]'s opname[%s] is not a input opname", input_fp16_nodes_vec[i].c_str()); return PARAM_INVALID; } @@ -205,8 +207,8 @@ static Status ParseOutputFp16NodesFormat(const string &is_output_fp16) { for (auto &is_fp16 : node_format_vec) { StringUtils::Trim(is_fp16); if (!CheckInputTrueOrFalse(is_fp16, "is_output_adjust_hw_layout")) { - GELOGE(PARAM_INVALID, "Invalid Param, is_output_adjust_hw_layout only support true/false: but is [%s]", - is_output_fp16.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid Param, is_output_adjust_hw_layout " + "only support true/false: but is [%s]", is_output_fp16.c_str()); return PARAM_INVALID; } if (is_fp16 == "false") { @@ -263,7 +265,8 @@ void FindParserSo(const string &path, vector &file_list, string &caffe_p Status SetOutFormatAndDataTypeAttr(ge::OpDescPtr op_desc, const ge::Format format, const ge::DataType data_type) { if (op_desc == nullptr) { - GELOGE(domi::FAILED, "Input op desc invalid."); + REPORT_INNER_ERROR("E19999", "param op_desc is nullptr, check invalid."); + GELOGE(domi::FAILED, "[Check][Param]Input op desc invalid."); return domi::FAILED; } (void)ge::AttrUtils::SetInt(op_desc, ATTR_NAME_NET_OUTPUT_FORMAT, format); @@ -274,7 +277,7 @@ Status SetOutFormatAndDataTypeAttr(ge::OpDescPtr op_desc, const ge::Format forma bool CheckDigitStr(std::string &str) { for (char c : str) { if (!isdigit(c)) { - GELOGE(domi::FAILED, "value[%s] is not positive integer", str.c_str()); + GELOGE(domi::FAILED, "[Check][Param]value[%s] is not positive integer", str.c_str()); return false; } } @@ -284,18 +287,18 @@ bool CheckDigitStr(std::string &str) { Status StringToInt(std::string &str, int32_t &value) { try { if (!CheckDigitStr(str)) { - GELOGE(PARAM_INVALID, "Invalid of digit string: %s ", str.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid of digit string: %s ", str.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--output_type", str, "is not positive integer"}); return PARAM_INVALID; } value = stoi(str); } catch (std::invalid_argument &) { - GELOGE(PARAM_INVALID, "Invalid of digit string: %s, catch invalid_argument.", str.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid of digit string: %s, catch invalid_argument.", str.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10014", {"parameter", "value"}, {"--output_type", str}); return PARAM_INVALID; } catch (std::out_of_range &) { - GELOGE(PARAM_INVALID, "Invalid of digit string: %s, catch out_of_range.", str.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid of digit string: %s, catch out_of_range.", str.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10013", {"parameter", "value"}, {"--output_type", str}); return PARAM_INVALID; } @@ -314,7 +317,8 @@ Status VerifyOutputTypeAndOutNodes(std::vector &out_type_vec) { if (out_nodes_info.find(out_type_vec[i]) == out_nodes_info.end()) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--output_type", out_type_vec[i], kOutputTypeError}); - GELOGE(domi::FAILED, "Invalid value for --output_type[%s], %s.", out_type_vec[i].c_str(), kOutputTypeError); + GELOGE(domi::FAILED, "[Check][Param]Invalid value for --output_type[%s], %s.", + out_type_vec[i].c_str(), kOutputTypeError); return domi::FAILED; } } @@ -326,7 +330,8 @@ Status CheckOutPutDataTypeSupport(const std::string &output_type) { if (it == output_type_str_to_datatype.end()) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--output_type", output_type, kOutputTypeSupport}); - GELOGE(PARAM_INVALID, "Invalid value for --output_type[%s], %s.", output_type.c_str(), kOutputTypeSupport); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid value for --output_type[%s], %s.", + output_type.c_str(), kOutputTypeSupport); return domi::FAILED; } return domi::SUCCESS; @@ -344,7 +349,7 @@ Status ParseOutputType(const std::string &output_type, std::mapsecond; @@ -383,7 +390,7 @@ Status CheckOutNode(ge::OpDescPtr op_desc, int32_t index) { int32_t out_size = op_desc->GetOutputsSize(); if (index < 0 || index >= out_size) { GELOGE(domi::FAILED, - "out_node [%s] output index:%d must be smaller " + "[Check][Param]out_node [%s] output index:%d must be smaller " "than node output size:%d and can not be negative!", op_desc->GetName().c_str(), index, out_size); std::string fail_reason = "output index:" + to_string(index) + " must be smaller than output size:" + @@ -403,7 +410,7 @@ Status GetDefaultOutInfo(ge::ComputeGraphPtr &compute_graph, if (out_node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage("E10016", {"parameter", "opname"}, {"out_nodes", default_out_nodes[i].first}); - GELOGE(domi::FAILED, "Can not find src node (%s) in graph.", default_out_nodes[i].first.c_str()); + GELOGE(domi::FAILED, "[Check][Param]Can not find src node (%s) in graph.", default_out_nodes[i].first.c_str()); return domi::FAILED; } output_nodes_info.push_back(std::make_pair(out_node, default_out_nodes[i].second)); @@ -432,7 +439,7 @@ Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const std::map> output_node_dt_map; if (!output_type.empty()) { if (ParseOutputType(output_type, output_node_dt_map) != SUCCESS) { - GELOGE(domi::FAILED, "Parse output_type failed."); + GELOGE(domi::FAILED, "[Parse][output_type] failed."); return domi::FAILED; } } @@ -443,13 +450,13 @@ Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const if (out_node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage("E10016", {"parameter", "opname"}, {"out_nodes", user_out_nodes[i].first}); - GELOGE(domi::FAILED, "Can not find src node (%s) in graph.", user_out_nodes[i].first.c_str()); + GELOGE(domi::FAILED, "[Check][Param]Can not find src node (%s) in graph.", user_out_nodes[i].first.c_str()); return domi::FAILED; } auto op_desc = out_node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); if (CheckOutNode(op_desc, user_out_nodes[i].second) != SUCCESS) { - GELOGE(domi::FAILED, "Check out node (%s) fail.", user_out_nodes[i].first.c_str()); + GELOGE(domi::FAILED, "[Check][OutNode] (%s) fail.", user_out_nodes[i].first.c_str()); return domi::FAILED; } @@ -475,7 +482,7 @@ Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const // default output node (leaf) if (user_out_nodes.empty()) { if (GetDefaultOutInfo(compute_graph, output_nodes_info) != SUCCESS) { - GELOGE(domi::FAILED, "Get default output info failed."); + GELOGE(domi::FAILED, "[Get][DefaultOutInfo] failed."); return domi::FAILED; } } @@ -513,7 +520,8 @@ void GetOutputNodesNameAndIndex(std::vector> &ou Status GetOutputLeaf(NodePtr node, std::vector> &output_nodes_info) { ge::OpDescPtr tmpDescPtr = node->GetOpDesc(); if (tmpDescPtr == nullptr) { - GELOGE(domi::FAILED, "Get outnode op desc fail."); + REPORT_INNER_ERROR("E19999", "param node has no opdesc."); + GELOGE(domi::FAILED, "[Check][Param]Get outnode op desc fail."); return domi::FAILED; } size_t size = tmpDescPtr->GetOutputsSize(); @@ -527,7 +535,8 @@ Status GetOutputLeaf(NodePtr node, std::vector> for (auto in_anchor : in_anchors) { auto out_anchor = in_anchor->GetPeerOutAnchor(); if (out_anchor == nullptr) { - GELOGE(domi::FAILED, "Get leaf node op desc fail."); + REPORT_INNER_ERROR("E19999", "GetPeerOutAnchor return nullptr, node:%s.", node->GetName().c_str()); + GELOGE(domi::FAILED, "[Invoke][GetPeerOutAnchor]Get leaf node op desc fail."); return domi::FAILED; } auto out_node = out_anchor->GetOwnerNode(); @@ -557,8 +566,10 @@ Status InitDomiOmgContext(const string &input_shape, const string &input_format, if (iter != ge::input_format_str_to_geformat.end()) { domi::GetContext().format = iter->second; } else { - GELOGE(PARAM_INVALID, "Input format %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", - input_format.c_str()); + REPORT_INNER_ERROR("E19999", "param input_format:%s is not support, " + "expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", input_format.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Input format %s not support, " + "expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", input_format.c_str()); return PARAM_INVALID; } } @@ -572,9 +583,9 @@ Status InitDomiOmgContext(const string &input_shape, const string &input_format, map> &shape_map = domi::GetContext().input_dims; if (!ge::ParseInputShape(input_shape, domi::GetContext().input_dims, domi::GetContext().user_input_dims, - is_dynamic_input) || - shape_map.empty()) { - GELOGE(PARAM_INVALID, "Failed to parse input shape: %s", input_shape.c_str()); + is_dynamic_input) || shape_map.empty()) { + REPORT_CALL_ERROR("E19999", "ParseInputShape failed for %s", input_shape.c_str()); + GELOGE(PARAM_INVALID, "[Parse][InputShape] %s failed.", input_shape.c_str()); return PARAM_INVALID; } @@ -601,7 +612,7 @@ Status ParseOutNodes(const string &out_nodes) { "E10001", {"parameter", "value", "reason"}, {"--out_nodes", node, "the correct format is \"node_name1:0;node_name1:1;node_name2:0\""}); GELOGE(PARAM_INVALID, - "The input format of --out_nodes is invalid, the correct format is " + "[Parse][Param]The input format of --out_nodes is invalid, the correct format is " "\"node_name1:0;node_name1:1;node_name2:0\", while the actual input is %s.", node.c_str()); return PARAM_INVALID; @@ -609,15 +620,16 @@ Status ParseOutNodes(const string &out_nodes) { if (!domi::GetContext().user_out_nodes_top_vec.empty()) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--out_nodes", out_nodes, "is not all index or top_name"}); - GELOGE(PARAM_INVALID, - "This out_nodes str must be all index or top_name, while the actual input is %s", out_nodes.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param]This out_nodes str must be all index or top_name, " + "while the actual input is %s", out_nodes.c_str()); return PARAM_INVALID; } // stoi: The method may throw an exception: invalid_argument/out_of_range if (!CheckDigitStr(key_value_v[1])) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--out_nodes", out_nodes, "is not positive integer"}); - GELOGE(PARAM_INVALID, "This str must be digit string, while the actual input is %s", out_nodes.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param]This str must be digit string, while the actual input is %s", + out_nodes.c_str()); return PARAM_INVALID; } @@ -635,11 +647,11 @@ Status ParseOutNodes(const string &out_nodes) { } } } catch (std::invalid_argument &) { - GELOGE(PARAM_INVALID, "Invalid of out_nodes: %s ", out_nodes.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param]Invalid of out_nodes: %s ", out_nodes.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10014", {"parameter", "value"}, {"--out_nodes", out_nodes}); return PARAM_INVALID; } catch (std::out_of_range &) { - GELOGE(PARAM_INVALID, "Invalid of out_nodes: %s ", out_nodes.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param]Invalid of out_nodes: %s ", out_nodes.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10013", {"parameter", "value"}, {"--out_nodes", out_nodes}); return PARAM_INVALID; } @@ -657,7 +669,8 @@ static Status CheckOpNameMap(const ComputeGraphPtr &graph, const std::string &op for (const NodePtr &node : graph->GetAllNodes()) { auto op_desc = node->GetOpDesc(); if (op_desc == nullptr) { - GELOGE(PARAM_INVALID, "Invalid parameter for opDesc."); + REPORT_INNER_ERROR("E19999", "param graph's node has no opdesc."); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid parameter for opDesc."); return PARAM_INVALID; } graphNodeTypes[op_desc->GetType()] = ""; @@ -666,7 +679,7 @@ static Status CheckOpNameMap(const ComputeGraphPtr &graph, const std::string &op if (propertiesMap.empty()) { ErrorManager::GetInstance().ATCReportErrMessage( "E10003", {"parameter", "value", "reason"}, {"op_name_map", op_conf, "the file content is empty"}); - GELOGE(PARAM_INVALID, "op_name_map file content is empty, please check file!"); + GELOGE(PARAM_INVALID, "[Check][Param]op_name_map file content is empty, please check file!"); return PARAM_INVALID; } for (auto iter = propertiesMap.begin(); iter != propertiesMap.end(); iter++) { @@ -674,7 +687,8 @@ static Status CheckOpNameMap(const ComputeGraphPtr &graph, const std::string &op ErrorManager::GetInstance().ATCReportErrMessage( "E10003", {"parameter", "value", "reason"}, {"op_name_map", op_conf, "type[" + iter->second + "] is not found in model"}); - GELOGE(PARAM_INVALID, "Invalid parameter for op_name_map."); return PARAM_INVALID;); + GELOGE(PARAM_INVALID, "[Find][NodeType]Invalid parameter for op_name_map."); + return PARAM_INVALID;); } return SUCCESS; } @@ -711,15 +725,16 @@ FMK_FUNC_HOST_VISIBILITY Status ParseGraph(ge::Graph &graph, const std::mapCreateModelParser(type); - GE_CHK_BOOL_RET_STATUS(model_parser != nullptr, FAILED, "ATC create model parser ret fail, type:%d.", type); - + if (model_parser == nullptr) { + REPORT_INNER_ERROR("E19999", "CreateModelParser failed, type:%d", type); + GELOGE(FAILED, "[Create][ModelParser] ret fail, type:%d.", type); + return FAILED; + } UpdateParserCtxWithOmgCtx(); Status ret = model_parser->Parse(model_file, graph); UpdateOmgCtxWithParserCtx(); @@ -749,7 +768,8 @@ FMK_FUNC_HOST_VISIBILITY Status ParseGraph(ge::Graph &graph, const std::map(model.model_data); model.model_data = nullptr; @@ -941,7 +963,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js status = omFileLoadHelper.GetModelPartition(MODEL_DEF, ir_part); if (status != ge::GRAPH_SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"}); - GELOGE(ge::FAILED, "Get model part failed."); + GELOGE(ge::FAILED, "[Get][ModelPartition] failed."); if (model.model_data != nullptr) { delete[] reinterpret_cast(model.model_data); model.model_data = nullptr; @@ -967,13 +989,13 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js } else { ret = INTERNAL_ERROR; ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); - GELOGE(ret, "ReadProtoFromArray failed."); + GELOGE(ret, "[Read][Proto]From Array failed."); } } else { ErrorManager::GetInstance().ATCReportErrMessage("E10003", {"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); GELOGE(ACL_ERROR_GE_PARAM_INVALID, - "ParseModelContent failed because of invalid om file. Please check --om param."); + "[Parse][ModelContent] failed because of invalid om file. Please check --om param."); } if (model.model_data != nullptr) { @@ -984,7 +1006,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js } catch (const std::exception &e) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Convert om model to json failed, exception message[" + std::string(e.what()) + "]"}); - GELOGE(FAILED, "Convert om model to json failed, exception message : %s.", e.what()); + GELOGE(FAILED, "[Save][Model]Convert om model to json failed, exception message : %s.", e.what()); return FAILED; } } @@ -1003,7 +1025,8 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const }; if (ret != SUCCESS) { free_model_data(&model.model_data); - GELOGE(ret, "LoadFromFile failed."); + REPORT_CALL_ERROR("E19999", "LoadFromFile failed."); + GELOGE(ret, "[Invoke][LoadFromFile] failed."); return ret; } @@ -1015,7 +1038,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const if (!flag) { free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"}); - GELOGE(FAILED, "ParseFromString failed."); + GELOGE(FAILED, "[Invoke][ParseFromString] failed."); return FAILED; } GetGroupName(model_def); @@ -1024,7 +1047,8 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const ret = ModelSaver::SaveJsonToFile(json_file, j); if (ret != SUCCESS) { free_model_data(&model.model_data); - GELOGE(ret, "Save json to file fail."); + REPORT_CALL_ERROR("E19999", "SaveJsonToFile failed."); + GELOGE(ret, "[Save][Json] to file fail."); return ret; } free_model_data(&model.model_data); @@ -1033,12 +1057,12 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" + std::string(e.what()) + "]"}); - GELOGE(FAILED, "ParseFromString failed. exception message : %s", e.what()); + GELOGE(FAILED, "[Invoke][ParseFromString] failed. exception message : %s", e.what()); return FAILED; } catch (const std::exception &e) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Convert pbtxt to json failed, exception message[" + std::string(e.what()) + "]"}); - GELOGE(FAILED, "Convert pbtxt to json failed, exception message : %s.", e.what()); + GELOGE(FAILED, "[Save][pbtxt]Convert pbtxt to json failed, exception message : %s.", e.what()); return FAILED; } } @@ -1047,16 +1071,19 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertFwkModelToJson(const domi::FrameworkType const char *json_file) { if (framework == domi::CAFFE || framework == domi::TENSORFLOW || framework == domi::ONNX) { auto model_parser = ModelParserFactory::Instance()->CreateModelParser(framework); - GE_CHK_BOOL_RET_STATUS(model_parser != nullptr, FAILED, "ATC create model parser ret fail, framework:%d.", - framework); + if (model_parser == nullptr) { + REPORT_INNER_ERROR("E19999", "CreateModelParser failed, framework:%d.", framework); + GELOGE(FAILED, "[Create][ModelParser] ret fail, framework:%d.", framework); + return FAILED; + } return model_parser->ToJson(model_file, json_file); } ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--framework", std::to_string(framework), "only support 0(Caffe) 3(TensorFlow) 5(Onnx)"}); - GELOGE(PARAM_INVALID, "Input parameter[--framework] is mandatory and it's value must be: 0(Caffe) 3(TensorFlow) " - "or 5(Onnx)."); + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--framework] is mandatory " + "and it's value must be: 0(Caffe) 3(TensorFlow) or 5(Onnx)."); return PARAM_INVALID; } @@ -1072,7 +1099,8 @@ FMK_FUNC_HOST_VISIBILITY Status DumpInfershapeJson(const ge::Graph &graph, const if (buffer.GetData() != nullptr) { std::string str(reinterpret_cast(buffer.GetData()), buffer.GetSize()); if (!ge_proto.ParseFromString(str)) { - GELOGE(GRAPH_FAILED, "parse from string failed."); + REPORT_CALL_ERROR("E19999", "ParseFromString failed."); + GELOGE(GRAPH_FAILED, "[Invoke][ParseFromString] failed."); return FAILED; } diff --git a/ge/single_op/single_op_manager.cc b/ge/single_op/single_op_manager.cc index 667e987b..180b50c1 100644 --- a/ge/single_op/single_op_manager.cc +++ b/ge/single_op/single_op_manager.cc @@ -67,6 +67,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status SingleOpManager::Release std::lock_guard lock(mutex_); auto it = stream_resources_.find(resource_id); if (it == stream_resources_.end()) { + MemManager::Instance().CachingInstance(RT_MEMORY_HBM).TryFreeBlocks(); return SUCCESS; } delete it->second; diff --git a/inc/external/acl/acl.h b/inc/external/acl/acl.h index a53d029d..8d261201 100644 --- a/inc/external/acl/acl.h +++ b/inc/external/acl/acl.h @@ -26,9 +26,9 @@ extern "C" { #endif // Current version is 1.0.0 -#define ACL_MAJOR_VERSION 1 -#define ACL_MINOR_VERSION 0 -#define ACL_PATCH_VERSION 0 +#define ACL_MAJOR_VERSION 1 +#define ACL_MINOR_VERSION 0 +#define ACL_PATCH_VERSION 0 /** * @ingroup AscendCL @@ -72,11 +72,11 @@ ACL_FUNC_VISIBILITY aclError aclrtGetVersion(int32_t *majorVersion, int32_t *min * * @retval null for failed * @retval OtherValues success -*/ + */ ACL_FUNC_VISIBILITY const char *aclGetRecentErrMsg(); #ifdef __cplusplus } #endif -#endif // INC_EXTERNAL_ACL_ACL_H_ +#endif // INC_EXTERNAL_ACL_ACL_H_ diff --git a/inc/external/acl/acl_base.h b/inc/external/acl/acl_base.h index 417a80c8..64d4bd81 100644 --- a/inc/external/acl/acl_base.h +++ b/inc/external/acl/acl_base.h @@ -136,50 +136,49 @@ static const int ACL_ERROR_PROFILING_FAILURE = 500005; #define ACL_UNKNOWN_RANK 0xFFFFFFFFFFFFFFFE typedef enum { - ACL_DT_UNDEFINED = -1, - ACL_FLOAT = 0, - ACL_FLOAT16 = 1, - ACL_INT8 = 2, - ACL_INT32 = 3, - ACL_UINT8 = 4, - ACL_INT16 = 6, - ACL_UINT16 = 7, - ACL_UINT32 = 8, - ACL_INT64 = 9, - ACL_UINT64 = 10, - ACL_DOUBLE = 11, - ACL_BOOL = 12, - ACL_STRING = 13, + ACL_DT_UNDEFINED = -1, + ACL_FLOAT = 0, + ACL_FLOAT16 = 1, + ACL_INT8 = 2, + ACL_INT32 = 3, + ACL_UINT8 = 4, + ACL_INT16 = 6, + ACL_UINT16 = 7, + ACL_UINT32 = 8, + ACL_INT64 = 9, + ACL_UINT64 = 10, + ACL_DOUBLE = 11, + ACL_BOOL = 12, + ACL_STRING = 13, } aclDataType; typedef enum { - ACL_FORMAT_UNDEFINED = -1, - ACL_FORMAT_NCHW = 0, - ACL_FORMAT_NHWC = 1, - ACL_FORMAT_ND = 2, - ACL_FORMAT_NC1HWC0 = 3, - ACL_FORMAT_FRACTAL_Z = 4, - ACL_FORMAT_NC1HWC0_C04 = 12, - ACL_FORMAT_NDHWC = 27, - ACL_FORMAT_FRACTAL_NZ = 29, - ACL_FORMAT_NCDHW = 30, - ACL_FORMAT_NDC1HWC0 = 32, - ACL_FRACTAL_Z_3D = 33 + ACL_FORMAT_UNDEFINED = -1, + ACL_FORMAT_NCHW = 0, + ACL_FORMAT_NHWC = 1, + ACL_FORMAT_ND = 2, + ACL_FORMAT_NC1HWC0 = 3, + ACL_FORMAT_FRACTAL_Z = 4, + ACL_FORMAT_NC1HWC0_C04 = 12, + ACL_FORMAT_NDHWC = 27, + ACL_FORMAT_FRACTAL_NZ = 29, + ACL_FORMAT_NCDHW = 30, + ACL_FORMAT_NDC1HWC0 = 32, + ACL_FRACTAL_Z_3D = 33 } aclFormat; typedef enum { - ACL_DEBUG = 0, - ACL_INFO = 1, - ACL_WARNING = 2, - ACL_ERROR = 3, + ACL_DEBUG = 0, + ACL_INFO = 1, + ACL_WARNING = 2, + ACL_ERROR = 3, } aclLogLevel; typedef enum { - ACL_MEMTYPE_DEVICE = 0, - ACL_MEMTYPE_HOST = 1, + ACL_MEMTYPE_DEVICE = 0, + ACL_MEMTYPE_HOST = 1, } aclMemType; - /** * @ingroup AscendCL * @brief Converts data of type aclFloat16 to data of type float @@ -312,9 +311,7 @@ ACL_FUNC_VISIBILITY size_t aclDataTypeSize(aclDataType dataType); * @retval aclTensorDesc pointer. * @retval nullptr if param is invalid or run out of memory */ -ACL_FUNC_VISIBILITY aclTensorDesc *aclCreateTensorDesc(aclDataType dataType, - int numDims, - const int64_t *dims, +ACL_FUNC_VISIBILITY aclTensorDesc *aclCreateTensorDesc(aclDataType dataType, int numDims, const int64_t *dims, aclFormat format); /** @@ -336,8 +333,7 @@ ACL_FUNC_VISIBILITY void aclDestroyTensorDesc(const aclTensorDesc *desc); * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclSetTensorShapeRange(aclTensorDesc* desc, - size_t dimsCount, +ACL_FUNC_VISIBILITY aclError aclSetTensorShapeRange(aclTensorDesc *desc, size_t dimsCount, int64_t dimsRange[][ACL_TENSOR_SHAPE_RANGE_NUM]); /** @@ -434,9 +430,7 @@ ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimV2(const aclTensorDesc *desc, si * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimRange(const aclTensorDesc *desc, - size_t index, - size_t dimRangeNum, +ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimRange(const aclTensorDesc *desc, size_t index, size_t dimRangeNum, int64_t *dimRange); /** @@ -473,7 +467,7 @@ ACL_FUNC_VISIBILITY const char *aclGetTensorDescName(aclTensorDesc *desc); * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclTransTensorDescFormat(const aclTensorDesc *srcDesc, aclFormat dstFormat, - aclTensorDesc **dstDesc); + aclTensorDesc **dstDesc); /** * @ingroup AscendCL @@ -561,7 +555,7 @@ ACL_FUNC_VISIBILITY aclError aclSetTensorOriginShape(aclTensorDesc *desc, int nu * * @retval null for failed. * @retval OtherValues success. -*/ + */ ACL_FUNC_VISIBILITY aclTensorDesc *aclGetTensorDescByIndex(aclTensorDesc *desc, size_t index); /** @@ -572,7 +566,7 @@ ACL_FUNC_VISIBILITY aclTensorDesc *aclGetTensorDescByIndex(aclTensorDesc *desc, * * @retval null for failed * @retval OtherValues success -*/ + */ ACL_FUNC_VISIBILITY void *aclGetTensorDescAddress(const aclTensorDesc *desc); /** @@ -624,7 +618,7 @@ ACL_FUNC_VISIBILITY aclError aclSetTensorPlaceMent(aclTensorDesc *desc, aclMemTy * @param ... [IN] the value of current log */ ACL_FUNC_VISIBILITY void aclAppLog(aclLogLevel logLevel, const char *func, const char *file, uint32_t line, - const char *fmt, ...); + const char *fmt, ...); /** * @ingroup AscendCL @@ -632,14 +626,13 @@ ACL_FUNC_VISIBILITY void aclAppLog(aclLogLevel logLevel, const char *func, const * * @retval null for failed * @retval OtherValues success -*/ + */ ACL_FUNC_VISIBILITY const char *aclrtGetSocName(); -#define ACL_APP_LOG(level, fmt, ...) \ - aclAppLog(level, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__) +#define ACL_APP_LOG(level, fmt, ...) aclAppLog(level, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__) #ifdef __cplusplus } #endif -#endif // INC_EXTERNAL_ACL_ACL_BASE_H_ +#endif // INC_EXTERNAL_ACL_ACL_BASE_H_ diff --git a/inc/external/acl/acl_mdl.h b/inc/external/acl/acl_mdl.h index e2f95a56..88f85cb3 100644 --- a/inc/external/acl/acl_mdl.h +++ b/inc/external/acl/acl_mdl.h @@ -27,19 +27,19 @@ extern "C" { #endif -#define ACL_MAX_DIM_CNT 128 -#define ACL_MAX_TENSOR_NAME_LEN 128 -#define ACL_MAX_BATCH_NUM 128 -#define ACL_MAX_HW_NUM 128 -#define ACL_MAX_SHAPE_COUNT 128 -#define ACL_INVALID_NODE_INDEX 0xFFFFFFFF - -#define ACL_MDL_LOAD_FROM_FILE 1 -#define ACL_MDL_LOAD_FROM_FILE_WITH_MEM 2 -#define ACL_MDL_LOAD_FROM_MEM 3 -#define ACL_MDL_LOAD_FROM_MEM_WITH_MEM 4 -#define ACL_MDL_LOAD_FROM_FILE_WITH_Q 5 -#define ACL_MDL_LOAD_FROM_MEM_WITH_Q 6 +#define ACL_MAX_DIM_CNT 128 +#define ACL_MAX_TENSOR_NAME_LEN 128 +#define ACL_MAX_BATCH_NUM 128 +#define ACL_MAX_HW_NUM 128 +#define ACL_MAX_SHAPE_COUNT 128 +#define ACL_INVALID_NODE_INDEX 0xFFFFFFFF + +#define ACL_MDL_LOAD_FROM_FILE 1 +#define ACL_MDL_LOAD_FROM_FILE_WITH_MEM 2 +#define ACL_MDL_LOAD_FROM_MEM 3 +#define ACL_MDL_LOAD_FROM_MEM_WITH_MEM 4 +#define ACL_MDL_LOAD_FROM_FILE_WITH_Q 5 +#define ACL_MDL_LOAD_FROM_MEM_WITH_Q 6 #define ACL_DYNAMIC_TENSOR_NAME "ascend_mbatch_shape_data" #define ACL_DYNAMIC_AIPP_NAME "ascend_dynamic_aipp_data" @@ -51,123 +51,123 @@ typedef struct aclAippExtendInfo aclAippExtendInfo; typedef struct aclmdlConfigHandle aclmdlConfigHandle; typedef enum { - ACL_YUV420SP_U8 = 1, - ACL_XRGB8888_U8, - ACL_RGB888_U8, - ACL_YUV400_U8, - ACL_NC1HWC0DI_FP16, - ACL_NC1HWC0DI_S8, - ACL_ARGB8888_U8, - ACL_YUYV_U8, - ACL_YUV422SP_U8, - ACL_AYUV444_U8, - ACL_RAW10, - ACL_RAW12, - ACL_RAW16, - ACL_RAW24, - ACL_AIPP_RESERVED = 0xffff, + ACL_YUV420SP_U8 = 1, + ACL_XRGB8888_U8, + ACL_RGB888_U8, + ACL_YUV400_U8, + ACL_NC1HWC0DI_FP16, + ACL_NC1HWC0DI_S8, + ACL_ARGB8888_U8, + ACL_YUYV_U8, + ACL_YUV422SP_U8, + ACL_AYUV444_U8, + ACL_RAW10, + ACL_RAW12, + ACL_RAW16, + ACL_RAW24, + ACL_AIPP_RESERVED = 0xffff, } aclAippInputFormat; typedef enum { - ACL_MDL_PRIORITY_INT32 = 0, - ACL_MDL_LOAD_TYPE_SIZET, - ACL_MDL_PATH_PTR, /**< pointer to model load path with deep copy */ - ACL_MDL_MEM_ADDR_PTR, /**< pointer to model memory with shallow copy */ - ACL_MDL_MEM_SIZET, - ACL_MDL_WEIGHT_ADDR_PTR, /**< pointer to weight memory of model with shallow copy */ - ACL_MDL_WEIGHT_SIZET, - ACL_MDL_WORKSPACE_ADDR_PTR, /**< pointer to worksapce memory of model with shallow copy */ - ACL_MDL_WORKSPACE_SIZET, - ACL_MDL_INPUTQ_NUM_SIZET, - ACL_MDL_INPUTQ_ADDR_PTR, /**< pointer to inputQ with shallow copy */ - ACL_MDL_OUTPUTQ_NUM_SIZET, - ACL_MDL_OUTPUTQ_ADDR_PTR /**< pointer to outputQ with shallow copy */ + ACL_MDL_PRIORITY_INT32 = 0, + ACL_MDL_LOAD_TYPE_SIZET, + ACL_MDL_PATH_PTR, /**< pointer to model load path with deep copy */ + ACL_MDL_MEM_ADDR_PTR, /**< pointer to model memory with shallow copy */ + ACL_MDL_MEM_SIZET, + ACL_MDL_WEIGHT_ADDR_PTR, /**< pointer to weight memory of model with shallow copy */ + ACL_MDL_WEIGHT_SIZET, + ACL_MDL_WORKSPACE_ADDR_PTR, /**< pointer to worksapce memory of model with shallow copy */ + ACL_MDL_WORKSPACE_SIZET, + ACL_MDL_INPUTQ_NUM_SIZET, + ACL_MDL_INPUTQ_ADDR_PTR, /**< pointer to inputQ with shallow copy */ + ACL_MDL_OUTPUTQ_NUM_SIZET, + ACL_MDL_OUTPUTQ_ADDR_PTR /**< pointer to outputQ with shallow copy */ } aclmdlConfigAttr; typedef enum { - ACL_DATA_WITHOUT_AIPP = 0, - ACL_DATA_WITH_STATIC_AIPP, - ACL_DATA_WITH_DYNAMIC_AIPP, - ACL_DYNAMIC_AIPP_NODE + ACL_DATA_WITHOUT_AIPP = 0, + ACL_DATA_WITH_STATIC_AIPP, + ACL_DATA_WITH_DYNAMIC_AIPP, + ACL_DYNAMIC_AIPP_NODE } aclmdlInputAippType; typedef struct aclmdlIODims { - char name[ACL_MAX_TENSOR_NAME_LEN]; /**< tensor name */ - size_t dimCount; /**< dim array count */ - int64_t dims[ACL_MAX_DIM_CNT]; /**< dim data array */ + char name[ACL_MAX_TENSOR_NAME_LEN]; /**< tensor name */ + size_t dimCount; /**< dim array count */ + int64_t dims[ACL_MAX_DIM_CNT]; /**< dim data array */ } aclmdlIODims; typedef struct aclAippDims { - aclmdlIODims srcDims; /**< input dims before model transform */ - size_t srcSize; /**< input size before model transform */ - aclmdlIODims aippOutdims; /**< aipp output dims */ - size_t aippOutSize; /**< aipp output size */ + aclmdlIODims srcDims; /**< input dims before model transform */ + size_t srcSize; /**< input size before model transform */ + aclmdlIODims aippOutdims; /**< aipp output dims */ + size_t aippOutSize; /**< aipp output size */ } aclAippDims; typedef struct aclmdlBatch { - size_t batchCount; /**< batch array count */ - uint64_t batch[ACL_MAX_BATCH_NUM]; /**< batch data array */ + size_t batchCount; /**< batch array count */ + uint64_t batch[ACL_MAX_BATCH_NUM]; /**< batch data array */ } aclmdlBatch; typedef struct aclmdlHW { - size_t hwCount; /**< height&width array count */ - uint64_t hw[ACL_MAX_HW_NUM][2]; /**< height&width data array */ + size_t hwCount; /**< height&width array count */ + uint64_t hw[ACL_MAX_HW_NUM][2]; /**< height&width data array */ } aclmdlHW; typedef struct aclAippInfo { - aclAippInputFormat inputFormat; - int32_t srcImageSizeW; - int32_t srcImageSizeH; - int8_t cropSwitch; - int32_t loadStartPosW; - int32_t loadStartPosH; - int32_t cropSizeW; - int32_t cropSizeH; - int8_t resizeSwitch; - int32_t resizeOutputW; - int32_t resizeOutputH; - int8_t paddingSwitch; - int32_t leftPaddingSize; - int32_t rightPaddingSize; - int32_t topPaddingSize; - int32_t bottomPaddingSize; - int8_t cscSwitch; - int8_t rbuvSwapSwitch; - int8_t axSwapSwitch; - int8_t singleLineMode; - int32_t matrixR0C0; - int32_t matrixR0C1; - int32_t matrixR0C2; - int32_t matrixR1C0; - int32_t matrixR1C1; - int32_t matrixR1C2; - int32_t matrixR2C0; - int32_t matrixR2C1; - int32_t matrixR2C2; - int32_t outputBias0; - int32_t outputBias1; - int32_t outputBias2; - int32_t inputBias0; - int32_t inputBias1; - int32_t inputBias2; - int32_t meanChn0; - int32_t meanChn1; - int32_t meanChn2; - int32_t meanChn3; - float minChn0; - float minChn1; - float minChn2; - float minChn3; - float varReciChn0; - float varReciChn1; - float varReciChn2; - float varReciChn3; - aclFormat srcFormat; - aclDataType srcDatatype; - size_t srcDimNum; - size_t shapeCount; - aclAippDims outDims[ACL_MAX_SHAPE_COUNT]; - aclAippExtendInfo *aippExtend; /**< reserved parameters, current version needs to be null */ + aclAippInputFormat inputFormat; + int32_t srcImageSizeW; + int32_t srcImageSizeH; + int8_t cropSwitch; + int32_t loadStartPosW; + int32_t loadStartPosH; + int32_t cropSizeW; + int32_t cropSizeH; + int8_t resizeSwitch; + int32_t resizeOutputW; + int32_t resizeOutputH; + int8_t paddingSwitch; + int32_t leftPaddingSize; + int32_t rightPaddingSize; + int32_t topPaddingSize; + int32_t bottomPaddingSize; + int8_t cscSwitch; + int8_t rbuvSwapSwitch; + int8_t axSwapSwitch; + int8_t singleLineMode; + int32_t matrixR0C0; + int32_t matrixR0C1; + int32_t matrixR0C2; + int32_t matrixR1C0; + int32_t matrixR1C1; + int32_t matrixR1C2; + int32_t matrixR2C0; + int32_t matrixR2C1; + int32_t matrixR2C2; + int32_t outputBias0; + int32_t outputBias1; + int32_t outputBias2; + int32_t inputBias0; + int32_t inputBias1; + int32_t inputBias2; + int32_t meanChn0; + int32_t meanChn1; + int32_t meanChn2; + int32_t meanChn3; + float minChn0; + float minChn1; + float minChn2; + float minChn3; + float varReciChn0; + float varReciChn1; + float varReciChn2; + float varReciChn3; + aclFormat srcFormat; + aclDataType srcDatatype; + size_t srcDimNum; + size_t shapeCount; + aclAippDims outDims[ACL_MAX_SHAPE_COUNT]; + aclAippExtendInfo *aippExtend; /**< reserved parameters, current version needs to be null */ } aclAippInfo; /** @@ -291,8 +291,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlAddDatasetBuffer(aclmdlDataset *dataset, aclD * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclmdlSetDatasetTensorDesc(aclmdlDataset *dataset, - aclTensorDesc *tensorDesc, +ACL_FUNC_VISIBILITY aclError aclmdlSetDatasetTensorDesc(aclmdlDataset *dataset, aclTensorDesc *tensorDesc, size_t index); /** @@ -354,8 +353,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFile(const char *modelPath, uint32_t * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMem(const void *model, size_t modelSize, - uint32_t *modelId); +ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMem(const void *model, size_t modelSize, uint32_t *modelId); /** * @ingroup AscendCL @@ -377,9 +375,8 @@ ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMem(const void *model, size_t modelS * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithMem(const char *modelPath, - uint32_t *modelId, void *workPtr, size_t workSize, - void *weightPtr, size_t weightSize); +ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithMem(const char *modelPath, uint32_t *modelId, void *workPtr, + size_t workSize, void *weightPtr, size_t weightSize); /** * @ingroup AscendCL @@ -402,9 +399,9 @@ ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithMem(const char *modelPath, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMemWithMem(const void *model, size_t modelSize, - uint32_t *modelId, void *workPtr, size_t workSize, - void *weightPtr, size_t weightSize); +ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMemWithMem(const void *model, size_t modelSize, uint32_t *modelId, + void *workPtr, size_t workSize, void *weightPtr, + size_t weightSize); /** * @ingroup AscendCL @@ -439,8 +436,8 @@ ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithQ(const char *modelPath, uint * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMemWithQ(const void *model, size_t modelSize, uint32_t *modelId, - const uint32_t *inputQ, size_t inputQNum, - const uint32_t *outputQ, size_t outputQNum); + const uint32_t *inputQ, size_t inputQNum, const uint32_t *outputQ, + size_t outputQNum); /** * @ingroup AscendCL @@ -470,8 +467,8 @@ ACL_FUNC_VISIBILITY aclError aclmdlExecute(uint32_t modelId, const aclmdlDataset * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | * aclmdlLoadFromMemWithMem */ -ACL_FUNC_VISIBILITY aclError aclmdlExecuteAsync(uint32_t modelId, const aclmdlDataset *input, - aclmdlDataset *output, aclrtStream stream); +ACL_FUNC_VISIBILITY aclError aclmdlExecuteAsync(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output, + aclrtStream stream); /** * @ingroup AscendCL @@ -846,11 +843,11 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPInputFormat(aclmdlAIPP *aippParmsSet, * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCscParams(aclmdlAIPP *aippParmsSet, int8_t csc_switch, - int16_t cscMatrixR0C0, int16_t cscMatrixR0C1, int16_t cscMatrixR0C2, - int16_t cscMatrixR1C0, int16_t cscMatrixR1C1, int16_t cscMatrixR1C2, - int16_t cscMatrixR2C0, int16_t cscMatrixR2C1, int16_t cscMatrixR2C2, + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCscParams(aclmdlAIPP *aippParmsSet, int8_t csc_switch, int16_t cscMatrixR0C0, + int16_t cscMatrixR0C1, int16_t cscMatrixR0C2, int16_t cscMatrixR1C0, + int16_t cscMatrixR1C1, int16_t cscMatrixR1C2, int16_t cscMatrixR2C0, + int16_t cscMatrixR2C1, int16_t cscMatrixR2C2, uint8_t cscOutputBiasR0, uint8_t cscOutputBiasR1, uint8_t cscOutputBiasR2, uint8_t cscInputBiasR0, uint8_t cscInputBiasR1, uint8_t cscInputBiasR2); @@ -866,7 +863,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCscParams(aclmdlAIPP *aippParmsSet, in * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPRbuvSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t rbuvSwapSwitch); /** @@ -880,7 +877,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPRbuvSwapSwitch(aclmdlAIPP *aippParmsSe * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPAxSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t axSwapSwitch); /** @@ -895,7 +892,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPAxSwapSwitch(aclmdlAIPP *aippParmsSet, * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPSrcImageSize(aclmdlAIPP *aippParmsSet, int32_t srcImageSizeW, int32_t srcImageSizeH); @@ -915,14 +912,10 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPSrcImageSize(aclmdlAIPP *aippParmsSet, * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPScfParams(aclmdlAIPP *aippParmsSet, - int8_t scfSwitch, - int32_t scfInputSizeW, - int32_t scfInputSizeH, - int32_t scfOutputSizeW, - int32_t scfOutputSizeH, - uint64_t batchIndex); + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPScfParams(aclmdlAIPP *aippParmsSet, int8_t scfSwitch, int32_t scfInputSizeW, + int32_t scfInputSizeH, int32_t scfOutputSizeW, + int32_t scfOutputSizeH, uint64_t batchIndex); /** * @ingroup AscendCL @@ -940,13 +933,9 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPScfParams(aclmdlAIPP *aippParmsSet, * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCropParams(aclmdlAIPP *aippParmsSet, - int8_t cropSwitch, - int32_t cropStartPosW, - int32_t cropStartPosH, - int32_t cropSizeW, - int32_t cropSizeH, + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCropParams(aclmdlAIPP *aippParmsSet, int8_t cropSwitch, int32_t cropStartPosW, + int32_t cropStartPosH, int32_t cropSizeW, int32_t cropSizeH, uint64_t batchIndex); /** @@ -965,7 +954,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCropParams(aclmdlAIPP *aippParmsSet, * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPaddingParams(aclmdlAIPP *aippParmsSet, int8_t paddingSwitch, int32_t paddingSizeTop, int32_t paddingSizeBottom, int32_t paddingSizeLeft, int32_t paddingSizeRight, @@ -986,13 +975,10 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPaddingParams(aclmdlAIPP *aippParmsSet * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMean(aclmdlAIPP *aippParmsSet, - int16_t dtcPixelMeanChn0, - int16_t dtcPixelMeanChn1, - int16_t dtcPixelMeanChn2, - int16_t dtcPixelMeanChn3, - uint64_t batchIndex); + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMean(aclmdlAIPP *aippParmsSet, int16_t dtcPixelMeanChn0, + int16_t dtcPixelMeanChn1, int16_t dtcPixelMeanChn2, + int16_t dtcPixelMeanChn3, uint64_t batchIndex); /** * @ingroup AscendCL @@ -1009,13 +995,10 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMean(aclmdlAIPP *aippParmsSet, * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMin(aclmdlAIPP *aippParmsSet, - float dtcPixelMinChn0, - float dtcPixelMinChn1, - float dtcPixelMinChn2, - float dtcPixelMinChn3, - uint64_t batchIndex); + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMin(aclmdlAIPP *aippParmsSet, float dtcPixelMinChn0, + float dtcPixelMinChn1, float dtcPixelMinChn2, + float dtcPixelMinChn3, uint64_t batchIndex); /** * @ingroup AscendCL @@ -1032,13 +1015,10 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMin(aclmdlAIPP *aippParmsSet, * @retval OtherValues Failure * * @see aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPixelVarReci(aclmdlAIPP *aippParmsSet, - float dtcPixelVarReciChn0, - float dtcPixelVarReciChn1, - float dtcPixelVarReciChn2, - float dtcPixelVarReciChn3, - uint64_t batchIndex); + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPixelVarReci(aclmdlAIPP *aippParmsSet, float dtcPixelVarReciChn0, + float dtcPixelVarReciChn1, float dtcPixelVarReciChn2, + float dtcPixelVarReciChn3, uint64_t batchIndex); /** * @ingroup AscendCL @@ -1054,10 +1034,8 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPixelVarReci(aclmdlAIPP *aippParmsSet, * * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlSetInputAIPP(uint32_t modelId, - aclmdlDataset *dataset, - size_t index, + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetInputAIPP(uint32_t modelId, aclmdlDataset *dataset, size_t index, const aclmdlAIPP *aippParmsSet); /** @@ -1074,10 +1052,8 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetInputAIPP(uint32_t modelId, * * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPByInputIndex(uint32_t modelId, - aclmdlDataset *dataset, - size_t index, + */ +ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPByInputIndex(uint32_t modelId, aclmdlDataset *dataset, size_t index, const aclmdlAIPP *aippParmsSet); /** @@ -1095,10 +1071,8 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPByInputIndex(uint32_t modelId, * * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP -*/ -ACL_FUNC_VISIBILITY aclError aclmdlGetAippType(uint32_t modelId, - size_t index, - aclmdlInputAippType *type, + */ +ACL_FUNC_VISIBILITY aclError aclmdlGetAippType(uint32_t modelId, size_t index, aclmdlInputAippType *type, size_t *dynamicAttachedDataIndex); /** @@ -1115,7 +1089,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlGetAippType(uint32_t modelId, * * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlGetFirstAippInfo(uint32_t modelId, size_t index, aclAippInfo *aippinfo); /** @@ -1134,10 +1108,11 @@ ACL_FUNC_VISIBILITY aclError aclmdlGetFirstAippInfo(uint32_t modelId, size_t ind * * @retval ACL_SUCCESS The function is successfully executed * @retval OtherValues Failure -*/ -ACL_FUNC_VISIBILITY aclError aclmdlCreateAndGetOpDesc(uint32_t deviceId, uint32_t streamId, - uint32_t taskId, char *opName, size_t opNameLen, aclTensorDesc **inputDesc, size_t *numInputs, - aclTensorDesc **outputDesc, size_t *numOutputs); + */ +ACL_FUNC_VISIBILITY aclError aclmdlCreateAndGetOpDesc(uint32_t deviceId, uint32_t streamId, uint32_t taskId, + char *opName, size_t opNameLen, aclTensorDesc **inputDesc, + size_t *numInputs, aclTensorDesc **outputDesc, + size_t *numOutputs); /** * @ingroup AscendCL @@ -1145,7 +1120,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlCreateAndGetOpDesc(uint32_t deviceId, uint32_ * * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlInitDump(); /** @@ -1156,7 +1131,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlInitDump(); * * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlSetDump(const char *dumpCfgPath); /** @@ -1165,7 +1140,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlSetDump(const char *dumpCfgPath); * * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlFinalizeDump(); /** @@ -1177,7 +1152,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlFinalizeDump(); * * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure -*/ + */ ACL_FUNC_VISIBILITY aclError aclmdlLoadWithConfig(const aclmdlConfigHandle *handle, uint32_t *modelId); /** @@ -1187,7 +1162,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlLoadWithConfig(const aclmdlConfigHandle *hand * @retval the aclmdlConfigHandle pointer * * @see aclmdlDestroyConfigHandle -*/ + */ ACL_FUNC_VISIBILITY aclmdlConfigHandle *aclmdlCreateConfigHandle(); /** @@ -1216,7 +1191,7 @@ ACL_FUNC_VISIBILITY aclError aclmdlDestroyConfigHandle(aclmdlConfigHandle *handl * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclmdlSetConfigOpt(aclmdlConfigHandle *handle, aclmdlConfigAttr attr, - const void *attrValue, size_t valueSize); + const void *attrValue, size_t valueSize); /** * @ingroup AscendCL @@ -1234,4 +1209,4 @@ ACL_FUNC_VISIBILITY const char *aclmdlGetTensorRealName(const aclmdlDesc *modelD } #endif -#endif // INC_EXTERNAL_ACL_ACL_MODEL_H_ +#endif // INC_EXTERNAL_ACL_ACL_MODEL_H_ diff --git a/inc/external/acl/acl_op.h b/inc/external/acl/acl_op.h index b1be0d6e..d2e59bfb 100644 --- a/inc/external/acl/acl_op.h +++ b/inc/external/acl/acl_op.h @@ -33,9 +33,9 @@ typedef void (*aclDataDeallocator)(void *data, size_t length); static const int ACL_COMPILE_FLAG_BIN_SELECTOR = 1; typedef enum aclEngineType { - ACL_ENGINE_SYS, - ACL_ENGINE_AICORE, - ACL_ENGINE_VECTOR, + ACL_ENGINE_SYS, + ACL_ENGINE_AICORE, + ACL_ENGINE_VECTOR, } aclopEngineType; /** @@ -148,7 +148,7 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrString(aclopAttr *attr, const char *att * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *attrName, int numValues, - const uint8_t *values); + const uint8_t *values); /** * @ingroup AscendCL @@ -163,7 +163,7 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *a * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *attrName, int numValues, - const int64_t *values); + const int64_t *values); /** * @ingroup AscendCL @@ -178,7 +178,7 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *at * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char *attrName, int numValues, - const float *values); + const float *values); /** * @ingroup AscendCL @@ -193,7 +193,7 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char * * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char *attrName, int numValues, - const char **values); + const char **values); /** * @ingroup AscendCL @@ -208,11 +208,8 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, - const char *attrName, - int numLists, - const int *numValues, - const int64_t *const values[]); +ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, const char *attrName, int numLists, + const int *numValues, const int64_t *const values[]); /** * @ingroup AscendCL @@ -242,15 +239,10 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, * @retval OtherValues Failure */ ACL_DEPRECATED_MESSAGE("aclopExecute is deprecated, use aclopExecuteV2 instead") -ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, - int numInputs, - const aclTensorDesc *const inputDesc[], - const aclDataBuffer *const inputs[], - int numOutputs, - const aclTensorDesc *const outputDesc[], - aclDataBuffer *const outputs[], - const aclopAttr *attr, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, int numInputs, const aclTensorDesc *const inputDesc[], + const aclDataBuffer *const inputs[], int numOutputs, + const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[], + const aclopAttr *attr, aclrtStream stream); /** * @ingroup AscendCL @@ -280,15 +272,9 @@ ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopExecuteV2(const char *opType, - int numInputs, - aclTensorDesc *inputDesc[], - aclDataBuffer *inputs[], - int numOutputs, - aclTensorDesc *outputDesc[], - aclDataBuffer *outputs[], - aclopAttr *attr, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError aclopExecuteV2(const char *opType, int numInputs, aclTensorDesc *inputDesc[], + aclDataBuffer *inputs[], int numOutputs, aclTensorDesc *outputDesc[], + aclDataBuffer *outputs[], aclopAttr *attr, aclrtStream stream); /** * @ingroup AscendCL @@ -306,12 +292,9 @@ ACL_FUNC_VISIBILITY aclError aclopExecuteV2(const char *opType, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopCreateHandle(const char *opType, - int numInputs, - const aclTensorDesc *const inputDesc[], - int numOutputs, - const aclTensorDesc *const outputDesc[], - const aclopAttr *opAttr, +ACL_FUNC_VISIBILITY aclError aclopCreateHandle(const char *opType, int numInputs, + const aclTensorDesc *const inputDesc[], int numOutputs, + const aclTensorDesc *const outputDesc[], const aclopAttr *opAttr, aclopHandle **handle); /** @@ -343,12 +326,9 @@ ACL_FUNC_VISIBILITY void aclopDestroyHandle(aclopHandle *handle); * * @see aclopCreateHandle | aclCreateDataBuffer */ -ACL_FUNC_VISIBILITY aclError aclopExecWithHandle(aclopHandle *handle, - int numInputs, - const aclDataBuffer *const inputs[], - int numOutputs, - aclDataBuffer *const outputs[], - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError aclopExecWithHandle(aclopHandle *handle, int numInputs, + const aclDataBuffer *const inputs[], int numOutputs, + aclDataBuffer *const outputs[], aclrtStream stream); /** * @ingroup AscendCL @@ -364,11 +344,8 @@ ACL_FUNC_VISIBILITY aclError aclopExecWithHandle(aclopHandle *handle, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc, - const aclDataBuffer *srcBuffer, - const aclTensorDesc *dstDesc, - aclDataBuffer *dstBuffer, - uint8_t truncate, +ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc, const aclDataBuffer *srcBuffer, + const aclTensorDesc *dstDesc, aclDataBuffer *dstBuffer, uint8_t truncate, aclrtStream stream); /** @@ -383,12 +360,9 @@ ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, - aclTensorDesc *dstDesc, - uint8_t truncate, +ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, aclTensorDesc *dstDesc, uint8_t truncate, aclopHandle **handle); - /** * @ingroup AscendCL * @brief create kernel @@ -407,15 +381,10 @@ ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, * * @see aclopCompile */ -ACL_FUNC_VISIBILITY aclError aclopCreateKernel(const char *opType, - const char *kernelId, - const char *kernelName, - void *binData, - int binSize, - aclopEngineType enginetype, +ACL_FUNC_VISIBILITY aclError aclopCreateKernel(const char *opType, const char *kernelId, const char *kernelName, + void *binData, int binSize, aclopEngineType enginetype, aclDataDeallocator deallocator); - /** * @ingroup AscendCL * @brief create kernel @@ -430,11 +399,8 @@ ACL_FUNC_VISIBILITY aclError aclopCreateKernel(const char *opType, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -typedef aclError (*aclopCompileFunc)(int numInputs, - const aclTensorDesc *const inputDesc[], - int numOutputs, - const aclTensorDesc *const outputDesc[], - const aclopAttr *opAttr, +typedef aclError (*aclopCompileFunc)(int numInputs, const aclTensorDesc *const inputDesc[], int numOutputs, + const aclTensorDesc *const outputDesc[], const aclopAttr *opAttr, aclopKernelDesc *aclopKernelDesc); /** @@ -475,11 +441,8 @@ ACL_FUNC_VISIBILITY aclError aclopUnregisterCompileFunc(const char *opType); * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopSetKernelArgs(aclopKernelDesc *kernelDesc, - const char *kernelId, - uint32_t blockDim, - const void *args, - uint32_t argSize); +ACL_FUNC_VISIBILITY aclError aclopSetKernelArgs(aclopKernelDesc *kernelDesc, const char *kernelId, uint32_t blockDim, + const void *args, uint32_t argSize); /** * @ingroup AscendCL @@ -510,12 +473,9 @@ ACL_FUNC_VISIBILITY aclError aclopSetKernelWorkspaceSizes(aclopKernelDesc *kerne * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType, - int numInputs, - const aclTensorDesc *const inputDesc[], - int numOutputs, - const aclTensorDesc *const outputDesc[], - const aclopAttr *attr); +ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType, int numInputs, + const aclTensorDesc *const inputDesc[], int numOutputs, + const aclTensorDesc *const outputDesc[], const aclopAttr *attr); /** * @ingroup AscendCL @@ -533,17 +493,12 @@ ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopInferShape(const char *opType, - int numInputs, - aclTensorDesc *inputDesc[], - aclDataBuffer *inputs[], - int numOutputs, - aclTensorDesc *outputDesc[], +ACL_FUNC_VISIBILITY aclError aclopInferShape(const char *opType, int numInputs, aclTensorDesc *inputDesc[], + aclDataBuffer *inputs[], int numOutputs, aclTensorDesc *outputDesc[], aclopAttr *attr); - #ifdef __cplusplus } #endif -#endif // INC_EXTERNAL_ACL_ACL_OP_H_ +#endif // INC_EXTERNAL_ACL_ACL_OP_H_ diff --git a/inc/external/acl/acl_op_compiler.h b/inc/external/acl/acl_op_compiler.h index 353d2a1a..d9d1b3da 100644 --- a/inc/external/acl/acl_op_compiler.h +++ b/inc/external/acl/acl_op_compiler.h @@ -24,28 +24,22 @@ extern "C" { #endif -typedef enum aclCompileType { - ACL_COMPILE_SYS, - ACL_COMPILE_UNREGISTERED -} aclopCompileType; +typedef enum aclCompileType { ACL_COMPILE_SYS, ACL_COMPILE_UNREGISTERED } aclopCompileType; typedef enum { - ACL_PRECISION_MODE, - ACL_AICORE_NUM, - ACL_AUTO_TUNE_MODE, - ACL_OP_SELECT_IMPL_MODE, - ACL_OPTYPELIST_FOR_IMPLMODE, - ACL_OP_DEBUG_LEVEL, - ACL_DEBUG_DIR, - ACL_OP_COMPILER_CACHE_MODE, - ACL_OP_COMPILER_CACHE_DIR, - ACL_OP_PERFORMANCE_MODE + ACL_PRECISION_MODE, + ACL_AICORE_NUM, + ACL_AUTO_TUNE_MODE, + ACL_OP_SELECT_IMPL_MODE, + ACL_OPTYPELIST_FOR_IMPLMODE, + ACL_OP_DEBUG_LEVEL, + ACL_DEBUG_DIR, + ACL_OP_COMPILER_CACHE_MODE, + ACL_OP_COMPILER_CACHE_DIR, + ACL_OP_PERFORMANCE_MODE } aclCompileOpt; -typedef enum aclCompileFlag { - ACL_OP_COMPILE_DEFAULT, - ACL_OP_COMPILE_FUZZ -} aclOpCompileFlag; +typedef enum aclCompileFlag { ACL_OP_COMPILE_DEFAULT, ACL_OP_COMPILE_FUZZ } aclOpCompileFlag; /** * @ingroup AscendCL @@ -65,15 +59,10 @@ typedef enum aclCompileFlag { * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopCompile(const char *opType, - int numInputs, - const aclTensorDesc *const inputDesc[], - int numOutputs, - const aclTensorDesc *const outputDesc[], - const aclopAttr *attr, - aclopEngineType engineType, - aclopCompileType compileFlag, - const char *opPath); +ACL_FUNC_VISIBILITY aclError aclopCompile(const char *opType, int numInputs, const aclTensorDesc *const inputDesc[], + int numOutputs, const aclTensorDesc *const outputDesc[], + const aclopAttr *attr, aclopEngineType engineType, + aclopCompileType compileFlag, const char *opPath); /** * @ingroup AscendCL @@ -96,11 +85,10 @@ ACL_FUNC_VISIBILITY aclError aclopCompile(const char *opType, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclopCompileAndExecute(const char *opType, - int numInputs, const aclTensorDesc *const inputDesc[], const aclDataBuffer *const inputs[], - int numOutputs, const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[], - const aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag, - const char *opPath, aclrtStream stream); +ACL_FUNC_VISIBILITY aclError aclopCompileAndExecute( + const char *opType, int numInputs, const aclTensorDesc *const inputDesc[], const aclDataBuffer *const inputs[], + int numOutputs, const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[], const aclopAttr *attr, + aclopEngineType engineType, aclopCompileType compileFlag, const char *opPath, aclrtStream stream); /** * @ingroup AscendCL @@ -130,4 +118,4 @@ ACL_FUNC_VISIBILITY aclError aclopSetCompileFlag(aclOpCompileFlag flag); } #endif -#endif // INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_ +#endif // INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_ diff --git a/inc/external/acl/acl_prof.h b/inc/external/acl/acl_prof.h index 93bc3a9b..3784d8c6 100644 --- a/inc/external/acl/acl_prof.h +++ b/inc/external/acl/acl_prof.h @@ -23,24 +23,24 @@ extern "C" { #endif -#define ACL_PROF_ACL_API 0x0001 -#define ACL_PROF_TASK_TIME 0x0002 -#define ACL_PROF_AICORE_METRICS 0x0004 -#define ACL_PROF_AICPU 0x0008 +#define ACL_PROF_ACL_API 0x0001 +#define ACL_PROF_TASK_TIME 0x0002 +#define ACL_PROF_AICORE_METRICS 0x0004 +#define ACL_PROF_AICPU 0x0008 /** * @deprecated please use aclprofGetOpTypeLen and aclprofGetOpTNameLen instead */ -#define ACL_PROF_MAX_OP_NAME_LEN 257 -#define ACL_PROF_MAX_OP_TYPE_LEN 65 +#define ACL_PROF_MAX_OP_NAME_LEN 257 +#define ACL_PROF_MAX_OP_TYPE_LEN 65 typedef enum { - ACL_AICORE_ARITHMETIC_UTILIZATION = 0, - ACL_AICORE_PIPE_UTILIZATION = 1, - ACL_AICORE_MEMORY_BANDWIDTH = 2, - ACL_AICORE_L0B_AND_WIDTH = 3, - ACL_AICORE_RESOURCE_CONFLICT_RATIO = 4, - ACL_AICORE_NONE = 0xFF + ACL_AICORE_ARITHMETIC_UTILIZATION = 0, + ACL_AICORE_PIPE_UTILIZATION = 1, + ACL_AICORE_MEMORY_BANDWIDTH = 2, + ACL_AICORE_L0B_AND_WIDTH = 3, + ACL_AICORE_RESOURCE_CONFLICT_RATIO = 4, + ACL_AICORE_NONE = 0xFF } aclprofAicoreMetrics; typedef struct aclprofConfig aclprofConfig; @@ -101,7 +101,8 @@ ACL_FUNC_VISIBILITY aclError aclprofStart(const aclprofConfig *profilerConfig); * @see aclprofDestroyConfig */ ACL_FUNC_VISIBILITY aclprofConfig *aclprofCreateConfig(uint32_t *deviceIdList, uint32_t deviceNums, - aclprofAicoreMetrics aicoreMetrics, aclprofAicoreEvents *aicoreEvents, uint64_t dataTypeConfig); + aclprofAicoreMetrics aicoreMetrics, + aclprofAicoreEvents *aicoreEvents, uint64_t dataTypeConfig); /** * @ingroup AscendCL @@ -141,8 +142,7 @@ ACL_FUNC_VISIBILITY aclError aclprofStop(const aclprofConfig *profilerConfig); * * @see aclprofModelUnSubscribe */ -ACL_FUNC_VISIBILITY aclError aclprofModelSubscribe(uint32_t modelId, - const aclprofSubscribeConfig *profSubscribeConfig); +ACL_FUNC_VISIBILITY aclError aclprofModelSubscribe(uint32_t modelId, const aclprofSubscribeConfig *profSubscribeConfig); /** * @ingroup AscendCL @@ -170,7 +170,7 @@ ACL_FUNC_VISIBILITY aclError aclprofModelUnSubscribe(uint32_t modelId); * @see aclprofDestroySubscribeConfig */ ACL_FUNC_VISIBILITY aclprofSubscribeConfig *aclprofCreateSubscribeConfig(int8_t timeInfoSwitch, - aclprofAicoreMetrics aicoreMetrics, void *fd); + aclprofAicoreMetrics aicoreMetrics, void *fd); /** * @ingroup AscendCL @@ -222,7 +222,7 @@ ACL_FUNC_VISIBILITY aclError aclprofGetOpNum(const void *opInfo, size_t opInfoLe * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclprofGetOpTypeLen(const void *opInfo, size_t opInfoLen, uint32_t index, - size_t *opTypeLen); + size_t *opTypeLen); /** * @ingroup AscendCL @@ -237,8 +237,8 @@ ACL_FUNC_VISIBILITY aclError aclprofGetOpTypeLen(const void *opInfo, size_t opIn * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclprofGetOpType(const void *opInfo, size_t opInfoLen, uint32_t index, - char *opType, size_t opTypeLen); +ACL_FUNC_VISIBILITY aclError aclprofGetOpType(const void *opInfo, size_t opInfoLen, uint32_t index, char *opType, + size_t opTypeLen); /** * @ingroup AscendCL @@ -253,7 +253,7 @@ ACL_FUNC_VISIBILITY aclError aclprofGetOpType(const void *opInfo, size_t opInfoL * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError aclprofGetOpNameLen(const void *opInfo, size_t opInfoLen, uint32_t index, - size_t *opNameLen); + size_t *opNameLen); /** * @ingroup AscendCL @@ -268,8 +268,8 @@ ACL_FUNC_VISIBILITY aclError aclprofGetOpNameLen(const void *opInfo, size_t opIn * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclprofGetOpName(const void *opInfo, size_t opInfoLen, uint32_t index, - char *opName, size_t opNameLen); +ACL_FUNC_VISIBILITY aclError aclprofGetOpName(const void *opInfo, size_t opInfoLen, uint32_t index, char *opName, + size_t opNameLen); /** * @ingroup AscendCL @@ -326,4 +326,4 @@ ACL_FUNC_VISIBILITY size_t aclprofGetModelId(const void *opInfo, size_t opInfoLe } #endif -#endif // INC_EXTERNAL_ACL_PROF_H_ +#endif // INC_EXTERNAL_ACL_PROF_H_ diff --git a/inc/external/acl/acl_rt.h b/inc/external/acl/acl_rt.h index 3c777ecc..5ee70724 100644 --- a/inc/external/acl/acl_rt.h +++ b/inc/external/acl/acl_rt.h @@ -28,63 +28,63 @@ extern "C" { #define ACL_EVENT_TIME_LINE 0x00000008u typedef enum aclrtRunMode { - ACL_DEVICE, - ACL_HOST, + ACL_DEVICE, + ACL_HOST, } aclrtRunMode; typedef enum aclrtTsId { - ACL_TS_ID_AICORE = 0, - ACL_TS_ID_AIVECTOR = 1, - ACL_TS_ID_RESERVED = 2, + ACL_TS_ID_AICORE = 0, + ACL_TS_ID_AIVECTOR = 1, + ACL_TS_ID_RESERVED = 2, } aclrtTsId; typedef enum aclrtEventStatus { - ACL_EVENT_STATUS_COMPLETE = 0, - ACL_EVENT_STATUS_NOT_READY = 1, - ACL_EVENT_STATUS_RESERVED = 2, + ACL_EVENT_STATUS_COMPLETE = 0, + ACL_EVENT_STATUS_NOT_READY = 1, + ACL_EVENT_STATUS_RESERVED = 2, } aclrtEventStatus; typedef enum aclrtCallbackBlockType { - ACL_CALLBACK_NO_BLOCK, - ACL_CALLBACK_BLOCK, + ACL_CALLBACK_NO_BLOCK, + ACL_CALLBACK_BLOCK, } aclrtCallbackBlockType; typedef enum aclrtMemcpyKind { - ACL_MEMCPY_HOST_TO_HOST, - ACL_MEMCPY_HOST_TO_DEVICE, - ACL_MEMCPY_DEVICE_TO_HOST, - ACL_MEMCPY_DEVICE_TO_DEVICE, + ACL_MEMCPY_HOST_TO_HOST, + ACL_MEMCPY_HOST_TO_DEVICE, + ACL_MEMCPY_DEVICE_TO_HOST, + ACL_MEMCPY_DEVICE_TO_DEVICE, } aclrtMemcpyKind; typedef enum aclrtMemMallocPolicy { - ACL_MEM_MALLOC_HUGE_FIRST, - ACL_MEM_MALLOC_HUGE_ONLY, - ACL_MEM_MALLOC_NORMAL_ONLY, - ACL_MEM_MALLOC_HUGE_FIRST_P2P, - ACL_MEM_MALLOC_HUGE_ONLY_P2P, - ACL_MEM_MALLOC_NORMAL_ONLY_P2P, + ACL_MEM_MALLOC_HUGE_FIRST, + ACL_MEM_MALLOC_HUGE_ONLY, + ACL_MEM_MALLOC_NORMAL_ONLY, + ACL_MEM_MALLOC_HUGE_FIRST_P2P, + ACL_MEM_MALLOC_HUGE_ONLY_P2P, + ACL_MEM_MALLOC_NORMAL_ONLY_P2P, } aclrtMemMallocPolicy; typedef enum aclrtMemAttr { - ACL_DDR_MEM, - ACL_HBM_MEM, - ACL_DDR_MEM_HUGE, - ACL_DDR_MEM_NORMAL, - ACL_HBM_MEM_HUGE, - ACL_HBM_MEM_NORMAL, - ACL_DDR_MEM_P2P_HUGE, - ACL_DDR_MEM_P2P_NORMAL, - ACL_HBM_MEM_P2P_HUGE, - ACL_HBM_MEM_P2P_NORMAL, + ACL_DDR_MEM, + ACL_HBM_MEM, + ACL_DDR_MEM_HUGE, + ACL_DDR_MEM_NORMAL, + ACL_HBM_MEM_HUGE, + ACL_HBM_MEM_NORMAL, + ACL_DDR_MEM_P2P_HUGE, + ACL_DDR_MEM_P2P_NORMAL, + ACL_HBM_MEM_P2P_HUGE, + ACL_HBM_MEM_P2P_NORMAL, } aclrtMemAttr; typedef enum aclrtGroupAttr { - ACL_GROUP_AICORE_INT, - ACL_GROUP_AIV_INT, - ACL_GROUP_AIC_INT, - ACL_GROUP_SDMANUM_INT, - ACL_GROUP_ASQNUM_INT, - ACL_GROUP_GROUPID_INT + ACL_GROUP_AICORE_INT, + ACL_GROUP_AIV_INT, + ACL_GROUP_AIC_INT, + ACL_GROUP_SDMANUM_INT, + ACL_GROUP_ASQNUM_INT, + ACL_GROUP_GROUPID_INT } aclrtGroupAttr; typedef struct tagRtGroupInfo aclrtGroupInfo; @@ -487,7 +487,7 @@ ACL_FUNC_VISIBILITY aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stre */ ACL_FUNC_VISIBILITY aclError aclrtResetEvent(aclrtEvent event, aclrtStream stream); - /** +/** * @ingroup AscendCL * @brief Queries an event's status * @@ -549,9 +549,7 @@ ACL_FUNC_VISIBILITY aclError aclrtEventElapsedTime(float *ms, aclrtEvent start, * * @see aclrtFree | acldvppMalloc | aclrtMallocCached */ -ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, - size_t size, - aclrtMemMallocPolicy policy); +ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, size_t size, aclrtMemMallocPolicy policy); /** * @ingroup AscendCL @@ -574,9 +572,7 @@ ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, * * @see aclrtFree | aclrtMalloc */ -ACL_FUNC_VISIBILITY aclError aclrtMallocCached(void **devPtr, - size_t size, - aclrtMemMallocPolicy policy); +ACL_FUNC_VISIBILITY aclError aclrtMallocCached(void **devPtr, size_t size, aclrtMemMallocPolicy policy); /** * @ingroup AscendCL @@ -667,10 +663,7 @@ ACL_FUNC_VISIBILITY aclError aclrtFreeHost(void *hostPtr); * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclrtMemcpy(void *dst, - size_t destMax, - const void *src, - size_t count, +ACL_FUNC_VISIBILITY aclError aclrtMemcpy(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind); /** @@ -717,38 +710,31 @@ ACL_FUNC_VISIBILITY aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t * * @see aclrtSynchronizeStream */ -ACL_FUNC_VISIBILITY aclError aclrtMemcpyAsync(void *dst, - size_t destMax, - const void *src, - size_t count, - aclrtMemcpyKind kind, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError aclrtMemcpyAsync(void *dst, size_t destMax, const void *src, size_t count, + aclrtMemcpyKind kind, aclrtStream stream); /** -* @ingroup AscendCL -* @brief Asynchronous initialize memory -* and set contents of memory to specified value async -* -* @par Function + * @ingroup AscendCL + * @brief Asynchronous initialize memory + * and set contents of memory to specified value async + * + * @par Function * The memory to be initialized is on the Host or device side, * and the system determines whether * it is host or device according to the address * -* @param devPtr [IN] destination address pointer -* @param maxCount [IN] Max length of destination address memory -* @param value [IN] set value -* @param count [IN] the number of byte to set -* @param stream [IN] asynchronized task stream -* -* @retval ACL_SUCCESS The function is successfully executed. -* @retval OtherValues Failure -* -* @see aclrtSynchronizeStream -*/ -ACL_FUNC_VISIBILITY aclError aclrtMemsetAsync(void *devPtr, - size_t maxCount, - int32_t value, - size_t count, + * @param devPtr [IN] destination address pointer + * @param maxCount [IN] Max length of destination address memory + * @param value [IN] set value + * @param count [IN] the number of byte to set + * @param stream [IN] asynchronized task stream + * + * @retval ACL_SUCCESS The function is successfully executed. + * @retval OtherValues Failure + * + * @see aclrtSynchronizeStream + */ +ACL_FUNC_VISIBILITY aclError aclrtMemsetAsync(void *devPtr, size_t maxCount, int32_t value, size_t count, aclrtStream stream); /** @@ -894,11 +880,8 @@ ACL_FUNC_VISIBILITY aclError aclrtGetAllGroupInfo(aclrtGroupInfo *groupInfo); * * @see aclrtGetGroupCount | aclrtGetAllGroupInfo */ -ACL_FUNC_VISIBILITY aclError aclrtGetGroupInfoDetail(const aclrtGroupInfo *groupInfo, - int32_t groupIndex, - aclrtGroupAttr attr, - void *attrValue, - size_t valueLen, +ACL_FUNC_VISIBILITY aclError aclrtGetGroupInfoDetail(const aclrtGroupInfo *groupInfo, int32_t groupIndex, + aclrtGroupAttr attr, void *attrValue, size_t valueLen, size_t *paramRetSize); /** @@ -972,5 +955,4 @@ ACL_FUNC_VISIBILITY aclError aclrtSetOpWaitTimeout(uint32_t timeout); } #endif -#endif // INC_EXTERNAL_ACL_ACL_RT_H_ - +#endif // INC_EXTERNAL_ACL_ACL_RT_H_ diff --git a/inc/external/acl/acl_tdt.h b/inc/external/acl/acl_tdt.h index 61995121..c357518d 100644 --- a/inc/external/acl/acl_tdt.h +++ b/inc/external/acl/acl_tdt.h @@ -24,10 +24,10 @@ extern "C" { #endif enum acltdtTensorType { - ACL_TENSOR_DATA_UNDEFINED = -1, - ACL_TENSOR_DATA_TENSOR, - ACL_TENSOR_DATA_END_OF_SEQUENCE, - ACL_TENSOR_DATA_ABNORMAL + ACL_TENSOR_DATA_UNDEFINED = -1, + ACL_TENSOR_DATA_TENSOR, + ACL_TENSOR_DATA_END_OF_SEQUENCE, + ACL_TENSOR_DATA_ABNORMAL }; typedef struct acltdtDataItem acltdtDataItem; @@ -64,7 +64,7 @@ ACL_FUNC_VISIBILITY aclDataType acltdtGetDataTypeFromItem(const acltdtDataItem * * * @retval null for failed * @retval OtherValues success -*/ + */ ACL_FUNC_VISIBILITY void *acltdtGetDataAddrFromItem(const acltdtDataItem *dataItem); /** @@ -75,7 +75,7 @@ ACL_FUNC_VISIBILITY void *acltdtGetDataAddrFromItem(const acltdtDataItem *dataIt * * @retval 0 for failed * @retval OtherValues success -*/ + */ ACL_FUNC_VISIBILITY size_t acltdtGetDataSizeFromItem(const acltdtDataItem *dataItem); /** @@ -86,7 +86,7 @@ ACL_FUNC_VISIBILITY size_t acltdtGetDataSizeFromItem(const acltdtDataItem *dataI * * @retval 0 for failed * @retval OtherValues success -*/ + */ ACL_FUNC_VISIBILITY size_t acltdtGetDimNumFromItem(const acltdtDataItem *dataItem); /** @@ -118,12 +118,8 @@ ACL_FUNC_VISIBILITY aclError acltdtGetDimsFromItem(const acltdtDataItem *dataIte * * @see acltdtDestroyDataItem */ -ACL_FUNC_VISIBILITY acltdtDataItem *acltdtCreateDataItem(acltdtTensorType tdtType, - const int64_t *dims, - size_t dimNum, - aclDataType dataType, - void *data, - size_t size); +ACL_FUNC_VISIBILITY acltdtDataItem *acltdtCreateDataItem(acltdtTensorType tdtType, const int64_t *dims, size_t dimNum, + aclDataType dataType, void *data, size_t size); /** * @ingroup AscendCL @@ -254,8 +250,7 @@ ACL_FUNC_VISIBILITY aclError acltdtDestroyChannel(acltdtChannelHandle *handle); * * @see acltdtReceiveTensor */ -ACL_FUNC_VISIBILITY aclError acltdtSendTensor(const acltdtChannelHandle *handle, - const acltdtDataset *dataset, +ACL_FUNC_VISIBILITY aclError acltdtSendTensor(const acltdtChannelHandle *handle, const acltdtDataset *dataset, int32_t timeout); /** @@ -271,13 +266,11 @@ ACL_FUNC_VISIBILITY aclError acltdtSendTensor(const acltdtChannelHandle *handle, * * @see acltdtSendTensor */ -ACL_FUNC_VISIBILITY aclError acltdtReceiveTensor(const acltdtChannelHandle *handle, - acltdtDataset *dataset, +ACL_FUNC_VISIBILITY aclError acltdtReceiveTensor(const acltdtChannelHandle *handle, acltdtDataset *dataset, int32_t timeout); #ifdef __cplusplus } #endif -#endif //INC_EXTERNAL_ACL_ACL_TDT_H_ - +#endif // INC_EXTERNAL_ACL_ACL_TDT_H_ diff --git a/inc/external/acl/error_codes/rt_error_codes.h b/inc/external/acl/error_codes/rt_error_codes.h index 02a357fc..437a5544 100644 --- a/inc/external/acl/error_codes/rt_error_codes.h +++ b/inc/external/acl/error_codes/rt_error_codes.h @@ -23,81 +23,81 @@ extern "C" { #endif -static const int32_t ACL_RT_SUCCESS = 0; // success +static const int32_t ACL_RT_SUCCESS = 0; // success -static const int32_t ACL_ERROR_RT_PARAM_INVALID = 107000; // param invalid -static const int32_t ACL_ERROR_RT_INVALID_DEVICEID = 107001; // invalid device id -static const int32_t ACL_ERROR_RT_CONTEXT_NULL = 107002; // current context null -static const int32_t ACL_ERROR_RT_STREAM_CONTEXT = 107003; // stream not in current context -static const int32_t ACL_ERROR_RT_MODEL_CONTEXT = 107004; // model not in current context -static const int32_t ACL_ERROR_RT_STREAM_MODEL = 107005; // stream not in model -static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID = 107006; // event timestamp invalid -static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL = 107007; // event timestamp reversal -static const int32_t ACL_ERROR_RT_ADDR_UNALIGNED = 107008; // memory address unaligned -static const int32_t ACL_ERROR_RT_FILE_OPEN = 107009; // open file failed -static const int32_t ACL_ERROR_RT_FILE_WRITE = 107010; // write file failed -static const int32_t ACL_ERROR_RT_STREAM_SUBSCRIBE = 107011; // error subscribe stream -static const int32_t ACL_ERROR_RT_THREAD_SUBSCRIBE = 107012; // error subscribe thread -static const int32_t ACL_ERROR_RT_GROUP_NOT_SET = 107013; // group not set -static const int32_t ACL_ERROR_RT_GROUP_NOT_CREATE = 107014; // group not create -static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callback not register to stream -static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type -static const int32_t ACL_ERROR_RT_INVALID_HANDLE = 107017; // invalid handle -static const int32_t ACL_ERROR_RT_INVALID_MALLOC_TYPE = 107018; // invalid malloc type +static const int32_t ACL_ERROR_RT_PARAM_INVALID = 107000; // param invalid +static const int32_t ACL_ERROR_RT_INVALID_DEVICEID = 107001; // invalid device id +static const int32_t ACL_ERROR_RT_CONTEXT_NULL = 107002; // current context null +static const int32_t ACL_ERROR_RT_STREAM_CONTEXT = 107003; // stream not in current context +static const int32_t ACL_ERROR_RT_MODEL_CONTEXT = 107004; // model not in current context +static const int32_t ACL_ERROR_RT_STREAM_MODEL = 107005; // stream not in model +static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID = 107006; // event timestamp invalid +static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL = 107007; // event timestamp reversal +static const int32_t ACL_ERROR_RT_ADDR_UNALIGNED = 107008; // memory address unaligned +static const int32_t ACL_ERROR_RT_FILE_OPEN = 107009; // open file failed +static const int32_t ACL_ERROR_RT_FILE_WRITE = 107010; // write file failed +static const int32_t ACL_ERROR_RT_STREAM_SUBSCRIBE = 107011; // error subscribe stream +static const int32_t ACL_ERROR_RT_THREAD_SUBSCRIBE = 107012; // error subscribe thread +static const int32_t ACL_ERROR_RT_GROUP_NOT_SET = 107013; // group not set +static const int32_t ACL_ERROR_RT_GROUP_NOT_CREATE = 107014; // group not create +static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callback not register to stream +static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type +static const int32_t ACL_ERROR_RT_INVALID_HANDLE = 107017; // invalid handle +static const int32_t ACL_ERROR_RT_INVALID_MALLOC_TYPE = 107018; // invalid malloc type -static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPORT = 207000; // feature not support -static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error -static const int32_t ACL_ERROR_RT_MEMORY_FREE = 207002; // memory free error -static const int32_t ACL_ERROR_RT_AICORE_OVER_FLOW = 207003; // aicore over flow -static const int32_t ACL_ERROR_RT_NO_DEVICE = 207004; // no device -static const int32_t ACL_ERROR_RT_RESOURCE_ALLOC_FAIL = 207005; // resource alloc fail -static const int32_t ACL_ERROR_RT_NO_PERMISSION = 207006; // no permission -static const int32_t ACL_ERROR_RT_NO_EVENT_RESOURCE = 207007; // no event resource -static const int32_t ACL_ERROR_RT_NO_STREAM_RESOURCE = 207008; // no stream resource -static const int32_t ACL_ERROR_RT_NO_NOTIFY_RESOURCE = 207009; // no notify resource -static const int32_t ACL_ERROR_RT_NO_MODEL_RESOURCE = 207010; // no model resource +static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPORT = 207000; // feature not support +static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error +static const int32_t ACL_ERROR_RT_MEMORY_FREE = 207002; // memory free error +static const int32_t ACL_ERROR_RT_AICORE_OVER_FLOW = 207003; // aicore over flow +static const int32_t ACL_ERROR_RT_NO_DEVICE = 207004; // no device +static const int32_t ACL_ERROR_RT_RESOURCE_ALLOC_FAIL = 207005; // resource alloc fail +static const int32_t ACL_ERROR_RT_NO_PERMISSION = 207006; // no permission +static const int32_t ACL_ERROR_RT_NO_EVENT_RESOURCE = 207007; // no event resource +static const int32_t ACL_ERROR_RT_NO_STREAM_RESOURCE = 207008; // no stream resource +static const int32_t ACL_ERROR_RT_NO_NOTIFY_RESOURCE = 207009; // no notify resource +static const int32_t ACL_ERROR_RT_NO_MODEL_RESOURCE = 207010; // no model resource -static const int32_t ACL_ERROR_RT_INTERNAL_ERROR = 507000; // runtime internal error -static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error -static const int32_t ACL_ERROR_RT_STREAM_TASK_FULL = 507002; // task full in stream -static const int32_t ACL_ERROR_RT_STREAM_TASK_EMPTY = 507003; // task empty in stream -static const int32_t ACL_ERROR_RT_STREAM_NOT_COMPLETE = 507004; // stream not complete -static const int32_t ACL_ERROR_RT_END_OF_SEQUENCE = 507005; // end of sequence -static const int32_t ACL_ERROR_RT_EVENT_NOT_COMPLETE = 507006; // event not complete -static const int32_t ACL_ERROR_RT_CONTEXT_RELEASE_ERROR = 507007; // context release error -static const int32_t ACL_ERROR_RT_SOC_VERSION = 507008; // soc version error -static const int32_t ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT = 507009; // task type not support -static const int32_t ACL_ERROR_RT_LOST_HEARTBEAT = 507010; // ts lost heartbeat -static const int32_t ACL_ERROR_RT_MODEL_EXECUTE = 507011; // model execute failed -static const int32_t ACL_ERROR_RT_REPORT_TIMEOUT = 507012; // report timeout -static const int32_t ACL_ERROR_RT_SYS_DMA = 507013; // sys dma error -static const int32_t ACL_ERROR_RT_AICORE_TIMEOUT = 507014; // aicore timeout -static const int32_t ACL_ERROR_RT_AICORE_EXCEPTION = 507015; // aicore exception -static const int32_t ACL_ERROR_RT_AICORE_TRAP_EXCEPTION = 507016; // aicore trap exception -static const int32_t ACL_ERROR_RT_AICPU_TIMEOUT = 507017; // aicpu timeout -static const int32_t ACL_ERROR_RT_AICPU_EXCEPTION = 507018; // aicpu exception -static const int32_t ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR = 507019; // aicpu datadump response error -static const int32_t ACL_ERROR_RT_AICPU_MODEL_RSP_ERR = 507020; // aicpu model operate response error -static const int32_t ACL_ERROR_RT_PROFILING_ERROR = 507021; // profiling error -static const int32_t ACL_ERROR_RT_IPC_ERROR = 507022; // ipc error -static const int32_t ACL_ERROR_RT_MODEL_ABORT_NORMAL = 507023; // model abort normal -static const int32_t ACL_ERROR_RT_KERNEL_UNREGISTERING = 507024; // kernel unregistering -static const int32_t ACL_ERROR_RT_RINGBUFFER_NOT_INIT = 507025; // ringbuffer not init -static const int32_t ACL_ERROR_RT_RINGBUFFER_NO_DATA = 507026; // ringbuffer no data -static const int32_t ACL_ERROR_RT_KERNEL_LOOKUP = 507027; // kernel lookup error -static const int32_t ACL_ERROR_RT_KERNEL_DUPLICATE = 507028; // kernel register duplicate -static const int32_t ACL_ERROR_RT_DEBUG_REGISTER_FAIL = 507029; // debug register failed -static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug unregister failed -static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context -static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out -static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error +static const int32_t ACL_ERROR_RT_INTERNAL_ERROR = 507000; // runtime internal error +static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error +static const int32_t ACL_ERROR_RT_STREAM_TASK_FULL = 507002; // task full in stream +static const int32_t ACL_ERROR_RT_STREAM_TASK_EMPTY = 507003; // task empty in stream +static const int32_t ACL_ERROR_RT_STREAM_NOT_COMPLETE = 507004; // stream not complete +static const int32_t ACL_ERROR_RT_END_OF_SEQUENCE = 507005; // end of sequence +static const int32_t ACL_ERROR_RT_EVENT_NOT_COMPLETE = 507006; // event not complete +static const int32_t ACL_ERROR_RT_CONTEXT_RELEASE_ERROR = 507007; // context release error +static const int32_t ACL_ERROR_RT_SOC_VERSION = 507008; // soc version error +static const int32_t ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT = 507009; // task type not support +static const int32_t ACL_ERROR_RT_LOST_HEARTBEAT = 507010; // ts lost heartbeat +static const int32_t ACL_ERROR_RT_MODEL_EXECUTE = 507011; // model execute failed +static const int32_t ACL_ERROR_RT_REPORT_TIMEOUT = 507012; // report timeout +static const int32_t ACL_ERROR_RT_SYS_DMA = 507013; // sys dma error +static const int32_t ACL_ERROR_RT_AICORE_TIMEOUT = 507014; // aicore timeout +static const int32_t ACL_ERROR_RT_AICORE_EXCEPTION = 507015; // aicore exception +static const int32_t ACL_ERROR_RT_AICORE_TRAP_EXCEPTION = 507016; // aicore trap exception +static const int32_t ACL_ERROR_RT_AICPU_TIMEOUT = 507017; // aicpu timeout +static const int32_t ACL_ERROR_RT_AICPU_EXCEPTION = 507018; // aicpu exception +static const int32_t ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR = 507019; // aicpu datadump response error +static const int32_t ACL_ERROR_RT_AICPU_MODEL_RSP_ERR = 507020; // aicpu model operate response error +static const int32_t ACL_ERROR_RT_PROFILING_ERROR = 507021; // profiling error +static const int32_t ACL_ERROR_RT_IPC_ERROR = 507022; // ipc error +static const int32_t ACL_ERROR_RT_MODEL_ABORT_NORMAL = 507023; // model abort normal +static const int32_t ACL_ERROR_RT_KERNEL_UNREGISTERING = 507024; // kernel unregistering +static const int32_t ACL_ERROR_RT_RINGBUFFER_NOT_INIT = 507025; // ringbuffer not init +static const int32_t ACL_ERROR_RT_RINGBUFFER_NO_DATA = 507026; // ringbuffer no data +static const int32_t ACL_ERROR_RT_KERNEL_LOOKUP = 507027; // kernel lookup error +static const int32_t ACL_ERROR_RT_KERNEL_DUPLICATE = 507028; // kernel register duplicate +static const int32_t ACL_ERROR_RT_DEBUG_REGISTER_FAIL = 507029; // debug register failed +static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug unregister failed +static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context +static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out +static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error -static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error -static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error -static const int32_t ACL_ERROR_RT_SOCKET_CLOSE = 507901; // hdc disconnect +static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error +static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error +static const int32_t ACL_ERROR_RT_SOCKET_CLOSE = 507901; // hdc disconnect #ifdef __cplusplus } #endif -#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__ +#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__ diff --git a/inc/external/acl/ops/acl_cblas.h b/inc/external/acl/ops/acl_cblas.h index a2bd8c61..3d81eb2b 100644 --- a/inc/external/acl/ops/acl_cblas.h +++ b/inc/external/acl/ops/acl_cblas.h @@ -23,17 +23,9 @@ extern "C" { #endif -typedef enum aclTransType { - ACL_TRANS_N, - ACL_TRANS_T, - ACL_TRANS_NZ, - ACL_TRANS_NZ_T -} aclTransType; +typedef enum aclTransType { ACL_TRANS_N, ACL_TRANS_T, ACL_TRANS_NZ, ACL_TRANS_NZ_T } aclTransType; -typedef enum aclComputeType { - ACL_COMPUTE_HIGH_PRECISION, - ACL_COMPUTE_LOW_PRECISION -} aclComputeType; +typedef enum aclComputeType { ACL_COMPUTE_HIGH_PRECISION, ACL_COMPUTE_LOW_PRECISION } aclComputeType; /** * @ingroup AscendCL @@ -61,12 +53,11 @@ typedef enum aclComputeType { * * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure -*/ -ACL_FUNC_VISIBILITY aclError aclblasGemvEx(aclTransType transA, int m, int n, - const void *alpha, const void *a, int lda, aclDataType dataTypeA, - const void *x, int incx, aclDataType dataTypeX, - const void *beta, void *y, int incy, aclDataType dataTypeY, - aclComputeType type, aclrtStream stream); + */ +ACL_FUNC_VISIBILITY aclError aclblasGemvEx(aclTransType transA, int m, int n, const void *alpha, const void *a, int lda, + aclDataType dataTypeA, const void *x, int incx, aclDataType dataTypeX, + const void *beta, void *y, int incy, aclDataType dataTypeY, + aclComputeType type, aclrtStream stream); /** * @ingroup AscendCL @@ -83,15 +74,10 @@ ACL_FUNC_VISIBILITY aclError aclblasGemvEx(aclTransType transA, int m, int n, * * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure -*/ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemvEx(aclTransType transA, - int m, - int n, - aclDataType dataTypeA, - aclDataType dataTypeX, - aclDataType dataTypeY, - aclComputeType type, - aclopHandle **handle); + */ +ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemvEx(aclTransType transA, int m, int n, aclDataType dataTypeA, + aclDataType dataTypeX, aclDataType dataTypeY, + aclComputeType type, aclopHandle **handle); /** * @ingroup AscendCL @@ -115,18 +101,9 @@ ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemvEx(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasHgemv(aclTransType transA, - int m, - int n, - const aclFloat16 *alpha, - const aclFloat16 *a, - int lda, - const aclFloat16 *x, - int incx, - const aclFloat16 *beta, - aclFloat16 *y, - int incy, - aclComputeType type, +ACL_FUNC_VISIBILITY aclError aclblasHgemv(aclTransType transA, int m, int n, const aclFloat16 *alpha, + const aclFloat16 *a, int lda, const aclFloat16 *x, int incx, + const aclFloat16 *beta, aclFloat16 *y, int incy, aclComputeType type, aclrtStream stream); /** @@ -142,10 +119,7 @@ ACL_FUNC_VISIBILITY aclError aclblasHgemv(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemv(aclTransType transA, - int m, - int n, - aclComputeType type, +ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemv(aclTransType transA, int m, int n, aclComputeType type, aclopHandle **handle); /** @@ -171,19 +145,9 @@ ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemv(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasS8gemv(aclTransType transA, - int m, - int n, - const int32_t *alpha, - const int8_t *a, - int lda, - const int8_t *x, - int incx, - const int32_t *beta, - int32_t *y, - int incy, - aclComputeType type, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError aclblasS8gemv(aclTransType transA, int m, int n, const int32_t *alpha, const int8_t *a, + int lda, const int8_t *x, int incx, const int32_t *beta, int32_t *y, + int incy, aclComputeType type, aclrtStream stream); /** * @ingroup AscendCL @@ -198,10 +162,7 @@ ACL_FUNC_VISIBILITY aclError aclblasS8gemv(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemv(aclTransType transA, - int m, - int n, - aclComputeType type, +ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemv(aclTransType transA, int m, int n, aclComputeType type, aclopHandle **handle); /** @@ -233,26 +194,11 @@ ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemv(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasGemmEx(aclTransType transA, - aclTransType transB, - aclTransType transC, - int m, - int n, - int k, - const void *alpha, - const void *matrixA, - int lda, - aclDataType dataTypeA, - const void *matrixB, - int ldb, - aclDataType dataTypeB, - const void *beta, - void *matrixC, - int ldc, - aclDataType dataTypeC, - aclComputeType type, - aclrtStream stream); - +ACL_FUNC_VISIBILITY aclError aclblasGemmEx(aclTransType transA, aclTransType transB, aclTransType transC, int m, int n, + int k, const void *alpha, const void *matrixA, int lda, + aclDataType dataTypeA, const void *matrixB, int ldb, aclDataType dataTypeB, + const void *beta, void *matrixC, int ldc, aclDataType dataTypeC, + aclComputeType type, aclrtStream stream); /** * @ingroup AscendCL @@ -274,18 +220,10 @@ ACL_FUNC_VISIBILITY aclError aclblasGemmEx(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemmEx(aclTransType transA, - aclTransType transB, - aclTransType transC, - int m, - int n, - int k, - aclDataType dataTypeA, - aclDataType dataTypeB, - aclDataType dataTypeC, - aclComputeType type, - aclopHandle **handle); - +ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemmEx(aclTransType transA, aclTransType transB, aclTransType transC, + int m, int n, int k, aclDataType dataTypeA, + aclDataType dataTypeB, aclDataType dataTypeC, + aclComputeType type, aclopHandle **handle); /** * @ingroup AscendCL @@ -313,22 +251,10 @@ ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemmEx(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasHgemm(aclTransType transA, - aclTransType transB, - aclTransType transC, - int m, - int n, - int k, - const aclFloat16 *alpha, - const aclFloat16 *matrixA, - int lda, - const aclFloat16 *matrixB, - int ldb, - const aclFloat16 *beta, - aclFloat16 *matrixC, - int ldc, - aclComputeType type, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError aclblasHgemm(aclTransType transA, aclTransType transB, aclTransType transC, int m, int n, + int k, const aclFloat16 *alpha, const aclFloat16 *matrixA, int lda, + const aclFloat16 *matrixB, int ldb, const aclFloat16 *beta, + aclFloat16 *matrixC, int ldc, aclComputeType type, aclrtStream stream); /** * @ingroup AscendCL @@ -346,13 +272,8 @@ ACL_FUNC_VISIBILITY aclError aclblasHgemm(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemm(aclTransType transA, - aclTransType transB, - aclTransType transC, - int m, - int n, - int k, - aclComputeType type, +ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemm(aclTransType transA, aclTransType transB, aclTransType transC, + int m, int n, int k, aclComputeType type, aclopHandle **handle); /** @@ -381,23 +302,10 @@ ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemm(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasS8gemm(aclTransType transA, - aclTransType transB, - aclTransType transC, - int m, - int n, - int k, - const int32_t *alpha, - const int8_t *matrixA, - int lda, - const int8_t *matrixB, - int ldb, - const int32_t *beta, - int32_t *matrixC, - int ldc, - aclComputeType type, - aclrtStream stream); - +ACL_FUNC_VISIBILITY aclError aclblasS8gemm(aclTransType transA, aclTransType transB, aclTransType transC, int m, int n, + int k, const int32_t *alpha, const int8_t *matrixA, int lda, + const int8_t *matrixB, int ldb, const int32_t *beta, int32_t *matrixC, + int ldc, aclComputeType type, aclrtStream stream); /** * @ingroup AscendCL @@ -415,17 +323,12 @@ ACL_FUNC_VISIBILITY aclError aclblasS8gemm(aclTransType transA, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemm(aclTransType transA, - aclTransType transB, - aclTransType transC, - int m, - int n, - int k, - aclComputeType type, +ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemm(aclTransType transA, aclTransType transB, aclTransType transC, + int m, int n, int k, aclComputeType type, aclopHandle **handle); #ifdef __cplusplus } #endif -#endif // INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_ +#endif // INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_ diff --git a/inc/external/acl/ops/acl_dvpp.h b/inc/external/acl/ops/acl_dvpp.h index 90dc70e8..dcaa3936 100644 --- a/inc/external/acl/ops/acl_dvpp.h +++ b/inc/external/acl/ops/acl_dvpp.h @@ -53,123 +53,109 @@ typedef void (*aclvencCallback)(acldvppPicDesc *input, acldvppStreamDesc *output // Supported Pixel Format enum acldvppPixelFormat { - PIXEL_FORMAT_YUV_400 = 0, // 0 - PIXEL_FORMAT_YUV_SEMIPLANAR_420 = 1, // 1 - PIXEL_FORMAT_YVU_SEMIPLANAR_420 = 2, // 2 - PIXEL_FORMAT_YUV_SEMIPLANAR_422 = 3, // 3 - PIXEL_FORMAT_YVU_SEMIPLANAR_422 = 4, // 4 - PIXEL_FORMAT_YUV_SEMIPLANAR_444 = 5, // 5 - PIXEL_FORMAT_YVU_SEMIPLANAR_444 = 6, // 6 - PIXEL_FORMAT_YUYV_PACKED_422 = 7, // 7 - PIXEL_FORMAT_UYVY_PACKED_422 = 8, // 8 - PIXEL_FORMAT_YVYU_PACKED_422 = 9, // 9 - PIXEL_FORMAT_VYUY_PACKED_422 = 10, // 10 - PIXEL_FORMAT_YUV_PACKED_444 = 11, // 11 - PIXEL_FORMAT_RGB_888 = 12, // 12 - PIXEL_FORMAT_BGR_888 = 13, // 13 - PIXEL_FORMAT_ARGB_8888 = 14, // 14 - PIXEL_FORMAT_ABGR_8888 = 15, // 15 - PIXEL_FORMAT_RGBA_8888 = 16, // 16 - PIXEL_FORMAT_BGRA_8888 = 17, // 17 - PIXEL_FORMAT_YUV_SEMI_PLANNER_420_10BIT = 18, // 18 - PIXEL_FORMAT_YVU_SEMI_PLANNER_420_10BIT = 19, // 19 - PIXEL_FORMAT_YVU_PLANAR_420 = 20, // 20 - PIXEL_FORMAT_YVU_PLANAR_422, - PIXEL_FORMAT_YVU_PLANAR_444, - PIXEL_FORMAT_RGB_444 = 23, - PIXEL_FORMAT_BGR_444, - PIXEL_FORMAT_ARGB_4444, - PIXEL_FORMAT_ABGR_4444, - PIXEL_FORMAT_RGBA_4444, - PIXEL_FORMAT_BGRA_4444, - PIXEL_FORMAT_RGB_555, - PIXEL_FORMAT_BGR_555, - PIXEL_FORMAT_RGB_565, - PIXEL_FORMAT_BGR_565, - PIXEL_FORMAT_ARGB_1555, - PIXEL_FORMAT_ABGR_1555, - PIXEL_FORMAT_RGBA_1555, - PIXEL_FORMAT_BGRA_1555, - PIXEL_FORMAT_ARGB_8565, - PIXEL_FORMAT_ABGR_8565, - PIXEL_FORMAT_RGBA_8565, - PIXEL_FORMAT_BGRA_8565, - PIXEL_FORMAT_RGB_BAYER_8BPP = 50, - PIXEL_FORMAT_RGB_BAYER_10BPP, - PIXEL_FORMAT_RGB_BAYER_12BPP, - PIXEL_FORMAT_RGB_BAYER_14BPP, - PIXEL_FORMAT_RGB_BAYER_16BPP, - PIXEL_FORMAT_BGR_888_PLANAR = 70, - PIXEL_FORMAT_HSV_888_PACKAGE, - PIXEL_FORMAT_HSV_888_PLANAR, - PIXEL_FORMAT_LAB_888_PACKAGE, - PIXEL_FORMAT_LAB_888_PLANAR, - PIXEL_FORMAT_S8C1, - PIXEL_FORMAT_S8C2_PACKAGE, - PIXEL_FORMAT_S8C2_PLANAR, - PIXEL_FORMAT_S16C1, - PIXEL_FORMAT_U8C1, - PIXEL_FORMAT_U16C1, - PIXEL_FORMAT_S32C1, - PIXEL_FORMAT_U32C1, - PIXEL_FORMAT_U64C1, - PIXEL_FORMAT_S64C1, - PIXEL_FORMAT_YUV_SEMIPLANAR_440 = 1000, - PIXEL_FORMAT_YVU_SEMIPLANAR_440, - PIXEL_FORMAT_FLOAT32, - PIXEL_FORMAT_BUTT, - PIXEL_FORMAT_UNKNOWN = 10000 + PIXEL_FORMAT_YUV_400 = 0, // 0 + PIXEL_FORMAT_YUV_SEMIPLANAR_420 = 1, // 1 + PIXEL_FORMAT_YVU_SEMIPLANAR_420 = 2, // 2 + PIXEL_FORMAT_YUV_SEMIPLANAR_422 = 3, // 3 + PIXEL_FORMAT_YVU_SEMIPLANAR_422 = 4, // 4 + PIXEL_FORMAT_YUV_SEMIPLANAR_444 = 5, // 5 + PIXEL_FORMAT_YVU_SEMIPLANAR_444 = 6, // 6 + PIXEL_FORMAT_YUYV_PACKED_422 = 7, // 7 + PIXEL_FORMAT_UYVY_PACKED_422 = 8, // 8 + PIXEL_FORMAT_YVYU_PACKED_422 = 9, // 9 + PIXEL_FORMAT_VYUY_PACKED_422 = 10, // 10 + PIXEL_FORMAT_YUV_PACKED_444 = 11, // 11 + PIXEL_FORMAT_RGB_888 = 12, // 12 + PIXEL_FORMAT_BGR_888 = 13, // 13 + PIXEL_FORMAT_ARGB_8888 = 14, // 14 + PIXEL_FORMAT_ABGR_8888 = 15, // 15 + PIXEL_FORMAT_RGBA_8888 = 16, // 16 + PIXEL_FORMAT_BGRA_8888 = 17, // 17 + PIXEL_FORMAT_YUV_SEMI_PLANNER_420_10BIT = 18, // 18 + PIXEL_FORMAT_YVU_SEMI_PLANNER_420_10BIT = 19, // 19 + PIXEL_FORMAT_YVU_PLANAR_420 = 20, // 20 + PIXEL_FORMAT_YVU_PLANAR_422, + PIXEL_FORMAT_YVU_PLANAR_444, + PIXEL_FORMAT_RGB_444 = 23, + PIXEL_FORMAT_BGR_444, + PIXEL_FORMAT_ARGB_4444, + PIXEL_FORMAT_ABGR_4444, + PIXEL_FORMAT_RGBA_4444, + PIXEL_FORMAT_BGRA_4444, + PIXEL_FORMAT_RGB_555, + PIXEL_FORMAT_BGR_555, + PIXEL_FORMAT_RGB_565, + PIXEL_FORMAT_BGR_565, + PIXEL_FORMAT_ARGB_1555, + PIXEL_FORMAT_ABGR_1555, + PIXEL_FORMAT_RGBA_1555, + PIXEL_FORMAT_BGRA_1555, + PIXEL_FORMAT_ARGB_8565, + PIXEL_FORMAT_ABGR_8565, + PIXEL_FORMAT_RGBA_8565, + PIXEL_FORMAT_BGRA_8565, + PIXEL_FORMAT_RGB_BAYER_8BPP = 50, + PIXEL_FORMAT_RGB_BAYER_10BPP, + PIXEL_FORMAT_RGB_BAYER_12BPP, + PIXEL_FORMAT_RGB_BAYER_14BPP, + PIXEL_FORMAT_RGB_BAYER_16BPP, + PIXEL_FORMAT_BGR_888_PLANAR = 70, + PIXEL_FORMAT_HSV_888_PACKAGE, + PIXEL_FORMAT_HSV_888_PLANAR, + PIXEL_FORMAT_LAB_888_PACKAGE, + PIXEL_FORMAT_LAB_888_PLANAR, + PIXEL_FORMAT_S8C1, + PIXEL_FORMAT_S8C2_PACKAGE, + PIXEL_FORMAT_S8C2_PLANAR, + PIXEL_FORMAT_S16C1, + PIXEL_FORMAT_U8C1, + PIXEL_FORMAT_U16C1, + PIXEL_FORMAT_S32C1, + PIXEL_FORMAT_U32C1, + PIXEL_FORMAT_U64C1, + PIXEL_FORMAT_S64C1, + PIXEL_FORMAT_YUV_SEMIPLANAR_440 = 1000, + PIXEL_FORMAT_YVU_SEMIPLANAR_440, + PIXEL_FORMAT_FLOAT32, + PIXEL_FORMAT_BUTT, + PIXEL_FORMAT_UNKNOWN = 10000 }; // Stream Format -enum acldvppStreamFormat { - H265_MAIN_LEVEL = 0, - H264_BASELINE_LEVEL, - H264_MAIN_LEVEL, - H264_HIGH_LEVEL -}; +enum acldvppStreamFormat { H265_MAIN_LEVEL = 0, H264_BASELINE_LEVEL, H264_MAIN_LEVEL, H264_HIGH_LEVEL }; // Supported Channel Mode -enum acldvppChannelMode { - DVPP_CHNMODE_VPC = 1, - DVPP_CHNMODE_JPEGD = 2, - DVPP_CHNMODE_JPEGE = 4 -}; +enum acldvppChannelMode { DVPP_CHNMODE_VPC = 1, DVPP_CHNMODE_JPEGD = 2, DVPP_CHNMODE_JPEGE = 4 }; // Supported Border Type -enum acldvppBorderType { - BORDER_CONSTANT = 0, - BORDER_REPLICATE, - BORDER_REFLECT, - BORDER_REFLECT_101 -}; +enum acldvppBorderType { BORDER_CONSTANT = 0, BORDER_REPLICATE, BORDER_REFLECT, BORDER_REFLECT_101 }; // Venc parameter type enum aclvencChannelDescParamType { - ACL_VENC_THREAD_ID_UINT64 = 0, - ACL_VENC_CALLBACK_PTR, - ACL_VENC_PIXEL_FORMAT_UINT32, - ACL_VENC_ENCODE_TYPE_UINT32, - ACL_VENC_PIC_WIDTH_UINT32, - ACL_VENC_PIC_HEIGHT_UINT32, - ACL_VENC_KEY_FRAME_INTERVAL_UINT32, - ACL_VENC_BUF_ADDR_PTR, - ACL_VENC_BUF_SIZE_UINT32, - ACL_VENC_RC_MODE_UINT32, - ACL_VENC_SRC_RATE_UINT32, - ACL_VENC_MAX_BITRATE_UINT32, - ACL_VENC_MAX_IP_PROP_UINT32 + ACL_VENC_THREAD_ID_UINT64 = 0, + ACL_VENC_CALLBACK_PTR, + ACL_VENC_PIXEL_FORMAT_UINT32, + ACL_VENC_ENCODE_TYPE_UINT32, + ACL_VENC_PIC_WIDTH_UINT32, + ACL_VENC_PIC_HEIGHT_UINT32, + ACL_VENC_KEY_FRAME_INTERVAL_UINT32, + ACL_VENC_BUF_ADDR_PTR, + ACL_VENC_BUF_SIZE_UINT32, + ACL_VENC_RC_MODE_UINT32, + ACL_VENC_SRC_RATE_UINT32, + ACL_VENC_MAX_BITRATE_UINT32, + ACL_VENC_MAX_IP_PROP_UINT32 }; // Jpeg picture format enum acldvppJpegFormat { - ACL_JPEG_CSS_444 = 0, - ACL_JPEG_CSS_422, - ACL_JPEG_CSS_420, - ACL_JPEG_CSS_GRAY, - ACL_JPEG_CSS_440, - ACL_JPEG_CSS_411, - ACL_JPEG_CSS_UNKNOWN = 1000 + ACL_JPEG_CSS_444 = 0, + ACL_JPEG_CSS_422, + ACL_JPEG_CSS_420, + ACL_JPEG_CSS_GRAY, + ACL_JPEG_CSS_440, + ACL_JPEG_CSS_411, + ACL_JPEG_CSS_UNKNOWN = 1000 }; /** @@ -523,9 +509,7 @@ ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescRetCode(const acldvppPicDesc *picD * @retval null for failed. * @retval other success */ -ACL_FUNC_VISIBILITY acldvppRoiConfig *acldvppCreateRoiConfig(uint32_t left, - uint32_t right, - uint32_t top, +ACL_FUNC_VISIBILITY acldvppRoiConfig *acldvppCreateRoiConfig(uint32_t left, uint32_t right, uint32_t top, uint32_t bottom); /** @@ -604,10 +588,7 @@ ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigBottom(acldvppRoiConfig *config, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfig(acldvppRoiConfig *config, - uint32_t left, - uint32_t right, - uint32_t top, +ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfig(acldvppRoiConfig *config, uint32_t left, uint32_t right, uint32_t top, uint32_t bottom); /** @@ -1096,7 +1077,8 @@ ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescMaxBitRate(aclvencChannelDesc * @retval ACL_SUCCESS for success, other for failure */ ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescParam(aclvencChannelDesc *channelDesc, - aclvencChannelDescParamType paramType, size_t length, const void *param); + aclvencChannelDescParamType paramType, size_t length, + const void *param); /** * @ingroup AscendCL @@ -1245,7 +1227,8 @@ ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescMaxBitRate(const aclvencChanne * @retval ACL_SUCCESS for success, other for failure */ ACL_FUNC_VISIBILITY aclError aclvencGetChannelDescParam(const aclvencChannelDesc *channelDesc, - aclvencChannelDescParamType paramType, size_t length, size_t *paramRetSize, void *param); + aclvencChannelDescParamType paramType, size_t length, + size_t *paramRetSize, void *param); /** * @ingroup AscendCL @@ -1545,10 +1528,7 @@ ACL_FUNC_VISIBILITY aclError aclvdecDestroyFrameConfig(aclvdecFrameConfig *vdecF * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfo(const void *data, - uint32_t size, - uint32_t *width, - uint32_t *height, +ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfo(const void *data, uint32_t size, uint32_t *width, uint32_t *height, int32_t *components); /** @@ -1565,11 +1545,8 @@ ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfo(const void *data, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfoV2(const void *data, - uint32_t size, - uint32_t *width, - uint32_t *height, - int32_t *components, +ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfoV2(const void *data, uint32_t size, uint32_t *width, + uint32_t *height, int32_t *components, acldvppJpegFormat *format); /** @@ -1584,8 +1561,7 @@ ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfoV2(const void *data, * @retval OtherValues Failure */ ACL_FUNC_VISIBILITY aclError acldvppJpegPredictEncSize(const acldvppPicDesc *inputDesc, - const acldvppJpegeConfig *config, - uint32_t *size); + const acldvppJpegeConfig *config, uint32_t *size); /** * @ingroup AscendCL @@ -1599,10 +1575,8 @@ ACL_FUNC_VISIBILITY aclError acldvppJpegPredictEncSize(const acldvppPicDesc *inp * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppJpegPredictDecSize(const void *data, - uint32_t dataSize, - acldvppPixelFormat outputPixelFormat, - uint32_t *decSize); +ACL_FUNC_VISIBILITY aclError acldvppJpegPredictDecSize(const void *data, uint32_t dataSize, + acldvppPixelFormat outputPixelFormat, uint32_t *decSize); /** * @ingroup AscendCL @@ -1617,11 +1591,8 @@ ACL_FUNC_VISIBILITY aclError acldvppJpegPredictDecSize(const void *data, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppPngGetImageInfo(const void *data, - uint32_t dataSize, - uint32_t *width, - uint32_t *height, - int32_t *components); +ACL_FUNC_VISIBILITY aclError acldvppPngGetImageInfo(const void *data, uint32_t dataSize, uint32_t *width, + uint32_t *height, int32_t *components); /** * @ingroup AscendCL @@ -1635,10 +1606,8 @@ ACL_FUNC_VISIBILITY aclError acldvppPngGetImageInfo(const void *data, * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppPngPredictDecSize(const void *data, - uint32_t dataSize, - acldvppPixelFormat outputPixelFormat, - uint32_t *decSize); +ACL_FUNC_VISIBILITY aclError acldvppPngPredictDecSize(const void *data, uint32_t dataSize, + acldvppPixelFormat outputPixelFormat, uint32_t *decSize); /** * @ingroup AscendCL @@ -1702,10 +1671,8 @@ ACL_FUNC_VISIBILITY aclError acldvppDestroyChannel(acldvppChannelDesc *channelDe * @see acldvppCreateChannel | acldvppCreatePicDesc * | acldvppCreateResizeConfig */ -ACL_FUNC_VISIBILITY aclError acldvppVpcResizeAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - acldvppResizeConfig *resizeConfig, +ACL_FUNC_VISIBILITY aclError acldvppVpcResizeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppResizeConfig *resizeConfig, aclrtStream stream); /** @@ -1741,10 +1708,8 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcResizeAsync(acldvppChannelDesc *channelDe * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppVpcCropAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - acldvppRoiConfig *cropArea, +ACL_FUNC_VISIBILITY aclError acldvppVpcCropAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, aclrtStream stream); /** @@ -1781,13 +1746,9 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcCropAsync(acldvppChannelDesc *channelDesc * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizeAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - acldvppRoiConfig *cropArea, - acldvppResizeConfig *resizeConfig, - aclrtStream stream); - +ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, + acldvppResizeConfig *resizeConfig, aclrtStream stream); /** * @ingroup AscendCL @@ -1811,12 +1772,9 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizeAsync(acldvppChannelDesc *chann * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig */ ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAsync(acldvppChannelDesc *channelDesc, - acldvppBatchPicDesc *srcBatchPicDescs, - uint32_t *roiNums, - uint32_t size, - acldvppBatchPicDesc *dstBatchPicDescs, - acldvppRoiConfig *cropAreas[], - aclrtStream stream); + acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, + uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs, + acldvppRoiConfig *cropAreas[], aclrtStream stream); /** * @ingroup AscendCL @@ -1841,13 +1799,10 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAsync(acldvppChannelDesc *channe * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateDvppConfig */ ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeAsync(acldvppChannelDesc *channelDesc, - acldvppBatchPicDesc *srcBatchPicDescs, - uint32_t *roiNums, - uint32_t size, - acldvppBatchPicDesc *dstBatchPicDescs, + acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, + uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs, acldvppRoiConfig *cropAreas[], - acldvppResizeConfig *resizeConfig, - aclrtStream stream); + acldvppResizeConfig *resizeConfig, aclrtStream stream); /** * @ingroup AscendCL @@ -1870,12 +1825,9 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeAsync(acldvppChannelDesc * * * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig */ -ACL_FUNC_VISIBILITY aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - acldvppRoiConfig *cropArea, - acldvppRoiConfig *pasteArea, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, + acldvppRoiConfig *pasteArea, aclrtStream stream); /** * @ingroup AscendCL @@ -1899,13 +1851,10 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *cha * * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig */ -ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizePasteAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - acldvppRoiConfig *cropArea, +ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizePasteAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, acldvppRoiConfig *pasteArea, - acldvppResizeConfig *resizeConfig, - aclrtStream stream); + acldvppResizeConfig *resizeConfig, aclrtStream stream); /** * @ingroup AscendCL @@ -1930,14 +1879,11 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizePasteAsync(acldvppChannelDesc * * * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig */ - ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAndPasteAsync(acldvppChannelDesc *channelDesc, - acldvppBatchPicDesc *srcBatchPicDescs, - uint32_t *roiNums, - uint32_t size, - acldvppBatchPicDesc *dstBatchPicDescs, - acldvppRoiConfig *cropAreas[], - acldvppRoiConfig *pasteAreas[], - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAndPasteAsync(acldvppChannelDesc *channelDesc, + acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, + uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs, + acldvppRoiConfig *cropAreas[], + acldvppRoiConfig *pasteAreas[], aclrtStream stream); /** * @ingroup AscendCL @@ -1963,16 +1909,10 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizePasteAsync(acldvppChannelDesc * * * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig */ -ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizePasteAsync(acldvppChannelDesc *channelDesc, - acldvppBatchPicDesc *srcBatchPicDescs, - uint32_t *roiNums, - uint32_t size, - acldvppBatchPicDesc *dstBatchPicDescs, - acldvppRoiConfig *cropAreas[], - acldvppRoiConfig *pasteAreas[], - acldvppResizeConfig *resizeConfig, - aclrtStream stream); - +ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizePasteAsync( + acldvppChannelDesc *channelDesc, acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, uint32_t size, + acldvppBatchPicDesc *dstBatchPicDescs, acldvppRoiConfig *cropAreas[], acldvppRoiConfig *pasteAreas[], + acldvppResizeConfig *resizeConfig, aclrtStream stream); /** * @ingroup AscendCL @@ -2000,11 +1940,8 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizePasteAsync(acldvppChannelD * * @see acldvppCreateChannel | acldvppCreatePicDesc */ -ACL_FUNC_VISIBILITY aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelDesc, - const void *data, - uint32_t size, - acldvppPicDesc *outputDesc, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size, + acldvppPicDesc *outputDesc, aclrtStream stream); /** * @ingroup AscendCL @@ -2022,11 +1959,8 @@ ACL_FUNC_VISIBILITY aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelD * * @see acldvppCreateChannel | acldvppCreateJpegeConfig */ -ACL_FUNC_VISIBILITY aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *inputDesc, - const void *data, - uint32_t *size, - acldvppJpegeConfig *config, +ACL_FUNC_VISIBILITY aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + const void *data, uint32_t *size, acldvppJpegeConfig *config, aclrtStream stream); /** @@ -2044,11 +1978,8 @@ ACL_FUNC_VISIBILITY aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelD * * @see acldvppCreateChannel | acldvppCreatePicDesc */ -ACL_FUNC_VISIBILITY aclError acldvppPngDecodeAsync(acldvppChannelDesc *channelDesc, - const void *data, - uint32_t size, - acldvppPicDesc *outputDesc, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError acldvppPngDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size, + acldvppPicDesc *outputDesc, aclrtStream stream); /** * @ingroup AscendCL @@ -2103,11 +2034,8 @@ ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannel(aclvdecChannelDesc *channelDe * * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc */ -ACL_FUNC_VISIBILITY aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc, - acldvppStreamDesc *input, - acldvppPicDesc *output, - aclvdecFrameConfig *config, - void *userData); +ACL_FUNC_VISIBILITY aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input, + acldvppPicDesc *output, aclvdecFrameConfig *config, void *userData); /** * @ingroup AscendCL @@ -2126,10 +2054,8 @@ ACL_FUNC_VISIBILITY aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc, * * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc | aclvdecSendFrame */ -ACL_FUNC_VISIBILITY aclError aclvdecSendSkippedFrame(aclvdecChannelDesc *channelDesc, - acldvppStreamDesc *input, - aclvdecFrameConfig *config, - void *userData); +ACL_FUNC_VISIBILITY aclError aclvdecSendSkippedFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input, + aclvdecFrameConfig *config, void *userData); /** * @ingroup AscendCL @@ -2150,10 +2076,8 @@ ACL_FUNC_VISIBILITY aclError aclvdecSendSkippedFrame(aclvdecChannelDesc *channel * * @see acldvppCreateChannel | acldvppCreatePicDesc */ -ACL_FUNC_VISIBILITY aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, aclrtStream stream); /** * @ingroup AscendCL @@ -2175,11 +2099,8 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *cha * * @see acldvppCreateChannel | acldvppCreatePicDesc */ -ACL_FUNC_VISIBILITY aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - void *reserve, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, + acldvppPicDesc *outputDesc, void *reserve, aclrtStream stream); /** * @ingroup AscendCL @@ -2191,8 +2112,7 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *channelD * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppSetChannelDescMode(acldvppChannelDesc *channelDesc, - uint32_t mode); +ACL_FUNC_VISIBILITY aclError acldvppSetChannelDescMode(acldvppChannelDesc *channelDesc, uint32_t mode); /** * @ingroup AscendCL @@ -2227,8 +2147,7 @@ ACL_FUNC_VISIBILITY uint32_t acldvppGetResizeConfigInterpolation(const acldvppRe * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutMode(aclvdecChannelDesc *channelDesc, - uint32_t outMode); +ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutMode(aclvdecChannelDesc *channelDesc, uint32_t outMode); /** * @ingroup AscendCL @@ -2325,9 +2244,7 @@ ACL_FUNC_VISIBILITY uint32_t acldvppGetLutMapDims(const acldvppLutMap *lutMap); * @retval ACL_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ -ACL_FUNC_VISIBILITY aclError acldvppGetLutMapData(const acldvppLutMap *lutMap, - uint32_t dim, - uint8_t **data, +ACL_FUNC_VISIBILITY aclError acldvppGetLutMapData(const acldvppLutMap *lutMap, uint32_t dim, uint8_t **data, uint32_t *len); /** * @ingroup AscendCL @@ -2345,10 +2262,8 @@ ACL_FUNC_VISIBILITY aclError acldvppGetLutMapData(const acldvppLutMap *lutMap, * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateLutMap */ ACL_FUNC_VISIBILITY aclError acldvppVpcEqualizeHistAsync(const acldvppChannelDesc *channelDesc, - const acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - const acldvppLutMap *lutMap, - aclrtStream stream); + const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc, + const acldvppLutMap *lutMap, aclrtStream stream); /** * @ingroup AscendCL @@ -2369,8 +2284,7 @@ ACL_FUNC_VISIBILITY acldvppBorderConfig *acldvppCreateBorderConfig(); * * @retval ACL_SUCCESS for success, other for failure */ -ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigValue(acldvppBorderConfig *borderConfig, - uint32_t index, +ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigValue(acldvppBorderConfig *borderConfig, uint32_t index, double value); /** @@ -2515,10 +2429,8 @@ ACL_FUNC_VISIBILITY aclError acldvppDestroyBorderConfig(acldvppBorderConfig *bor * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateBorderConfig */ ACL_FUNC_VISIBILITY aclError acldvppVpcMakeBorderAsync(const acldvppChannelDesc *channelDesc, - const acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, - const acldvppBorderConfig *borderConfig, - aclrtStream stream); + const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc, + const acldvppBorderConfig *borderConfig, aclrtStream stream); /** * @ingroup AscendCL @@ -2535,11 +2447,8 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcMakeBorderAsync(const acldvppChannelDesc * * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateHist */ -ACL_FUNC_VISIBILITY aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *channelDesc, - acldvppPicDesc *srcPicDesc, - acldvppHist *hist, - void *reserve, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *srcPicDesc, + acldvppHist *hist, void *reserve, aclrtStream stream); /** * @ingroup AscendCL @@ -2548,7 +2457,7 @@ ACL_FUNC_VISIBILITY aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *channel * @retval null for failed. * @retval OtherValues success. */ -ACL_FUNC_VISIBILITY acldvppHist* acldvppCreateHist(); +ACL_FUNC_VISIBILITY acldvppHist *acldvppCreateHist(); /** * @ingroup AscendCL @@ -2605,7 +2514,7 @@ ACL_FUNC_VISIBILITY aclError acldvppGetHistData(acldvppHist *hist, uint32_t dim, * * @see acldvppCreateHist | acldvppVpcCalcHistAsync */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetHistRetCode(acldvppHist* hist); +ACL_FUNC_VISIBILITY uint32_t acldvppGetHistRetCode(acldvppHist *hist); /** * @ingroup AscendCL @@ -2624,7 +2533,6 @@ ACL_FUNC_VISIBILITY uint32_t acldvppGetHistRetCode(acldvppHist* hist); */ ACL_FUNC_VISIBILITY aclError acldvppClearHist(acldvppHist *hist); - /** * @ingroup AscendCL * @brief dvpp vpc batch crop, resize config and make border. @@ -2648,18 +2556,13 @@ ACL_FUNC_VISIBILITY aclError acldvppClearHist(acldvppHist *hist); * * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig */ -ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeMakeBorderAsync(acldvppChannelDesc *channelDesc, - acldvppBatchPicDesc *srcBatchPicDescs, - uint32_t *roiNums, - uint32_t size, - acldvppBatchPicDesc *dstBatchPicDescs, - acldvppRoiConfig *cropAreas[], - acldvppBorderConfig *borderCfgs[], - acldvppResizeConfig *resizeConfig, - aclrtStream stream); +ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeMakeBorderAsync( + acldvppChannelDesc *channelDesc, acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, uint32_t size, + acldvppBatchPicDesc *dstBatchPicDescs, acldvppRoiConfig *cropAreas[], acldvppBorderConfig *borderCfgs[], + acldvppResizeConfig *resizeConfig, aclrtStream stream); #ifdef __cplusplus } #endif -#endif // INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_ +#endif // INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_ diff --git a/inc/external/acl/ops/acl_fv.h b/inc/external/acl/ops/acl_fv.h index 40cd50cb..27dc367a 100644 --- a/inc/external/acl/ops/acl_fv.h +++ b/inc/external/acl/ops/acl_fv.h @@ -32,8 +32,8 @@ typedef struct aclfvSearchResult aclfvSearchResult; // search operation type enum aclfvSearchType { - SEARCH_1_N, // 1:N operation type - SEARCH_N_M // N:M operation type + SEARCH_1_N, // 1:N operation type + SEARCH_N_M // N:M operation type }; /** @@ -104,7 +104,8 @@ ACL_FUNC_VISIBILITY aclError aclfvSetNMTopNum(aclfvInitPara *initPara, uint32_t * @retval OtherValues success. */ ACL_FUNC_VISIBILITY aclfvFeatureInfo *aclfvCreateFeatureInfo(uint32_t id0, uint32_t id1, uint32_t offset, - uint32_t featureLen, uint32_t featureCount, uint8_t *featureData, uint32_t featureDataLen); + uint32_t featureLen, uint32_t featureCount, + uint8_t *featureData, uint32_t featureDataLen); /** * @ingroup AscendCL @@ -233,8 +234,9 @@ ACL_FUNC_VISIBILITY aclError aclfvDestroySearchInput(aclfvSearchInput *searchInp * @retval null for failed. OtherValues success */ ACL_FUNC_VISIBILITY aclfvSearchResult *aclfvCreateSearchResult(uint32_t queryCnt, uint32_t *resultNum, - uint32_t resultNumDataLen, uint32_t *id0, uint32_t *id1, uint32_t *resultOffset, float *resultDistance, - uint32_t dataLen); + uint32_t resultNumDataLen, uint32_t *id0, uint32_t *id1, + uint32_t *resultOffset, float *resultDistance, + uint32_t dataLen); /** * @ingroup AscendCL @@ -348,4 +350,4 @@ ACL_FUNC_VISIBILITY aclError aclfvSearch(aclfvSearchType type, aclfvSearchInput } #endif -#endif // INC_EXTERNAL_ACL_OPS_ACL_RETR_H_ +#endif // INC_EXTERNAL_ACL_OPS_ACL_RETR_H_ diff --git a/inc/external/ge/ge_api_types.h b/inc/external/ge/ge_api_types.h index 5ae5f036..cef3fc42 100644 --- a/inc/external/ge/ge_api_types.h +++ b/inc/external/ge/ge_api_types.h @@ -166,6 +166,8 @@ const std::string COMPRESS_FLAG = "ge.compressFlag"; const std::string PRECISION_MODE = "ge.exec.precision_mode"; +const std::string TUNE_DEVICE_IDS = "ge.exec.tuneDeviceIds"; + // Configure single op flag for FE // its value should be "0" or "1", default value is "0" const std::string SINGLE_OP_FLAG = "ge.exec.single_op"; @@ -359,6 +361,7 @@ using RunAsyncCallback = std::function ir_builder_suppported_options = {INPUT_FORMAT, DYNAMIC_DIMS, INSERT_OP_FILE, PRECISION_MODE, + TUNE_DEVICE_IDS, EXEC_DISABLE_REUSED_MEMORY, AUTO_TUNE_MODE, OUTPUT_TYPE, @@ -434,6 +439,7 @@ const std::set global_options = {CORE_TYPE, ENABLE_COMPRESS_WEIGHT, COMPRESS_WEIGHT_CONF, PRECISION_MODE, + TUNE_DEVICE_IDS, EXEC_DISABLE_REUSED_MEMORY, AUTO_TUNE_MODE, ENABLE_SINGLE_STREAM, diff --git a/inc/external/hccl/hccl.h b/inc/external/hccl/hccl.h index cc4bea8e..9992a636 100644 --- a/inc/external/hccl/hccl.h +++ b/inc/external/hccl/hccl.h @@ -27,7 +27,7 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus /** * @brief Initialize HCCL. @@ -66,14 +66,15 @@ extern HcclResult HcclCommInitRootInfo(uint32_t nRanks, const HcclRootInfo *root * @param sendBuf A pointer identifying the input data address of the operator. * @param recvBuf A pointer identifying the output data address of the operator. * @param count An integer(u64) identifying the number of the output data. - * @param dataType The data type of the operator, must be one of the following types: int8, int16, int32, float16, float32. + * @param dataType The data type of the operator, must be one of the following types: int8, int16, int32, float16, + * float32. * @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod. * @param comm A pointer identifying the communication resource based on. * @param stream A pointer identifying the stream information. - * @return HcclResult + * @return HcclResult */ -extern HcclResult HcclAllReduce(void *sendBuf, void *recvBuf, uint64_t count, HcclDataType dataType, -HcclReduceOp op, HcclComm comm, aclrtStream stream); +extern HcclResult HcclAllReduce(void *sendBuf, void *recvBuf, uint64_t count, HcclDataType dataType, HcclReduceOp op, + HcclComm comm, aclrtStream stream); /** * @brief Broadcast operator. @@ -84,10 +85,10 @@ HcclReduceOp op, HcclComm comm, aclrtStream stream); * @param root An integer(u32) identifying the the root rank in the operator. * @param comm A pointer identifying the communication resource based on * @param stream A pointer identifying the stream information. - * @return HcclResult + * @return HcclResult */ -extern HcclResult HcclBroadcast(void *buf, uint64_t count, HcclDataType dataType, uint32_t root, HcclComm comm, -aclrtStream stream); +extern HcclResult HcclBroadcast(void *buf, uint64_t count, HcclDataType dataType, uint32_t root, HcclComm comm, + aclrtStream stream); /** * @brief ReduceScatter operator. @@ -99,10 +100,10 @@ aclrtStream stream); * @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod. * @param comm A pointer identifying the communication resource based on. * @param stream A pointer identifying the stream information. - * @return HcclResult + * @return HcclResult */ -extern HcclResult HcclReduceScatter(void *sendBuf, void *recvBuf, uint64_t recvCount, HcclDataType dataType, -HcclReduceOp op, HcclComm comm, aclrtStream stream); +extern HcclResult HcclReduceScatter(void *sendBuf, void *recvBuf, uint64_t recvCount, HcclDataType dataType, + HcclReduceOp op, HcclComm comm, aclrtStream stream); /** * @brief AllGather operator. @@ -113,17 +114,17 @@ HcclReduceOp op, HcclComm comm, aclrtStream stream); * @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. * @param comm A pointer identifying the communication resource based on. * @param stream A pointer identifying the stream information. - * @return HcclResult + * @return HcclResult */ -extern HcclResult HcclAllGather(void *sendBuf, void *recvBuf, uint64_t sendCount, HcclDataType dataType, -HcclComm comm, aclrtStream stream); +extern HcclResult HcclAllGather(void *sendBuf, void *recvBuf, uint64_t sendCount, HcclDataType dataType, HcclComm comm, + aclrtStream stream); /** * @brief Barrier operator. * * @param comm A pointer identifying the communication resource based on. * @param stream A pointer identifying the stream information. - * @return HcclResult + * @return HcclResult */ extern HcclResult HcclBarrier(HcclComm comm, aclrtStream stream); @@ -138,5 +139,5 @@ extern HcclResult HcclCommDestroy(HcclComm comm); #ifdef __cplusplus } -#endif // __cplusplus -#endif // HCCL_H_ +#endif // __cplusplus +#endif // HCCL_H_ diff --git a/inc/external/hccl/hccl_types.h b/inc/external/hccl/hccl_types.h index 50a64795..0e832396 100644 --- a/inc/external/hccl/hccl_types.h +++ b/inc/external/hccl/hccl_types.h @@ -16,10 +16,10 @@ /** * @file hccl_types.h - * @brief HCCL data type definition - * + * @brief HCCL data type definition + * */ - + #ifndef HCCL_TYPES_H_ #define HCCL_TYPES_H_ @@ -27,33 +27,33 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus /** * @brief HCCL functions return value definition */ typedef enum { - HCCL_SUCCESS = 0, /**< success */ - HCCL_E_PARA = 1, /**< parameter error */ - HCCL_E_PTR = 2, /**< empty pointer */ - HCCL_E_MEMORY = 3, /**< memory error */ - HCCL_E_INTERNAL = 4, /**< internal error */ - HCCL_E_NOT_SUPPORT = 5, /**< not support feature */ - HCCL_E_NOT_FOUND = 6, /**< not found specific resource */ - HCCL_E_UNAVAIL = 7, /**< resource unavailable */ - HCCL_E_SYSCALL = 8, /**< call system interface error */ - HCCL_E_TIMEOUT = 9, /**< timeout */ - HCCL_E_OPEN_FILE_FAILURE = 10, /**< open file fail */ - HCCL_E_TCP_CONNECT = 11, /**< tcp connect fail */ - HCCL_E_ROCE_CONNECT = 12, /**< roce connect fail */ - HCCL_E_TCP_TRANSFER = 13, /**< tcp transfer fail */ - HCCL_E_ROCE_TRANSFER = 14, /**< roce transfer fail */ - HCCL_E_RUNTIME = 15, /**< call runtime api fail */ - HCCL_E_DRV = 16, /**< call driver api fail */ - HCCL_E_PROFILING = 17, /**< call profiling api fail */ - HCCL_E_CCE = 18, /**< call cce api fail */ - HCCL_E_NETWORK = 19, /**< call network api fail */ - HCCL_E_RESERVED /**< reserved */ + HCCL_SUCCESS = 0, /**< success */ + HCCL_E_PARA = 1, /**< parameter error */ + HCCL_E_PTR = 2, /**< empty pointer */ + HCCL_E_MEMORY = 3, /**< memory error */ + HCCL_E_INTERNAL = 4, /**< internal error */ + HCCL_E_NOT_SUPPORT = 5, /**< not support feature */ + HCCL_E_NOT_FOUND = 6, /**< not found specific resource */ + HCCL_E_UNAVAIL = 7, /**< resource unavailable */ + HCCL_E_SYSCALL = 8, /**< call system interface error */ + HCCL_E_TIMEOUT = 9, /**< timeout */ + HCCL_E_OPEN_FILE_FAILURE = 10, /**< open file fail */ + HCCL_E_TCP_CONNECT = 11, /**< tcp connect fail */ + HCCL_E_ROCE_CONNECT = 12, /**< roce connect fail */ + HCCL_E_TCP_TRANSFER = 13, /**< tcp transfer fail */ + HCCL_E_ROCE_TRANSFER = 14, /**< roce transfer fail */ + HCCL_E_RUNTIME = 15, /**< call runtime api fail */ + HCCL_E_DRV = 16, /**< call driver api fail */ + HCCL_E_PROFILING = 17, /**< call profiling api fail */ + HCCL_E_CCE = 18, /**< call cce api fail */ + HCCL_E_NETWORK = 19, /**< call network api fail */ + HCCL_E_RESERVED /**< reserved */ } HcclResult; /** @@ -65,37 +65,37 @@ typedef void *HcclComm; * @brief HCCL Reduction opperation */ typedef enum { - HCCL_REDUCE_SUM = 0, /**< sum */ - HCCL_REDUCE_PROD = 1, /**< prod */ - HCCL_REDUCE_MAX = 2, /**< max */ - HCCL_REDUCE_MIN = 3, /**< min */ - HCCL_REDUCE_RESERVED /**< reserved */ + HCCL_REDUCE_SUM = 0, /**< sum */ + HCCL_REDUCE_PROD = 1, /**< prod */ + HCCL_REDUCE_MAX = 2, /**< max */ + HCCL_REDUCE_MIN = 3, /**< min */ + HCCL_REDUCE_RESERVED /**< reserved */ } HcclReduceOp; /** * @brief HCCL data type */ typedef enum { - HCCL_DATA_TYPE_INT8 = 0, /**< int8 */ - HCCL_DATA_TYPE_INT16 = 1, /**< int16 */ - HCCL_DATA_TYPE_INT32 = 2, /**< int32 */ - HCCL_DATA_TYPE_FP16 = 3, /**< fp16 */ - HCCL_DATA_TYPE_FP32 = 4, /**< fp32 */ - HCCL_DATA_TYPE_INT64 = 5, /**< int64 */ - HCCL_DATA_TYPE_UINT64 = 6, /**< uint64 */ - HCCL_DATA_TYPE_RESERVED /**< reserved */ + HCCL_DATA_TYPE_INT8 = 0, /**< int8 */ + HCCL_DATA_TYPE_INT16 = 1, /**< int16 */ + HCCL_DATA_TYPE_INT32 = 2, /**< int32 */ + HCCL_DATA_TYPE_FP16 = 3, /**< fp16 */ + HCCL_DATA_TYPE_FP32 = 4, /**< fp32 */ + HCCL_DATA_TYPE_INT64 = 5, /**< int64 */ + HCCL_DATA_TYPE_UINT64 = 6, /**< uint64 */ + HCCL_DATA_TYPE_RESERVED /**< reserved */ } HcclDataType; -const uint32_t HCCL_ROOT_INFO_BYTES = 4108; // 4108: root info length +const uint32_t HCCL_ROOT_INFO_BYTES = 4108; // 4108: root info length /** * @brief HCCL root info */ typedef struct HcclRootInfoDef { - char internal[HCCL_ROOT_INFO_BYTES]; + char internal[HCCL_ROOT_INFO_BYTES]; } HcclRootInfo; #ifdef __cplusplus } -#endif // __cplusplus -#endif // HCCL_TYPES_H_ +#endif // __cplusplus +#endif // HCCL_TYPES_H_ diff --git a/inc/external/runtime/rt_error_codes.h b/inc/external/runtime/rt_error_codes.h index 02a357fc..437a5544 100644 --- a/inc/external/runtime/rt_error_codes.h +++ b/inc/external/runtime/rt_error_codes.h @@ -23,81 +23,81 @@ extern "C" { #endif -static const int32_t ACL_RT_SUCCESS = 0; // success +static const int32_t ACL_RT_SUCCESS = 0; // success -static const int32_t ACL_ERROR_RT_PARAM_INVALID = 107000; // param invalid -static const int32_t ACL_ERROR_RT_INVALID_DEVICEID = 107001; // invalid device id -static const int32_t ACL_ERROR_RT_CONTEXT_NULL = 107002; // current context null -static const int32_t ACL_ERROR_RT_STREAM_CONTEXT = 107003; // stream not in current context -static const int32_t ACL_ERROR_RT_MODEL_CONTEXT = 107004; // model not in current context -static const int32_t ACL_ERROR_RT_STREAM_MODEL = 107005; // stream not in model -static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID = 107006; // event timestamp invalid -static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL = 107007; // event timestamp reversal -static const int32_t ACL_ERROR_RT_ADDR_UNALIGNED = 107008; // memory address unaligned -static const int32_t ACL_ERROR_RT_FILE_OPEN = 107009; // open file failed -static const int32_t ACL_ERROR_RT_FILE_WRITE = 107010; // write file failed -static const int32_t ACL_ERROR_RT_STREAM_SUBSCRIBE = 107011; // error subscribe stream -static const int32_t ACL_ERROR_RT_THREAD_SUBSCRIBE = 107012; // error subscribe thread -static const int32_t ACL_ERROR_RT_GROUP_NOT_SET = 107013; // group not set -static const int32_t ACL_ERROR_RT_GROUP_NOT_CREATE = 107014; // group not create -static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callback not register to stream -static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type -static const int32_t ACL_ERROR_RT_INVALID_HANDLE = 107017; // invalid handle -static const int32_t ACL_ERROR_RT_INVALID_MALLOC_TYPE = 107018; // invalid malloc type +static const int32_t ACL_ERROR_RT_PARAM_INVALID = 107000; // param invalid +static const int32_t ACL_ERROR_RT_INVALID_DEVICEID = 107001; // invalid device id +static const int32_t ACL_ERROR_RT_CONTEXT_NULL = 107002; // current context null +static const int32_t ACL_ERROR_RT_STREAM_CONTEXT = 107003; // stream not in current context +static const int32_t ACL_ERROR_RT_MODEL_CONTEXT = 107004; // model not in current context +static const int32_t ACL_ERROR_RT_STREAM_MODEL = 107005; // stream not in model +static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID = 107006; // event timestamp invalid +static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL = 107007; // event timestamp reversal +static const int32_t ACL_ERROR_RT_ADDR_UNALIGNED = 107008; // memory address unaligned +static const int32_t ACL_ERROR_RT_FILE_OPEN = 107009; // open file failed +static const int32_t ACL_ERROR_RT_FILE_WRITE = 107010; // write file failed +static const int32_t ACL_ERROR_RT_STREAM_SUBSCRIBE = 107011; // error subscribe stream +static const int32_t ACL_ERROR_RT_THREAD_SUBSCRIBE = 107012; // error subscribe thread +static const int32_t ACL_ERROR_RT_GROUP_NOT_SET = 107013; // group not set +static const int32_t ACL_ERROR_RT_GROUP_NOT_CREATE = 107014; // group not create +static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callback not register to stream +static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type +static const int32_t ACL_ERROR_RT_INVALID_HANDLE = 107017; // invalid handle +static const int32_t ACL_ERROR_RT_INVALID_MALLOC_TYPE = 107018; // invalid malloc type -static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPORT = 207000; // feature not support -static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error -static const int32_t ACL_ERROR_RT_MEMORY_FREE = 207002; // memory free error -static const int32_t ACL_ERROR_RT_AICORE_OVER_FLOW = 207003; // aicore over flow -static const int32_t ACL_ERROR_RT_NO_DEVICE = 207004; // no device -static const int32_t ACL_ERROR_RT_RESOURCE_ALLOC_FAIL = 207005; // resource alloc fail -static const int32_t ACL_ERROR_RT_NO_PERMISSION = 207006; // no permission -static const int32_t ACL_ERROR_RT_NO_EVENT_RESOURCE = 207007; // no event resource -static const int32_t ACL_ERROR_RT_NO_STREAM_RESOURCE = 207008; // no stream resource -static const int32_t ACL_ERROR_RT_NO_NOTIFY_RESOURCE = 207009; // no notify resource -static const int32_t ACL_ERROR_RT_NO_MODEL_RESOURCE = 207010; // no model resource +static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPORT = 207000; // feature not support +static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error +static const int32_t ACL_ERROR_RT_MEMORY_FREE = 207002; // memory free error +static const int32_t ACL_ERROR_RT_AICORE_OVER_FLOW = 207003; // aicore over flow +static const int32_t ACL_ERROR_RT_NO_DEVICE = 207004; // no device +static const int32_t ACL_ERROR_RT_RESOURCE_ALLOC_FAIL = 207005; // resource alloc fail +static const int32_t ACL_ERROR_RT_NO_PERMISSION = 207006; // no permission +static const int32_t ACL_ERROR_RT_NO_EVENT_RESOURCE = 207007; // no event resource +static const int32_t ACL_ERROR_RT_NO_STREAM_RESOURCE = 207008; // no stream resource +static const int32_t ACL_ERROR_RT_NO_NOTIFY_RESOURCE = 207009; // no notify resource +static const int32_t ACL_ERROR_RT_NO_MODEL_RESOURCE = 207010; // no model resource -static const int32_t ACL_ERROR_RT_INTERNAL_ERROR = 507000; // runtime internal error -static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error -static const int32_t ACL_ERROR_RT_STREAM_TASK_FULL = 507002; // task full in stream -static const int32_t ACL_ERROR_RT_STREAM_TASK_EMPTY = 507003; // task empty in stream -static const int32_t ACL_ERROR_RT_STREAM_NOT_COMPLETE = 507004; // stream not complete -static const int32_t ACL_ERROR_RT_END_OF_SEQUENCE = 507005; // end of sequence -static const int32_t ACL_ERROR_RT_EVENT_NOT_COMPLETE = 507006; // event not complete -static const int32_t ACL_ERROR_RT_CONTEXT_RELEASE_ERROR = 507007; // context release error -static const int32_t ACL_ERROR_RT_SOC_VERSION = 507008; // soc version error -static const int32_t ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT = 507009; // task type not support -static const int32_t ACL_ERROR_RT_LOST_HEARTBEAT = 507010; // ts lost heartbeat -static const int32_t ACL_ERROR_RT_MODEL_EXECUTE = 507011; // model execute failed -static const int32_t ACL_ERROR_RT_REPORT_TIMEOUT = 507012; // report timeout -static const int32_t ACL_ERROR_RT_SYS_DMA = 507013; // sys dma error -static const int32_t ACL_ERROR_RT_AICORE_TIMEOUT = 507014; // aicore timeout -static const int32_t ACL_ERROR_RT_AICORE_EXCEPTION = 507015; // aicore exception -static const int32_t ACL_ERROR_RT_AICORE_TRAP_EXCEPTION = 507016; // aicore trap exception -static const int32_t ACL_ERROR_RT_AICPU_TIMEOUT = 507017; // aicpu timeout -static const int32_t ACL_ERROR_RT_AICPU_EXCEPTION = 507018; // aicpu exception -static const int32_t ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR = 507019; // aicpu datadump response error -static const int32_t ACL_ERROR_RT_AICPU_MODEL_RSP_ERR = 507020; // aicpu model operate response error -static const int32_t ACL_ERROR_RT_PROFILING_ERROR = 507021; // profiling error -static const int32_t ACL_ERROR_RT_IPC_ERROR = 507022; // ipc error -static const int32_t ACL_ERROR_RT_MODEL_ABORT_NORMAL = 507023; // model abort normal -static const int32_t ACL_ERROR_RT_KERNEL_UNREGISTERING = 507024; // kernel unregistering -static const int32_t ACL_ERROR_RT_RINGBUFFER_NOT_INIT = 507025; // ringbuffer not init -static const int32_t ACL_ERROR_RT_RINGBUFFER_NO_DATA = 507026; // ringbuffer no data -static const int32_t ACL_ERROR_RT_KERNEL_LOOKUP = 507027; // kernel lookup error -static const int32_t ACL_ERROR_RT_KERNEL_DUPLICATE = 507028; // kernel register duplicate -static const int32_t ACL_ERROR_RT_DEBUG_REGISTER_FAIL = 507029; // debug register failed -static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug unregister failed -static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context -static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out -static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error +static const int32_t ACL_ERROR_RT_INTERNAL_ERROR = 507000; // runtime internal error +static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error +static const int32_t ACL_ERROR_RT_STREAM_TASK_FULL = 507002; // task full in stream +static const int32_t ACL_ERROR_RT_STREAM_TASK_EMPTY = 507003; // task empty in stream +static const int32_t ACL_ERROR_RT_STREAM_NOT_COMPLETE = 507004; // stream not complete +static const int32_t ACL_ERROR_RT_END_OF_SEQUENCE = 507005; // end of sequence +static const int32_t ACL_ERROR_RT_EVENT_NOT_COMPLETE = 507006; // event not complete +static const int32_t ACL_ERROR_RT_CONTEXT_RELEASE_ERROR = 507007; // context release error +static const int32_t ACL_ERROR_RT_SOC_VERSION = 507008; // soc version error +static const int32_t ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT = 507009; // task type not support +static const int32_t ACL_ERROR_RT_LOST_HEARTBEAT = 507010; // ts lost heartbeat +static const int32_t ACL_ERROR_RT_MODEL_EXECUTE = 507011; // model execute failed +static const int32_t ACL_ERROR_RT_REPORT_TIMEOUT = 507012; // report timeout +static const int32_t ACL_ERROR_RT_SYS_DMA = 507013; // sys dma error +static const int32_t ACL_ERROR_RT_AICORE_TIMEOUT = 507014; // aicore timeout +static const int32_t ACL_ERROR_RT_AICORE_EXCEPTION = 507015; // aicore exception +static const int32_t ACL_ERROR_RT_AICORE_TRAP_EXCEPTION = 507016; // aicore trap exception +static const int32_t ACL_ERROR_RT_AICPU_TIMEOUT = 507017; // aicpu timeout +static const int32_t ACL_ERROR_RT_AICPU_EXCEPTION = 507018; // aicpu exception +static const int32_t ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR = 507019; // aicpu datadump response error +static const int32_t ACL_ERROR_RT_AICPU_MODEL_RSP_ERR = 507020; // aicpu model operate response error +static const int32_t ACL_ERROR_RT_PROFILING_ERROR = 507021; // profiling error +static const int32_t ACL_ERROR_RT_IPC_ERROR = 507022; // ipc error +static const int32_t ACL_ERROR_RT_MODEL_ABORT_NORMAL = 507023; // model abort normal +static const int32_t ACL_ERROR_RT_KERNEL_UNREGISTERING = 507024; // kernel unregistering +static const int32_t ACL_ERROR_RT_RINGBUFFER_NOT_INIT = 507025; // ringbuffer not init +static const int32_t ACL_ERROR_RT_RINGBUFFER_NO_DATA = 507026; // ringbuffer no data +static const int32_t ACL_ERROR_RT_KERNEL_LOOKUP = 507027; // kernel lookup error +static const int32_t ACL_ERROR_RT_KERNEL_DUPLICATE = 507028; // kernel register duplicate +static const int32_t ACL_ERROR_RT_DEBUG_REGISTER_FAIL = 507029; // debug register failed +static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug unregister failed +static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context +static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out +static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error -static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error -static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error -static const int32_t ACL_ERROR_RT_SOCKET_CLOSE = 507901; // hdc disconnect +static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error +static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error +static const int32_t ACL_ERROR_RT_SOCKET_CLOSE = 507901; // hdc disconnect #ifdef __cplusplus } #endif -#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__ +#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__ diff --git a/inc/framework/common/util.h b/inc/framework/common/util.h index 92cb8397..bd84d0ac 100644 --- a/inc/framework/common/util.h +++ b/inc/framework/common/util.h @@ -113,14 +113,13 @@ } while (0) // Check if the parameter is null. If yes, return PARAM_INVALID and record the error -#define GE_CHECK_NOTNULL(val) \ - do { \ - if (val == nullptr) { \ - REPORT_INNER_ERROR("E19999", "Param:%s is nullptr, check invalid when %s", \ - #val, __FUNCTION__); \ - DOMI_LOGE("[Check][Param:%s]null is invalid when %s.", #val, __FUNCTION__); \ - return ge::PARAM_INVALID; \ - } \ +#define GE_CHECK_NOTNULL(val) \ + do { \ + if (val == nullptr) { \ + REPORT_INNER_ERROR("E19999", "Param:%s is nullptr, check invalid", #val); \ + DOMI_LOGE("[Check][Param:%s]null is invalid.", #val); \ + return ge::PARAM_INVALID; \ + } \ } while (0) // Check if the parameter is null. If yes, just return and record the error diff --git a/metadef b/metadef index 99627af3..22ab76ec 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 99627af3e039343ee972701acaf9a6f376a6ca77 +Subproject commit 22ab76ecd8461f679606374be4b3b6b6f7cad321 diff --git a/parser b/parser index 424ac060..f12a4159 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 424ac0609fe17f455865436462a2c62f85aea2b1 +Subproject commit f12a4159641de89e38460205be89da8ef74eba8a diff --git a/tests/depends/error_manager/src/error_manager_stub.cc b/tests/depends/error_manager/src/error_manager_stub.cc index 5f62c91b..7ed8dbcb 100644 --- a/tests/depends/error_manager/src/error_manager_stub.cc +++ b/tests/depends/error_manager/src/error_manager_stub.cc @@ -16,16 +16,16 @@ #include "common/util/error_manager/error_manager.h" -using namespace ErrorMessage; +using namespace error_message; -namespace ErrorMessage { +thread_local Context ErrorManager::error_context_ = {0, "", "", ""}; + +namespace error_message { int FormatErrorMessage(char *str_dst, size_t dst_max, const char *format, ...) { return 1; } } -thread_local Context ErrorManager::error_context_ = {0, "", "", ""}; - ErrorManager &ErrorManager::GetInstance() { static ErrorManager instance; return instance; @@ -98,11 +98,11 @@ thread_local Context ErrorManager::error_context_ = {0, "", "", ""}; const std::string &ErrorManager::GetLogHeader() { return error_context_.log_header; } - struct Context &ErrorManager::GetErrorContext() { - struct Context error_context; + struct error_message::Context &ErrorManager::GetErrorManagerContext() { + struct error_message::Context error_context; return error_context; } -void ErrorManager::SetErrorContext(struct Context error_context) {} +void ErrorManager::SetErrorContext(struct error_message::Context error_context) {} void ErrorManager::SetStage(const std::string &first_stage, const std::string &second_stage) {} diff --git a/tests/ut/common/graph/testcase/ge_graph/ge_def_type_unittest.cc b/tests/ut/common/graph/testcase/ge_graph/ge_def_type_unittest.cc index 10d6dc86..7dc124fe 100644 --- a/tests/ut/common/graph/testcase/ge_graph/ge_def_type_unittest.cc +++ b/tests/ut/common/graph/testcase/ge_graph/ge_def_type_unittest.cc @@ -32,14 +32,6 @@ class UtestGeTestDefType : public testing::Test { void TearDown() {} }; -TEST_F(UtestGeTestDefType, base) { - CompressInfo com1; - com1.set_blockrow(1); - int32_t a = com1.blockrow; - EXPECT_EQ(a, 1); - -} - TEST_F(UtestGeTestDefType, quant) { OpDescPtr desc_ptr1 = std::make_shared("name1", "type1"); EXPECT_EQ(desc_ptr1->AddInputDesc("x", GeTensorDesc(GeShape({1, 16, 16, 16}), FORMAT_NCHW)), GRAPH_SUCCESS); @@ -48,28 +40,4 @@ TEST_F(UtestGeTestDefType, quant) { EXPECT_EQ(OpDescUtils::HasQuantizeFactorParams(desc_ptr1), false); EXPECT_EQ(OpDescUtils::HasQuantizeFactorParams(*desc_ptr1), false); - QuantizeFactorParams q1; - EXPECT_EQ(q1.has_quantize_param(), false); - QuantizeFactor *qf1 = q1.mutable_quantize_param(); - EXPECT_EQ(q1.has_quantize_param(), true); - - string s1 = "value1"; - q1.quantize_param.set_scale_value(s1.data(), s1.size()); - EXPECT_EQ(OpDescUtils::SetQuantizeFactorParams(desc_ptr1, q1), GRAPH_SUCCESS); - QuantizeFactorParams q2; - EXPECT_EQ(OpDescUtils::GetQuantizeFactorParams(desc_ptr1, q2), GRAPH_SUCCESS); - string s2((char *)q2.quantize_param.scale_value.GetData(), q2.quantize_param.scale_value.GetSize()); - EXPECT_EQ(s2, "value1"); - - float f[2] = {1, 2}; - string s(static_cast(static_cast(f)), 2 * sizeof(float)); - q1.quantize_param.set_scale_value(f, 2 * sizeof(float)); - EXPECT_EQ(OpDescUtils::SetQuantizeFactorParams(*desc_ptr1, q1), GRAPH_SUCCESS); - QuantizeFactorParams q3; - EXPECT_EQ(OpDescUtils::GetQuantizeFactorParams(*desc_ptr1, q3), GRAPH_SUCCESS); - Buffer &b = q3.quantize_param.scale_value; - float f1[2]; - memcpy(f1, b.GetData(), b.GetSize()); - EXPECT_EQ(f1[0], 1); - EXPECT_EQ(f1[1], 2); } diff --git a/tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc b/tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc index 5c75bd01..aa43ac99 100644 --- a/tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc +++ b/tests/ut/common/graph/testcase/ge_graph/ge_tensor_unittest.cc @@ -209,18 +209,6 @@ TEST_F(UtestGeTensor, test_tensor_desc_invalid_null) { tensor_desc2.SetDataType(DT_DUAL_SUB_INT8); EXPECT_EQ(tensor_desc2.GetDataType(), DT_DUAL_SUB_INT8); - CompressInfo info; - EXPECT_EQ(TensorUtils::GetCmpsInfo(tensor_desc2, info), GRAPH_FAILED); - TensorUtils::SetCmpsInfo(tensor_desc2, info); - EXPECT_EQ(TensorUtils::GetCmpsInfo(tensor_desc2, info), GRAPH_SUCCESS); - - AllOffsetQuantizeInfo quantize_info; - EXPECT_FALSE(TensorUtils::HasAlloffsetQuantizeInfo(tensor_desc2)); - EXPECT_EQ(TensorUtils::GetAlloffsetQuantizeInfo(tensor_desc2, quantize_info), GRAPH_FAILED); - TensorUtils::SetAlloffsetQuantizeInfo(tensor_desc2, quantize_info); - EXPECT_EQ(TensorUtils::GetAlloffsetQuantizeInfo(tensor_desc2, quantize_info), GRAPH_SUCCESS); - EXPECT_TRUE(TensorUtils::HasAlloffsetQuantizeInfo(tensor_desc2)); - TensorUtils::SetWeightSize(tensor_desc, 100); EXPECT_EQ(TensorUtils::GetWeightSize(tensor_desc), 0); } diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index dabc1485..12b329d7 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -24,7 +24,7 @@ set(PROTO_LIST "${GE_CODE_DIR}/metadef/proto/insert_op.proto" "${GE_CODE_DIR}/metadef/proto/dump_task.proto" "${GE_CODE_DIR}/metadef/proto/fwk_adapter.proto" - "${GE_CODE_DIR}/metadef/proto/op_mapping_info.proto" + "${GE_CODE_DIR}/metadef/proto/op_mapping.proto" "${GE_CODE_DIR}/metadef/proto/optimizer_priority.proto" "${GE_CODE_DIR}/metadef/proto/ge_api.proto" "${GE_CODE_DIR}/metadef/proto/tensorflow/attr_value.proto" @@ -287,7 +287,6 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/load/model_manager/zero_copy_task.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/cpu_queue_schedule.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/aipp_utils.cc" - "${GE_CODE_DIR}/ge/omm/csa_interact.cc" "${GE_CODE_DIR}/ge/graph/load/model_manager/tbe_handle_store.cc" "${GE_CODE_DIR}/ge/common/kernel_store.cc" "${GE_CODE_DIR}/ge/common/tbe_kernel_store.cc" @@ -308,7 +307,7 @@ set(COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/partition/stage_partition.cc" "${GE_CODE_DIR}/ge/graph/partition/dynamic_shape_partition.cc" "${GE_CODE_DIR}/ge/graph/optimize/summary_optimize.cc" - "${GE_CODE_DIR}/ge/ir_build/atc_ir_common.cc" + "${GE_CODE_DIR}/ge/ir_build/option_utils.cc" "${GE_CODE_DIR}/ge/graph/preprocess/insert_op/ge_aipp_op.cc" "${GE_CODE_DIR}/ge/graph/preprocess/multi_batch_options.cc" "${GE_CODE_DIR}/ge/graph/build/model_builder.cc" @@ -391,7 +390,6 @@ set(GRAPH_PARTITION_COMMON_SRC_FILES set(GRAPH_LOAD_COMMON_SRC_FILES "${GE_CODE_DIR}/ge/graph/load/graph_loader.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_manager_utils.cc" - "${GE_CODE_DIR}/ge/omm/csa_interact.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_mem_allocator.cc" "${GE_CODE_DIR}/ge/graph/manager/graph_var_manager.cc" "${GE_CODE_DIR}/ge/graph/manager/trans_var_data_utils.cc" @@ -711,6 +709,7 @@ set(PASS_TEST_FILES "graph/passes/buffer_pool_memory_pass_unittest.cc" "graph/passes/mark_node_unknown_shape_pass_unittest.cc" "graph/passes/reshape_recovery_pass_unittest.cc" + "graph/passes/cast_remove_pass_unittest.cc" ) set(KERNEL_TEST_FILES @@ -815,6 +814,7 @@ set(PROFILING_MNG_TEST_FILES set(HYBRID_TEST_FILES "hybrid/ge_hybrid_unittest.cc" "hybrid/known_node_executor_unittest.cc" + "hybrid/executor/worker/execution_engine_unittest.cc" ) set(OTHERS_TEST_FILES diff --git a/tests/ut/ge/common/format_transfer_unittest.cc b/tests/ut/ge/common/format_transfer_unittest.cc index 73b7703d..04817d29 100644 --- a/tests/ut/ge/common/format_transfer_unittest.cc +++ b/tests/ut/ge/common/format_transfer_unittest.cc @@ -51,35 +51,5 @@ TEST_F(UtestFormatTransfer, build_unsupported_transfer) { auto transfer2 = BuildFormatTransfer(args2); EXPECT_EQ(transfer2, nullptr); } - -TEST_F(UtestFormatTransfer, get_size_by_data_type) { - EXPECT_EQ(GetSizeByDataType(DT_FLOAT), 4); - EXPECT_EQ(GetSizeByDataType(DT_FLOAT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_INT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_INT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_UINT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_UINT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_INT32), 4); - EXPECT_EQ(GetSizeByDataType(DT_INT64), 8); - EXPECT_EQ(GetSizeByDataType(DT_UINT32), 4); - EXPECT_EQ(GetSizeByDataType(DT_UINT64), 8); - EXPECT_EQ(GetSizeByDataType(DT_BOOL), 1); - EXPECT_EQ(GetSizeByDataType(DT_DOUBLE), 8); - EXPECT_EQ(GetSizeByDataType(DT_STRING), -1); - EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_INT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_DUAL_SUB_UINT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_COMPLEX64), 8); - EXPECT_EQ(GetSizeByDataType(DT_COMPLEX128), 16); - EXPECT_EQ(GetSizeByDataType(DT_QINT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_QINT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_QINT32), 4); - EXPECT_EQ(GetSizeByDataType(DT_QUINT8), 1); - EXPECT_EQ(GetSizeByDataType(DT_QUINT16), 2); - EXPECT_EQ(GetSizeByDataType(DT_RESOURCE), 8); - EXPECT_EQ(GetSizeByDataType(DT_STRING_REF), -1); - EXPECT_EQ(GetSizeByDataType(DT_DUAL), 5); - EXPECT_EQ(GetSizeByDataType(DT_UNDEFINED), -1); - EXPECT_EQ(DT_UNDEFINED, 28); -} } // namespace formats } // namespace ge diff --git a/tests/ut/ge/graph/build/mem_assigner_unittest.cc b/tests/ut/ge/graph/build/mem_assigner_unittest.cc index 92f9b5b4..c883e87f 100644 --- a/tests/ut/ge/graph/build/mem_assigner_unittest.cc +++ b/tests/ut/ge/graph/build/mem_assigner_unittest.cc @@ -339,3 +339,25 @@ TEST_F(UtestMemoryAssignerTest, graph_memory_assign_set_input_offset) { EXPECT_EQ(assgin->GetOpDesc()->GetInputOffset()[1], 0); EXPECT_EQ(memoryAssigner.CheckOffset(), GRAPH_SUCCESS); } + +TEST_F(UtestMemoryAssignerTest, graph_memory_assign_update_ref_op_offset_reverse) { + ge::ut::GraphBuilder builder("graph"); + auto data_input = builder.AddNode("data", "Data", 1, 1); + auto const_input = builder.AddNode("const", "Const", 1, 1); + auto add = builder.AddNode("add", "Add", 2, 1); + // add link + builder.AddDataEdge(data_input, 0, add, 0); + builder.AddDataEdge(const_input, 0, add, 1); + // set ref + uint32_t reuse_input_index = 0; + auto output_tensordesc = data_input->GetOpDesc()->MutableOutputDesc(0); + ge::TensorUtils::SetReuseInput(*output_tensordesc, true); + ge::TensorUtils::SetReuseInputIndex(*output_tensordesc, reuse_input_index); + auto output_tensordesc1 = add->GetOpDesc()->MutableOutputDesc(0); + ge::TensorUtils::SetReuseInput(*output_tensordesc1, true); + ge::TensorUtils::SetReuseInputIndex(*output_tensordesc1, reuse_input_index); + ge::ComputeGraphPtr graph = builder.GetGraph(); + + GraphMemoryAssigner memoryAssigner(graph); + EXPECT_EQ(memoryAssigner.UpdateRefOpOffsetReverse(add), SUCCESS); +} diff --git a/tests/ut/ge/graph/execute/graph_execute_unittest.cc b/tests/ut/ge/graph/execute/graph_execute_unittest.cc index b24985be..e340df2f 100644 --- a/tests/ut/ge/graph/execute/graph_execute_unittest.cc +++ b/tests/ut/ge/graph/execute/graph_execute_unittest.cc @@ -22,7 +22,6 @@ #include "graph/execute/graph_execute.h" #include "graph/load/model_manager/model_manager.h" #include "graph/load/model_manager/davinci_model.h" -#include "omm/csa_interact.h" #undef private #undef public diff --git a/tests/ut/ge/graph/load/data_dumper_unittest.cc b/tests/ut/ge/graph/load/data_dumper_unittest.cc index 68040bf1..1eb9eb49 100644 --- a/tests/ut/ge/graph/load/data_dumper_unittest.cc +++ b/tests/ut/ge/graph/load/data_dumper_unittest.cc @@ -38,29 +38,53 @@ std::vector stub_get_output_addrs(const RuntimeParam &model_param, Const res.emplace_back(reinterpret_cast(23333)); return res; } -/* -TEST_F(UtestDataDumper, LoadDumpInfo_no_output_addrs_fail) { + +static ge::OpDescPtr CreateOpDesc(string name = "", string type = "") { + auto op_desc = std::make_shared(name, type); + op_desc->SetStreamId(0); + op_desc->SetId(0); + + op_desc->SetWorkspace({}); + op_desc->SetWorkspaceBytes({}); + op_desc->SetInputOffset({}); + op_desc->SetOutputOffset({100, 200}); + return op_desc; +} + +TEST_F(UtestDataDumper, LoadDumpInfo_success) { RuntimeParam rts_param; - DataDumper data_dumper(rts_param); + DataDumper data_dumper(&rts_param); data_dumper.SetModelName("test"); data_dumper.SetModelId(2333); std::shared_ptr op_desc_1(new OpDesc()); op_desc_1->AddOutputDesc("test", GeTensorDesc()); data_dumper.SaveDumpTask(0, 0, op_desc_1, 0); string dump_mode = "output"; + data_dumper.is_op_debug_ = true; data_dumper.dump_properties_.SetDumpMode(dump_mode); - Status ret = data_dumper.LoadDumpInfo(); - EXPECT_EQ(ret, SUCCESS); + EXPECT_EQ(data_dumper.LoadDumpInfo(), SUCCESS); + EXPECT_EQ(data_dumper.UnloadDumpInfo(), SUCCESS); } -*/ -TEST_F(UtestDataDumper, UnloadDumpInfo_success) { +TEST_F(UtestDataDumper, DumpOutputWithTask_success) { RuntimeParam rts_param; DataDumper data_dumper(&rts_param); data_dumper.SetModelName("test"); data_dumper.SetModelId(2333); - Status ret = data_dumper.UnloadDumpInfo(); + toolkit::aicpu::dump::Task task; + OpDescPtr op_desc = CreateOpDesc("conv", CONVOLUTION); + GeTensorDesc tensor_0(GeShape(), FORMAT_NCHW, DT_FLOAT); + GeTensorDesc tensor_1(GeShape(), FORMAT_NCHW, DT_FLOAT); + int32_t calc_type = 1; + ge::AttrUtils::SetInt(tensor_1, ATTR_NAME_MEMORY_SIZE_CALC_TYPE, calc_type); + op_desc->AddOutputDesc(tensor_0); + op_desc->AddOutputDesc(tensor_1); + DataDumper::InnerDumpInfo inner_dump_info; + inner_dump_info.op = op_desc; + Status ret = data_dumper.DumpOutputWithTask(inner_dump_info, task); EXPECT_EQ(ret, SUCCESS); + int64_t task_size = 1; + data_dumper.GenerateOpBuffer(task_size, task); } } // namespace ge diff --git a/tests/ut/ge/graph/manager/graph_manager_unittest.cc b/tests/ut/ge/graph/manager/graph_manager_unittest.cc index dad55f3d..79beb02d 100644 --- a/tests/ut/ge/graph/manager/graph_manager_unittest.cc +++ b/tests/ut/ge/graph/manager/graph_manager_unittest.cc @@ -109,7 +109,7 @@ #include "graph/build/label_allocator.h" #include "graph/utils/tensor_adapter.h" #include "inc/pass_manager.h" -#include "ir_build/atc_ir_common.h" +#include "ir_build/option_utils.h" #include "graph/common/local_context.h" #include "graph/common/omg_util.h" #include "common/formats/utils/formats_trans_utils.h" @@ -251,7 +251,7 @@ TEST_F(UtestGraphManagerTest, test_pre_run_thread) { GraphId graph_id = 1; std::vector input_tensor; uint64_t session_id = 0; - ErrorMessage::Context error_context; + error_message::Context error_context; GEThreadLocalContext context; RunAsyncCallback callback; // PreRunArgs args{graph_id, input_tensor, session_id, error_context, context, callback}; @@ -277,7 +277,7 @@ TEST_F(UtestGraphManagerTest, test_pre_run_thread_2) { graph_node_1->SetBuildFlag(true); std::vector input_tensor; uint64_t session_id = 0; - ErrorMessage::Context error_context; + error_message::Context error_context; GEThreadLocalContext context; RunAsyncCallback callback; // PreRunArgs args{graph_id, input_tensor, session_id, error_context, context, callback}; @@ -373,3 +373,33 @@ TEST_F(UtestGraphManagerTest, test_check_incre_build_and_pre_run_3) { Status status = graph_manager.CheckIncreBuildAndPreRun(&graph_manager, arg, graph_node, ge_root_model); EXPECT_NE(status, ge::SUCCESS); } + +TEST_F(UtestGraphManagerTest, test_add_graph_with_copy_success) { + GraphId graph_id = 1; + GraphManager graph_manager; + // create graph + ComputeGraphPtr compute_graph = MakeShared("test_graph"); + Graph graph = GraphUtils::CreateGraphFromComputeGraph(compute_graph); + + std::map options; + OmgContext context; + Status status = graph_manager.AddGraphWithCopy(graph_id, graph, options, context); + EXPECT_EQ(status, ge::SUCCESS); +} + +TEST_F(UtestGraphManagerTest, test_add_graph_with_copy_fail) { + GraphId graph_id = 1; + GraphManager graph_manager; + // create graph + ComputeGraphPtr compute_graph = MakeShared("test_graph"); + Graph graph = GraphUtils::CreateGraphFromComputeGraph(compute_graph); + + std::map options; + OmgContext context; + Status status = graph_manager.AddGraph(graph_id, graph, options, context); + EXPECT_EQ(status, ge::SUCCESS); + status = graph_manager.RemoveGraph(graph_id); + EXPECT_EQ(status, ge::SUCCESS); + status = graph_manager.AddGraphWithCopy(graph_id, graph, options, context); + EXPECT_NE(status, ge::SUCCESS); +} diff --git a/tests/ut/ge/graph/passes/cast_remove_pass_unittest.cc b/tests/ut/ge/graph/passes/cast_remove_pass_unittest.cc new file mode 100644 index 00000000..6831d451 --- /dev/null +++ b/tests/ut/ge/graph/passes/cast_remove_pass_unittest.cc @@ -0,0 +1,117 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#define protected public +#define private public +#include "graph/passes/cast_remove_pass.h" +#undef protected +#undef private + +#include "anchor.h" +#include "common/debug/log.h" +#include "common/debug/memory_dumper.h" +#include "common/op/attr_value_util.h" +#include "common/types.h" +#include "framework/common/ge_inner_error_codes.h" +#include "graph/attr_value.h" +#include "graph/debug/ge_attr_define.h" +#include "inc/pass_manager.h" +#include "graph_builder_utils.h" +#include +#include +#include +#include "opskernel_manager/ops_kernel_manager.h" +#include "omg/omg_inner_types.h" + + +using namespace testing; +using namespace ge; +using namespace std; + +class UtestGraphPassesCastRemovePass : public testing::Test { + protected: + void SetUp() {} + + void TearDown() {} +}; + +// case1:no net_out_put_node +// TEST_F(UtestGraphPassesCastRemovePass, DoFuseProcess) { +// std::vector nodes_to_fuse; + +// auto builder = ut::GraphBuilder("g1"); +// auto data = builder.AddNode("data", DATA, 1, 1); +// auto cast1 = builder.AddNode("cast1", CAST, 1, 1); +// cast1->GetOpDesc()->MutableOutputDesc(0)->SetDataType(DT_FLOAT16); +// auto trans = builder.AddNode("trans", TRANSPOSE, 1, 1, FORMAT_NCHW, DT_FLOAT16); +// auto cast2 = builder.AddNode("cast2", CAST, 1, 1); +// cast2->GetOpDesc()->MutableInputDesc(0)->SetDataType(DT_FLOAT16); +// auto net = builder.AddNode("netout", NETOUTPUT, 1, 1); + +// builder.AddDataEdge(data, 0, cast1, 0); +// builder.AddDataEdge(cast1, 0, trans, 0); +// builder.AddDataEdge(trans, 0, cast2, 0); +// builder.AddDataEdge(cast2, 0, net, 0); +// ComputeGraphPtr compute_graph = builder.GetGraph(); + +// map options; + +// CastRemovePass cast_remove_pass; +// DataType type = DT_FLOAT; +// nodes_to_fuse.emplace_back(cast1); +// nodes_to_fuse.emplace_back(trans); +// nodes_to_fuse.emplace_back(cast2); +// OpsKernelManager ops_kernel_manager; +// cast_remove_pass.DoFuse(ops_kernel_manager, type, nodes_to_fuse); +// EXPECT_EQ(compute_graph->GetAllNodesSize(),5); +// std::vector to_be_deleted_cast_index; +// to_be_deleted_cast_index.emplace_back(0); +// to_be_deleted_cast_index.emplace_back(2); +// (void)cast_remove_pass.DoRemoveCast(to_be_deleted_cast_index, nodes_to_fuse); +// EXPECT_EQ(compute_graph->GetAllNodesSize(),3); +// } + +TEST_F(UtestGraphPassesCastRemovePass, DoFuseProcess) { + std::vector nodes_to_fuse; + + auto builder = ut::GraphBuilder("g1"); + auto data = builder.AddNode("data", DATA, 1, 1); + auto cast1 = builder.AddNode("cast1", CAST, 1, 1); + cast1->GetOpDesc()->MutableOutputDesc(0)->SetDataType(DT_FLOAT16); + auto trans = builder.AddNode("trans", TRANSPOSE, 1, 1, FORMAT_NCHW, DT_FLOAT16); + auto cast2 = builder.AddNode("cast2", CAST, 1, 1); + cast2->GetOpDesc()->MutableInputDesc(0)->SetDataType(DT_FLOAT16); + auto net = builder.AddNode("netout", NETOUTPUT, 1, 1); + + builder.AddDataEdge(data, 0, cast1, 0); + builder.AddDataEdge(cast1, 0, trans, 0); + builder.AddDataEdge(trans, 0, cast2, 0); + builder.AddDataEdge(cast2, 0, net, 0); + ComputeGraphPtr compute_graph = builder.GetGraph(); + + map options; + + CastRemovePass cast_remove_pass; + DataType type = DT_FLOAT; + nodes_to_fuse.emplace_back(cast1); + nodes_to_fuse.emplace_back(trans); + nodes_to_fuse.emplace_back(cast2); + cast_remove_pass.RemoveCast(type, nodes_to_fuse); + EXPECT_EQ(compute_graph->GetAllNodesSize(),3); +} diff --git a/tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc b/tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc index 511ddece..716cc91d 100644 --- a/tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc @@ -43,7 +43,7 @@ ut::GraphBuilder Graph1Builder() { ut::GraphBuilder builder = ut::GraphBuilder("g1"); auto const1 = builder.AddNode("const1", "Const", 0, 1); auto const2 = builder.AddNode("const2", "Const", 0, 1); - auto gen_mask1 = builder.AddNode("gen_mask1", "DropOutGenMask", 2, 1); + auto gen_mask1 = builder.AddNode("gen_mask1_DropOutGenMask", "DropOutGenMask", 2, 1); auto gen_mask2 = builder.AddNode("gen_mask2", "DropOutGenMaskV3", 2, 1); auto gen_mask3 = builder.AddNode("gen_mask3", "DropOutGenMaskV3D", 2, 1); auto do_mask1 = builder.AddNode("do_mask1", "DropOutDoMask", 3, 1); @@ -106,6 +106,6 @@ TEST_F(UtestLinkGenMaskNodesPass, link_gen_mask_nodes_pass_success) { auto out_ctrl_nodes = gen_mask2->GetOutControlNodes(); EXPECT_EQ(out_ctrl_nodes.size(), 1); auto out_ctrl_node = out_ctrl_nodes.at(0); - EXPECT_EQ(out_ctrl_node->GetName(), "gen_mask1"); + EXPECT_EQ(out_ctrl_node->GetName(), "gen_mask1_DropOutGenMask"); } } // namespace ge diff --git a/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc b/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc index dd6b1881..ec7b9488 100644 --- a/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc +++ b/tests/ut/ge/graph_ir/ge_ir_build_unittest.cc @@ -15,8 +15,9 @@ */ #include -#include "ir_build/atc_ir_common.h" +#include "ir_build/option_utils.h" #include "graph/testcase/ge_graph/graph_builder_utils.h" +#include "graph/debug/ge_attr_define.h" #define protected public #define private public @@ -68,6 +69,20 @@ TEST(UtestIrCommon, update_data_op_shape) { EXPECT_EQ(ret, ge::SUCCESS); } +TEST(UtestIrCommon, update_data_op_shape_range) { + ge::OpDescPtr op_desc = CreateOpDesc("Data", "Data"); + std::vector>> index_shape_range_map; + + std::pair range_pair(1, 2); + vector> range_pair_tmp = { range_pair }; + + index_shape_range_map.push_back(range_pair_tmp); + + AttrUtils::SetInt(op_desc, ATTR_NAME_INDEX, 0); + Status ret = UpdateDataOpShapeRange(op_desc, index_shape_range_map); + EXPECT_EQ(ret, ge::SUCCESS); +} + TEST(UtestIrCommon, update_dynamic_shape_range_success) { ComputeGraphPtr graph = BuildComputeGraph(); std::string input_shape_range = "input1:[1, 2~3, -1];input2:[3~5, 10]"; @@ -108,3 +123,107 @@ TEST(UtestIrCommon, update_dynamic_shape_range_failed) { ret = UpdateDynamicInputShapeRange(graph, input_shape_range); EXPECT_EQ(ret, ge::PARAM_INVALID); } + +TEST(UtestIrCommon, check_dynamic_image_size_fail) { + map> shape_map; + shape_map["input1"] = {8, 3, -1, -1}; + string input_format = "NCHW"; + string dynamic_image_size = "@64,64;128,128;"; + + bool ret = CheckDynamicImagesizeInputShapeValid(shape_map, input_format, dynamic_image_size); + EXPECT_EQ(ret, false); +} + +TEST(UtestIrCommon, check_input_format_failed) { + std::string format = "invalid"; + Status ret = CheckInputFormat(format); + EXPECT_EQ(ret, ge::PARAM_INVALID); +} + +TEST(UtestIrCommon, check_dynamic_batch_size_input_shape_succ) { + map> shape_map; + shape_map.insert(std::pair>("data", {-1, 2, 3})); + std::string dynamic_batch_size = "11"; + + bool ret = CheckDynamicBatchSizeInputShapeValid(shape_map, dynamic_batch_size); + EXPECT_EQ(ret, true); +} + +TEST(UtestIrCommon, check_dynamic_images_size_input_shape_succ) { + map> shape_map; + shape_map.insert(std::pair>("data", {4, -1, -1, 5})); + std::string input_format = "NCHW"; + std::string dynamic_image_size = "4,5"; + + Status ret = CheckDynamicImagesizeInputShapeValid(shape_map, input_format, dynamic_image_size); + EXPECT_EQ(ret, ge::SUCCESS); +} + +TEST(UtestIrCommon, check_dynamic_input_param_succ) { + string dynamic_batch_size = "1"; + string dynamic_image_size; + string dynamic_dims; + string input_shape = "data:-1,3,244,244"; + string input_shape_range; + string input_format = "NCHW"; + bool is_dynamic_input = false; + + Status ret = CheckDynamicInputParamValid(dynamic_batch_size, dynamic_image_size, dynamic_dims, + input_shape, input_shape_range, input_format,is_dynamic_input); + EXPECT_EQ(ret, ge::SUCCESS); +} + +TEST(UtestIrCommon, check_dynamic_input_param_failed) { + string dynamic_batch_size = "1"; + string dynamic_image_size; + string dynamic_dims; + string input_shape = "data:1,3,244,244"; + string input_shape_range; + string input_format = "NCHW"; + bool is_dynamic_input = false; + + Status ret = CheckDynamicInputParamValid(dynamic_batch_size, dynamic_image_size, dynamic_dims, + input_shape, input_shape_range, input_format,is_dynamic_input); + EXPECT_EQ(ret, ge::PARAM_INVALID); +} + +TEST(UtestIrCommon, check_compress_weight) { + std::string enable_compress_weight = "true"; + std::string compress_weight_conf="./"; + Status ret = CheckCompressWeightParamValid(enable_compress_weight, compress_weight_conf); + EXPECT_EQ(ret, PARAM_INVALID); + + enable_compress_weight = "yes"; + compress_weight_conf = "./"; + ret = CheckCompressWeightParamValid(enable_compress_weight, compress_weight_conf); + EXPECT_EQ(ret, PARAM_INVALID); +} + +TEST(UtestIrCommon, check_param_failed) { + std::string param_invalid = "invalid"; + + Status ret = CheckOutputTypeParamValid(param_invalid); + EXPECT_EQ(ret, PARAM_INVALID); + + ret = CheckBufferOptimizeParamValid(param_invalid); + EXPECT_EQ(ret, PARAM_INVALID); + + ret = CheckKeepTypeParamValid(param_invalid); + EXPECT_EQ(ret, PARAM_INVALID); + + ret = CheckInsertOpConfParamValid(param_invalid); + EXPECT_EQ(ret, PARAM_INVALID); + + ret = CheckDisableReuseMemoryParamValid(param_invalid); + EXPECT_EQ(ret, PARAM_INVALID); + + ret = CheckEnableSingleStreamParamValid(param_invalid); + EXPECT_EQ(ret, PARAM_INVALID); + + std::string optypelist_for_implmode; + std::string op_select_implmode = "1"; + ret = CheckImplmodeParamValid(optypelist_for_implmode, op_select_implmode); + EXPECT_EQ(ret, PARAM_INVALID); + + ret = CheckLogParamValidAndSetLogLevel(param_invalid); +} diff --git a/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc new file mode 100644 index 00000000..5fa0d22c --- /dev/null +++ b/tests/ut/ge/hybrid/executor/worker/execution_engine_unittest.cc @@ -0,0 +1,119 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include "runtime/rt.h" + +#define protected public +#define private public +#include "hybrid/model/hybrid_model.h" +#include "hybrid/node_executor/node_executor.h" +#include "hybrid/executor/hybrid_execution_context.h" +#include "hybrid/executor/hybrid_model_executor.h" +#include "hybrid/executor/worker/execution_engine.h" +#undef private +#undef protected + +using namespace std; +using namespace testing; +using namespace ge; +using namespace hybrid; + + +class UtestExecutionEngine : public testing::Test { + protected: + void SetUp() {} + + void TearDown() { + } +}; +namespace { +const int kIntBase = 10; +} +static ge::OpDescPtr CreateOpDesc(string name = "", string type = "") { + auto op_desc = std::make_shared(name, type); + op_desc->SetStreamId(0); + op_desc->SetId(0); + op_desc->SetWorkspace({}); + op_desc->SetWorkspaceBytes({}); + op_desc->SetInputOffset({}); + op_desc->SetOutputOffset({}); + + ge::AttrUtils::SetStr(op_desc, ge::TVM_ATTR_NAME_MAGIC, "RT_DEV_BINARY_MAGIC_ELF_AIVEC"); + bool support_dynamic = true; + ge::AttrUtils::GetBool(op_desc, "support_dynamicshape", support_dynamic); + return op_desc; +} + +TEST_F(UtestExecutionEngine, ExecuteAsync_without_kernel_task) { + auto graph = make_shared("graph"); + OpDescPtr op_desc = CreateOpDesc("Add", "Add"); + GeShape shape({2, 16}); + GeTensorDesc tensor_desc(shape); + op_desc->AddInputDesc(tensor_desc); + op_desc->AddOutputDesc(tensor_desc); + auto node = graph->AddNode(op_desc); + std::unique_ptr node_item; + NodeItem::Create(node, node_item); + ASSERT_TRUE(node_item != nullptr); + node_item->input_start = 0; + node_item->output_start = 0; + + GraphExecutionContext execution_context; + execution_context.profiling_level = 1; + SubgraphContext subgraph_context(nullptr, &execution_context); + + NodeState node_state(*node_item, &subgraph_context); + auto task_context = TaskContext::Create(&node_state, &execution_context, &subgraph_context); + auto shared_task_context = std::shared_ptr(task_context.release()); + node_state.SetTaskContext(shared_task_context); + + ExecutionEngine execution_engine; + ASSERT_TRUE(node_state.GetTaskContext() != nullptr); + EXPECT_EQ(execution_engine.ExecuteAsync(node_state, node_state.GetTaskContext(), execution_context), INTERNAL_ERROR); +} + +TEST_F(UtestExecutionEngine, ExecuteAsync_without_callback_and_kernel_task) { + auto graph = make_shared("graph"); + OpDescPtr op_desc = CreateOpDesc("Add", "Add"); + GeShape shape({2, 16}); + GeTensorDesc tensor_desc(shape); + op_desc->AddInputDesc(tensor_desc); + op_desc->AddOutputDesc(tensor_desc); + auto node = graph->AddNode(op_desc); + std::unique_ptr node_item; + NodeItem::Create(node, node_item); + ASSERT_TRUE(node_item != nullptr); + node_item->input_start = 0; + node_item->output_start = 0; + + GraphExecutionContext execution_context; + GeRootModelPtr ge_root_model = make_shared(graph); + HybridModel hybrid_model(ge_root_model); + execution_context.model = &hybrid_model; + SubgraphContext subgraph_context(nullptr, &execution_context); + + NodeState node_state(*node_item, &subgraph_context); + auto task_context = TaskContext::Create(&node_state, &execution_context, &subgraph_context); + auto shared_task_context = std::shared_ptr(task_context.release()); + node_state.SetTaskContext(shared_task_context); + + ExecutionEngine execution_engine; + ASSERT_TRUE(node_state.GetTaskContext() != nullptr); + EXPECT_EQ(execution_engine.ExecuteAsync(node_state, node_state.GetTaskContext(), execution_context), INTERNAL_ERROR); +} diff --git a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc index 3dfbff41..2da80b32 100644 --- a/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc +++ b/tests/ut/ge/profiling/ge_profiling_manager_unittest.cc @@ -78,3 +78,9 @@ TEST_F(UtestGeProfilinganager, plungin_init_) { EXPECT_EQ(ret, INTERNAL_ERROR); ProfilingManager::Instance().prof_cb_.msprofReporterCallback = nullptr; } + +TEST_F(UtestGeProfilinganager, report_data_) { + std::string data = "ge is better than tensorflow."; + std::string tag_name = "fmk"; + ProfilingManager::Instance().ReportData(0, data, tag_name); +} \ No newline at end of file